[llvm-commits] [llvm] r116909 - in /llvm/trunk/lib/System: RWMutex.cpp Win32/ThreadLocal.inc
Duncan Sands
baldrick at free.fr
Tue Oct 19 23:54:16 PDT 2010
Hi,
> // Initialize the rwlock
> - int errorcode = pthread_rwlock_init(rwlock, NULL);
> - (void)errorcode;
> + int ATTRIBUTE_UNUSED errorcode = pthread_rwlock_init(rwlock, NULL);
> assert(errorcode == 0);
when building with assertions on, errorcode is used, so mightn't this result
in a warning? [*] I don't see what was wrong with casting to void: that's used
all over the place in LLVM already, not to mention in lots of other projects.
> void ThreadLocalImpl::setInstance(const void* d){
> DWORD* tls = static_cast<DWORD*>(data);
> - int errorcode = TlsSetValue(*tls, const_cast<void*>(d));
> + int ATTRIBUTE_UNUSED errorcode = TlsSetValue(*tls, const_cast<void*>(d));
> assert(errorcode != 0);
> - (void)errorcode;
Likewise.
Ciao,
Duncan.
[*] It may be that the compiler you are using does not produce a warning in this
case, but since this seems like a reasonable thing to warn about perhaps other
(maybe future) versions will, or other compilers will. My Ada compiler warns
about this if you use the analogous Ada construct (mark as unused, but use it).
More information about the llvm-commits
mailing list