+2015-05-08 Jason Merrill <jason@redhat.com>
+
+ * c.opt (Wc++0x-compat): Also set cpp_warn_cxx11_compat.
+
2015-05-08 Marek Polacek <polacek@redhat.com>
PR c/64918
Warn about C constructs that are not in the common subset of C and C++
Wc++0x-compat
-C++ ObjC++ Var(warn_cxx0x_compat) Warning LangEnabledBy(C++ ObjC++,Wall)
+C++ ObjC++ Var(warn_cxx0x_compat) Warning LangEnabledBy(C++ ObjC++,Wall) Init(0) CPP(cpp_warn_cxx11_compat) CppReason(CPP_W_CXX11_COMPAT)
Deprecated in favor of -Wc++11-compat
Wc++11-compat
--- /dev/null
+// { dg-options "-Wall" }
+
+#define FOO "foo"
+const char *p = "bar"FOO; // { dg-warning "macro" }
+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
/* 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
{
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. */
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;
++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);