Commit 119d0c36 by Jim Wilson

(process_pragma): Take the IDENTIFIER_POINTER tree

node instead of a character.

From-SVN: r11840
parent 86d086ba
...@@ -90,28 +90,29 @@ static int ret_label = 0; ...@@ -90,28 +90,29 @@ static int ret_label = 0;
intel compilers understand. */ intel compilers understand. */
int int
process_pragma (finput, c) process_pragma (finput, t)
FILE *finput; FILE *finput;
int c; tree t;
{ {
int i; int i;
register int c;
register char *pname;
while (c == ' ' || c == '\t') if (TREE_CODE (t) != IDENTIFIER_NODE)
c = getc (finput); return 0;
pname = IDENTIFIER_POINTER (t);
if (c == 'a' if (strcmp (pname, "align") == 0)
&& getc (finput) == 'l'
&& getc (finput) == 'i'
&& getc (finput) == 'g'
&& getc (finput) == 'n'
&& ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
{ {
char buf[20]; char buf[20];
char *s = buf; char *s = buf;
int align; int align;
while (c == ' ' || c == '\t') do {
c = getc (finput); c = getc (finput);
} while (c == ' ' || c == '\t');
if (c == '(') if (c == '(')
c = getc (finput); c = getc (finput);
while (c >= '0' && c <= '9') while (c >= '0' && c <= '9')
...@@ -157,13 +158,13 @@ process_pragma (finput, c) ...@@ -157,13 +158,13 @@ process_pragma (finput, c)
- missing identifier means next struct - missing identifier means next struct
- alignment rules for bitfields need more investigation */ - alignment rules for bitfields need more investigation */
return 1;
} }
/* Should be pragma 'far' or equivalent for callx/balx here. */ /* Should be pragma 'far' or equivalent for callx/balx here. */
while (c != '\n' && c != EOF) return 0;
c = getc (finput);
return c;
} }
/* Initialize variables before compiling any files. */ /* Initialize variables before compiling any files. */
......
...@@ -18,6 +18,8 @@ along with GNU CC; see the file COPYING. If not, write to ...@@ -18,6 +18,8 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <tree.h>
/* Make everything that used to go in the text section really go there. */ /* Make everything that used to go in the text section really go there. */
int flag_no_mach_text_sections = 0; int flag_no_mach_text_sections = 0;
...@@ -37,15 +39,15 @@ extern char *get_directive_line (); ...@@ -37,15 +39,15 @@ extern char *get_directive_line ();
/* Called from check_newline via the macro HANDLE_PRAGMA. /* Called from check_newline via the macro HANDLE_PRAGMA.
FINPUT is the source file input stream. FINPUT is the source file input stream.
CH is the first character after `#pragma'. CH is the first character after `#pragma'.
The result is the terminating character ('\n' or EOF). */ The result is 1 if the pragma was handled. */
int int
handle_pragma (finput, ch, get_line_function) handle_pragma (finput, node)
FILE *finput; FILE *finput;
int ch; tree node;
char *(*get_line_function) ();
{ {
register char *p; 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)
...@@ -54,22 +56,24 @@ handle_pragma (finput, ch, get_line_function) ...@@ -54,22 +56,24 @@ handle_pragma (finput, ch, get_line_function)
initial_optimize_flag = optimize; initial_optimize_flag = optimize;
} }
/* Nothing to do if #pragma is by itself. */ if (TREE_CODE (node) != IDENTIFIER_NODE)
if (ch == '\n' || ch == EOF) return 0;
return ch;
pname = IDENTIFIER_POINTER (node);
p = (*get_line_function) (finput); if (strcmp (pname, "CC_OPT_ON") == 0)
if (OPT_STRCMP ("CC_OPT_ON"))
{ {
optimize = 1, obey_regdecls = 0; optimize = 1, obey_regdecls = 0;
warning ("optimization turned on"); warning ("optimization turned on");
retval = 1;
} }
else if (OPT_STRCMP ("CC_OPT_OFF")) else if (strcmp (pname, "CC_OPT_OFF") == 0)
{ {
optimize = 0, obey_regdecls = 1; optimize = 0, obey_regdecls = 1;
warning ("optimization turned off"); warning ("optimization turned off");
retval = 1;
} }
else if (OPT_STRCMP ("CC_OPT_RESTORE")) else if (strcmp (pname, "CC_OPT_RESTORE") == 0)
{ {
extern int initial_optimize_flag; extern int initial_optimize_flag;
...@@ -82,14 +86,14 @@ handle_pragma (finput, ch, get_line_function) ...@@ -82,14 +86,14 @@ handle_pragma (finput, ch, get_line_function)
optimize = initial_optimize_flag; optimize = initial_optimize_flag;
} }
warning ("optimization level restored"); warning ("optimization level restored");
retval = 1;
} }
else if (OPT_STRCMP ("CC_WRITABLE_STRINGS")) else if (strcmp (pname, "CC_WRITABLE_STRINGS") == 0)
flag_writable_strings = 1; flag_writable_strings = retval = 1;
else if (OPT_STRCMP ("CC_NON_WRITABLE_STRINGS")) else if (strcmp (pname, "CC_NON_WRITABLE_STRINGS") == 0)
flag_writable_strings = 0; flag_writable_strings = 0, retval = 1;
else if (OPT_STRCMP ("CC_NO_MACH_TEXT_SECTIONS")) else if (strcmp (pname, "CC_NO_MACH_TEXT_SECTIONS") == 0)
flag_no_mach_text_sections = 1; flag_no_mach_text_sections = retval = 1;
/* get_line_function must leave the last character read in FINPUT. */ return retval;
return getc (finput);
} }
...@@ -2132,38 +2132,25 @@ initial_elimination_offset (from, to) ...@@ -2132,38 +2132,25 @@ initial_elimination_offset (from, to)
compiler. */ compiler. */
int int
handle_pragma (file, c) handle_pragma (file, t)
FILE *file; FILE *file;
int c; tree t;
{ {
char pbuf[200]; int retval = 0;
int psize = 0; register char *pname;
while (c == ' ' || c == '\t') if (TREE_CODE (t) != IDENTIFIER_NODE)
c = getc (file); return 0;
if (c != '\n' & c != EOF)
{
while (psize < sizeof (pbuf) - 1
&& (isalpha (c) || c == '_'))
{
pbuf[psize++] = c;
c = getc (file);
}
pbuf[psize] = 0;
if (strcmp (pbuf, "interrupt") == 0)
pragma_interrupt = 1;
else if (strcmp (pbuf, "trapa") == 0)
pragma_interrupt = pragma_trapa = 1;
else if (strcmp (pbuf, "nosave_low_regs") == 0)
pragma_nosave_low_regs = 1;
while (c != '\n' && c != EOF) pname = IDENTIFIER_POINTER (t);
c = getc (file); if (strcmp (pname, "interrupt") == 0)
} pragma_interrupt = retval = 1;
else if (strcmp (pname, "trapa") == 0)
pragma_interrupt = pragma_trapa = retval = 1;
else if (strcmp (pname, "nosave_low_regs") == 0)
pragma_nosave_low_regs = retval = 1;
return c; return retval;
} }
/* Predicates used by the templates. */ /* Predicates used by the templates. */
......
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