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]
Other format: [Raw text]

IA64 Patch for setting CPP builtins.


A while back I sent out a patch to modify CPP_PREDEFINES on IA64 for
Linux, AIX, and HP-UX.  I never got any replies to that patch so here is
a new one in which I completely remove the use of CPP_PREDEFINES and
replace it with the newer TARGET_CPU_CPP_BUILTINS and
TARGET_OS_CPP_BUILTINS macros.

I am hoping someone can review and approve it.  Note that this affects
IA64 Linux and AIX as well as HP-UX but I only tested it on HP-UX.

Steve Ellcey
sje@cup.hp.com


2002-08-27  Steve Ellcey  <sje@cup.hp.com>

	* config/ia64/ia64.h (EXTRA_SPECS): Remove cpp_cpu.
	(CPP_CPU_SPEC): Remove.
	(TARGET_CPU_CPP_BUILTINS): New.
	* config/ia64/hpux.h (CPP_PREDEFINES): Remove.
	(CPP_SPEC): Remove.
	(TARGET_OS_CPP_BUILTINS): New.
	* config/ia64/linux.h (CPP_PREDEFINES): Remove.
	(TARGET_OS_CPP_BUILTINS): New.
	* config/ia64/aix.h (CPP_SPEC): Move some stuff to
	TARGET_OS_CPP_BUILTINS.
	(CPP_PREDEFINES): Remove.
	(CPLUSPLUS_CPP_SPEC): Remove.
	(TARGET_OS_CPP_BUILTINS): New.


*** gcc.orig/gcc/config/ia64/ia64.h	Tue Aug 27 13:05:32 2002
--- gcc/gcc/config/ia64/ia64.h	Tue Aug 27 13:09:39 2002
*************** Boston, MA 02111-1307, USA.  */
*** 31,43 ****
  
  /* Run-time target specifications */
  
  #define EXTRA_SPECS \
-   { "cpp_cpu", CPP_CPU_SPEC }, \
    { "asm_extra", ASM_EXTRA_SPEC },
- 
- #define CPP_CPU_SPEC " \
-   -Acpu=ia64 -Amachine=ia64 -D__ia64 -D__ia64__ %{!milp32:-D_LP64 -D__LP64__} \
-   -D__ELF__"
  
  #define CC1_SPEC "%(cc1_cpu) "
  
--- 31,55 ----
  
  /* Run-time target specifications */
  
+ /* Target CPU builtins.  */
+ #define TARGET_CPU_CPP_BUILTINS()		\
+ do {						\
+ 	builtin_assert("cpu=ia64");		\
+ 	builtin_assert("machine=ia64");		\
+ 	builtin_define("__ia64");		\
+ 	builtin_define("__ia64__");		\
+ 	builtin_define("__ELF__");		\
+ 	if (!TARGET_ILP32)			\
+ 	  {					\
+ 	    builtin_define("_LP64");		\
+ 	    builtin_define("__LP64__");		\
+ 	  }					\
+ 	if (TARGET_BIG_ENDIAN)			\
+ 	  builtin_define("__BIG_ENDIAN__");	\
+ } while (0)
+ 
  #define EXTRA_SPECS \
    { "asm_extra", ASM_EXTRA_SPEC },
  
  #define CC1_SPEC "%(cc1_cpu) "
  
*** gcc.orig/gcc/config/ia64/hpux.h	Tue Aug 27 13:04:20 2002
--- gcc/gcc/config/ia64/hpux.h	Tue Aug 27 13:18:05 2002
*************** Boston, MA 02111-1307, USA.  */
*** 25,50 ****
  
  #define TARGET_VERSION fprintf (stderr, " (IA-64) HP-UX");
  
! #undef CPP_PREDEFINES
! #define CPP_PREDEFINES "\
!   -D__IA64__ -D__hpux -D__hpux__ -Dhpux -Dunix \
!   -D__BIG_ENDIAN__ -D_LONGLONG \
!   -Asystem=hpux -Asystem=posix -Asystem=unix \
!   -D_UINT128_T"
! 
! /* -D__fpreg=long double is needed to compensate for the lack of __fpreg
!    which is a primitive type in HP C but does not exist in GNU C.  Same
!    for __float80 and __float128.  These types appear in HP-UX header
!    files and so must have some definition.  */
! 
! #undef CPP_SPEC
! #define CPP_SPEC "\
!   %{mcpu=itanium:-D__itanium__} \
!   %{mlp64:-D__LP64__ -D_LP64} \
!   %{!ansi:%{!std=c*:%{!std=i*: -D_HPUX_SOURCE -D__STDC_EXT__}}} \
!   -D__fpreg=long\\ double \
!   -D__float80=long\\ double \
!   -D__float128=long\\ double"
  
  #undef  ASM_EXTRA_SPEC
  #define ASM_EXTRA_SPEC "%{milp32:-milp32} %{mlp64:-mlp64}"
--- 25,53 ----
  
  #define TARGET_VERSION fprintf (stderr, " (IA-64) HP-UX");
  
