Bug 18022 - change in libiberty.h prevents compilation by IBM C compiler
Summary: change in libiberty.h prevents compilation by IBM C compiler
Status: RESOLVED OBSOLETE
Alias: None
Product: binutils
Classification: Unclassified
Component: admin (show other bugs)
Version: 2.25
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-25 08:04 UTC by Michael
Modified: 2020-01-29 22:41 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 2015-02-25 08:04:23 UTC
I was able to compile and build binutils-2.24 without any real issues. However, version 2.25 will not build.

make stops with the following error


Details:

  +103  /* HAVE_DECL_* is a three-state macro: undefined, 0 or 1.  If it is
  +104     undefined, we haven't run the autoconf check so provide the
  +105     declaration without arguments.  If it is 0, we checked and failed
  +106     to find the declaration so provide a fully prototyped one.  If it
  +107     is 1, we found it so don't provide any declaration at all.  */
  +108  #if !HAVE_DECL_BASENAME
  +109  #if defined (__GNU_LIBRARY__ ) || defined (__linux__) \
  +110   || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
  +111   || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
  +112   || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME)
  +113  extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
  +114  #else
  +115  /* Do not allow basename to be used if there is no prototype seen.  We
  +116     either need to use the above prototype or have one from
  +117     autoconf which would result in HAVE_DECL_BASENAME being set.  */
  +118  #define basename basename_cannot_be_used_without_a_prototype
  +119  #endif
  +120  #endif

The important part of the diff for this file between 2.24 and 2.25 is:
--- ./binutils-2.24/include/libiberty.h 2013-11-04 15:33:39 +0000
+++ ./binutils-2.25/include/libiberty.h 2014-10-14 07:32:04 +0000
...
@@ -106,8 +106,11 @@
    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 !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 *);
+#if defined (__GNU_LIBRARY__ ) || defined (__linux__) \
+ || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
+ || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
+ || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME) 
+extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
 #else
 /* Do not allow basename to be used if there is no prototype seen.  We
    either need to use the above prototype or have one from
...

Hopefully, this will not be too difficult to correct.

If you need any additional info (e.g., config.log) - just ask.

Michael
Comment 1 Ian Lance Taylor 2015-02-25 13:12:30 UTC
What is the actual error?  I don't see it.
Comment 2 Michael 2015-02-25 13:23:53 UTC
My bad - was stil asleep I guess...

/opt/bin/make > build/aix/make.out # only text to stderr shown
"./regex.c", line 31.3: 1506-224 (I) Incorrect pragma ignored.
"/usr/include/alloca.h", line 34.1: 1506-224 (I) Incorrect pragma ignored.
"./../include/libiberty.h", line 113.24: 1506-172 (S) Parameter type list for function basename contains parameters without identifiers.
"./../include/libiberty.h", line 113.38: 1506-276 (S) Syntax error: possible missing '{'?
make[2]: *** [cp-demangle.o] Error 1
make[1]: *** [all-libiberty] Error 2
make: *** [all] Error 2
/opt/bin/make returned an error
Comment 3 Alan Modra 2020-01-29 22:41:43 UTC
.