* 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
+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
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");
}
#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))
{
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)
{
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;
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;
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:
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);
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);
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;
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;
}
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. */
/* 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
&& !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,
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);
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);
/* -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;
/* 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;
/* 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. */
/* 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;
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
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,
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");
}
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;