re PR c/69407 (-Wunused-value on __atomic_fetch_OP and __atomic_OP_fetch)
PR c/69407 * c-common.c (resolve_overloaded_builtin): Set TREE_USED for the fetch operations. * gcc.dg/atomic-op-6.c: New test. From-SVN: r234304
This commit is contained in:
parent
ded6091379
commit
14ba7b28a8
@ -1,3 +1,9 @@
|
||||
2016-03-17 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c/69407
|
||||
* c-common.c (resolve_overloaded_builtin): Set TREE_USED for the fetch
|
||||
operations.
|
||||
|
||||
2016-03-14 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* c-cppbuiltin.c (c_cpp_builtins): Set __cpp_hex_float.
|
||||
|
@ -11445,6 +11445,10 @@ resolve_overloaded_builtin (location_t loc, tree function,
|
||||
&& orig_code != BUILT_IN_ATOMIC_STORE_N)
|
||||
result = sync_resolve_return (first_param, result, orig_format);
|
||||
|
||||
if (fetch_op)
|
||||
/* Prevent -Wunused-value warning. */
|
||||
TREE_USED (result) = true;
|
||||
|
||||
/* If new_return is set, assign function to that expr and cast the
|
||||
result to void since the generic interface returned void. */
|
||||
if (new_return)
|
||||
|
@ -1,3 +1,8 @@
|
||||
2016-03-17 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c/69407
|
||||
* gcc.dg/atomic-op-6.c: New test.
|
||||
|
||||
2016-03-17 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
PR c/70264
|
||||
|
11
gcc/testsuite/gcc.dg/atomic-op-6.c
Normal file
11
gcc/testsuite/gcc.dg/atomic-op-6.c
Normal file
@ -0,0 +1,11 @@
|
||||
/* Test we don't generate bogus warnings. */
|
||||
/* PR c/69407 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wall -Wextra" } */
|
||||
|
||||
void
|
||||
foo (int *p, int a)
|
||||
{
|
||||
__atomic_fetch_add (&p, a, 0); /* { dg-bogus "value computed is not used" } */
|
||||
__atomic_add_fetch (&p, a, 0); /* { dg-bogus "value computed is not used" } */
|
||||
}
|
Loading…
Reference in New Issue
Block a user