Commit cca615af by Jakub Jelinek Committed by Jakub Jelinek

re PR c/37743 (Bogus printf format warning with __builtin_bswap32.)

	PR c/37743
	* c-common.c (c_common_nodes_and_builtins): When initializing
	c_uint{16,32,64}_type_node, also set corresponding
	uint{16,32,64}_type_node to the same value.

	* g++.dg/ext/builtin-bswap1.C: New test.
	* c-c++-common/pr37743.c: New test.

From-SVN: r207924
parent 9254148e
2014-02-19 Jakub Jelinek <jakub@redhat.com> 2014-02-19 Jakub Jelinek <jakub@redhat.com>
PR c/37743
* c-common.c (c_common_nodes_and_builtins): When initializing
c_uint{16,32,64}_type_node, also set corresponding
uint{16,32,64}_type_node to the same value.
PR c++/60267 PR c++/60267
* c-pragma.c (init_pragma): Don't call cpp_register_deferred_pragma * c-pragma.c (init_pragma): Don't call cpp_register_deferred_pragma
for PRAGMA_IVDEP if flag_preprocess_only. for PRAGMA_IVDEP if flag_preprocess_only.
......
...@@ -5610,13 +5610,13 @@ c_common_nodes_and_builtins (void) ...@@ -5610,13 +5610,13 @@ c_common_nodes_and_builtins (void)
uint8_type_node = uint8_type_node =
TREE_TYPE (identifier_global_value (c_get_ident (UINT8_TYPE))); TREE_TYPE (identifier_global_value (c_get_ident (UINT8_TYPE)));
if (UINT16_TYPE) if (UINT16_TYPE)
c_uint16_type_node = c_uint16_type_node = uint16_type_node =
TREE_TYPE (identifier_global_value (c_get_ident (UINT16_TYPE))); TREE_TYPE (identifier_global_value (c_get_ident (UINT16_TYPE)));
if (UINT32_TYPE) if (UINT32_TYPE)
c_uint32_type_node = c_uint32_type_node = uint32_type_node =
TREE_TYPE (identifier_global_value (c_get_ident (UINT32_TYPE))); TREE_TYPE (identifier_global_value (c_get_ident (UINT32_TYPE)));
if (UINT64_TYPE) if (UINT64_TYPE)
c_uint64_type_node = c_uint64_type_node = uint64_type_node =
TREE_TYPE (identifier_global_value (c_get_ident (UINT64_TYPE))); TREE_TYPE (identifier_global_value (c_get_ident (UINT64_TYPE)));
if (INT_LEAST8_TYPE) if (INT_LEAST8_TYPE)
int_least8_type_node = int_least8_type_node =
......
2014-02-19 Jakub Jelinek <jakub@redhat.com>
PR c/37743
* g++.dg/ext/builtin-bswap1.C: New test.
* c-c++-common/pr37743.c: New test.
2014-02-19 Prathamesh Kulkarni <bilbotheelffriend@gmail.com> 2014-02-19 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
* gcc.dg/decl-10.c: New test. * gcc.dg/decl-10.c: New test.
......
/* PR c/37743 */
/* This needs to be run only on targets where __UINT32_TYPE__ is defined
to unsigned int. */
/* { dg-do compile { target *-*-linux-gnu* } } */
/* { dg-options "-Wformat" } */
int foo (const char *, ...) __attribute__ ((format (printf, 1, 2)));
void
bar (unsigned int x)
{
foo ("%x", __builtin_bswap32 (x));
}
// PR c/37743
// { dg-do compile }
#if defined(__UINT32_TYPE__) && defined(__INT32_TYPE__)
void foo (__UINT32_TYPE__);
void foo (__INT32_TYPE__);
void
bar (__UINT32_TYPE__ x)
{
foo (__builtin_bswap32 (x));
}
#else
void
bar ()
{
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment