cpplib.h (struct cpp_reader): Remove lang_asm.

* cpplib.h (struct cpp_reader): Remove lang_asm.
        (struct cpp_options): Remove c89. New members lang,
        extended_numbers.
        * cppexp.c (parse_number): Use them.
        * cpphash.h (VALID_SIGN): Use them.
        * cppinit.c (set_lang, cpp_start_read): Update.
        * cpplex.c (parse_string, _cpp_lex_token): Update.
        * cpplib.c (_cpp_handle_directive): Update.
        * cppmacro.c (parse_args): Update.
        * cppmain.c (scan_buffer): Update.

From-SVN: r37761
This commit is contained in:
Neil Booth 2000-11-26 17:31:13 +00:00 committed by Neil Booth
parent e108596275
commit bdb05a7b49
9 changed files with 37 additions and 36 deletions

View File

@ -1,3 +1,16 @@
2000-11-26 Neil Booth <neilb@earthling.net>
* cpplib.h (struct cpp_reader): Remove lang_asm.
(struct cpp_options): Remove c89. New members lang,
extended_numbers.
* cppexp.c (parse_number): Use them.
* cpphash.h (VALID_SIGN): Use them.
* cppinit.c (set_lang, cpp_start_read): Update.
* cpplex.c (parse_string, _cpp_lex_token): Update.
* cpplib.c (_cpp_handle_directive): Update.
* cppmacro.c (parse_args): Update.
* cppmain.c (scan_buffer): Update.
Sun Nov 26 10:02:37 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* fold-const.c (fold, case CONVERT_EXPR): Always return tree of

View File

@ -205,9 +205,7 @@ parse_number (pfile, tok)
if (CPP_WTRADITIONAL (pfile) && sufftab[i].u)
cpp_warning (pfile, "traditional C rejects the `U' suffix");
if (CPP_OPTION (pfile, c89)
&& sufftab[i].l == 2
&& pfile->spec_nodes.n__STRICT_ANSI__->type == NT_MACRO)
if (sufftab[i].l == 2 && !CPP_OPTION (pfile, extended_numbers))
SYNTAX_ERROR ("too many 'l' suffixes in integer constant");
}

View File

@ -26,7 +26,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define VALID_SIGN(c, prevc) \
(((c) == '+' || (c) == '-') && \
((prevc) == 'e' || (prevc) == 'E' \
|| (((prevc) == 'p' || (prevc) == 'P') && !CPP_OPTION (pfile, c89))))
|| (((prevc) == 'p' || (prevc) == 'P') \
&& CPP_OPTION (pfile, extended_numbers))))
/* Memory pools. */
#define ALIGN(size, align) (((size) + ((align) - 1)) & ~((align) - 1))

View File

@ -431,10 +431,11 @@ set_lang (pfile, lang)
{
struct cpp_pending *pend = CPP_OPTION (pfile, pending);
/* Default to zero. */
CPP_OPTION (pfile, lang_asm) = 0;
/* Defaults. */
CPP_OPTION (pfile, lang) = lang;
CPP_OPTION (pfile, objc) = 0;
CPP_OPTION (pfile, cplusplus) = 0;
CPP_OPTION (pfile, extended_numbers) = 1; /* Allowed in GNU C and C99. */
switch (lang)
{
@ -444,7 +445,6 @@ set_lang (pfile, lang)
CPP_OPTION (pfile, dollars_in_ident) = 1;
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, c89) = 0;
CPP_OPTION (pfile, c99) = 1;
new_pending_directive (pend, "__STDC_VERSION__=199901L", cpp_define);
break;
@ -453,7 +453,6 @@ set_lang (pfile, lang)
CPP_OPTION (pfile, dollars_in_ident) = 1;
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, c89) = 1;
CPP_OPTION (pfile, c99) = 0;
break;
@ -465,8 +464,8 @@ set_lang (pfile, lang)
CPP_OPTION (pfile, dollars_in_ident) = 0;
CPP_OPTION (pfile, cplusplus_comments) = 0;
CPP_OPTION (pfile, digraphs) = lang == CLK_STDC94;
CPP_OPTION (pfile, c89) = 1;
CPP_OPTION (pfile, c99) = 0;
CPP_OPTION (pfile, extended_numbers) = 0;
new_pending_directive (pend, "__STRICT_ANSI__", cpp_define);
break;
case CLK_STDC99:
@ -474,7 +473,6 @@ set_lang (pfile, lang)
CPP_OPTION (pfile, dollars_in_ident) = 0;
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, c89) = 0;
CPP_OPTION (pfile, c99) = 1;
new_pending_directive (pend, "__STRICT_ANSI__", cpp_define);
new_pending_directive (pend, "__STDC_VERSION__=199901L", cpp_define);
@ -489,7 +487,6 @@ set_lang (pfile, lang)
CPP_OPTION (pfile, dollars_in_ident) = 1;
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, c89) = 0;
CPP_OPTION (pfile, c99) = 0;
CPP_OPTION (pfile, objc) = 1;
new_pending_directive (pend, "__OBJC__", cpp_define);
@ -503,7 +500,6 @@ set_lang (pfile, lang)
CPP_OPTION (pfile, dollars_in_ident) = lang == CLK_GNUCXX;
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, c89) = 0;
CPP_OPTION (pfile, c99) = 0;
new_pending_directive (pend, "__cplusplus", cpp_define);
break;
@ -514,9 +510,7 @@ set_lang (pfile, lang)
CPP_OPTION (pfile, dollars_in_ident) = 0; /* Maybe not? */
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, digraphs) = 0;
CPP_OPTION (pfile, c89) = 0;
CPP_OPTION (pfile, c99) = 0;
CPP_OPTION (pfile, lang_asm) = 1;
new_pending_directive (pend, "__ASSEMBLER__", cpp_define);
break;
}
@ -979,7 +973,7 @@ cpp_start_read (pfile, fname)
CPP_OPTION (pfile, warn_traditional) = 0;
/* Do not warn about invalid token pasting if -lang-asm. */
if (CPP_OPTION (pfile, lang_asm))
if (CPP_OPTION (pfile, lang) == CLK_ASM)
CPP_OPTION (pfile, warn_paste) = 0;
/* Set this if it hasn't been set already. */

