summaryrefslogtreecommitdiff
path: root/gcc/c-family/c-format.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-04-15 13:07:30 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-04-15 13:07:30 -0400
commit04b391c164bca9a8a332d5a5b8e3ee8cf86224b9 (patch)
tree4a2774c3a084439cf23480106d39252af28343d5 /gcc/c-family/c-format.c
parent79617d7e2e4e868da8bca85ea3d6d61ad1e89e4c (diff)
downloadgcc-04b391c164bca9a8a332d5a5b8e3ee8cf86224b9.tar.gz
re PR c++/52818 (printf format %lf is erroneously rejected by C++11)
PR c++/52818 * c-format.c (CPLUSPLUS_STD_VER): C++11 inherits from C99. (C_STD_NAME): Distinguish between C++98 and C++11. From-SVN: r186468
Diffstat (limited to 'gcc/c-family/c-format.c')
-rw-r--r--gcc/c-family/c-format.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index 9fabc399565..b9674925204 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -334,7 +334,7 @@ decode_format_attr (tree args, function_format_info *info, int validated_p)
/* The C standard version C++ is treated as equivalent to
or inheriting from, for the purpose of format features supported. */
-#define CPLUSPLUS_STD_VER STD_C94
+#define CPLUSPLUS_STD_VER (cxx_dialect < cxx11 ? STD_C94 : STD_C99)
/* The C standard version we are checking formats against when pedantic. */
#define C_STD_VER ((int) (c_dialect_cxx () \
? CPLUSPLUS_STD_VER \
@@ -345,7 +345,8 @@ decode_format_attr (tree args, function_format_info *info, int validated_p)
pedantic. FEATURE_VER is the version in which the feature warned out
appeared, which is higher than C_STD_VER. */
#define C_STD_NAME(FEATURE_VER) (c_dialect_cxx () \
- ? "ISO C++" \
+ ? (cxx_dialect < cxx11 ? "ISO C++98" \
+ : "ISO C++11") \
: ((FEATURE_VER) == STD_EXT \
? "ISO C" \
: "ISO C90"))