aboutsummaryrefslogtreecommitdiff
path: root/libcpp/init.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2014-09-17 21:49:46 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-09-17 21:49:46 +0000
commit909eb89ca5b48b9a5645358e1cb5c949ec3f1edb (patch)
treed873bfc33c03e881e036aa4a39cd18516df27f6b /libcpp/init.c
parent010718fc37a1e84698479677381e654169082cd0 (diff)
downloadgcc-909eb89ca5b48b9a5645358e1cb5c949ec3f1edb.zip
gcc-909eb89ca5b48b9a5645358e1cb5c949ec3f1edb.tar.gz
gcc-909eb89ca5b48b9a5645358e1cb5c949ec3f1edb.tar.bz2
re PR c/61854 (Warning single-line comment for -std=c89?)
PR c/61854 libcpp/ * init.c (struct lang_flags): Remove cplusplus_comments. (cpp_set_lang): Likewise. (post_options): Likewise. * lex.c (_cpp_lex_direct): Disallow C++ style comments in C90/C94. testsuite/ * gcc.dg/cpp/pr61854-1.c: New test. * gcc.dg/cpp/pr61854-2.c: New test. * gcc.dg/cpp/pr61854-3.c: New test. * gcc.dg/cpp/pr61854-3.h: New test. * gcc.dg/cpp/pr61854-4.c: New test. * gcc.dg/cpp/pr61854-5.c: New test. * gcc.dg/cpp/pr61854-6.c: New test. * gcc.dg/cpp/pr61854-7.c: New test. * gcc.dg/cpp/pr61854-c90.c: New test. * gcc.dg/cpp/pr61854-c94.c: New test. From-SVN: r215339
Diffstat (limited to 'libcpp/init.c')
-rw-r--r--libcpp/init.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/libcpp/init.c b/libcpp/init.c
index d612374..1121962 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -83,7 +83,6 @@ struct lang_flags
char extended_identifiers;
char c11_identifiers;
char std;
- char cplusplus_comments;
char digraphs;
char uliterals;
char rliterals;
@@ -94,23 +93,23 @@ struct lang_flags
};
static const struct lang_flags lang_defaults[] =
-{ /* c99 c++ xnum xid c11 std // digr ulit rlit udlit bincst digsep trig */
- /* GNUC89 */ { 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
- /* GNUC99 */ { 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
- /* GNUC11 */ { 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
- /* STDC89 */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 },
- /* STDC94 */ { 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1 },
- /* STDC99 */ { 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 },
- /* STDC11 */ { 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1 },
- /* GNUCXX */ { 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
- /* CXX98 */ { 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 },
- /* GNUCXX11 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
- /* CXX11 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1 },
- /* GNUCXX14 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0 },
- /* CXX14 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
- /* GNUCXX1Z */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0 },
- /* CXX1Z */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
- /* ASM */ { 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }
+{ /* c99 c++ xnum xid c11 std digr ulit rlit udlit bincst digsep trig */
+ /* GNUC89 */ { 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 },
+ /* GNUC99 */ { 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
+ /* GNUC11 */ { 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 },
+ /* STDC89 */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 },
+ /* STDC94 */ { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1 },
+ /* STDC99 */ { 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1 },
+ /* STDC11 */ { 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1 },
+ /* GNUCXX */ { 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 },
+ /* CXX98 */ { 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1 },
+ /* GNUCXX11 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0 },
+ /* CXX11 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1 },
+ /* GNUCXX14 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0 },
+ /* CXX14 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
+ /* GNUCXX1Z */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0 },
+ /* CXX1Z */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
+ /* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
/* xid should be 1 for GNUC99, STDC99, GNUCXX, CXX98, GNUCXX11, CXX11,
GNUCXX14, and CXX14 when no longer experimental (when all uses of
identifiers in the compiler have been audited for correct handling
@@ -131,7 +130,6 @@ cpp_set_lang (cpp_reader *pfile, enum c_lang lang)
CPP_OPTION (pfile, extended_identifiers) = l->extended_identifiers;
CPP_OPTION (pfile, c11_identifiers) = l->c11_identifiers;
CPP_OPTION (pfile, std) = l->std;
- CPP_OPTION (pfile, cplusplus_comments) = l->cplusplus_comments;
CPP_OPTION (pfile, digraphs) = l->digraphs;
CPP_OPTION (pfile, uliterals) = l->uliterals;
CPP_OPTION (pfile, rliterals) = l->rliterals;
@@ -775,8 +773,6 @@ post_options (cpp_reader *pfile)
if (CPP_OPTION (pfile, traditional))
{
- CPP_OPTION (pfile, cplusplus_comments) = 0;
-
CPP_OPTION (pfile, trigraphs) = 0;
CPP_OPTION (pfile, warn_trigraphs) = 0;
}