aboutsummaryrefslogtreecommitdiff
path: root/libcpp/lex.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-05-09 00:50:10 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-05-09 00:50:10 -0400
commitfe191308ddc9bb7095d01bcd11dcaf1f38c84bab (patch)
tree61fa36eb422bfdf8906071bacaa096b5ef2c2dbc /libcpp/lex.c
parent169980942642c39a062529f747e00a7882d046d7 (diff)
lex.c (lex_string): Add -Wc++11-compat warning.
libcpp/ * lex.c (lex_string): Add -Wc++11-compat warning. * include/cpplib.h: Add CPP_W_CXX11_COMPAT. (struct cpp_options): Add cpp_warn_cxx11_compat. * init.c (cpp_create_reader): Initialize it. gcc/c-family/ * c.opt (Wc++0x-compat): Set it. From-SVN: r222961
Diffstat (limited to 'libcpp/lex.c')
-rw-r--r--libcpp/lex.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libcpp/lex.c b/libcpp/lex.c
index ac96ff8dbe5..c7296a110b6 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -1905,6 +1905,12 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
++cur;
}
}
+ else if (CPP_OPTION (pfile, cpp_warn_cxx11_compat)
+ && is_macro (pfile, cur)
+ && !pfile->state.skipping)
+ cpp_warning_with_line (pfile, CPP_W_CXX11_COMPAT,
+ token->src_loc, 0, "C++11 requires a space "
+ "between string literal and macro");
pfile->buffer->cur = cur;
create_literal (pfile, token, base, cur - base, type);