This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Change ptrace return type autoconf check


Sigh.  GNU/Linux has the following ptrace(2) prototype:

  extern long int ptrace (enum __ptrace_request, ...);

GCC 3.4.1 thinks a declaration with an empty parameter list:

  extern long int ptrace();

conflicts with the above declaration.  As a result the default return
type `int' is chosen, which breaks alpha and ia64.  The attached fixes
things by defaulting to `long' instead of `int'.  For 32-bit systems
this shouldn't matter, for 64-bit systems it's just a bit more likely
to be correct.  If there is no prototype for ptrace(), the default is
still `int'.

Committed,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* configure.in: Change test for return type of ptrace to default
	to `long' instead of `int'.
	* configure: Regenerate.	

Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.166
diff -u -p -r1.166 configure.in
--- configure.in 21 Aug 2004 12:05:50 -0000 1.166
+++ configure.in 22 Aug 2004 14:10:31 -0000
@@ -506,9 +506,9 @@ gcc_AC_CHECK_DECLS(ptrace, , [
 # Check return type.
 AC_CACHE_CHECK([return type of ptrace], gdb_cv_func_ptrace_ret,
   AC_TRY_COMPILE($gdb_ptrace_headers,
-    [extern long ptrace ();],
-    gdb_cv_func_ptrace_ret='long',
-    gdb_cv_func_ptrace_ret='int'))
+    [extern int ptrace ();],
+    gdb_cv_func_ptrace_ret='int',
+    gdb_cv_func_ptrace_ret='long'))
 AC_DEFINE_UNQUOTED(PTRACE_TYPE_RET, $gdb_cv_func_ptrace_ret,
   [Define as the return type of ptrace.])
 # Check argument types.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]