diff options
author | Zack Weinberg <zack@wolery.cumb.org> | 2000-04-22 23:02:08 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-04-22 23:02:08 +0000 |
commit | 0f89df67fc5dbad0e6eb068f6facc4cbb0342c0d (patch) | |
tree | ce631ea761f6a054491332ece44f6ba0154f01b3 /gcc/cpplex.c | |
parent | 4ff812cd3f08389d68aa257bbfa9baaf9dbda2cc (diff) | |
download | gcc-0f89df67fc5dbad0e6eb068f6facc4cbb0342c0d.zip gcc-0f89df67fc5dbad0e6eb068f6facc4cbb0342c0d.tar.gz gcc-0f89df67fc5dbad0e6eb068f6facc4cbb0342c0d.tar.bz2 |
cpphash.c (trad_stringify, add_pat): New functions.
* 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.
From-SVN: r33350
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 effb6ca..3e6a89f 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); |