This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Prevent -Wunused-value warning with __atomic_fetch_* (PR c/69407)
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: Marek Polacek <polacek at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Jakub Jelinek <jakub at redhat dot com>, Jonathan Wakely <jwakely at redhat dot com>
- Date: Fri, 4 Mar 2016 19:17:46 +0100
- Subject: Re: [C PATCH] Prevent -Wunused-value warning with __atomic_fetch_* (PR c/69407)
- Authentication-results: sourceware.org; auth=none
Hello!
> This is not a regression but I thought I'd post this anyway. Martin reported
> that we generate -Wunused-value warnings on the attached testcase, which
> arguable doesn't make sense. Setting TREE_USED suppresses the warning. Since
> we already compute 'fetch_op' I used that. (This warning doesn't trigger e.g.
> for __atomic_load/store/compare.)
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk or gcc7?
>
> 2016-03-04 Marek Polacek <polacek@redhat.com>
>
> PR c/69407
> * c-common.c (resolve_overloaded_builtin): Set TREE_USED for the fetch
> operations.
>
> * gcc.dg/atomic-op-6.c: New test.
You can probably revert my workaround [1] that suppressed these
warnings in libsupc++/guard.cc.
[1] https://gcc.gnu.org/ml/gcc-patches/2015-07/msg00023.html
Uros.