[committed] PR16830: Don't define R3000 or R4000 on IRIX

Richard Sandiford rsandifo@redhat.com
Sat Nov 6 23:36:00 GMT 2004


This patch fixes PR target/16830, which is about a parse error when
including <sys/immu.h> on IRIX.

The problem is that the MIPS port defines the macro R4000 (and some
underscored derivates) for 64-bit targets and R3000 for 32-bit targets.
These aren't standard compiler macros on IRIX (meaning that MIPSpro
doesn't define them), and in the case of <sys/immu.h>, R4000 selects
some low-level definitions that also require a platform macro like
IP20 to be defined.

Several alternatives are mentioned in the PR trail.  IMO, the simplest
fix is to simply to follow MIPSpro's example and disable these macros
on IRIX.  __mips64 is a better macro if you want to know whether the
target is 64-bit or not and __mips is better if you want to know the
target ISA.

Bootstrapped & tested on mips-sgi-irix6.5.  Applied to mainline.

Richard


	PR target/16830
	* config/mips/mips.h (TARGET_CPU_CPP_BUILTINS): Don't define the
	R3000 and R4000 macros on IRIX.

Index: config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.373
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.373 mips.h
*** config/mips/mips.h	21 Oct 2004 00:53:40 -0000	1.373
--- config/mips/mips.h	26 Oct 2004 18:39:59 -0000
*************** #define TARGET_CPU_CPP_BUILTINS()				\
*** 393,410 ****
        if (!flag_iso)						\
  	builtin_define ("mips");				\
  								\
-       /* Treat _R3000 and _R4000 like register-size defines,	\
- 	 which is how they've historically been used.  */	\
        if (TARGET_64BIT)						\
  	{							\
! 	  builtin_define ("__mips64");     			\
! 	  builtin_define_std ("R4000");				\
! 	  builtin_define ("_R4000");				\
! 	}							\
!       else							\
! 	{							\
! 	  builtin_define_std ("R3000");				\
! 	  builtin_define ("_R3000");				\
  	}							\
        if (TARGET_FLOAT64)					\
  	builtin_define ("__mips_fpr=64");			\
--- 393,416 ----
        if (!flag_iso)						\
  	builtin_define ("mips");				\
  								\
        if (TARGET_64BIT)						\
+ 	builtin_define ("__mips64");				\
+ 								\
+       if (!TARGET_IRIX)						\
  	{							\
! 	  /* Treat _R3000 and _R4000 like register-size		\
! 	     defines, which is how they've historically		\
! 	     been used.  */					\
! 	  if (TARGET_64BIT)					\
! 	    {							\
! 	      builtin_define_std ("R4000");			\
! 	      builtin_define ("_R4000");			\
! 	    }							\
! 	  else							\
! 	    {							\
! 	      builtin_define_std ("R3000");			\
! 	      builtin_define ("_R3000");			\
! 	    }							\
  	}							\
        if (TARGET_FLOAT64)					\
  	builtin_define ("__mips_fpr=64");			\



More information about the Gcc-patches mailing list