aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-09 04:50:10 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-09 04:50:10 +0000
commit1b03cc89549deced5b77f9e691c6968ddabb227d (patch)
tree61fa36eb422bfdf8906071bacaa096b5ef2c2dbc /libcpp
parentf03df32112cfca98484bf085e62e7f6c8659a07c (diff)
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222961 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog7
-rw-r--r--libcpp/include/cpplib.h6
-rw-r--r--libcpp/init.c1
-rw-r--r--libcpp/lex.c6
4 files changed, 19 insertions, 1 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 6a2e0fb6f72..51304424753 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,10 @@
+2015-05-08 Jason Merrill <jason@redhat.com>
+
+ * include/cpplib.h: Add CPP_W_CXX11_COMPAT.
+ (struct cpp_options): Add cpp_warn_cxx11_compat.
+ * init.c (cpp_create_reader): Initialize it.
+ * lex.c (lex_string): Add -Wc++11-compat warning.
+
2015-05-05 David Malcolm <dmalcolm@redhat.com>
* pch.c (cpp_valid_state): Fix indentation so that it reflects the
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 5e080140389..0152ec8aa88 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -484,6 +484,9 @@ struct cpp_options
/* True if warn about differences between C90 and C99. */
signed char cpp_warn_c90_c99_compat;
+ /* True if warn about differences between C++98 and C++11. */
+ bool cpp_warn_cxx11_compat;
+
/* Dependency generation. */
struct
{
@@ -960,7 +963,8 @@ enum {
CPP_W_LITERAL_SUFFIX,
CPP_W_DATE_TIME,
CPP_W_PEDANTIC,
- CPP_W_C90_C99_COMPAT
+ CPP_W_C90_C99_COMPAT,
+ CPP_W_CXX11_COMPAT
};
/* Output a diagnostic of some kind. */
diff --git a/libcpp/init.c b/libcpp/init.c
index 45a4d13ffa3..1ebd709af2c 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -180,6 +180,7 @@ cpp_create_reader (enum c_lang lang, cpp_hash_table *table,
CPP_OPTION (pfile, warn_trigraphs) = 2;
CPP_OPTION (pfile, warn_endif_labels) = 1;
CPP_OPTION (pfile, cpp_warn_c90_c99_compat) = -1;
+ CPP_OPTION (pfile, cpp_warn_cxx11_compat) = 0;
CPP_OPTION (pfile, cpp_warn_deprecated) = 1;
CPP_OPTION (pfile, cpp_warn_long_long) = 0;
CPP_OPTION (pfile, dollars_in_ident) = 1;
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);