Commit 83ecd27e by Jason Merrill Committed by Jason Merrill

cpplib.h (CPP_PEDANTIC): Only true if system_header_p is not set for the buffer.

        * cpplib.h (CPP_PEDANTIC): Only true if system_header_p is not set
        for the buffer.
        (SET_CPP_PEDANTIC): New macro.
        * cpplib.c (do_include): Don't bother checking system_header_p.
        (do_warning, do_ident, do_assert, do_unassert): Likewise.

From-SVN: r32299
parent 3b18cdf9
2000-03-02 Jason Merrill <jason@casey.cygnus.com> 2000-03-02 Jason Merrill <jason@casey.cygnus.com>
* cpplib.h (CPP_PEDANTIC): Only true if system_header_p is not set
for the buffer.
(SET_CPP_PEDANTIC): New macro.
* cpplib.c (do_include): Don't bother checking system_header_p.
(do_warning, do_ident, do_assert, do_unassert): Likewise.
* function.h (struct expr_status): Add x_arg_space_so_far. * function.h (struct expr_status): Add x_arg_space_so_far.
(arg_space_so_far): New macro. (arg_space_so_far): New macro.
* expr.c (init_expr): Initialize it. * expr.c (init_expr): Initialize it.
......
...@@ -1068,7 +1068,7 @@ do_include (pfile, keyword) ...@@ -1068,7 +1068,7 @@ do_include (pfile, keyword)
int fd; int fd;
if (CPP_PEDANTIC (pfile) && !CPP_BUFFER (pfile)->system_header_p) if (CPP_PEDANTIC (pfile))
{ {
if (importing) if (importing)
cpp_pedwarn (pfile, "ANSI C does not allow `#import'"); cpp_pedwarn (pfile, "ANSI C does not allow `#import'");
...@@ -1555,7 +1555,7 @@ do_warning (pfile, keyword) ...@@ -1555,7 +1555,7 @@ do_warning (pfile, keyword)
skip_rest_of_line (pfile); skip_rest_of_line (pfile);
limit = CPP_BUFFER (pfile)->cur; limit = CPP_BUFFER (pfile)->cur;
if (CPP_PEDANTIC (pfile) && !CPP_BUFFER (pfile)->system_header_p) if (CPP_PEDANTIC (pfile))
cpp_pedwarn (pfile, "ANSI C does not allow `#warning'"); cpp_pedwarn (pfile, "ANSI C does not allow `#warning'");
cpp_warning (pfile, "#warning %.*s", (int)(limit - text), text); cpp_warning (pfile, "#warning %.*s", (int)(limit - text), text);
...@@ -1572,7 +1572,7 @@ do_ident (pfile, keyword) ...@@ -1572,7 +1572,7 @@ do_ident (pfile, keyword)
long old_written = CPP_WRITTEN (pfile); long old_written = CPP_WRITTEN (pfile);
/* Allow #ident in system headers, since that's not user's fault. */ /* Allow #ident in system headers, since that's not user's fault. */
if (CPP_PEDANTIC (pfile) && !CPP_BUFFER (pfile)->system_header_p) if (CPP_PEDANTIC (pfile))
cpp_pedwarn (pfile, "ANSI C does not allow `#ident'"); cpp_pedwarn (pfile, "ANSI C does not allow `#ident'");
CPP_PUTS (pfile, "#ident ", 7); CPP_PUTS (pfile, "#ident ", 7);
...@@ -2292,7 +2292,7 @@ validate_else (pfile, directive) ...@@ -2292,7 +2292,7 @@ validate_else (pfile, directive)
cpp_reader *pfile; cpp_reader *pfile;
const char *directive; const char *directive;
{ {
if (! CPP_PEDANTIC (pfile) || CPP_BUFFER (pfile)->system_header_p) if (! CPP_PEDANTIC (pfile))
return; return;
cpp_skip_hspace (pfile); cpp_skip_hspace (pfile);
...@@ -3060,8 +3060,7 @@ do_assert (pfile, keyword) ...@@ -3060,8 +3060,7 @@ do_assert (pfile, keyword)
HASHNODE *base, *this; HASHNODE *base, *this;
int baselen, thislen; int baselen, thislen;
if (CPP_PEDANTIC (pfile) && CPP_OPTIONS (pfile)->done_initializing if (CPP_PEDANTIC (pfile) && CPP_OPTIONS (pfile)->done_initializing)
&& !CPP_BUFFER (pfile)->system_header_p)
cpp_pedwarn (pfile, "ANSI C does not allow `#assert'"); cpp_pedwarn (pfile, "ANSI C does not allow `#assert'");
cpp_skip_hspace (pfile); cpp_skip_hspace (pfile);
...@@ -3125,8 +3124,7 @@ do_unassert (pfile, keyword) ...@@ -3125,8 +3124,7 @@ do_unassert (pfile, keyword)
long baselen, thislen; long baselen, thislen;
HASHNODE *base, *this, *next; HASHNODE *base, *this, *next;
if (CPP_PEDANTIC (pfile) && CPP_OPTIONS (pfile)->done_initializing if (CPP_PEDANTIC (pfile) && CPP_OPTIONS (pfile)->done_initializing)
&& !CPP_BUFFER (pfile)->system_header_p)
cpp_pedwarn (pfile, "ANSI C does not allow `#unassert'"); cpp_pedwarn (pfile, "ANSI C does not allow `#unassert'");
cpp_skip_hspace (pfile); cpp_skip_hspace (pfile);
......
...@@ -508,10 +508,14 @@ struct cpp_options { ...@@ -508,10 +508,14 @@ struct cpp_options {
#define CPP_TRADITIONAL(PFILE) (CPP_OPTIONS(PFILE)-> traditional) #define CPP_TRADITIONAL(PFILE) (CPP_OPTIONS(PFILE)-> traditional)
#define CPP_WARN_UNDEF(PFILE) (CPP_OPTIONS(PFILE)->warn_undef) #define CPP_WARN_UNDEF(PFILE) (CPP_OPTIONS(PFILE)->warn_undef)
#define CPP_C89(PFILE) (CPP_OPTIONS(PFILE)->c89) #define CPP_C89(PFILE) (CPP_OPTIONS(PFILE)->c89)
#define CPP_PEDANTIC(PFILE) (CPP_OPTIONS (PFILE)->pedantic)
#define CPP_PREPROCESSED(PFILE) (CPP_OPTIONS (PFILE)->preprocessed) #define CPP_PREPROCESSED(PFILE) (CPP_OPTIONS (PFILE)->preprocessed)
#define CPP_PRINT_DEPS(PFILE) (CPP_OPTIONS (PFILE)->print_deps) #define CPP_PRINT_DEPS(PFILE) (CPP_OPTIONS (PFILE)->print_deps)
#define CPP_PEDANTIC(PFILE) \
(CPP_OPTIONS (PFILE)->pedantic && !CPP_BUFFER (pfile)->system_header_p)
#define SET_CPP_PEDANTIC(PFILE) (CPP_OPTIONS (PFILE)->pedantic = 1)
/* List of directories to look for include files in. */ /* List of directories to look for include files in. */
struct file_name_list struct file_name_list
{ {
......
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