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]

PATCH: Follow Neil's lead abandoning CPP_PREDEFINES for *-*-freebsd*


In article <20030308133028 dot GN31657 at daikokuya dot co dot uk> Neil Booth writes:

> Loren noticed that -Wunused-macros would incorrectly
> warn with a duplicated -D on the command line.

Right back at you, Neil!  Neil noticed that we were failing extra
preprocessor tests due in part to our archaic usage of CPP_PREDEFINES.

Included is the patch I created to address this issue (even though
Neil fixed the related exposed common issue).  (OK, there is nothing
like a reformed sinner, but when are we poisoning CPP_PREDEFINES? ;-)

Fully bootstrapped without regression:

i386-unknown-freebsd4.8, mainline sources
alpha-unknown-freebsd5.0, 3.3 sources

Fully rebuilt and checked without regression:

i386-unknown-freebsd5.0, mainline sources

Currently failing mainline bootstrap with or without this patch on
sparc-*-freebsd5.0.  Under the assumption that the sparc port
eventually switches to TARGET_CPU_CPP_BUILTINS and avoids touching
TARGET_OS_CPP_BUILTINS (and as it had better based on new macro
conventions ;-), I have faith that I got that port right as well.

Neil reviewed this patch in private e-mail but I think I need a global
maintainer to review it as well.  I have tested for concurrent
mainline and 3.3 branch approval and that is what I'm seeking.

Thanks,
Loren

	* config/freebsd-spec.h (FBSD_CPP_PREDEFINES): Remove.
	(FBSD_TARGET_OS_CPP_BUILTINS): New port-specific macro.
	(FBSD_TARGET_CPU_CPP_BUILTINS): New port-specific macro.
	* config/freebsd.h (CPP_PREDEFINES): Remove.
	(TARGET_OS_CPP_BUILTINS): New.
	* config/alpha/freebsd.h: Use overridden FBSD_TARGET_CPU_CPP_BUILTINS
	instead of TARGET_OS_CPP_BUILTINS.
	* config/sparc/freebsd.h (CPP_PREDEFINES): Remove.

Index: gcc/config/freebsd-spec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/freebsd-spec.h,v
retrieving revision 1.2
diff -c -r1.2 freebsd-spec.h
*** gcc/config/freebsd-spec.h	29 Sep 2002 13:16:44 -0000	1.2
--- gcc/config/freebsd-spec.h	8 Mar 2003 12:40:52 -0000
***************
*** 48,77 ****
     || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") 		\
     || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
  
! #if FBSD_MAJOR == 6
! #define FBSD_CPP_PREDEFINES \
!   "-D__FreeBSD__=6 -Dunix -D__ELF__ -D__KPRINTF_ATTRIBUTE__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
! #endif
  
! #if FBSD_MAJOR == 5
! #define FBSD_CPP_PREDEFINES \
!   "-D__FreeBSD__=5 -Dunix -D__ELF__ -D__KPRINTF_ATTRIBUTE__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
! #endif
! 
! #if FBSD_MAJOR == 4
! #define FBSD_CPP_PREDEFINES \
!   "-D__FreeBSD__=4 -Dunix -D__ELF__ -D__KPRINTF_ATTRIBUTE__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
! #endif
! 
! #if FBSD_MAJOR == 3
! #define FBSD_CPP_PREDEFINES \
!   "-D__FreeBSD__=3 -Dunix -D__ELF__ -D__KPRINTF_ATTRIBUTE__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
! #endif
! 
! #ifndef FBSD_CPP_PREDEFINES
! #define FBSD_CPP_PREDEFINES \
!   "-D__FreeBSD__   -Dunix -D__ELF__ -D__KPRINTF_ATTRIBUTE__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
! #endif
  
  /* Provide a CPP_SPEC appropriate for FreeBSD.  We just deal with the GCC 
     option `-posix', and PIC issues.  */
--- 48,78 ----
     || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") 		\
     || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
  
