This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH, libstdc++]: Avoid "libsupc++/guard.cc:118:18: warning: variable â__pâ set but not used" warning
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Wed, 1 Jul 2015 12:43:33 +0100
- Subject: Re: [PATCH, libstdc++]: Avoid "libsupc++/guard.cc:118:18: warning: variable â__pâ set but not used" warning
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4ZpgTZAG8VoAsrCoQNnWsspTk-0ESXJuk+TXM-SQ6Lwpg at mail dot gmail dot com>
On 01/07/15 12:22 +0200, Uros Bizjak wrote:
Hello!
2015-07-01 Uros Bizjak <ubizjak@gmail.com>
* libsupc++/guard.cc (__test_and_acquire): Use __p after __atomic_load
to avoid unused variable warning.
(__set_and_release): Use __p after __atomic_store to avoid unused
variable warning.
Bootstrapped and regression tested on x86_64-linux-gnu.
OK for mainline?
Yes, OK, although I was wondering if this should really be fixed in
the front end, the warning is spurious, isn't it? __p is not unused,
because the load is done through it.
Index: libsupc++/guard.cc
===================================================================
--- libsupc++/guard.cc (revision 225221)
+++ libsupc++/guard.cc (working copy)
@@ -117,6 +117,7 @@ __test_and_acquire (__cxxabiv1::__guard *g)
unsigned char __c;
unsigned char *__p = reinterpret_cast<unsigned char *>(g);
__atomic_load (__p, &__c, __ATOMIC_ACQUIRE);
+ (void) __p;
return _GLIBCXX_GUARD_TEST(&__c);
}
# define _GLIBCXX_GUARD_TEST_AND_ACQUIRE(G) __test_and_acquire (G)
@@ -132,6 +133,7 @@ __set_and_release (__cxxabiv1::__guard *g)
unsigned char *__p = reinterpret_cast<unsigned char *>(g);
unsigned char val = 1;
__atomic_store (__p, &val, __ATOMIC_RELEASE);
+ (void) __p;
}
# define _GLIBCXX_GUARD_SET_AND_RELEASE(G) __set_and_release (G)
# endif