! /* Target OS builtins.  */
! /* -D__fpreg=long double is needed to compensate for
!    the lack of __fpreg which is a primative type in
!    HP C but does not exist in GNU C.  */
! #define TARGET_OS_CPP_BUILTINS()			\
! do {							\
! 	builtin_assert("system=hpux");			\
! 	builtin_assert("system=posix");			\
! 	builtin_assert("system=unix");			\
! 	builtin_define_std("hpux");			\
! 	builtin_define_std("unix");			\
! 	builtin_define("__IA64__");			\
! 	builtin_define("_LONGLONG");			\
! 	builtin_define("_UINT128_T");			\
! 	builtin_define("__fpreg=long double");		\
! 	builtin_define("__float80=long double");	\
! 	builtin_define("__float128=long double");	\
! 	if (c_language == clk_cplusplus || !flag_iso)	\
! 	  {						\
! 	    builtin_define("_HPUX_SOURCE");		\
! 	    builtin_define("__STDC_EXT__");		\
! 	  }						\
! } while (0)
  
  #undef  ASM_EXTRA_SPEC
  #define ASM_EXTRA_SPEC "%{milp32:-milp32} %{mlp64:-mlp64}"
*** gcc.orig/gcc/config/ia64/linux.h	Tue Aug 27 13:05:26 2002
--- gcc/gcc/config/ia64/linux.h	Tue Aug 27 13:16:59 2002
***************
*** 9,18 ****
  #undef CC1_SPEC
  #define CC1_SPEC "%{profile:-p} %{G*}"
  
! /* ??? Maybe this should be in sysv4.h?  */
! #define CPP_PREDEFINES "\
!   -D__gnu_linux__ -D__linux -D__linux__ -D_LONGLONG \
!   -Dlinux -Dunix -Asystem=linux"
  
  /* Need to override linux.h STARTFILE_SPEC, since it has crtbeginT.o in.  */
  #undef STARTFILE_SPEC
--- 9,23 ----
  #undef CC1_SPEC
  #define CC1_SPEC "%{profile:-p} %{G*}"
  
! /* Target OS builtins.  */
! #define TARGET_OS_CPP_BUILTINS()		\
! do {						\
! 	builtin_assert("system=linux");		\
! 	builtin_define_std("linux");		\
! 	builtin_define_std("unix");		\
! 	builtin_define("__gnu_linux__");	\
! 	builtin_define("_LONGLONG");		\
! } while (0)
  
  /* Need to override linux.h STARTFILE_SPEC, since it has crtbeginT.o in.  */
  #undef STARTFILE_SPEC
*** gcc.orig/gcc/config/ia64/aix.h	Tue Aug 27 13:05:18 2002
--- gcc/gcc/config/ia64/aix.h	Tue Aug 27 13:40:56 2002
*************** Boston, MA 02111-1307, USA.  */
*** 71,76 ****
--- 71,99 ----
  /* Define this so we can compile MS code for use with WINE.  */
  #define HANDLE_PRAGMA_PACK_PUSH_POP
  
+ /* Target OS builtins.  */
+ #define TARGET_OS_CPP_BUILTINS()			\
+ do {							\
+ 	if (iso_flag)					\
+ 	  builtin_define("_ANSI_C_SOURCE");		\
+ 	builtin_define("_AIX");				\
+ 	builtin_define("_AIX64");			\
+ 	builtin_define("unix");				\
+ 	builtin_assert("system=unix");			\
+ 	builtin_assert("system=aix");			\
+ 	builtin_define("__64BIT__");			\
+ 	builtin_define("_LONG_LONG");			\
+ 	builtin_define("_IA64");			\
+ 	builtin_define("__int128=__size128_t");		\
+ 	if (c_language == clk_cplusplus)		\
+ 	  {						\
+ 	    builtin_define("_XOPEN_SOURCE=500");	\
+ 	    builtin_define("_XOPEN_SOURCE_EXTENDED=1");	\
+ 	    builtin_define("_LARGE_FILE_API");		\
+ 	    builtin_define("_ALL_SOURCE");		\
+ 	  }						\
+ } while (0)
+ 
  /* A C string constant that tells the GNU CC driver program options to pass to
     CPP.  It can also specify how to translate options you give to GNU CC into
     options for GNU CC to pass to the CPP.  */
*************** Boston, MA 02111-1307, USA.  */
*** 78,102 ****
  /* If -ansi, we need to define _ANSI_C_SOURCE to get the right headers.  */
  #undef CPP_SPEC
  #define CPP_SPEC "\
! %{mcpu=itanium:-D__itanium__} %{mbig-endian:-D__BIG_ENDIAN__} \
! %{ansi:-D_ANSI_C_SOURCE} \
  %{posix:-D_POSIX_SOURCE} \
  %{cpp_cpu}"
- 
- #undef CPP_PREDEFINES
- #define CPP_PREDEFINES "\
-   -D_AIX -D_AIX64 -D_LONGLONG -Dunix \
-   -Asystem=unix -Asystem=aix \
-   -D__64BIT__ -D_LONG_LONG -D_IA64 -D__int128=__size128_t"
- 
- /* The GNU C++ standard library requires that these macros be defined.  */
- #undef CPLUSPLUS_CPP_SPEC
- #define CPLUSPLUS_CPP_SPEC                      \
-   "-D_XOPEN_SOURCE=500                          \
-    -D_XOPEN_SOURCE_EXTENDED=1                   \
-    -D_LARGE_FILE_API                            \
-    -D_ALL_SOURCE                                \
-    %{cpp_cpu}"
  
  /* Define this for shared library support.  */
  
--- 101,109 ----
  /* If -ansi, we need to define _ANSI_C_SOURCE to get the right headers.  */
  #undef CPP_SPEC
  #define CPP_SPEC "\
! %{mcpu=itanium:-D__itanium__} \
  %{posix:-D_POSIX_SOURCE} \
  %{cpp_cpu}"
  
  /* Define this for shared library support.  */
  


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