This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Problems with gcc + exceptions + -pedantic + libiberty.h
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: DJ Delorie <dj at delorie dot com>
- Cc: binutils at sources dot redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Mon, 24 Jun 2002 14:38:31 +0930
- Subject: Re: Problems with gcc + exceptions + -pedantic + libiberty.h
- References: <20020107235319.GA93680@compsoc.man.ac.uk> <200201080007.g08074U02537@envy.delorie.com> <20020108001602.GC21859@bubble.sa.bigpond.net.au> <200201080028.g080SPb02685@envy.delorie.com> <20020108041738.GG21859@bubble.sa.bigpond.net.au> <200201080428.g084Sl905133@envy.delorie.com>
On Mon, Jan 07, 2002 at 11:28:47PM -0500, DJ Delorie wrote:
>
> Ok, minus the obvious typo. A similar patch for getopt.h is
> preapproved.
Somehow, I never got around to committing the change, and there are
enough other changes in my local trees that these got lost. Here's
what I finally committed to gcc mainline. binutils can wait for
your automatic merge.
include/ChangeLog
* libiberty.h (basename): Don't declare if HAVE_DECL_BASENAME.
* getopt.h (getopt): Don't declare if HAVE_DECL_GETOPT.
Index: include/getopt.h
===================================================================
RCS file: /cvs/gcc/gcc/include/getopt.h,v
retrieving revision 1.6
diff -u -p -r1.6 getopt.h
--- include/getopt.h 14 Mar 2001 19:44:38 -0000 1.6
+++ include/getopt.h 24 Jun 2002 04:51:24 -0000
@@ -105,16 +105,17 @@ struct option
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)
+#if !HAVE_DECL_GETOPT
+#if defined (__GNU_LIBRARY__) || defined (HAVE_DECL_GETOPT)
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
-# if !defined (HAVE_DECL_GETOPT)
+#else
extern int getopt ();
-# endif
-#endif /* __GNU_LIBRARY__ */
+#endif
+#endif /* !HAVE_DECL_GETOPT */
+
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
Index: include/libiberty.h
===================================================================
RCS file: /cvs/gcc/gcc/include/libiberty.h,v
retrieving revision 1.27
diff -u -p -r1.27 libiberty.h
--- include/libiberty.h 28 Jan 2002 21:08:34 -0000 1.27
+++ include/libiberty.h 24 Jun 2002 04:51:25 -0000
@@ -73,12 +73,12 @@ extern char **dupargv PARAMS ((char **))
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)
+#if !HAVE_DECL_BASENAME
+#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (HAVE_DECL_BASENAME)
extern char *basename PARAMS ((const char *));
#else
-# if !defined (HAVE_DECL_BASENAME)
extern char *basename ();
-# endif
+#endif
#endif
/* A well-defined basename () that is always compiled in. */
--
Alan Modra
IBM OzLabs - Linux Technology Centre