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]

[COMMIT] Unify autoconf checks for function prototypes


In the past we used BFD_NEED_DECLARATION and more recently
gcc_AC_CHECK_DECLS.  The AC_CHECK_DECLS in autoconf 2.59 is perfectly
fine for use so this patch makes us use that one.  I removed the
checks for declarations of strdup and canonicalize_file_name.  The
checks for strdup weren't used and providing a prototype for
canonicalize_file_name is unnecessary now that we define _GNU_SOURCE.

Tested on i386-unknown-freebsd4.7 and x86_64-unknown-linux-gnu.

Committed,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* configure.ac: Use AC_CHECK_DECLS instead of gcc_AC_CHECK_DECLS
	and BFD_NEED_DECLARATION.  Don't check if a declaration of strdup
	is necessary.
	* configure, config.in: Regenerate.
	* utils.c: Adjust for usage of AC_CHECK_DECLS instead of
	BFD_NEED_DECLARATION.  Never provide a prototype for
	caninicalize_file_name.
	* gdb_string.h: Adjust for usage of AC_CHECK_DECLS instead of
	BFD_NEED_DECLARATION.

Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.7
diff -u -p -r1.7 configure.ac
--- configure.ac 21 Jan 2005 11:53:18 -0000 1.7
+++ configure.ac 21 Jan 2005 13:07:11 -0000
@@ -424,7 +424,9 @@ AC_CHECK_HEADERS(ctype.h time.h)
 # Checks for declarations.  #
 # ------------------------- #
 
-gcc_AC_CHECK_DECLS(getopt)
+AC_CHECK_DECLS([free, malloc, realloc])
+AC_CHECK_DECLS([strerror, strstr])
+AC_CHECK_DECLS(getopt)
 
 # ----------------------- #
 # Checks for structures.  #
@@ -477,7 +479,7 @@ gdb_ptrace_headers='
 #endif
 '
 # There is no point in checking if we don't have a prototype.
-gcc_AC_CHECK_DECLS(ptrace, , [
+AC_CHECK_DECLS(ptrace, [], [
   : ${gdb_cv_func_ptrace_ret='int'}
   : ${gdb_cv_func_ptrace_args='int,int,long,long'}
 ], $gdb_ptrace_headers)
@@ -694,14 +696,6 @@ if test $gdb_cv_have_uintptr_t = yes; th
   AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if <stdint.h> provides the uintptr_t type.])
 fi
 
-BFD_NEED_DECLARATION(malloc)
-BFD_NEED_DECLARATION(realloc)
-BFD_NEED_DECLARATION(free)
-BFD_NEED_DECLARATION(strerror)
-BFD_NEED_DECLARATION(strdup)
-BFD_NEED_DECLARATION(strstr)
-BFD_NEED_DECLARATION(canonicalize_file_name)
-
 # If we are configured native on GNU/Linux, work around problems with
 # sys/procfs.h
 # Also detect which type of /proc is in use, such as for Unixware or Solaris.
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.147
diff -u -p -r1.147 utils.c
--- utils.c 19 Jan 2005 22:54:56 -0000 1.147
+++ utils.c 21 Jan 2005 13:07:13 -0000
@@ -62,20 +62,15 @@
 
 #include "readline/readline.h"
 
-#ifdef NEED_DECLARATION_MALLOC
+#if !HAVE_DECL_MALLOC
 extern PTR malloc ();		/* OK: PTR */
 #endif
-#ifdef NEED_DECLARATION_REALLOC
+#if !HAVE_DECL_REALLOC
 extern PTR realloc ();		/* OK: PTR */
 #endif
-#ifdef NEED_DECLARATION_FREE
+#if !HAVE_DECL_FREE
 extern void free ();
 #endif
-/* Actually, we'll never have the decl, since we don't define _GNU_SOURCE.  */
-#if defined(HAVE_CANONICALIZE_FILE_NAME) \
-    && defined(NEED_DECLARATION_CANONICALIZE_FILE_NAME)
-extern char *canonicalize_file_name (const char *);
-#endif
 
 /* readline defines this.  */
 #undef savestring
Index: gdb_string.h
===================================================================
RCS file: /cvs/src/src/gdb/gdb_string.h,v
retrieving revision 1.4
diff -u -p -r1.4 gdb_string.h
--- gdb_string.h 6 Mar 2001 08:21:07 -0000 1.4
+++ gdb_string.h 21 Jan 2005 13:07:13 -0000
@@ -1,5 +1,7 @@
 /* Portable <string.h>
-   Copyright 1995, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+   Copyright 1995, 1998, 1999, 2000, 2001, 2004
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -52,15 +54,15 @@ extern int memcmp ();
 #endif
 #endif /* STDC_HEADERS */
 
-#ifdef NEED_DECLARATION_STRERROR
+#if !HAVE_DECL_STRERROR
 #ifndef strerror
 extern char *strerror (int);	/* X3.159-1989  4.11.6.2 */
 #endif
 #endif
 
-#ifdef NEED_DECLARATION_STRSTR
+#if !HAVE_DECL_STRSTR
 #ifndef strstr
-extern char *strstr (const char *, const char *);	/* X3.159-1989  4.11.5.7 */
+extern char *strstr (const char *, const char *); /* X3.159-1989  4.11.5.7 */
 #endif
 #endif
 


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