Change HANDLE_PRAGMA macro so that it will work with USE_CPPLIB
From-SVN: r22166
This commit is contained in:
parent
f09db6e0ca
commit
ae4d12ca9f
|
@ -1,3 +1,16 @@
|
||||||
|
Wed Sep 02 09:25:29 1998 Nick Clifton <nickc@cygnus.com>
|
||||||
|
|
||||||
|
* lex.c (check_newline): Call HANDLE_PRAGMA before
|
||||||
|
HANDLE_SYSV_PRAGMA if both are defined. Generate warning messages
|
||||||
|
if unknown pragmas are encountered.
|
||||||
|
(handle_sysv_pragma): Interpret return code from
|
||||||
|
handle_pragma_token (). Return success/failure indication rather
|
||||||
|
than next unprocessed character.
|
||||||
|
(pragma_getc): New function: retrieves characters from the
|
||||||
|
input stream. Defined when HANDLE_PRAGMA is defined.
|
||||||
|
(pragma_ungetc): New function: replaces characters back into the
|
||||||
|
input stream. Defined when HANDLE_PRAGMA is defined.
|
||||||
|
|
||||||
1998-09-01 Jason Merrill <jason@yorick.cygnus.com>
|
1998-09-01 Jason Merrill <jason@yorick.cygnus.com>
|
||||||
|
|
||||||
* decl2.c (output_vtable_inherit): Use %cDIGIT in the operands.
|
* decl2.c (output_vtable_inherit): Use %cDIGIT in the operands.
|
||||||
|
|
89
gcc/cp/lex.c
89
gcc/cp/lex.c
|
@ -2216,6 +2216,32 @@ get_last_nonwhite_on_line ()
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined HANDLE_PRAGMA
|
||||||
|
/* Local versions of these macros, that can be passed as function pointers. */
|
||||||
|
static int
|
||||||
|
pragma_getc ()
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
|
||||||
|
if (nextchar != EOF)
|
||||||
|
{
|
||||||
|
c = nextchar;
|
||||||
|
nextchar = EOF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
c = getch ();
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pragma_ungetc (arg)
|
||||||
|
int arg;
|
||||||
|
{
|
||||||
|
yyungetc (arg, 0);
|
||||||
|
}
|
||||||
|
#endif /* HANDLE_PRAGMA */
|
||||||
|
|
||||||
/* At the beginning of a line, increment the line number
|
/* At the beginning of a line, increment the line number
|
||||||
and process any #-directive on this line.
|
and process any #-directive on this line.
|
||||||
If the line is a #-directive, read the entire line and return a newline.
|
If the line is a #-directive, read the entire line and return a newline.
|
||||||
|
@ -2282,21 +2308,29 @@ check_newline ()
|
||||||
else if (token == END_OF_LINE)
|
else if (token == END_OF_LINE)
|
||||||
goto skipline;
|
goto skipline;
|
||||||
|
|
||||||
|
#ifdef HANDLE_PRAGMA
|
||||||
|
/* We invoke HANDLE_PRAGMA before HANDLE_SYSV_PRAGMA
|
||||||
|
(if both are defined), in order to give the back
|
||||||
|
end a chance to override the interpretation of
|
||||||
|
SYSV style pragmas. */
|
||||||
|
if (HANDLE_PRAGMA (pragma_getc, pragma_ungetc,
|
||||||
|
IDENTIFIER_POINTER (yylval.ttype)))
|
||||||
|
goto skipline;
|
||||||
|
#endif /* HANDLE_PRAGMA */
|
||||||
|
|
||||||
#ifdef HANDLE_SYSV_PRAGMA
|
#ifdef HANDLE_SYSV_PRAGMA
|
||||||
if (handle_sysv_pragma (token))
|
if (handle_sysv_pragma (token))
|
||||||
goto skipline;
|
goto skipline;
|
||||||
#else
|
#endif /* !HANDLE_SYSV_PRAGMA */
|
||||||
#ifdef HANDLE_PRAGMA
|
|
||||||
#if USE_CPPLIB
|
/* Issue a warning message if we have been asked to do so.
|
||||||
/* TODO: ??? */
|
Ignoring unknown pragmas in system header file unless
|
||||||
goto skipline;
|
an explcit -Wunknown-pragmas has been given. */
|
||||||
#else
|
if (warn_unknown_pragmas > 1
|
||||||
if (HANDLE_PRAGMA (finput, yylval.ttype))
|
|| (warn_unknown_pragmas && ! in_system_header))
|
||||||
goto skipline;
|
warning ("ignoring pragma: %s", token_buffer);
|
||||||
#endif /* !USE_CPPLIB */
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
goto skipline;
|
goto skipline;
|
||||||
}
|
}
|
||||||
else if (c == 'd')
|
else if (c == 'd')
|
||||||
|
@ -4730,7 +4764,33 @@ handle_cp_pragma (pname)
|
||||||
{
|
{
|
||||||
register int token;
|
register int token;
|
||||||
|
|
||||||
if (! strcmp (pname, "unit"))
|
if (! strcmp (pname, "vtable"))
|
||||||
|
{
|
||||||
|
extern tree pending_vtables;
|
||||||
|
|
||||||
|
/* More follows: it must be a string constant (class name). */
|
||||||
|
token = real_yylex ();
|
||||||
|
if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
|
||||||
|
{
|
||||||
|
error ("invalid #pragma vtable");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (write_virtuals != 2)
|
||||||
|
{
|
||||||
|
warning ("use `+e2' option to enable #pragma vtable");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
pending_vtables
|
||||||
|
= perm_tree_cons (NULL_TREE,
|
||||||
|
get_identifier (TREE_STRING_POINTER (yylval.ttype)),
|
||||||
|
pending_vtables);
|
||||||
|
token = real_yylex ();
|
||||||
|
if (token != END_OF_LINE)
|
||||||
|
warning ("trailing characters ignored");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if (! strcmp (pname, "unit"))
|
||||||
{
|
{
|
||||||
/* More follows: it must be a string constant (unit name). */
|
/* More follows: it must be a string constant (unit name). */
|
||||||
token = real_yylex ();
|
token = real_yylex ();
|
||||||
|
@ -4895,7 +4955,7 @@ handle_sysv_pragma (token)
|
||||||
case TYPENAME:
|
case TYPENAME:
|
||||||
case STRING:
|
case STRING:
|
||||||
case CONSTANT:
|
case CONSTANT:
|
||||||
handle_pragma_token ("ignored", yylval.ttype);
|
handle_pragma_token (IDENTIFIER_POINTER(yylval.ttype), yylval.ttype);
|
||||||
break;
|
break;
|
||||||
case '(':
|
case '(':
|
||||||
handle_pragma_token ("(", NULL_TREE);
|
handle_pragma_token ("(", NULL_TREE);
|
||||||
|
@ -4915,8 +4975,7 @@ handle_sysv_pragma (token)
|
||||||
break;
|
break;
|
||||||
case END_OF_LINE:
|
case END_OF_LINE:
|
||||||
default:
|
default:
|
||||||
handle_pragma_token (NULL_PTR, NULL_TREE);
|
return handle_pragma_token (NULL_PTR, NULL_TREE);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
token = real_yylex ();
|
token = real_yylex ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
Wed Sep 02 09:25:29 1998 Nick Clifton <nickc@cygnus.com>
|
||||||
|
|
||||||
|
* lex.c (ffe_lex_hash): Change how HANDLE_PRAGMA and
|
||||||
|
HANDLE_SYSV_PRAGMA would be called if they pragma parsing was
|
||||||
|
enabled in this code.
|
||||||
|
Generate warning messages if unknown pragmas are encountered.
|
||||||
|
(pragma_getc): New function: retrieves characters from the
|
||||||
|
input stream. Defined when HANDLE_PRAGMA is defined.
|
||||||
|
(pragma_ungetc): New function: replaces characters back into the
|
||||||
|
input stream. Defined when HANDLE_PRAGMA is defined.
|
||||||
|
|
||||||
Tue Sep 1 10:00:21 1998 Craig Burley <burley@gnu.org>
|
Tue Sep 1 10:00:21 1998 Craig Burley <burley@gnu.org>
|
||||||
|
|
||||||
* bugs.texi, g77.1, g77.texi, intdoc.in, news.texi: Doc updates
|
* bugs.texi, g77.1, g77.texi, intdoc.in, news.texi: Doc updates
|
||||||
|
|
56
gcc/f/lex.c
56
gcc/f/lex.c
|
@ -1,5 +1,5 @@
|
||||||
/* Implementation of Fortran lexer
|
/* Implementation of Fortran lexer
|
||||||
Copyright (C) 1995-1997 Free Software Foundation, Inc.
|
Copyright (C) 1995-1998 Free Software Foundation, Inc.
|
||||||
Contributed by James Craig Burley (burley@gnu.org).
|
Contributed by James Craig Burley (burley@gnu.org).
|
||||||
|
|
||||||
This file is part of GNU Fortran.
|
This file is part of GNU Fortran.
|
||||||
|
@ -1077,6 +1077,23 @@ ffelex_get_directive_line_ (char **text, FILE *finput)
|
||||||
Returns the next character unhandled, which is always newline or EOF. */
|
Returns the next character unhandled, which is always newline or EOF. */
|
||||||
|
|
||||||
#if FFECOM_targetCURRENT == FFECOM_targetGCC
|
#if FFECOM_targetCURRENT == FFECOM_targetGCC
|
||||||
|
|
||||||
|
#if defined HANDLE_PRAGMA
|
||||||
|
/* Local versions of these macros, that can be passed as function pointers. */
|
||||||
|
static int
|
||||||
|
pragma_getc ()
|
||||||
|
{
|
||||||
|
return getc (finput);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pragma_ungetc (arg)
|
||||||
|
int arg;
|
||||||
|
{
|
||||||
|
ungetc (arg, finput);
|
||||||
|
}
|
||||||
|
#endif /* HANDLE_PRAGMA */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ffelex_hash_ (FILE *finput)
|
ffelex_hash_ (FILE *finput)
|
||||||
{
|
{
|
||||||
|
@ -1105,17 +1122,42 @@ ffelex_hash_ (FILE *finput)
|
||||||
&& ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'
|
&& ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'
|
||||||
|| c == EOF))
|
|| c == EOF))
|
||||||
{
|
{
|
||||||
goto skipline;
|
|
||||||
#if 0 /* g77 doesn't handle pragmas, so ignores them FOR NOW. */
|
#if 0 /* g77 doesn't handle pragmas, so ignores them FOR NOW. */
|
||||||
#ifdef HANDLE_SYSV_PRAGMA
|
static char buffer [128];
|
||||||
return handle_sysv_pragma (finput, c);
|
char * buff = buffer;
|
||||||
#else /* !HANDLE_SYSV_PRAGMA */
|
|
||||||
|
/* Read the pragma name into a buffer. */
|
||||||
|
while (isspace (c = getc (finput)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
* buff ++ = c;
|
||||||
|
c = getc (finput);
|
||||||
|
}
|
||||||
|
while (c != EOF && ! isspace (c) && c != '\n'
|
||||||
|
&& buff < buffer + 128);
|
||||||
|
|
||||||
|
pragma_ungetc (c);
|
||||||
|
|
||||||
|
* -- buff = 0;
|
||||||
#ifdef HANDLE_PRAGMA
|
#ifdef HANDLE_PRAGMA
|
||||||
HANDLE_PRAGMA (finput);
|
if (HANDLE_PRAGMA (pragma_getc, pragma_ungetc, buffer))
|
||||||
|
goto skipline;
|
||||||
#endif /* HANDLE_PRAGMA */
|
#endif /* HANDLE_PRAGMA */
|
||||||
goto skipline;
|
#ifdef HANDLE_SYSV_PRAGMA
|
||||||
|
if (handle_sysv_pragma (buffer))
|
||||||
|
goto skipline;
|
||||||
#endif /* !HANDLE_SYSV_PRAGMA */
|
#endif /* !HANDLE_SYSV_PRAGMA */
|
||||||
|
|
||||||
|
/* Issue a warning message if we have been asked to do so.
|
||||||
|
Ignoring unknown pragmas in system header file unless
|
||||||
|
an explcit -Wunknown-pragmas has been given. */
|
||||||
|
if (warn_unknown_pragmas > 1
|
||||||
|
|| (warn_unknown_pragmas && ! in_system_header))
|
||||||
|
warning ("ignoring pragma: %s", token_buffer);
|
||||||
#endif /* 0 */
|
#endif /* 0 */
|
||||||
|
goto skipline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue