Patch to disable inappropriate predefines on hppa-hpux if flag_iso

Joseph S. Myers joseph@codesourcery.com
Sat May 7 18:58:00 GMT 2005


In 4.0 but not before, various feature test macros are predefined on
hppa-hpux depending on flag_pa_unix (which defaults to 1998).  This
flag also causes an appropriate object file to be linked with to
select runtime behavior depending on the Unix standard followed.  It
is wrong to define these feature test macros unconditionally as they
cause the headers to make declarations not part of ISO C and users
writing strictly conforming applications for a given Unix or POSIX
standard will expect to define the feature test macros themselves to
appropriate values.  This patch disables the inappropriate predefines
if flag_iso.

Bootstrapped with no regressions on hppa2.0w-hp-hpux11.23 and
hppa64-hp-hpux11.23.  OK to commit to mainline and 4.0 branch?

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

2005-05-07  Joseph S. Myers  <joseph@codesourcery.com>

	* config/pa/pa-hpux11.h (TARGET_OS_CPP_BUILTINS): Do not define
	inappropriate feature test macros if flag_iso.

diff -rupN GCC.orig/gcc/config/pa/pa-hpux11.h GCC/gcc/config/pa/pa-hpux11.h
--- GCC.orig/gcc/config/pa/pa-hpux11.h	2005-04-28 16:50:23.000000000 +0000
+++ GCC/gcc/config/pa/pa-hpux11.h	2005-05-06 03:33:05.000000000 +0000
@@ -66,7 +66,7 @@ Boston, MA 02111-1307, USA.  */
 	  }								\
 	if (!TARGET_64BIT)						\
 	  builtin_define ("_ILP32");					\
-	if (flag_pa_unix >= 1995)					\
+	if (flag_pa_unix >= 1995 && !flag_iso)				\
 	  {								\
 	    builtin_define ("_XOPEN_UNIX");				\
 	    builtin_define ("_XOPEN_SOURCE_EXTENDED");			\
@@ -75,8 +75,11 @@ Boston, MA 02111-1307, USA.  */
 	  {								\
 	    if (flag_pa_unix >= 1998)					\
 	      {								\
-		builtin_define ("_INCLUDE__STDC_A1_SOURCE");		\
-		builtin_define ("_INCLUDE_XOPEN_SOURCE_500");		\
+		if (flag_isoc94 || flag_isoc99 || c_dialect_cxx()	\
+		    || !flag_iso)					\
+		  builtin_define ("_INCLUDE__STDC_A1_SOURCE");		\
+		if (!flag_iso)						\
+		  builtin_define ("_INCLUDE_XOPEN_SOURCE_500");		\
 	      }								\
 	    else if (flag_isoc94 || flag_isoc99 || c_dialect_cxx ())	\
 	      warning (0, "-munix=98 option required for C89 "		\



More information about the Gcc-patches mailing list