This is the mail archive of the gcc-patches@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]

_XOPEN_SOURCE madness



Hi Tom, you wrote:
> I also got a couple reports that on some Linux systems (not mine, and
> not Solaris box either) `CODESET' is not defined unless _XOPEN_SOURCE
> is defined.  I think it is always safe for us to define _XOPEN_SOURCE.
> So my change defines it unconditionally.

I don't think it is always safe.  I know for a fact that it causes
build failures under Solaris.  I believe it also causes problems under
Linux, because it turns off various things that GCC will use.

Also, feature macros should be defined before you test for features.
Otherwise the tests might not match what is actually available.

If you get further bug reports, you need to write a proper feature
test macro that defines _XOPEN_SOURCE only when it is needed.

I'm about to commit this patch, which should still fix the problem,
Tested with native builds on sparc-solaris, x86-linux, powerpc-aix;
all of them made it out of gcc/.

Please test your patches better before committing them.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/gcc-xopensource.patch==============
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ChangeLog,v
retrieving revision 1.7772
diff -u -p -r1.7772 ChangeLog
--- ChangeLog	2000/09/16 18:30:58	1.7772
+++ ChangeLog	2000/09/16 23:23:13
@@ -1,3 +1,9 @@
+2000-09-16  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* configure.in: Define macros that affect features before
+	testing for features.  Don't define _XOPEN_SOURCE.
+	* configure: Regenerated.
+	* config.in: Regenerated.
+
 Sat Sep 16 14:35:55 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
 	* stor-layout.c (place_field): Don't do anything if field or
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/configure.in,v
retrieving revision 1.419
diff -u -p -r1.419 configure.in
--- configure.in	2000/09/16 13:13:49	1.419
+++ configure.in	2000/09/16 23:23:13
@@ -395,6 +395,9 @@ else
     AC_MSG_RESULT(no)
 fi
 
+# Define _GNU_SOURCE, since this is a GNU program.
+AC_DEFINE(_GNU_SOURCE, 1, [Always define this])
+
 AC_C_INLINE
 
 # Find some useful tools
@@ -419,13 +422,6 @@ AC_CHECK_HEADERS(limits.h stddef.h strin
 # Check for thread headers.
 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
-
-# Always define _XOPEN_SOURCE.  It doesn't hurt, and it lets us
-# pick up CODESET from langinfo.h, among other things.
-AC_DEFINE(_XOPEN_SOURCE, 1, [Always define this])
-# If we define _XOPEN_SOURCE on a glibc2 system, it hides other
-# interfaces.  Make them visible again with _GNU_SOURCE.
-AC_DEFINE(_GNU_SOURCE, 1, [Always define this])
 
 # See if GNAT has been installed
 AC_CHECK_PROG(gnat, gnatbind, yes, no)
============================================================

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