aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorJason Thorpe <thorpej@wasabisystems.com>2002-04-07 03:12:23 +0000
committerJason Thorpe <thorpej@gcc.gnu.org>2002-04-07 03:12:23 +0000
commit477cdac7549280eaf6d79ab9dce15e0099e01ce0 (patch)
treea89c2d17b9489b6bd19288f037013b3eaa28a891 /gcc/cppinit.c
parent03da52864c9025823694a9b5fabc472c6e534658 (diff)
downloadgcc-477cdac7549280eaf6d79ab9dce15e0099e01ce0.zip
gcc-477cdac7549280eaf6d79ab9dce15e0099e01ce0.tar.gz
gcc-477cdac7549280eaf6d79ab9dce15e0099e01ce0.tar.bz2
cppinit.c (cpp_create_reader): Initialize discard_comments_in_macro_exp.
* cppinit.c (cpp_create_reader): Initialize discard_comments_in_macro_exp. (COMMAND_LINE_OPTIONS): Add "-CC" option. (cpp_handle_option): Handle "-CC" option. * cpplex.c (save_comment): If saving a C++ comment in a directive, convert it to a C comment. (_cpp_lex_direct): Pass second comment start character to save_comment to indicate comment type. * cpplib.c (_cpp_handle_directive): If processing a "#define" directive and discard_comments_in_macro_exp is false, re-enable saving of comments. (lex_macro_node): If discard_comments_in_macro_exp is false, discard any comments before the macro identifier. * cpplib.h (struct cpp_options): Add discard_comments_in_macro_exp member. * cppmacro.c (cpp_get_token): If expanding a macro while processing a directive, discard any comments we might encounter. (parse_params): If discard_comments_in_macro_exp is false, ignore comments in the macro parameter list. * gcc.c (cpp_unique_options): Add "-CC" option. (option_map): Map "--comments-in-macros" to "-CC". * doc/cppopts.texi: Document "-CC" option. * f/lang-specs.h: Add "-CC" option. * testsuite/gcc.dg/cpp/maccom1.c: New test. * testsuite/gcc.dg/cpp/maccom2.c: New test. * testsuite/gcc.dg/cpp/maccom3.c: New test. * testsuite/gcc.dg/cpp/maccom4.c: New test. * testsuite/gcc.dg/cpp/maccom5.c: New test. * testsuite/gcc.dg/cpp/maccom6.c: New test. From-SVN: r51975
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index 8d4e0a7..ce950c0 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -488,6 +488,7 @@ cpp_create_reader (lang)
set_lang (pfile, lang);
CPP_OPTION (pfile, warn_import) = 1;
CPP_OPTION (pfile, discard_comments) = 1;
+ CPP_OPTION (pfile, discard_comments_in_macro_exp) = 1;
CPP_OPTION (pfile, show_column) = 1;
CPP_OPTION (pfile, tabstop) = 8;
CPP_OPTION (pfile, operator_names) = 1;
@@ -1172,6 +1173,7 @@ new_pending_directive (pend, text, handler)
DEF_OPT("-version", 0, OPT__version) \
DEF_OPT("A", no_ass, OPT_A) \
DEF_OPT("C", 0, OPT_C) \
+ DEF_OPT("CC", 0, OPT_CC) \
DEF_OPT("D", no_mac, OPT_D) \
DEF_OPT("H", 0, OPT_H) \
DEF_OPT("I", no_dir, OPT_I) \
@@ -1453,6 +1455,10 @@ cpp_handle_option (pfile, argc, argv, ignore)
case OPT_C:
CPP_OPTION (pfile, discard_comments) = 0;
break;
+ case OPT_CC:
+ CPP_OPTION (pfile, discard_comments) = 0;
+ CPP_OPTION (pfile, discard_comments_in_macro_exp) = 0;
+ break;
case OPT_P:
CPP_OPTION (pfile, no_line_commands) = 1;
break;