This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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 lto/40702] lto-elf.c fails to compile on Solaris



------- Comment #2 from ro at techfak dot uni-bielefeld dot de  2009-10-05 12:56 -------
Subject: Re:  lto-elf.c fails to compile on Solaris

> ------- Comment #1 from rguenth at gcc dot gnu dot org  2009-10-03 22:12 -------
> Waiting for someone with access to that host to investigate.

I've finally understood what was going on: Solaris 2 is one of the few
STDC_0_IN_SYSTEM_HEADERS targets, thus the definition of __STDC__ in the
-g3 -save-temps output changes on where in the file one is (and no
definition is actually emitted, which caused massive confusion for me).
The actual fix is simple: just test for defined(__STDC__) in libelf gelf.h
and libelf.h, as the following fix does:

===================================================================
RCS file: RCS/gelf.h,v
retrieving revision 1.1
diff -up -r1.1 gelf.h
--- gelf.h      2009/09/28 17:51:38     1.1
+++ gelf.h      2009/09/28 18:54:27
@@ -39,7 +39,7 @@ extern "C" {
 #endif /* __cplusplus */

 #ifndef __P
-# if (__STDC__ + 0) || defined(__cplusplus) || defined(_WIN32)
+# if defined(__STDC__) || defined(__cplusplus) || defined(_WIN32)
 #  define __P(args) args
 # else /* __STDC__ || defined(__cplusplus) */
 #  define __P(args) ()
===================================================================
RCS file: RCS/libelf.h,v
retrieving revision 1.1
diff -up -r1.1 libelf.h
--- libelf.h    2009/09/28 17:51:38     1.1
+++ libelf.h    2009/09/28 18:54:16
@@ -42,7 +42,7 @@ extern "C" {
 #endif /* __cplusplus */

 #ifndef __P
-# if (__STDC__ + 0) || defined(__cplusplus) || defined(_WIN32)
+# if defined(__STDC__) || defined(__cplusplus) || defined(_WIN32)
 #  define __P(args) args
 # else /* __STDC__ || defined(__cplusplus) */
 #  define __P(args) ()

This allowed me too bootstrap on Solaris 11/SPARC and Solaris 10/x86.

        Rainer


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40702


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