! #define FBSD_TARGET_OS_CPP_BUILTINS()					\
!   do									\
!     {									\
! 	if (FBSD_MAJOR == 6)						\
! 	  builtin_define ("__FreeBSD__=6");			       	\
! 	else if (FBSD_MAJOR == 5)	       				\
! 	  builtin_define ("__FreeBSD__=5");			       	\
! 	else if (FBSD_MAJOR == 4)			       		\
! 	  builtin_define ("__FreeBSD__=4");			       	\
! 	else if (FBSD_MAJOR == 3)	       				\
! 	  builtin_define ("__FreeBSD__=3");			       	\
! 	else								\
! 	  builtin_define ("__FreeBSD__");			       	\
! 	builtin_define_std ("unix");					\
! 	builtin_define ("__ELF__");					\
! 	builtin_define ("__KPRINTF_ATTRIBUTE__");		       	\
! 	builtin_assert ("system=unix");					\
! 	builtin_assert ("system=bsd");					\
! 	builtin_assert ("system=FreeBSD");				\
! 	FBSD_TARGET_CPU_CPP_BUILTINS();					\
!     }									\
!   while (0)
  
! /* Define the default FreeBSD-specific per-CPU hook code. */
! #define FBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
  
  /* Provide a CPP_SPEC appropriate for FreeBSD.  We just deal with the GCC 
     option `-posix', and PIC issues.  */
Index: gcc/config/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/freebsd.h,v
retrieving revision 1.17
diff -c -r1.17 freebsd.h
*** gcc/config/freebsd.h	17 Jul 2002 21:31:30 -0000	1.17
--- gcc/config/freebsd.h	8 Mar 2003 12:40:52 -0000
***************
*** 42,48 ****
  #define WORD_SWITCH_TAKES_ARG(STR) (FBSD_WORD_SWITCH_TAKES_ARG(STR))
  
  #undef  CPP_PREDEFINES
! #define CPP_PREDEFINES FBSD_CPP_PREDEFINES
  
  #undef  CPP_SPEC
  #define CPP_SPEC FBSD_CPP_SPEC
--- 42,51 ----
  #define WORD_SWITCH_TAKES_ARG(STR) (FBSD_WORD_SWITCH_TAKES_ARG(STR))
  
  #undef  CPP_PREDEFINES
! /* Obsolete, do not define it. */
! 
! #undef  TARGET_OS_CPP_BUILTINS
! #define TARGET_OS_CPP_BUILTINS() FBSD_TARGET_OS_CPP_BUILTINS()
  
  #undef  CPP_SPEC
  #define CPP_SPEC FBSD_CPP_SPEC
Index: gcc/config/alpha/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/freebsd.h,v
retrieving revision 1.14
diff -c -r1.14 freebsd.h
*** gcc/config/alpha/freebsd.h	8 Feb 2003 01:11:29 -0000	1.14
--- gcc/config/alpha/freebsd.h	8 Mar 2003 12:40:52 -0000
***************
*** 20,30 ****
  Boston, MA 02111-1307, USA.  */
  
  
! /* Provide a CPP_SPEC appropriate for FreeBSD/alpha.  Besides the dealing with
     the GCC option `-posix', and PIC issues as on all FreeBSD platforms, we must
     deal with the Alpha's FP issues.  */
  
! #define TARGET_OS_CPP_BUILTINS()		\
    do						\
      {						\
        if (flag_pic)				\
--- 20,32 ----
  Boston, MA 02111-1307, USA.  */
  
  
! /* Provide a FBSD_TARGET_CPU_CPP_BUILTINS and CPP_SPEC appropriate for
!    FreeBSD/alpha.  Besides the dealing with
     the GCC option `-posix', and PIC issues as on all FreeBSD platforms, we must
     deal with the Alpha's FP issues.  */
  
! #undef FBSD_TARGET_CPU_CPP_BUILTINS
! #define FBSD_TARGET_CPU_CPP_BUILTINS()		\
    do						\
      {						\
        if (flag_pic)				\
Index: gcc/config/sparc/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/freebsd.h,v
retrieving revision 1.17
diff -c -r1.17 freebsd.h
*** gcc/config/sparc/freebsd.h	8 Feb 2003 01:11:29 -0000	1.17
--- gcc/config/sparc/freebsd.h	8 Mar 2003 12:40:52 -0000
***************
*** 26,32 ****
  
  /* Because we include sparc/sysv4.h.  */
  #undef  CPP_PREDEFINES
! #define CPP_PREDEFINES FBSD_CPP_PREDEFINES
  
  #define LINK_SPEC "%(link_arch)						\
    %{!mno-relax:%{!r:-relax}}						\
--- 26,32 ----
  
  /* Because we include sparc/sysv4.h.  */
  #undef  CPP_PREDEFINES
! /* Do not define it here, we now use TARGET_OS_CPP_BUILTINS.  */
  
  #define LINK_SPEC "%(link_arch)						\
    %{!mno-relax:%{!r:-relax}}						\


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