Commit 67988bd2 by Nick Clifton Committed by Nick Clifton

Update definitions of HANDLE_PRAGMA macro in order to conform to new spec.

From-SVN: r22168
parent c5168e64
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 * c-lex.c (check_newline): Call HANDLE_PRAGMA before
HANDLE_SYSV_PRAGMA if both are defined. Generate warning messages HANDLE_SYSV_PRAGMA if both are defined. Generate warning messages
......
...@@ -856,17 +856,13 @@ eq_operator (x, mode) ...@@ -856,17 +856,13 @@ eq_operator (x, mode)
with this attribute may be safely used in an interrupt vector. */ with this attribute may be safely used in an interrupt vector. */
int int
handle_pragma (file, t) handle_pragma (p_getc, p_ungetc, name)
FILE *file; int (* p_getc) PROTO ((void));
tree t; void (* p_ungetc) PROTO ((int));
char * pname;
{ {
int retval = 0; int retval = 0;
register char *pname;
if (TREE_CODE (t) != IDENTIFIER_NODE)
return 0;
pname = IDENTIFIER_POINTER (t);
if (strcmp (pname, "interrupt") == 0) if (strcmp (pname, "interrupt") == 0)
interrupt_handler = retval = 1; interrupt_handler = retval = 1;
else if (strcmp (pname, "saveall") == 0) else if (strcmp (pname, "saveall") == 0)
......
...@@ -1358,11 +1358,17 @@ do { char dstr[30]; \ ...@@ -1358,11 +1358,17 @@ do { char dstr[30]; \
/* Define this macro if you want to implement any pragmas. If defined, it /* 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 should be a C expression to be executed when #pragma is seen. The
argument STREAM is the stdio input stream from which the source argument GETC is a function which will return the next character in the
text can be read. CH is the first character after the #pragma. The input stream, or EOF if no characters are left. The argument UNGETC is
result of the expression is the terminating character found a function which will push a character back into the input stream. The
(newline or EOF). */ argument NAME is the word following #pragma in the input stream. The input
#define HANDLE_PRAGMA(FILE, NODE) handle_pragma (FILE, NODE) 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) #define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
......
...@@ -89,86 +89,83 @@ static int ret_label = 0; ...@@ -89,86 +89,83 @@ static int ret_label = 0;
intel compilers understand. */ intel compilers understand. */
int int
process_pragma (finput, t) process_pragma (p_getc, p_ungetc, pname)
FILE *finput; int (* p_getc) PROTO ((void));
tree t; void (* p_ungetc) PROTO ((int));
char * pname;
{ {
int i; int i;
register int c; 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; return 0;
pname = IDENTIFIER_POINTER (t); do
if (strcmp (pname, "align") == 0)
{ {
char buf[20]; c = p_getc ();
char *s = buf; }
int align; while (c == ' ' || c == '\t');
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) 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] /* We had to read a non-numerical character to get out of the
- noalign means size==1 while loop---often a newline. So, we have to put it back to
- applies only to component elements of a struct (and union?) make sure we continue to parse everything properly. */
- identifier applies to structure tag (only)
- missing identifier means next struct 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. */ /* NOTE: ic960 R3.0 pragma align definition:
return 0; #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. */ /* Initialize variables before compiling any files. */
......
...@@ -122,7 +122,8 @@ Boston, MA 02111-1307, USA. */ ...@@ -122,7 +122,8 @@ Boston, MA 02111-1307, USA. */
fprintf (asm_out_file, "\t.type\t0x%x;", A) fprintf (asm_out_file, "\t.type\t0x%x;", A)
/* Handle pragmas for compatibility with Intel's compilers. */ /* 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. */ /* Run-time compilation parameters selecting different hardware subsets. */
......
...@@ -45,12 +45,12 @@ extern char *get_directive_line (); ...@@ -45,12 +45,12 @@ extern char *get_directive_line ();
The result is 1 if the pragma was handled. */ The result is 1 if the pragma was handled. */
int int
handle_pragma (finput, node) handle_pragma (p_getc, p_ungetc, name)
FILE *finput; int (* p_getc) PROTO ((void));
tree node; void (* p_ungetc) PROTO ((int));
char * pname;
{ {
int retval = 0; int retval = 0;
register char *pname;
/* Record initial setting of optimize flag, so we can restore it. */ /* Record initial setting of optimize flag, so we can restore it. */
if (!pragma_initialized) if (!pragma_initialized)
...@@ -59,11 +59,6 @@ handle_pragma (finput, node) ...@@ -59,11 +59,6 @@ handle_pragma (finput, node)
initial_optimize_flag = optimize; initial_optimize_flag = optimize;
} }
if (TREE_CODE (node) != IDENTIFIER_NODE)
return 0;
pname = IDENTIFIER_POINTER (node);
if (strcmp (pname, "CC_OPT_ON") == 0) if (strcmp (pname, "CC_OPT_ON") == 0)
{ {
optimize = 1, obey_regdecls = 0; optimize = 1, obey_regdecls = 0;
......
...@@ -27,42 +27,43 @@ Boston, MA 02111-1307, USA. */ ...@@ -27,42 +27,43 @@ Boston, MA 02111-1307, USA. */
#undef INCLUDE_DEFAULTS #undef INCLUDE_DEFAULTS
#define INCLUDE_DEFAULTS \ #define INCLUDE_DEFAULTS \
{ \ { \
{ GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
{ LOCAL_INCLUDE_DIR, 0, 1 }, \ { LOCAL_INCLUDE_DIR, 0, 0, 1 }, \
{ TOOL_INCLUDE_DIR, 0, 1 }, \ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 }, \
{ GCC_INCLUDE_DIR, 0, 0 }, \ { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \
/* These are for fixincludes-fixed ansi/bsd headers \ /* These are for fixincludes-fixed ansi/bsd headers \
which wouldn't be found otherwise. \ which wouldn't be found otherwise. \
(The use of string catenation here is OK since \ (The use of string catenation here is OK since \
NeXT's native compiler is derived from GCC.) */ \ NeXT's native compiler is derived from GCC.) */ \
{ GCC_INCLUDE_DIR "/ansi", 0, 0 }, \ { GCC_INCLUDE_DIR "/ansi", 0, 0, 0 }, \
{ GCC_INCLUDE_DIR "/bsd", 0, 0 }, \ { GCC_INCLUDE_DIR "/bsd", 0, 0, 0 }, \
{ "/NextDeveloper/Headers", 0, 0 }, \ { "/NextDeveloper/Headers", 0, 0, 0 }, \
{ "/NextDeveloper/Headers/ansi", 0, 0 }, \ { "/NextDeveloper/Headers/ansi", 0, 0, 0 }, \
{ "/NextDeveloper/Headers/bsd", 0, 0 }, \ { "/NextDeveloper/Headers/bsd", 0, 0, 0 }, \
{ "/LocalDeveloper/Headers", 0, 0 }, \ { "/LocalDeveloper/Headers", 0, 0, 0 }, \
{ "/LocalDeveloper/Headers/ansi", 0, 0 }, \ { "/LocalDeveloper/Headers/ansi", 0, 0, 0 }, \
{ "/LocalDeveloper/Headers/bsd", 0, 0 }, \ { "/LocalDeveloper/Headers/bsd", 0, 0, 0 }, \
{ "/NextDeveloper/2.0CompatibleHeaders", 0, 0 }, \ { "/NextDeveloper/2.0CompatibleHeaders", 0, 0, 0 }, \
{ STANDARD_INCLUDE_DIR, 0, 0 }, \ { STANDARD_INCLUDE_DIR, 0, 0, 0 }, \
{ "/usr/include/bsd", 0, 0 }, \ { "/usr/include/bsd", 0, 0, 0 }, \
{ 0, 0, 0 } \ { 0, 0, 0, 0 } \
} }
#else /* CROSS_COMPILE */ #else /* CROSS_COMPILE */
#undef INCLUDE_DEFAULTS #undef INCLUDE_DEFAULTS
#define INCLUDE_DEFAULTS \ #define INCLUDE_DEFAULTS \
{ \ { \
{ GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
{ LOCAL_INCLUDE_DIR, 0, 1 }, \ { GPLUSPLUS_INCLUDE_DIR, 0, 1, 1 }, \
{ GCC_INCLUDE_DIR, 0, 0 }, \ { LOCAL_INCLUDE_DIR, 0, 0, 1 }, \
{ GCC_INCLUDE_DIR "/ansi", 0, 0 }, \ { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \
{ GCC_INCLUDE_DIR "/bsd", 0, 0 }, \ { GCC_INCLUDE_DIR "/ansi", 0, 0, 0 }, \
{ TOOL_INCLUDE_DIR, 0, 1 }, \ { GCC_INCLUDE_DIR "/bsd", 0, 0, 0 }, \
{ TOOL_INCLUDE_DIR "/ansi", 0, 0 }, \ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 }, \
{ TOOL_INCLUDE_DIR "/bsd", 0, 0 }, \ { TOOL_INCLUDE_DIR "/ansi", 0, 0, 0 }, \
{ STANDARD_INCLUDE_DIR, 0, 0 }, \ { TOOL_INCLUDE_DIR "/bsd", 0, 0, 0 }, \
{ "/usr/include/bsd", 0, 0 }, \ { STANDARD_INCLUDE_DIR, 0, 0, 0 }, \
{ 0, 0, 0 } \ { "/usr/include/bsd", 0, 0, 0 }, \
{ 0, 0, 0, 0 } \
} }
#endif /* CROSS_COMPILE */ #endif /* CROSS_COMPILE */
...@@ -251,7 +252,8 @@ Boston, MA 02111-1307, USA. */ ...@@ -251,7 +252,8 @@ Boston, MA 02111-1307, USA. */
/* How to parse #pragma's */ /* How to parse #pragma's */
#undef HANDLE_PRAGMA #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. */ /* Give methods pretty symbol names on NeXT. */
...@@ -581,3 +583,9 @@ objc_section_init () \ ...@@ -581,3 +583,9 @@ objc_section_init () \
const_section (); \ const_section (); \
} \ } \
while (0) while (0)
#ifdef ASM_COMMENT_START
# undef ASM_COMMENT_START
#endif
#define ASM_COMMENT_START ";#"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment