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]

Re: Patch: tfformat.c doesn't compile under hpux 10.20


>   In message <200009130500.BAA07179@hiauly1.hia.nrc.ca>you write:
>   > > Hmmm.  Send mail to Uli & Benjamin and ask them for advice, they own this
>   > > code -- I don't think they're following this list carefully.
>   > 
>   > Ulrich's opinion was that the hpux 10.20 headers are not standards complian
>   > t
>   > and should be fixed.  While it's true the behaviour is not POSIX/XOPEN
>   > compliant, the standard gcc namespace for hpux is _HPUX_SOURCE which
>   > defines everything, including all hpux extensions.  Thus, the problem can't
>   > be fixed without possibly breaking other code.
> Perhaps the testsuite should be building with -ansi?  That should turn
> off the HPUX extensions.

After doing some testing, I find that just using -ansi is not sufficient.  It's
ok under i686 linux, but O_RDONLY and other similar symbols in fcntl.h don't
get defined under hpux 10.20.

Here is my suggested solution.  I restricted adding `-ansi -D_XOPEN_SOURCE=500'
to just hpux since probably the XOPEN and POSIX namespaces don't work well
on older systems.  _XOPEN_SOURCE=500 was selected because the draft Single
Unix Specification Version 2 is available to the public in html form.  Thus,
discrepancies in implementation can be readily checked.  Hpux 10.20 predates
this standard and the define results in just the XPG4 and POSIX2 symbols.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2000-09-15  J. David Anglin  <dave@hiauly1.hia.nrc.ca>

	* lib/libio.exp: Add `-ansi -D_XOPEN_SOURCE=500' flags for tests
	under hpux.

--- lib/libio.exp.orig	Wed Jun 23 08:10:00 1999
+++ lib/libio.exp	Fri Sep 15 15:43:45 2000
@@ -57,6 +57,12 @@
 
     set args ""
     set ld_library_path ""
+    if [ishost "*-*-hpux*"] {
+      # The standard _HPUX_SOURCE namespace generated by stdlib.h conflicts
+      # with that in iostdio.h.  Use the Open Group SUS2 namespace.  Under
+      # hpux 10.20, this includes XPG4 and POSIX2 symbols.
+      lappend args "additional_flags=-ansi -D_XOPEN_SOURCE=500";
+    }
     lappend args "additional_flags=-O3";
     lappend args "additional_flags=-I.. -I$srcdir/.."
     lappend args "additional_flags=$wrap_compile_flags";

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