c-format.c (CPLUSPLUS_STD_VER): Define to STD_C94.
* c-format.c (CPLUSPLUS_STD_VER): Define to STD_C94. testsuite: * g++.dg/warn/format1.C: New test. From-SVN: r45941
This commit is contained in:
parent
50f5f79326
commit
ed0ea5602b
|
@ -1,3 +1,7 @@
|
|||
2001-10-02 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* c-format.c (CPLUSPLUS_STD_VER): Define to STD_C94.
|
||||
|
||||
2001-10-01 Jim Wilson <wilson@redhat.com>
|
||||
|
||||
* sched-deps.c (add_dependence): When elide conditional dependence,
|
||||
|
|
|
@ -497,7 +497,7 @@ enum format_std_version
|
|||
|
||||
/* 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_C89
|
||||
#define CPLUSPLUS_STD_VER STD_C94
|
||||
/* The C standard version we are checking formats against when pedantic. */
|
||||
#define C_STD_VER ((int)(c_language == clk_cplusplus \
|
||||
? CPLUSPLUS_STD_VER \
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2001-10-02 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* g++.dg/warn/format1.C: New test.
|
||||
|
||||
2001-10-01 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
* mi6.c, mi6a.h, mi6b.h, mi6c.h, mi6d.h, mi6e.h: Correct tests.
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// Test that formats get checked according to C94.
|
||||
// Origin: Joseph Myers <jsm28@cam.ac.uk>.
|
||||
// { dg-do compile }
|
||||
// { dg-options "-ansi -pedantic -Wformat" }
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
void
|
||||
foo (int i, int *ip, __WINT_TYPE__ lc, wchar_t *ls)
|
||||
{
|
||||
std::printf ("%d%ls%lc\n", i, ls, lc);
|
||||
std::printf ("%d", ls); // { dg-warning "format" "printf warning" }
|
||||
std::scanf ("%d%lc%ls%l[abc]", ip, ls, ls, ls);
|
||||
std::scanf ("%hd", ip); // { dg-warning "format" "scanf warning" }
|
||||
}
|
Loading…
Reference in New Issue