This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
libiberty.h warning
- From: Mike Stump <mrs at apple dot com>
- To: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 14 Apr 2005 16:39:20 -0700
- Subject: libiberty.h warning
Here is one for libiberty to avoid an annoying warning:
../../gcc/libiberty/../include/libiberty.h:80: warning: function
declaration isn't a prototype
The idea is that instead of listing all known machines in the ifdef,
let's just list the one or two _bad_ machines (if any are left), and
shift the burden onto non-conforming machines. The only problem will
be that machines where this then fails, will need to add code to make
it work.
This shouldn't be a problem, as libgen.h is the header that
prototypes it, and that header usually isn't included. The other
solution, if you don't like this one, would be to check for libgen.h
and in libiberty.h do:
#ifdef HAVE_LOBGEN_H
#include <libgen.h>
#endif
but since they don't do that for any other header (unistd.h
included), I didn't think you'd want to do that.
Ok?
Doing diffs in include:
--- include/libiberty.h.~1~ 2005-04-14 14:46:14.000000000 -0700
+++ include/libiberty.h 2005-04-14 16:24:38.000000000 -0700
@@ -76,17 +76,11 @@ extern char **dupargv (char **) ATTRIBUT
across different systems, sometimes as "char *" and sometimes as
"const char *" */
-/* 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. */
+/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is 0
+ or undefined, provide a fully prototyped one. If it is 1, we found
+ it so don't provide any declaration at all. */
#if !HAVE_DECL_BASENAME
-#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined
(__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) ||
defined (__CYGWIN__) || defined (__CYGWIN32__) || defined
(__MINGW32__) || defined (HAVE_DECL_BASENAME)
extern char *basename (const char *);
-#else
-extern char *basename ();
-#endif
#endif
/* A well-defined basename () that is always compiled in. */
--------------