View File

@ -673,7 +673,7 @@ parse_string (pfile, token, terminator)
/* In assembly language, silently terminate string and
character literals at end of line. This is a kludge
around not knowing where comments are. */
if (CPP_OPTION (pfile, lang_asm) && terminator != '>')
if (CPP_OPTION (pfile, lang) == CLK_ASM && terminator != '>')
break;
/* Character constants and header names may not extend over
@ -1007,11 +1007,9 @@ _cpp_lex_token (pfile, result)
&& !CPP_IN_SYSTEM_HEADER (pfile))
break;
/* We silently allow C++ comments in system headers,
irrespective of conformance mode, because lots of
broken systems do that and trying to clean it up in
fixincludes is a nightmare. */
if (CPP_OPTION (pfile, c89) && CPP_PEDANTIC (pfile)
/* Warn about comments only if pedantically GNUC89, and not
in system headers. */
if (CPP_OPTION (pfile, lang) == CLK_GNUC89 && CPP_PEDANTIC (pfile)
&& ! buffer->warned_cplusplus_comments)
{
cpp_pedwarn (pfile,

View File

@ -293,7 +293,7 @@ _cpp_handle_directive (pfile, indented)
skipped conditional groups. Complain about this form if
we're being pedantic, but not if this is regurgitated input
(preprocessed or fed back in by the C++ frontend). */
if (! buffer->was_skipping && !CPP_OPTION (pfile, lang_asm))
if (! buffer->was_skipping && CPP_OPTION (pfile, lang) != CLK_ASM)
{
dir = &dtable[T_LINE];
_cpp_push_token (pfile, &dname, &pfile->directive_pos);
@ -354,7 +354,7 @@ _cpp_handle_directive (pfile, indented)
source: we don't know where the comments are, and # may
introduce assembler pseudo-ops. Don't complain about invalid
directives in skipped conditional groups (6.10 p4). */
if (CPP_OPTION (pfile, lang_asm))
if (CPP_OPTION (pfile, lang) == CLK_ASM)
{
/* Output the # and lookahead token for the assembler. */
_cpp_push_token (pfile, &dname, &pfile->directive_pos);

View File

@ -351,6 +351,9 @@ struct cpp_options
/* -fleading_underscore sets this to "_". */
const char *user_label_prefix;
/* The language we're preprocessing. */
enum c_lang lang;
/* Non-0 means -v, so print the full set of include dirs. */
unsigned char verbose;
@ -363,12 +366,6 @@ struct cpp_options
/* Nonzero means handle #import, for objective C. */
unsigned char objc;
/* Nonzero means this is an assembly file, so ignore unrecognized
directives and the "# 33" form of #line, both of which are
probably comments. Also, permit unbalanced ' strings (again,
likely to be in comments). */
unsigned char lang_asm;
/* Nonzero means don't copy comments into the output file. */
unsigned char discard_comments;
@ -378,6 +375,9 @@ struct cpp_options
/* Nonzero means process the ISO digraph sequences. */
unsigned char digraphs;
/* Nonzero means to allow hexadecimal floats and LL suffixes. */
unsigned char extended_numbers;
/* Nonzero means print the names of included files rather than the
preprocessed output. 1 means just the #include "...", 2 means
#include <...> as well. */
@ -447,9 +447,6 @@ struct cpp_options
/* Nonzero means warn if undefined identifiers are evaluated in an #if. */
unsigned char warn_undef;
/* Nonzero for the 1989 C Standard, including corrigenda and amendments. */
unsigned char c89;
/* Nonzero for the 1999 C Standard, including corrigenda and amendments. */
unsigned char c99;

View File

@ -564,7 +564,7 @@ parse_args (pfile, node)
if (argc + 1 == macro->paramc && macro->var_args)
{
if (CPP_OPTION (pfile, c99) && CPP_PEDANTIC (pfile))
if (CPP_PEDANTIC (pfile))
cpp_pedwarn (pfile, "ISO C99 requires rest arguments to be used");
}
else
@ -1283,7 +1283,7 @@ parse_params (pfile, macro)
pfile->state.va_args_ok = 1;
if (! CPP_OPTION (pfile, c99) && CPP_OPTION (pfile, pedantic))
cpp_pedwarn (pfile,
"C89 does not permit anonymous variable arguments");
"anonymous variable arguments were introduced in C99");
}
else if (CPP_OPTION (pfile, pedantic))
cpp_pedwarn (pfile,
@ -1395,7 +1395,7 @@ _cpp_create_definition (pfile, node)
macro->count--;
}
/* Let assembler get away with murder. */
else if (!CPP_OPTION (pfile, lang_asm))
else if (CPP_OPTION (pfile, lang) != CLK_ASM)
{
ok = 0;
cpp_error (pfile, "'#' is not followed by a macro parameter");

View File

@ -199,7 +199,7 @@ scan_buffer (pfile)
}
else if (print.printed
&& ! (token->flags & PREV_WHITE)
&& ! CPP_OPTION (pfile, lang_asm)
&& CPP_OPTION (pfile, lang) != CLK_ASM
&& cpp_avoid_paste (pfile, &tokens[1 - index], token))
token->flags |= PREV_WHITE;