aboutsummaryrefslogtreecommitdiff
path: root/gcc/system.h
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2016-11-23 10:06:07 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2016-11-23 10:06:07 +0000
commitfb2675cb4683a430fb63af44713cd9d2fcd77b97 (patch)
tree08fdcd7bc342d222856765ef9f8cff24381b75a7 /gcc/system.h
parentbaf53c4739a68b3307ce28bfeffc903fa641b946 (diff)
downloadgcc-fb2675cb4683a430fb63af44713cd9d2fcd77b97.zip
gcc-fb2675cb4683a430fb63af44713cd9d2fcd77b97.tar.gz
gcc-fb2675cb4683a430fb63af44713cd9d2fcd77b97.tar.bz2
system.h (HAVE_DESIGNATED_INITIALIZERS, [...]): Do not use "defined" in macros.
gcc: 2016-11-23 Paolo Bonzini <bonzini@gnu.org> * system.h (HAVE_DESIGNATED_INITIALIZERS, HAVE_DESIGNATED_UNION_INITIALIZERS): Do not use "defined" in macros. * doc/cpp.texi (Defined): Mention -Wexpansion-to-defined. * doc/cppopts.texi (Invocation): Document -Wexpansion-to-defined. * doc/invoke.texi (Warning Options): Document -Wexpansion-to-defined. gcc/c-family: 2016-11-23 Paolo Bonzini <bonzini@gnu.org> * c.opt (Wexpansion-to-defined): New. gcc/testsuite: 2016-11-23 Paolo Bonzini <bonzini@gnu.org> * gcc.dg/cpp/defined.c: Mark newly introduced warnings and adjust for warning->pedwarn change. * gcc.dg/cpp/defined-syshdr.c, gcc.dg/cpp/defined-Wexpansion-to-defined.c, gcc.dg/cpp/defined-Wextra-Wno-expansion-to-defined.c, gcc.dg/cpp/defined-Wextra.c, gcc.dg/cpp/defined-Wno-expansion-to-defined.c: New testcases. libcpp: 2016-11-23 Paolo Bonzini <bonzini@gnu.org> * include/cpplib.h (struct cpp_options): Add new member warn_expansion_to_defined. (CPP_W_EXPANSION_TO_DEFINED): New enum member. * expr.c (parse_defined): Warn for all uses of "defined" in macros, and tie warning to CPP_W_EXPANSION_TO_DEFINED. Make it a pedwarning instead of a warning. * system.h (HAVE_DESIGNATED_INITIALIZERS): Do not use "defined" in macros. From-SVN: r242743
Diffstat (limited to 'gcc/system.h')
-rw-r--r--gcc/system.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/system.h b/gcc/system.h
index 8c6127c..3e12017 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -577,15 +577,21 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
/* 1 if we have C99 designated initializers. */
#if !defined(HAVE_DESIGNATED_INITIALIZERS)
+#ifdef __cplusplus
+#define HAVE_DESIGNATED_INITIALIZERS 0
+#else
#define HAVE_DESIGNATED_INITIALIZERS \
- (((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L)) \
- && !defined(__cplusplus))
+ (((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
+#endif
#endif
#if !defined(HAVE_DESIGNATED_UNION_INITIALIZERS)
+#ifdef __cplusplus
+#define HAVE_DESIGNATED_UNION_INITIALIZERS (GCC_VERSION >= 4007)
+#else
#define HAVE_DESIGNATED_UNION_INITIALIZERS \
- (((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L)) \
- && (!defined(__cplusplus) || (GCC_VERSION >= 4007)))
+ (((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
+#endif
#endif
#if HAVE_SYS_STAT_H