This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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]

[Bug libc/10416] New: bug-atexit3-lib.cc build failure with g++ 4.5.0 (and fix)


When checking gcc using g++ to compile bug-atexit3-lib.cc produces

In file included from bug-atexit3-lib.cc:1:0:
../include/unistd.h:4:1: error: new declaration ?void _exit(int)?
../posix/unistd.h:570:13: error: ambiguates old declaration ?void _exit(int)?
../include/unistd.h:7:1: error: new declaration ?int execl(const char*, const
char*, ...)?
../posix/unistd.h:540:12: error: ambiguates old declaration ?int execl(const
char*, const char*, ...)?
../include/unistd.h:8:1: error: new declaration ?int execle(const char*, const
char*, ...)?
../posix/unistd.h:535:12: error: ambiguates old declaration ?int execle(const
char*, const char*, ...)?
../include/unistd.h:9:1: error: new declaration ?int execlp(const char*, const
char*, ...)?
../posix/unistd.h:551:12: error: ambiguates old declaration ?int execlp(const
char*, const char*, ...)?
../include/unistd.h:10:1: warning: ?int execvp(const char*, char* const*)?:
visibility attribute ignored because it
../posix/unistd.h:545:12: warning: conflicts with previous declaration here

This seems to be extern "C" version in posix/unistd.h being ambiguous with the
not extern "C" version in include/unistd.h. This presumably affects a wide range
of target architecture and many C++ compilers. 

The fix below fixes this by adding bracketing the contents of unistd.h in
_BEGIB_DECLS ... __END_DECLS.

--- include/unistd.h.dist       2009-07-19 17:22:48.160507246 +0100
+++ include/unistd.h    2009-07-19 20:06:03.857739225 +0100
@@ -1,6 +1,9 @@
 #ifndef _UNISTD_H
+# include <features.h>
 # include <posix/unistd.h>
 
+__BEGIN_DECLS
+
 libc_hidden_proto (_exit, __noreturn__)
 libc_hidden_proto (alarm)
 libc_hidden_proto (confstr)
@@ -174,4 +177,6 @@
    unless it is really necessary.  */
 #define __have_pipe2 __have_sock_cloexec
 
+__END_DECLS
+
 #endif

-- 
           Summary: bug-atexit3-lib.cc build failure with g++ 4.5.0 (and
                    fix)
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: dps at simpson dot demon dot co dot uk
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=10416

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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