Update definitions of HANDLE_PRAGMA macro in order to conform to new spec.
authorNick Clifton <nickc@cygnus.com>
Wed, 2 Sep 1998 10:13:23 +0000 (10:13 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Wed, 2 Sep 1998 10:13:23 +0000 (10:13 +0000)
From-SVN: r22168

gcc/ChangeLog
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.h
gcc/config/i960/i960.c
gcc/config/i960/i960.h
gcc/config/nextstep.c
gcc/config/nextstep.h

index 7af0d14973323f67abf8c11b2de17c4c26e42451..28e514ffc676aa0d61434feb5837dc6f8dbb6f1c 100644 (file)
@@ -1,4 +1,17 @@
-Wed Sep 2 09:25:29 1998  Nick Clifton  <nickc@cygnus.com>
+Wed Sep  2 10:06:07 1998  Nick Clifton  <nickc@cygnus.com>
+
+       * config/nextstep.h:    Update HANDLE_PRAGMA macro.
+       * config/h8300/h8300.h: Update HANDLE_PRAGMA macro.
+       * config/i960/i960.h:   Update HANDLE_PRAGMA macro.
+       
+       * config/nextstep.c (handle_pragma): Take three arguments, as per
+       the new HANDLE_PRAGMA macro specification.
+       * config/h8300/h8300.c (handle_pragma): Take three arguments, as
+       per the new HANDLE_PRAGMA macro specification.
+       * config/i960/i960.c (process_pragma): Take three arguments, as
+       per the new HANDLE_PRAGMA macro specification.
+
+Wed Sep  2 09:25:29 1998  Nick Clifton  <nickc@cygnus.com>
 
        * c-lex.c (check_newline):  Call HANDLE_PRAGMA before
        HANDLE_SYSV_PRAGMA if both are defined.  Generate warning messages
index 3f66b0630b5f48afeb30476ac74de4e046b4b7c6..92af43165b12001abb6745b52948ef542c6c7a58 100644 (file)
@@ -856,17 +856,13 @@ eq_operator (x, mode)
    with this attribute may be safely used in an interrupt vector.  */
 
 int
-handle_pragma (file, t)
-     FILE *file;
-     tree t;
+handle_pragma (p_getc, p_ungetc, name)
+     int (*  p_getc) PROTO ((void));
+     void (* p_ungetc) PROTO ((int));
+     char * pname;
 {
   int retval = 0;
-  register char *pname;
-
-  if (TREE_CODE (t) != IDENTIFIER_NODE)
-    return 0;
 
-  pname = IDENTIFIER_POINTER (t);
   if (strcmp (pname, "interrupt") == 0)
     interrupt_handler = retval = 1;
   else if (strcmp (pname, "saveall") == 0)
index c65eb42e17677fae452de4598e17af3f6293a998..f159174980d42fadc6ac504d7afef78935632c99 100644 (file)
@@ -1358,11 +1358,17 @@ do { char dstr[30];                                     \
 
 /* Define this macro if you want to implement any pragmas.  If defined, it
    should be a C expression to be executed when #pragma is seen.  The
-   argument STREAM is the stdio input stream from which the source
-   text can be read.  CH is the first character after the #pragma.  The
-   result of the expression is the terminating character found
-   (newline or EOF).  */
-#define HANDLE_PRAGMA(FILE, NODE) handle_pragma (FILE, NODE)
+   argument GETC is a function which will return the next character in the
+   input stream, or EOF if no characters are left.  The argument UNGETC is
+   a function which will push a character back into the input stream.  The
+   argument NAME is the word following #pragma in the input stream.  The input
+   stream pointer will be pointing just beyond the end of this word.  The
+   expression should return true if it handled the pragma, false otherwise.
+   The input stream should be left undistrubed if false is returned, otherwise
+   it should be pointing at the last character after the end of the pragma
+   (newline or end-of-file).  */
+#define HANDLE_PRAGMA(GETC, UNGETC, NAME) handle_pragma (GETC, UNGETC, NAME)
+extern int handle_pragma ();
 
 #define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
 
index 6189b4dee51e9f6ddffd403486341f643b202259..9fa8889c3011585f37f9cff5e384ef7576ca7993 100644 (file)
@@ -89,86 +89,83 @@ static int ret_label = 0;
    intel compilers understand.  */
 
 int
-process_pragma (finput, t)
-     FILE *finput;
-     tree t;
+process_pragma (p_getc, p_ungetc, pname)
+     int (*  p_getc) PROTO ((void));
+     void (* p_ungetc) PROTO ((int));
+     char * pname;
 {
   int i;
   register int c;
-  register char *pname;
+  char buf[20];
+  char *s = buf;
+  int align;
 
-  if (TREE_CODE (t) != IDENTIFIER_NODE)
+  /* Should be pragma 'far' or equivalent for callx/balx here.  */
+  if (strcmp (pname, "align") != 0)
     return 0;
-
-  pname = IDENTIFIER_POINTER (t);
-
-  if (strcmp (pname, "align") == 0)
+  
+  do
     {
-      char buf[20];
-      char *s = buf;
-      int align;
-
-      do {
-       c = getc (finput);
-      } while (c == ' ' || c == '\t');
-
-      if (c == '(')
-       c = getc (finput);
-      while (c >= '0' && c <= '9')
-       {
-         if (s < buf + sizeof buf - 1)
-           *s++ = c;
-         c = getc (finput);
-       }
-      *s = '\0';
-
-      /* We had to read a non-numerical character to get out of the
-        while loop---often a newline.  So, we have to put it back to
-        make sure we continue to parse everything properly.  */
-      ungetc (c, finput);
-
-      align = atoi (buf);
-      switch (align)
-       {
-       case 0:
-         /* Return to last alignment.  */
-         align = i960_last_maxbitalignment / 8;
-         /* Fall through.  */
-       case 16:
-       case 8:
-       case 4:
-       case 2:
-       case 1:
-         i960_last_maxbitalignment = i960_maxbitalignment;
-         i960_maxbitalignment = align * 8;
-         break;
-
-       default:
-         /* Silently ignore bad values.  */
-         break;
-       }
-
-      /* NOTE: ic960 R3.0 pragma align definition:
-
-        #pragma align [(size)] | (identifier=size[,...])
-        #pragma noalign [(identifier)[,...]]
+      c = p_getc ();
+    }
+  while (c == ' ' || c == '\t');
 
-        (all parens are optional)
+  if (c == '(')
+    c = p_getc ();
+  
+  while (c >= '0' && c <= '9')
+    {
+      if (s < buf + sizeof buf - 1)
+       *s++ = c;
+      c = p_getc ();
+    }
+  
+  *s = '\0';
 
-        - size is [1,2,4,8,16]
-        - noalign means size==1
-        - applies only to component elements of a struct (and union?)
-        - identifier applies to structure tag (only)
-        - missing identifier means next struct
+  /* We had to read a non-numerical character to get out of the
+     while loop---often a newline.  So, we have to put it back to
+     make sure we continue to parse everything properly.  */
+  
+  p_ungetc (c);
 
-        - alignment rules for bitfields need more investigation  */
+  align = atoi (buf);
 
-      return 1;
+  switch (align)
+    {
+    case 0:
+      /* Return to last alignment.  */
+      align = i960_last_maxbitalignment / 8;
+      /* Fall through.  */
+    case 16:
+    case 8:
+    case 4:
+    case 2:
+    case 1:
+      i960_last_maxbitalignment = i960_maxbitalignment;
+      i960_maxbitalignment = align * 8;
+      break;
+      
+    default:
+      /* Silently ignore bad values.  */
+      break;
     }
-
-  /* Should be pragma 'far' or equivalent for callx/balx here.  */
-
-  return 0;
+  
+  /* NOTE: ic960 R3.0 pragma align definition:
+     
+     #pragma align [(size)] | (identifier=size[,...])
+     #pragma noalign [(identifier)[,...]]
+     
+     (all parens are optional)
+     
+     - size is [1,2,4,8,16]
+     - noalign means size==1
+     - applies only to component elements of a struct (and union?)
+     - identifier applies to structure tag (only)
+     - missing identifier means next struct
+     
+     - alignment rules for bitfields need more investigation  */
+  
+  return 1;
 }
 
 /* Initialize variables before compiling any files.  */
index 4102c0ff27914c839e1ac9d540af8d4b77425f6d..b786d386e90872784092ca46871ffa66e4b0d1c9 100644 (file)
@@ -122,7 +122,8 @@ Boston, MA 02111-1307, USA.  */
   fprintf (asm_out_file, "\t.type\t0x%x;", A)
 
 /* Handle pragmas for compatibility with Intel's compilers.  */
-#define HANDLE_PRAGMA(FILE, NODE) process_pragma (FILE, NODE)
+#define HANDLE_PRAGMA(GET, UNGET, NAME) process_pragma (GET, UNGET, NAME)
+extern int process_pragma ();
 
 /* Run-time compilation parameters selecting different hardware subsets.  */
 
index e909a948cdaa9403b71e5bfa6d2a6dad74eadbe8..bdf13355392bdcc49e6d6bcc63841f4b4732a27f 100644 (file)
@@ -45,12 +45,12 @@ extern char *get_directive_line ();
    The result is 1 if the pragma was handled.  */
 
 int
-handle_pragma (finput, node)
-     FILE *finput;
-     tree node;
+handle_pragma (p_getc, p_ungetc, name)
+     int (*  p_getc) PROTO ((void));
+     void (* p_ungetc) PROTO ((int));
+     char * pname;
 {
   int retval = 0;
-  register char *pname;
 
   /* Record initial setting of optimize flag, so we can restore it.  */
   if (!pragma_initialized)
@@ -59,11 +59,6 @@ handle_pragma (finput, node)
       initial_optimize_flag = optimize;
     }
 
-  if (TREE_CODE (node) != IDENTIFIER_NODE)
-    return 0;
-
-  pname = IDENTIFIER_POINTER (node);
-
   if (strcmp (pname, "CC_OPT_ON") == 0)
     {
       optimize = 1, obey_regdecls = 0;
index de8fbdc8bf0259f27d566c41d3f828dae8dc6fe2..854832d75ed0c51cfc5a191e4b749b650534942a 100644 (file)
@@ -27,42 +27,43 @@ Boston, MA 02111-1307, USA.  */
 #undef INCLUDE_DEFAULTS
 #define INCLUDE_DEFAULTS                               \
   {                                                    \
-    { GPLUSPLUS_INCLUDE_DIR, 1, 1 },                   \
-    { LOCAL_INCLUDE_DIR, 0, 1 },                       \
-    { TOOL_INCLUDE_DIR, 0, 1 },                                \
-    { GCC_INCLUDE_DIR, 0, 0 },                         \
+    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },            \
+    { LOCAL_INCLUDE_DIR, 0, 0, 1 },                    \
+    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 },            \
+    { GCC_INCLUDE_DIR, "GCC", 0, 0 },                  \
     /* These are for fixincludes-fixed ansi/bsd headers        \
        which wouldn't be found otherwise.              \
        (The use of string catenation here is OK since  \
        NeXT's native compiler is derived from GCC.) */ \
-    { GCC_INCLUDE_DIR "/ansi", 0, 0 },                 \
-    { GCC_INCLUDE_DIR "/bsd", 0, 0 },                  \
-    { "/NextDeveloper/Headers", 0, 0 },                        \
-    { "/NextDeveloper/Headers/ansi", 0, 0 },           \
-    { "/NextDeveloper/Headers/bsd", 0, 0 },            \
-    { "/LocalDeveloper/Headers", 0, 0 },               \
-    { "/LocalDeveloper/Headers/ansi", 0, 0 },          \
-    { "/LocalDeveloper/Headers/bsd", 0, 0 },           \
-    { "/NextDeveloper/2.0CompatibleHeaders", 0, 0 },   \
-    { STANDARD_INCLUDE_DIR, 0, 0 },                    \
-    { "/usr/include/bsd", 0, 0 },                      \
-    { 0, 0, 0 }                                                \
+    { GCC_INCLUDE_DIR "/ansi", 0, 0, 0 },              \
+    { GCC_INCLUDE_DIR "/bsd", 0, 0, 0 },               \
+    { "/NextDeveloper/Headers", 0, 0, 0 },             \
+    { "/NextDeveloper/Headers/ansi", 0, 0, 0 },                \
+    { "/NextDeveloper/Headers/bsd", 0, 0, 0 },         \
+    { "/LocalDeveloper/Headers", 0, 0, 0 },            \
+    { "/LocalDeveloper/Headers/ansi", 0, 0, 0 },       \
+    { "/LocalDeveloper/Headers/bsd", 0, 0, 0 },                \
+    { "/NextDeveloper/2.0CompatibleHeaders", 0, 0, 0 },        \
+    { STANDARD_INCLUDE_DIR, 0, 0, 0 },                  \
+    { "/usr/include/bsd", 0, 0, 0 },                   \
+    { 0, 0, 0, 0 }                                     \
   }
 #else /* CROSS_COMPILE */
 #undef INCLUDE_DEFAULTS
 #define INCLUDE_DEFAULTS                               \
   {                                                    \
-    { GPLUSPLUS_INCLUDE_DIR, 1, 1 },                   \
-    { LOCAL_INCLUDE_DIR, 0, 1 },                       \
-    { GCC_INCLUDE_DIR, 0, 0 },                         \
-    { GCC_INCLUDE_DIR "/ansi", 0, 0 },                 \
-    { GCC_INCLUDE_DIR "/bsd", 0, 0 },                  \
-    { TOOL_INCLUDE_DIR, 0, 1 },                                \
-    { TOOL_INCLUDE_DIR "/ansi", 0, 0 },                        \
-    { TOOL_INCLUDE_DIR "/bsd", 0, 0 },                 \
-    { STANDARD_INCLUDE_DIR, 0, 0 },                    \
-    { "/usr/include/bsd", 0, 0 },                      \
-    { 0, 0, 0 }                                                \
+    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },            \
+    { GPLUSPLUS_INCLUDE_DIR, 0, 1, 1 },                        \
+    { LOCAL_INCLUDE_DIR, 0, 0, 1 },                    \
+    { GCC_INCLUDE_DIR, "GCC", 0, 0 },                  \
+    { GCC_INCLUDE_DIR "/ansi", 0, 0, 0 },              \
+    { GCC_INCLUDE_DIR "/bsd", 0, 0, 0 },               \
+    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 },            \
+    { TOOL_INCLUDE_DIR "/ansi", 0, 0, 0 },             \
+    { TOOL_INCLUDE_DIR "/bsd", 0, 0, 0 },              \
+    { STANDARD_INCLUDE_DIR, 0, 0, 0 },                 \
+    { "/usr/include/bsd", 0, 0, 0 },                   \
+    { 0, 0, 0, 0 }                                     \
   }
 #endif /* CROSS_COMPILE */
 
@@ -251,7 +252,8 @@ Boston, MA 02111-1307, USA.  */
 /* How to parse #pragma's */
 
 #undef HANDLE_PRAGMA
-#define HANDLE_PRAGMA(FINPUT, NODE) handle_pragma (FINPUT, NODE)
+#define HANDLE_PRAGMA(GETC, UNGETC, NAME) handle_pragma (GETC, UNGETC, NAME)
+extern int handle_pragma ();
 
 /* Give methods pretty symbol names on NeXT. */
 
@@ -581,3 +583,9 @@ objc_section_init ()                                \
        const_section ();                                               \
     }                                                                  \
   while (0)
+
+#ifdef ASM_COMMENT_START
+# undef ASM_COMMENT_START
+#endif
+
+#define ASM_COMMENT_START ";#"