diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7af0d149733..28e514ffc67 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,17 @@ -Wed Sep 2 09:25:29 1998 Nick Clifton +Wed Sep 2 10:06:07 1998 Nick Clifton + + * 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 * c-lex.c (check_newline): Call HANDLE_PRAGMA before HANDLE_SYSV_PRAGMA if both are defined. Generate warning messages diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 3f66b0630b5..92af43165b1 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -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) diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index c65eb42e176..f159174980d 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -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) diff --git a/gcc/config/i960/i960.c b/gcc/config/i960/i960.c index 6189b4dee51..9fa8889c301 100644 --- a/gcc/config/i960/i960.c +++ b/gcc/config/i960/i960.c @@ -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; - - if (TREE_CODE (t) != IDENTIFIER_NODE) - return 0; - - pname = IDENTIFIER_POINTER (t); - - if (strcmp (pname, "align") == 0) - { - 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)[,...]] - - (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; - } + char buf[20]; + char *s = buf; + int align; /* Should be pragma 'far' or equivalent for callx/balx here. */ + if (strcmp (pname, "align") != 0) + return 0; + + do + { + c = p_getc (); + } + while (c == ' ' || c == '\t'); - return 0; + if (c == '(') + c = p_getc (); + + while (c >= '0' && c <= '9') + { + if (s < buf + sizeof buf - 1) + *s++ = c; + c = p_getc (); + } + + *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. */ + + p_ungetc (c); + + 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)[,...]] + + (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. */ diff --git a/gcc/config/i960/i960.h b/gcc/config/i960/i960.h index 4102c0ff279..b786d386e90 100644 --- a/gcc/config/i960/i960.h +++ b/gcc/config/i960/i960.h @@ -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. */ diff --git a/gcc/config/nextstep.c b/gcc/config/nextstep.c index e909a948cda..bdf13355392 100644 --- a/gcc/config/nextstep.c +++ b/gcc/config/nextstep.c @@ -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; diff --git a/gcc/config/nextstep.h b/gcc/config/nextstep.h index de8fbdc8bf0..854832d75ed 100644 --- a/gcc/config/nextstep.h +++ b/gcc/config/nextstep.h @@ -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 ";#"