Commit f31e826b by Kaveh R. Ghazi Committed by Kaveh Ghazi

getopt.h (getopt): Also check HAVE_DECL_* when prototyping.

include:
	* getopt.h (getopt): Also check HAVE_DECL_* when prototyping.

	* libiberty.h (basename): Likewise.

gcc:
	* aclocal.m4 (gcc_AC_CHECK_DECL, gcc_AC_CHECK_DECLS): New macros
	rewritten from the internals of gcc_AC_NEED_DECLARATION{S}.

	* configure.in (gcc_AC_CHECK_DECLS): Call this instead of
	gcc_AC_NEED_DECLARATIONS.

	* dwarfout.c: Don't prototype time().

	* gcc.c: Check HAVE_DECL_* instead of NEED_DECLARATION_*.

	* system.h: Likewise.

	* toplev.c: Likewise.

From-SVN: r34108
parent 04de7314
2000-05-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* aclocal.m4 (gcc_AC_CHECK_DECL, gcc_AC_CHECK_DECLS): New macros
rewritten from the internals of gcc_AC_NEED_DECLARATION{S}.
* configure.in (gcc_AC_CHECK_DECLS): Call this instead of
gcc_AC_NEED_DECLARATIONS.
* dwarfout.c: Don't prototype time().
* gcc.c: Check HAVE_DECL_* instead of NEED_DECLARATION_*.
* system.h: Likewise.
* toplev.c: Likewise.
2000-05-23 Zack Weinberg <zack@wolery.cumb.org> 2000-05-23 Zack Weinberg <zack@wolery.cumb.org>
* c-decl.c (pushdecl): Invert sense of test for non-global types. * c-decl.c (pushdecl): Invert sense of test for non-global types.
...@@ -13,40 +13,43 @@ dnl See whether we need a declaration for a function. ...@@ -13,40 +13,43 @@ dnl See whether we need a declaration for a function.
dnl The result is highly dependent on the INCLUDES passed in, so make sure dnl The result is highly dependent on the INCLUDES passed in, so make sure
dnl to use a different cache variable name in this macro if it is invoked dnl to use a different cache variable name in this macro if it is invoked
dnl in a different context somewhere else. dnl in a different context somewhere else.
dnl gcc_AC_NEED_DECLARATION(FUNCTION, INCLUDES, dnl gcc_AC_CHECK_DECL(SYMBOL,
dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED]]) dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
AC_DEFUN(gcc_AC_NEED_DECLARATION, AC_DEFUN(gcc_AC_CHECK_DECL,
[AC_MSG_CHECKING([whether $1 must be declared]) [AC_MSG_CHECKING([whether $1 is declared])
AC_CACHE_VAL(gcc_cv_decl_needed_$1, AC_CACHE_VAL(gcc_cv_have_decl_$1,
[AC_TRY_COMPILE([$2], [AC_TRY_COMPILE([$4],
[#ifndef $1 [#ifndef $1
char *(*pfn) = (char *(*)) $1 ; char *(*pfn) = (char *(*)) $1 ;
#endif], eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")]) #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
AC_MSG_RESULT(yes) ; ifelse([$3], , :, [$3]) AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
else else
AC_MSG_RESULT(no) ; ifelse([$4], , :, [$4]) AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
fi fi
])dnl ])dnl
dnl Check multiple functions to see whether each needs a declaration. dnl Check multiple functions to see whether each needs a declaration.
dnl Arrange to define NEED_DECLARATION_<FUNCTION> if appropriate. dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
dnl gcc_AC_NEED_DECLARATIONS(FUNCTION... , INCLUDES, dnl gcc_AC_CHECK_DECLS(SYMBOLS,
dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED]]) dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
AC_DEFUN(gcc_AC_NEED_DECLARATIONS, AC_DEFUN(gcc_AC_CHECK_DECLS,
[for ac_func in $1 [for ac_func in $1
do do
gcc_AC_NEED_DECLARATION($ac_func, [$2], changequote(, )dnl
[changequote(, )dnl ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
ac_tr_decl=NEED_DECLARATION_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
changequote([, ])dnl changequote([, ])dnl
AC_DEFINE_UNQUOTED($ac_tr_decl) $3], $4) gcc_AC_CHECK_DECL($ac_func,
[AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
[AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
$4
)
done done
dnl Automatically generate config.h entries via autoheader. dnl Automatically generate config.h entries via autoheader.
if test x = y ; then if test x = y ; then
patsubst(translit([$1], [a-z], [A-Z]), [\w+], patsubst(translit([$1], [a-z], [A-Z]), [\w+],
AC_DEFINE([NEED_DECLARATION_\&], 1, AC_DEFINE([HAVE_DECL_\&], 1,
[Define if you need to provide a declaration for this function.]))dnl [Define to 1 if we found this declaration otherwise define to 0.]))dnl
fi fi
]) ])
......
...@@ -316,77 +316,83 @@ ...@@ -316,77 +316,83 @@
/* Define if read-only mmap of a plain file works. */ /* Define if read-only mmap of a plain file works. */
#undef HAVE_MMAP_FILE #undef HAVE_MMAP_FILE
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_BCOPY #undef HAVE_DECL_BCOPY
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_BZERO #undef HAVE_DECL_BZERO
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_BCMP #undef HAVE_DECL_BCMP
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_INDEX #undef HAVE_DECL_INDEX
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_RINDEX #undef HAVE_DECL_RINDEX
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_GETENV #undef HAVE_DECL_GETENV
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_ATOL #undef HAVE_DECL_ATOL
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_SBRK #undef HAVE_DECL_SBRK
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_ABORT #undef HAVE_DECL_ABORT
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_ATOF #undef HAVE_DECL_ATOF
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_GETCWD #undef HAVE_DECL_GETCWD
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_GETWD #undef HAVE_DECL_GETWD
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_STRSIGNAL #undef HAVE_DECL_STRSIGNAL
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_PUTC_UNLOCKED #undef HAVE_DECL_PUTC_UNLOCKED
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_FPUTS_UNLOCKED #undef HAVE_DECL_FPUTS_UNLOCKED
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_STRSTR #undef HAVE_DECL_STRSTR
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_ENVIRON #undef HAVE_DECL_ENVIRON
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_MALLOC #undef HAVE_DECL_MALLOC
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_REALLOC #undef HAVE_DECL_REALLOC
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_CALLOC #undef HAVE_DECL_CALLOC
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_FREE #undef HAVE_DECL_FREE
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_GETRLIMIT #undef HAVE_DECL_BASENAME
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_SETRLIMIT #undef HAVE_DECL_GETOPT
/* Define if you need to provide a declaration for this function. */ /* Define to 1 if we found this declaration otherwise define to 0. */
#undef NEED_DECLARATION_GETRUSAGE #undef HAVE_DECL_GETRLIMIT
/* Define to 1 if we found this declaration otherwise define to 0. */
#undef HAVE_DECL_SETRLIMIT
/* Define to 1 if we found this declaration otherwise define to 0. */
#undef HAVE_DECL_GETRUSAGE
/* Define if host mkdir takes a single argument. */ /* Define if host mkdir takes a single argument. */
#undef MKDIR_TAKES_ONE_ARG #undef MKDIR_TAKES_ONE_ARG
......
...@@ -479,14 +479,14 @@ AC_FUNC_MMAP_FILE ...@@ -479,14 +479,14 @@ AC_FUNC_MMAP_FILE
# We will need to find libiberty.h and ansidecl.h # We will need to find libiberty.h and ansidecl.h
saved_CFLAGS="$CFLAGS" saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include" CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
gcc_AC_NEED_DECLARATIONS(bcopy bzero bcmp \ gcc_AC_CHECK_DECLS(bcopy bzero bcmp \
index rindex getenv atol sbrk abort atof getcwd getwd \ index rindex getenv atol sbrk abort atof getcwd getwd \
strsignal putc_unlocked fputs_unlocked strstr environ \ strsignal putc_unlocked fputs_unlocked strstr environ \
malloc realloc calloc free, [ malloc realloc calloc free basename getopt, , ,[
#include "gansidecl.h" #include "gansidecl.h"
#include "system.h"]) #include "system.h"])
gcc_AC_NEED_DECLARATIONS(getrlimit setrlimit getrusage, [ gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
#include "gansidecl.h" #include "gansidecl.h"
#include "system.h" #include "system.h"
#ifdef HAVE_SYS_RESOURCE_H #ifdef HAVE_SYS_RESOURCE_H
......
...@@ -37,12 +37,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -37,12 +37,6 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h" #include "toplev.h"
#include "tm_p.h" #include "tm_p.h"
#if defined(DWARF_TIMESTAMPS)
#if !defined(POSIX)
extern time_t time PARAMS ((time_t *)); /* FIXME: use NEED_DECLARATION_TIME */
#endif /* !defined(POSIX) */
#endif /* defined(DWARF_TIMESTAMPS) */
/* We cannot use <assert.h> in GCC source, since that would include /* We cannot use <assert.h> in GCC source, since that would include
GCC's assert.h, which may not be compatible with the host compiler. */ GCC's assert.h, which may not be compatible with the host compiler. */
#undef assert #undef assert
......
...@@ -48,7 +48,7 @@ compilation is specified by a string called a "spec". */ ...@@ -48,7 +48,7 @@ compilation is specified by a string called a "spec". */
#ifdef HAVE_SYS_RESOURCE_H #ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#ifdef NEED_DECLARATION_GETRUSAGE #if defined (HAVE_DECL_GETRUSAGE) && !HAVE_DECL_GETRUSAGE
extern int getrusage PARAMS ((int, struct rusage *)); extern int getrusage PARAMS ((int, struct rusage *));
#endif #endif
......
...@@ -53,24 +53,24 @@ Boston, MA 02111-1307, USA. */ ...@@ -53,24 +53,24 @@ Boston, MA 02111-1307, USA. */
/* The compiler is not a multi-threaded application and therefore we /* The compiler is not a multi-threaded application and therefore we
do not have to use the locking functions. do not have to use the locking functions.
NEED_DECLARATION_PUTC_UNLOCKED actually indicates whether or not HAVE_DECL_PUTC_UNLOCKED actually indicates whether or not the IO
the IO code is multi-thread safe by default. If it is not declared, code is multi-thread safe by default. If it is set to 0, then do
then do not worry about using the _unlocked functions. not worry about using the _unlocked functions.
fputs_unlocked is an extension and needs to be prototyped specially. */ fputs_unlocked is an extension and needs to be prototyped specially. */
#if defined HAVE_PUTC_UNLOCKED && !defined NEED_DECLARATION_PUTC_UNLOCKED #if defined HAVE_PUTC_UNLOCKED && (defined (HAVE_DECL_PUTC_UNLOCKED) && HAVE_DECL_PUTC_UNLOCKED)
# undef putc # undef putc
# define putc(C, Stream) putc_unlocked (C, Stream) # define putc(C, Stream) putc_unlocked (C, Stream)
#endif #endif
#if defined HAVE_FPUTC_UNLOCKED && !defined NEED_DECLARATION_PUTC_UNLOCKED #if defined HAVE_FPUTC_UNLOCKED && (defined (HAVE_DECL_PUTC_UNLOCKED) && HAVE_DECL_PUTC_UNLOCKED)
# undef fputc # undef fputc
# define fputc(C, Stream) fputc_unlocked (C, Stream) # define fputc(C, Stream) fputc_unlocked (C, Stream)
#endif #endif
#if defined HAVE_FPUTS_UNLOCKED && !defined NEED_DECLARATION_PUTC_UNLOCKED #if defined HAVE_FPUTS_UNLOCKED && (defined (HAVE_DECL_PUTC_UNLOCKED) && HAVE_DECL_PUTC_UNLOCKED)
# undef fputs # undef fputs
# define fputs(String, Stream) fputs_unlocked (String, Stream) # define fputs(String, Stream) fputs_unlocked (String, Stream)
# ifdef NEED_DECLARATION_FPUTS_UNLOCKED # if defined (HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
extern int fputs_unlocked PARAMS ((const char *, FILE *)); extern int fputs_unlocked PARAMS ((const char *, FILE *));
# endif # endif
#endif #endif
...@@ -305,11 +305,14 @@ extern int errno; ...@@ -305,11 +305,14 @@ extern int errno;
#define WSTOPSIG WEXITSTATUS #define WSTOPSIG WEXITSTATUS
#endif #endif
/* The HAVE_DECL_* macros are three-state, undefined, 0 or 1. If they
are defined to 0 then we must provide the relevant declaration
here. These checks will be in the undefined state while configure
is running so be careful to test "defined (HAVE_DECL_*)". */
#ifndef bcopy #ifndef bcopy
# ifdef HAVE_BCOPY # ifdef HAVE_BCOPY
# ifdef NEED_DECLARATION_BCOPY # if defined (HAVE_DECL_BCOPY) && !HAVE_DECL_BCOPY
extern void bcopy PARAMS ((const PTR, PTR, size_t)); extern void bcopy PARAMS ((const PTR, PTR, size_t));
# endif # endif
# else /* ! HAVE_BCOPY */ # else /* ! HAVE_BCOPY */
...@@ -319,7 +322,7 @@ extern void bcopy PARAMS ((const PTR, PTR, size_t)); ...@@ -319,7 +322,7 @@ extern void bcopy PARAMS ((const PTR, PTR, size_t));
#ifndef bcmp #ifndef bcmp
# ifdef HAVE_BCMP # ifdef HAVE_BCMP
# ifdef NEED_DECLARATION_BCMP # if defined (HAVE_DECL_BCMP) && !HAVE_DECL_BCMP
extern int bcmp PARAMS ((const PTR, const PTR, size_t)); extern int bcmp PARAMS ((const PTR, const PTR, size_t));
# endif # endif
# else /* ! HAVE_BCMP */ # else /* ! HAVE_BCMP */
...@@ -329,7 +332,7 @@ extern int bcmp PARAMS ((const PTR, const PTR, size_t)); ...@@ -329,7 +332,7 @@ extern int bcmp PARAMS ((const PTR, const PTR, size_t));
#ifndef bzero #ifndef bzero
# ifdef HAVE_BZERO # ifdef HAVE_BZERO
# ifdef NEED_DECLARATION_BZERO # if defined (HAVE_DECL_BZERO) && !HAVE_DECL_BZERO
extern void bzero PARAMS ((PTR, size_t)); extern void bzero PARAMS ((PTR, size_t));
# endif # endif
# else /* ! HAVE_BZERO */ # else /* ! HAVE_BZERO */
...@@ -339,7 +342,7 @@ extern void bzero PARAMS ((PTR, size_t)); ...@@ -339,7 +342,7 @@ extern void bzero PARAMS ((PTR, size_t));
#ifndef index #ifndef index
# ifdef HAVE_INDEX # ifdef HAVE_INDEX
# ifdef NEED_DECLARATION_INDEX # if defined (HAVE_DECL_INDEX) && !HAVE_DECL_INDEX
extern char *index PARAMS ((const char *, int)); extern char *index PARAMS ((const char *, int));
# endif # endif
# else /* ! HAVE_INDEX */ # else /* ! HAVE_INDEX */
...@@ -349,7 +352,7 @@ extern char *index PARAMS ((const char *, int)); ...@@ -349,7 +352,7 @@ extern char *index PARAMS ((const char *, int));
#ifndef rindex #ifndef rindex
# ifdef HAVE_RINDEX # ifdef HAVE_RINDEX
# ifdef NEED_DECLARATION_RINDEX # if defined (HAVE_DECL_RINDEX) && !HAVE_DECL_RINDEX
extern char *rindex PARAMS ((const char *, int)); extern char *rindex PARAMS ((const char *, int));
# endif # endif
# else /* ! HAVE_RINDEX */ # else /* ! HAVE_RINDEX */
...@@ -357,35 +360,35 @@ extern char *rindex PARAMS ((const char *, int)); ...@@ -357,35 +360,35 @@ extern char *rindex PARAMS ((const char *, int));
# endif # endif
#endif #endif
#ifdef NEED_DECLARATION_ATOF #if defined (HAVE_DECL_ATOF) && !HAVE_DECL_ATOF
extern double atof PARAMS ((const char *)); extern double atof PARAMS ((const char *));
#endif #endif
#ifdef NEED_DECLARATION_ATOL #if defined (HAVE_DECL_ATOL) && !HAVE_DECL_ATOL
extern long atol PARAMS ((const char *)); extern long atol PARAMS ((const char *));
#endif #endif
#ifdef NEED_DECLARATION_FREE #if defined (HAVE_DECL_FREE) && !HAVE_DECL_FREE
extern void free PARAMS ((PTR)); extern void free PARAMS ((PTR));
#endif #endif
#ifdef NEED_DECLARATION_GETCWD #if defined (HAVE_DECL_GETCWD) && !HAVE_DECL_GETCWD
extern char *getcwd PARAMS ((char *, size_t)); extern char *getcwd PARAMS ((char *, size_t));
#endif #endif
#ifdef NEED_DECLARATION_GETENV #if defined (HAVE_DECL_GETENV) && !HAVE_DECL_GETENV
extern char *getenv PARAMS ((const char *)); extern char *getenv PARAMS ((const char *));
#endif #endif
#ifdef NEED_DECLARATION_GETWD #if defined (HAVE_DECL_GETWD) && !HAVE_DECL_GETWD
extern char *getwd PARAMS ((char *)); extern char *getwd PARAMS ((char *));
#endif #endif
#ifdef NEED_DECLARATION_SBRK #if defined (HAVE_DECL_SBRK) && !HAVE_DECL_SBRK
extern PTR sbrk PARAMS ((int)); extern PTR sbrk PARAMS ((int));
#endif #endif
#ifdef NEED_DECLARATION_STRSTR #if defined (HAVE_DECL_STRSTR) && !HAVE_DECL_STRSTR
extern char *strstr PARAMS ((const char *, const char *)); extern char *strstr PARAMS ((const char *, const char *));
#endif #endif
...@@ -393,28 +396,28 @@ extern char *strstr PARAMS ((const char *, const char *)); ...@@ -393,28 +396,28 @@ extern char *strstr PARAMS ((const char *, const char *));
#include <malloc.h> #include <malloc.h>
#endif #endif
#ifdef NEED_DECLARATION_MALLOC #if defined (HAVE_DECL_MALLOC) && !HAVE_DECL_MALLOC
extern PTR malloc PARAMS ((size_t)); extern PTR malloc PARAMS ((size_t));
#endif #endif
#ifdef NEED_DECLARATION_CALLOC #if defined (HAVE_DECL_CALLOC) && !HAVE_DECL_CALLOC
extern PTR calloc PARAMS ((size_t, size_t)); extern PTR calloc PARAMS ((size_t, size_t));
#endif #endif
#ifdef NEED_DECLARATION_REALLOC #if defined (HAVE_DECL_REALLOC) && !HAVE_DECL_REALLOC
extern PTR realloc PARAMS ((PTR, size_t)); extern PTR realloc PARAMS ((PTR, size_t));
#endif #endif
/* If the system doesn't provide strsignal, we get it defined in /* If the system doesn't provide strsignal, we get it defined in
libiberty but no declaration is supplied. */ libiberty but no declaration is supplied. */
#ifdef NEED_DECLARATION_STRSIGNAL #if defined (HAVE_DECL_STRSIGNAL) && !HAVE_DECL_STRSIGNAL
# ifndef strsignal # ifndef strsignal
extern const char *strsignal PARAMS ((int)); extern const char *strsignal PARAMS ((int));
# endif # endif
#endif #endif
#ifdef HAVE_GETRLIMIT #ifdef HAVE_GETRLIMIT
# ifdef NEED_DECLARATION_GETRLIMIT # if defined (HAVE_DECL_GETRLIMIT) && !HAVE_DECL_GETRLIMIT
# ifndef getrlimit # ifndef getrlimit
# ifdef ANSI_PROTOTYPES # ifdef ANSI_PROTOTYPES
struct rlimit; struct rlimit;
...@@ -425,7 +428,7 @@ extern int getrlimit PARAMS ((int, struct rlimit *)); ...@@ -425,7 +428,7 @@ extern int getrlimit PARAMS ((int, struct rlimit *));
#endif #endif
#ifdef HAVE_SETRLIMIT #ifdef HAVE_SETRLIMIT
# ifdef NEED_DECLARATION_SETRLIMIT # if defined (HAVE_DECL_SETRLIMIT) && !HAVE_DECL_SETRLIMIT
# ifndef setrlimit # ifndef setrlimit
# ifdef ANSI_PROTOTYPES # ifdef ANSI_PROTOTYPES
struct rlimit; struct rlimit;
...@@ -441,7 +444,7 @@ extern int setrlimit PARAMS ((int, const struct rlimit *)); ...@@ -441,7 +444,7 @@ extern int setrlimit PARAMS ((int, const struct rlimit *));
#define volatile #define volatile
#endif #endif
#ifdef NEED_DECLARATION_ABORT #if defined (HAVE_DECL_ABORT) && !HAVE_DECL_ABORT
extern void abort PARAMS ((void)); extern void abort PARAMS ((void));
#endif #endif
......
...@@ -145,7 +145,7 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE! ...@@ -145,7 +145,7 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE!
#define PREFERRED_DEBUGGING_TYPE NO_DEBUG #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
#endif #endif
#ifdef NEED_DECLARATION_ENVIRON #if defined (HAVE_DECL_ENVIRON) && !HAVE_DECL_ENVIRON
extern char **environ; extern char **environ;
#endif #endif
......
2000-05-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* getopt.h (getopt): Also check HAVE_DECL_* when prototyping.
* libiberty.h (basename): Likewise.
2000-05-06 Zack Weinberg <zack@wolery.cumb.org> 2000-05-06 Zack Weinberg <zack@wolery.cumb.org>
* ansidecl.h: #define __extension__ to nothing if * ansidecl.h: #define __extension__ to nothing if
......
...@@ -99,13 +99,20 @@ struct option ...@@ -99,13 +99,20 @@ struct option
#define optional_argument 2 #define optional_argument 2
#if defined (__STDC__) && __STDC__ #if defined (__STDC__) && __STDC__
#ifdef __GNU_LIBRARY__ /* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
undefined, we haven't run the autoconf check so provide the
declaration without arguments. If it is 0, we checked and failed
to find the declaration so provide a fully prototyped one. If it
is 1, we found it so don't provide any declaration at all. */
#if defined (__GNU_LIBRARY__) || (defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT)
/* Many other libraries have conflicting prototypes for getopt, with /* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */ errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts); extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */ #else /* not __GNU_LIBRARY__ */
# if !defined (HAVE_DECL_GETOPT)
extern int getopt (); extern int getopt ();
# endif
#endif /* __GNU_LIBRARY__ */ #endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts, extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind); const struct option *longopts, int *longind);
......
...@@ -36,10 +36,17 @@ extern char **dupargv PARAMS ((char **)) ATTRIBUTE_MALLOC; ...@@ -36,10 +36,17 @@ extern char **dupargv PARAMS ((char **)) ATTRIBUTE_MALLOC;
across different systems, sometimes as "char *" and sometimes as across different systems, sometimes as "char *" and sometimes as
"const char *" */ "const char *" */
#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) /* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
undefined, we haven't run the autoconf check so provide the
declaration without arguments. If it is 0, we checked and failed
to find the declaration so provide a fully prototyped one. If it
is 1, we found it so don't provide any declaration at all. */
#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || (defined (HAVE_DECL_BASENAME) && !HAVE_DECL_BASENAME)
extern char *basename PARAMS ((const char *)); extern char *basename PARAMS ((const char *));
#else #else
# if !defined (HAVE_DECL_BASENAME)
extern char *basename (); extern char *basename ();
# endif
#endif #endif
/* Concatenate an arbitrary number of strings, up to (char *) NULL. /* Concatenate an arbitrary number of strings, up to (char *) NULL.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment