From 75ec21db305f832534b2072c02a2a785c3cc0b4c Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Thu, 27 Jan 2000 22:29:07 +0000 Subject: cppinit.c (cpp_handle_option): Recognize C++ comments under -std=gnu89. * cppinit.c (cpp_handle_option): Recognize C++ comments under -std=gnu89. * cpplib.c (skip_block_comment, skip_line_comment): Split code out of... (skip_comment) ... here. Permit C++ comments in system headers always. Warn about C++ comments in user code under -std=gnu89 -pedantic. (copy_comment): Use skip_comment. (cpp_skip_hspace, cpp_get_token): skip_comment can no longer return EOF. (consider_directive_while_skipping, do_else, do_endif): Call validate_else unconditionally. (validate_else): Check CPP_PEDANTIC here. Accept non-comment text after the conditional in a system header. * cpplib.h (struct cpp_buffer): Add flag warned_cplusplus_comments. From-SVN: r31654 --- gcc/cpplib.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/cpplib.h') diff --git a/gcc/cpplib.h b/gcc/cpplib.h index 66c77e3..29514a1 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -140,6 +140,11 @@ struct cpp_buffer /* Used by the C++ frontend to implement redirected input (such as for default argument and/or template parsing). */ char manual_pop; + + /* True if we have already warned about C++ comments in this file. + The warning happens only for C89 extended mode with -pedantic on, + and only once per file (otherwise it would be far too noisy). */ + char warned_cplusplus_comments; }; struct file_name_map_list; -- cgit v1.1