diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-04-22 23:02:08 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-04-22 23:02:08 +0000 |
commit | fdaea7a20d303496fa4dca869aeaa7c5a6fad9db (patch) | |
tree | ce631ea761f6a054491332ece44f6ba0154f01b3 /gcc/cpplex.c | |
parent | 541b1cdeb476c9bc6be5c92ab53694782ee32e41 (diff) | |
download | gcc-fdaea7a20d303496fa4dca869aeaa7c5a6fad9db.tar.gz |
* cpphash.c (trad_stringify, add_pat): New functions.
(collect_expansion): Restore support for -traditional syntax.
Use trad_stringify and add_pat.
(_cpp_macroexpand): Restore support for -traditional semantics.
* cpplex.c (_cpp_scan_line): Don't change space_before if we
get a COMMENT token.
(_cpp_lex_token): Provide COMMENT tokens to caller if
traditional and parsing_define_directive.
(skip_comment): Warn about // comments if -Wtraditional.
* cpplib.c (do_define): Fix typo. Create EMPTY nodes with
proper node type.
(do_undef): Don't warn about undefining EMPTY nodes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33350 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r-- | gcc/cpplex.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c index effb6ca0510..3e6a89feac5 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -513,6 +513,11 @@ _cpp_scan_line (pfile, list) space_before = 1; continue; } + else if (type == CPP_COMMENT) + /* Only happens when processing -traditional macro definitions. + Do not give this a token entry, but do not change space_before + either. */ + continue; if (list->tokens_used >= list->tokens_cap) expand_token_space (list); @@ -644,13 +649,17 @@ skip_comment (pfile, m) } else if (CPP_OPTION (pfile, cplusplus_comments)) { - if (CPP_OPTION (pfile, c89) - && CPP_PEDANTIC (pfile) - && ! CPP_BUFFER (pfile)->warned_cplusplus_comments) + if (! CPP_BUFFER (pfile)->warned_cplusplus_comments) { - cpp_pedwarn (pfile, - "C++ style comments are not allowed in ISO C89"); - cpp_pedwarn (pfile, + if (CPP_WTRADITIONAL (pfile)) + cpp_pedwarn (pfile, + "C++ style comments are not allowed in traditional C"); + else if (CPP_OPTION (pfile, c89) && CPP_PEDANTIC (pfile)) + cpp_pedwarn (pfile, + "C++ style comments are not allowed in ISO C89"); + if (CPP_WTRADITIONAL (pfile) + || (CPP_OPTION (pfile, c89) && CPP_PEDANTIC (pfile))) + cpp_pedwarn (pfile, "(this will be reported only once per input file)"); CPP_BUFFER (pfile)->warned_cplusplus_comments = 1; } @@ -1053,7 +1062,11 @@ _cpp_lex_token (pfile) if (!CPP_OPTION (pfile, discard_comments)) return CPP_COMMENT; else if (CPP_TRADITIONAL (pfile)) - goto get_next; + { + if (pfile->parsing_define_directive) + return CPP_COMMENT; + goto get_next; + } else { CPP_PUTC (pfile, c); |