This is the mail archive of the gcc@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: MIPS port and fixincludes


On Tue, Jan 18, 2000 at 01:24:29PM -0500, Gavin Romig-Koch wrote:
> 
> Well, I agree this is a minor issue, at least until we break
> something :-).  
> 
> I think fixincludes should do as little as resonably possible
> (for some definition of reasonable).

I'm looking through the machine_name fixes applied on this machine
(bleeding edge linux distribution) and all of them are unnecessary,
or at least questionable.  Examples:

--- /usr/include/./gc/gc.h      Fri Oct 29 15:39:58 1999
+++ ./gc/gc.h   Tue Jan 18 12:07:42 2000
@@ -738,7 +738,7 @@
  * from the statically loaded program section.
  * This circumvents a Solaris 2.X (X<=4) linker bug.
  */
-#if defined(sparc) || defined(__sparc)
+#if defined(__sparc__) || defined(__sparc)
 #   define GC_INIT() { extern end, etext; \
                       GC_noop(&end, &etext); }
 #else

--- /usr/include/./linux/a.out.h        Sun Dec 26 10:44:59 1999
+++ ./linux/a.out.h     Tue Jan 18 12:05:17 2000
@@ -113,16 +113,16 @@
 /* Address of data segment in memory after it is loaded.
    Note that it is up to you to define SEGMENT_SIZE
    on machines not listed here.  */
-#if defined(vax) || defined(hp300) || defined(pyr)
+#if defined(__vax__) || defined(hp300) || defined(__pyr__)
 #define SEGMENT_SIZE page_size
 #endif
 #ifdef sony
 #define        SEGMENT_SIZE    0x2000
 #endif /* Sony.  */
-#ifdef is68k
+#ifdef __is68k__
 #define SEGMENT_SIZE 0x20000
 #endif
-#if defined(m68k) && defined(PORTAR)
+#if defined(__m68k__) && defined(PORTAR)
 #define PAGE_SIZE 0x400
 #define SEGMENT_SIZE PAGE_SIZE
 #endif

I'm half tempted to say we should discard this fix entirely and say
that if your vendor provides broken headers, -ansi may not work, sorry.

[...]
> That said, the mips port defines __mips in all cases.  It also
> defines __mips__ in the case where host or target is openbsd.

Hm - sounds like the existing behavior may be incorrect, not just
overenthusiastic.

The offending substitutions are

                "\ts/ _*MIPSE\\([LB]\\) / __MIPSE\\1__ /g\n"
                "\ts/ _*SYSTYPE_\\([A-Z0-9]*\\) / __SYSTYPE_\\1__ /g\n"
                "\ts/ _*\\([Rr][34]\\)000 / __\\1000__ /g\n"
                "\ts/ _*host_mips / __host_mips__ /g\n"
                "\ts/ _*i386 / __i386__ /g\n"
                "\ts/ _*mips / __mips__ /g\n"

I think these were all intended to match the symbol with zero or one
leading underscores, not two or more.  Unfortunately, sed doesn't have
the ? regexp operator.  The simplest fix is just to duplicate each
substitution, once with one underscore and once with none.  Patch is
appended - comments?

zw

===================================================================
Index: inclhack.def
--- inclhack.def	2000/01/17 21:45:29	1.47
+++ inclhack.def	2000/01/18 20:18:10
@@ -1292,16 +1273,16 @@ fix = {
      * The fixinc_eol stuff is to work around a bug in the sed
      */
     select = "^#[ \t]*(if|elif).*"
-             "[^a-zA-Z0-9_](_*[MSRrhim]|[Mbimnpstuv])[a-zA-Z0-9_]";
+             "[^a-zA-Z0-9_](_?[MSRrhim]|[Mbimnpstuv])[a-zA-Z0-9_]";
     exesel = "^#[ \t]*(if|elif).*[^a-zA-Z0-9_]"
              "("
                   "M32"
-                 "|_*MIPSE[LB]"
-                 "|_*SYSTYPE_[A-Z0-9]"
-                 "|_*[Rr][34]000"
-                 "|_*host_mips"
-                 "|_*i386"
-                 "|_*mips"
+                 "|_?MIPSE[LB]"
+                 "|_?SYSTYPE_[A-Z0-9]"
+                 "|_?[Rr][34]000"
+                 "|_?host_mips"
+                 "|_?i386"
+                 "|_?mips"
                  "|bsd4"
                  "|is68k"
                  "|m[68]8k"
@@ -1332,12 +1313,18 @@ fix = {
                 "\ts/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g\n"
 
                 "\ts/ M32 / __M32__ /g\n"
-                "\ts/ _*MIPSE\\([LB]\\) / __MIPSE\\1__ /g\n"
-                "\ts/ _*SYSTYPE_\\([A-Z0-9]*\\) / __SYSTYPE_\\1__ /g\n"
-                "\ts/ _*\\([Rr][34]\\)000 / __\\1000__ /g\n"
-                "\ts/ _*host_mips / __host_mips__ /g\n"
-                "\ts/ _*i386 / __i386__ /g\n"
-                "\ts/ _*mips / __mips__ /g\n"
+                "\ts/ MIPSE\\([LB]\\) / __MIPSE\\1__ /g\n"
+		"\ts/ _MIPSE\\([LB]\\) / __MIPSE\\1__ /g\n"
+                "\ts/ SYSTYPE_\\([A-Z0-9]*\\) / __SYSTYPE_\\1__ /g\n"
+                "\ts/ _SYSTYPE_\\([A-Z0-9]*\\) / __SYSTYPE_\\1__ /g\n"
+                "\ts/ \\([Rr][34]\\)000 / __\\1000__ /g\n"
+                "\ts/ _\\([Rr][34]\\)000 / __\\1000__ /g\n"
+                "\ts/ host_mips / __host_mips /g\n"
+                "\ts/ _host_mips / __host_mips /g\n"
+                "\ts/ i386 / __i386__ /g\n"
+                "\ts/ _i386 / __i386__ /g\n"
+                "\ts/ mips / __mips /g\n"
+                "\ts/ _mips / __mips /g\n"
                 "\ts/ bsd4\\([0-9]\\) / __bsd4\\1__ /g\n"
                 "\ts/ is68k / __is68k__ /g\n"
                 "\ts/ m68k / __m68k__ /g\n"

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