Commit a3100298 by Tom Wood

Undo rcs botch

From-SVN: r1370
parent 207f8358
...@@ -482,13 +482,7 @@ check_newline () ...@@ -482,13 +482,7 @@ check_newline ()
&& ((c = getc (finput)) == ' ' || c == '\t' || c == '\n')) && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
{ {
#ifdef HANDLE_SYSV_PRAGMA #ifdef HANDLE_SYSV_PRAGMA
c = handle_sysv_pragma (finput, c); return handle_sysv_pragma (finput, c);
if (c >= 0)
;
else if (nextchar >= 0)
c = nextchar, nextchar = -1;
else
c = getc (finput);
#endif /* HANDLE_SYSV_PRAGMA */ #endif /* HANDLE_SYSV_PRAGMA */
#ifdef HANDLE_PRAGMA #ifdef HANDLE_PRAGMA
HANDLE_PRAGMA (finput); HANDLE_PRAGMA (finput);
...@@ -741,9 +735,8 @@ linenum: ...@@ -741,9 +735,8 @@ linenum:
#ifdef HANDLE_SYSV_PRAGMA #ifdef HANDLE_SYSV_PRAGMA
/* Handle a #pragma directive. INPUT is the current input stream, /* Handle a #pragma directive. INPUT is the current input stream,
and C is a character to reread. and C is a character to reread. Processes the entire input line
Returns a character for the caller to reread, and returns a character for the caller to reread: either \n or EOF. */
or -1 meaning there isn't one. */
/* This function has to be in this file, in order to get at /* This function has to be in this file, in order to get at
the token types. */ the token types. */
...@@ -753,26 +746,32 @@ handle_sysv_pragma (input, c) ...@@ -753,26 +746,32 @@ handle_sysv_pragma (input, c)
FILE *input; FILE *input;
int c; int c;
{ {
while (c == ' ' || c == '\t') for (;;)
c = getc (input);
if (c == '\n' || c == EOF)
{
handle_pragma_token (0, 0);
return c;
}
ungetc (c, input);
switch (yylex ())
{ {
case IDENTIFIER: while (c == ' ' || c == '\t')
case TYPENAME: c = getc (input);
case STRING: if (c == '\n' || c == EOF)
case CONSTANT: {
handle_pragma_token (token_buffer, yylval.ttype); handle_pragma_token (0, 0);
break; return c;
default: }
handle_pragma_token (token_buffer, 0); ungetc (c, input);
switch (yylex ())
{
case IDENTIFIER:
case TYPENAME:
case STRING:
case CONSTANT:
handle_pragma_token (token_buffer, yylval.ttype);
break;
default:
handle_pragma_token (token_buffer, 0);
}
if (nextchar >= 0)
c = nextchar, nextchar = -1;
else
c = getc (input);
} }
return -1;
} }
#endif /* HANDLE_SYSV_PRAGMA */ #endif /* HANDLE_SYSV_PRAGMA */
......
...@@ -23,12 +23,20 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -23,12 +23,20 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef HANDLE_SYSV_PRAGMA #ifdef HANDLE_SYSV_PRAGMA
/* Support #pragma weak by default if WEAK_ASM_OP is defined. */
#if !defined (HANDLE_PRAGMA_WEAK) && defined (WEAK_ASM_OP)
#define HANDLE_PRAGMA_WEAK 1
#endif
/* When structure field packing is in effect, this variable is the /* When structure field packing is in effect, this variable is the
number of bits to use as the maximum alignment. When packing is not number of bits to use as the maximum alignment. When packing is not
in effect, this is zero. */ in effect, this is zero. */
extern int maximum_field_alignment; extern int maximum_field_alignment;
/* File used for outputting assembler code. */
extern FILE *asm_out_file;
/* Handle one token of a pragma directive. TOKEN is the /* Handle one token of a pragma directive. TOKEN is the
current token, and STRING is its printable form. */ current token, and STRING is its printable form. */
...@@ -64,27 +72,30 @@ handle_pragma_token (string, token) ...@@ -64,27 +72,30 @@ handle_pragma_token (string, token)
else else
warning ("malformed `#pragma pack'"); warning ("malformed `#pragma pack'");
} }
#ifdef WEAK_ASM_OP
else if (type == ps_weak) else if (type == ps_weak)
{ {
if (state == ps_name || state == ps_value) #ifdef HANDLE_PRAGMA_WEAK
if (HANDLE_PRAGMA_WEAK)
{ {
fprintf (asm_out_file, "\t%s\t", WEAK_ASM_OP); if (state == ps_name || state == ps_value)
ASM_OUTPUT_LABELREF (asm_out_file, name);
fputc ('\n', asm_out_file);
if (state == ps_value)
{ {
fprintf (asm_out_file, "\t%s\t", SET_ASM_OP); fprintf (asm_out_file, "\t%s\t", WEAK_ASM_OP);
ASM_OUTPUT_LABELREF (asm_out_file, name); ASM_OUTPUT_LABELREF (asm_out_file, name);
fputc (',', asm_out_file);
ASM_OUTPUT_LABELREF (asm_out_file, value);
fputc ('\n', asm_out_file); fputc ('\n', asm_out_file);
if (state == ps_value)
{
fprintf (asm_out_file, "\t%s\t", SET_ASM_OP);
ASM_OUTPUT_LABELREF (asm_out_file, name);
fputc (',', asm_out_file);
ASM_OUTPUT_LABELREF (asm_out_file, value);
fputc ('\n', asm_out_file);
}
} }
else if (! (state == ps_done || state == ps_start))
warning ("malformed `#pragma weak'");
} }
else if (! (state == ps_done || state == ps_start)) #endif /* HANDLE_PRAMA_WEAK */
warning ("malformed `#pragma weak'");
} }
#endif /* WEAK_ASM_OP */
type = state = ps_start; type = state = ps_start;
return; return;
...@@ -97,10 +108,8 @@ handle_pragma_token (string, token) ...@@ -97,10 +108,8 @@ handle_pragma_token (string, token)
{ {
if (strcmp (IDENTIFIER_POINTER (token), "pack") == 0) if (strcmp (IDENTIFIER_POINTER (token), "pack") == 0)
type = state = ps_pack; type = state = ps_pack;
#ifdef WEAK_ASM_OP
else if (strcmp (IDENTIFIER_POINTER (token), "weak") == 0) else if (strcmp (IDENTIFIER_POINTER (token), "weak") == 0)
type = state = ps_weak; type = state = ps_weak;
#endif
else else
type = state = ps_done; type = state = ps_done;
} }
...@@ -108,7 +117,6 @@ handle_pragma_token (string, token) ...@@ -108,7 +117,6 @@ handle_pragma_token (string, token)
type = state = ps_done; type = state = ps_done;
break; break;
#ifdef WEAK_ASM_OP
case ps_weak: case ps_weak:
if (token && TREE_CODE (token) == IDENTIFIER_NODE) if (token && TREE_CODE (token) == IDENTIFIER_NODE)
{ {
...@@ -136,7 +144,6 @@ handle_pragma_token (string, token) ...@@ -136,7 +144,6 @@ handle_pragma_token (string, token)
case ps_value: case ps_value:
state = ps_bad; state = ps_bad;
break; break;
#endif /* WEAK_ASM_OP */
case ps_pack: case ps_pack:
if (strcmp (string, "(") == 0) if (strcmp (string, "(") == 0)
......
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