[llvm-commits] [llvm] r116785 - /llvm/trunk/lib/System/Win32/ThreadLocal.inc
NAKAMURA Takumi
geek4civic at gmail.com
Tue Oct 19 19:33:47 PDT 2010
Bill san, Jim san,
Thank you to give me comments.
I am sorry I remembered only the fixup in lib/System/RWMutex.cpp at 110667,
and I commited similarly.
I think it would be better to take Bill's way. May I fix up 2 files
with attached patch?
...Takumi
ps. I can still see some points with grep -nri '(void)[A-Z][0-9A-Z]*;'
| fgrep -iv warning
2010/10/20 Bill Wendling <wendling at apple.com>:
> Or better yet, use the ATTRIBUTE_UNUSED attribute in
> llvm/Support/Compiler.h.
> -bw
> On Oct 19, 2010, at 9:16 AM, Jim Grosbach wrote:
>
> Can you add a comment saying why that line is necessary? Otherwise some well
> meaning person may remove the "unusued" statement.
>
> -Jim
>
> On Oct 18, 2010, at 6:22 PM, NAKAMURA Takumi wrote:
>
> Author: chapuni
>
> Date: Mon Oct 18 20:22:01 2010
>
> New Revision: 116785
>
> URL: http://llvm.org/viewvc/llvm-project?rev=116785&view=rev
>
> Log:
>
> lib/System/Win32/ThreadLocal.inc: Suppress "unused" warning on -Asserts.
>
> Modified:
>
> llvm/trunk/lib/System/Win32/ThreadLocal.inc
>
> Modified: llvm/trunk/lib/System/Win32/ThreadLocal.inc
>
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/ThreadLocal.inc?rev=116785&r1=116784&r2=116785&view=diff
>
> ==============================================================================
>
> --- llvm/trunk/lib/System/Win32/ThreadLocal.inc (original)
>
> +++ llvm/trunk/lib/System/Win32/ThreadLocal.inc Mon Oct 18 20:22:01 2010
>
> @@ -44,6 +44,7 @@
>
> DWORD* tls = static_cast<DWORD*>(data);
>
> int errorcode = TlsSetValue(*tls, const_cast<void*>(d));
>
> assert(errorcode != 0);
>
> + (void)errorcode;
>
> }
>
> void ThreadLocalImpl::removeInstance() {
>
>
> _______________________________________________
>
> llvm-commits mailing list
>
> llvm-commits at cs.uiuc.edu
>
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
diff --git a/lib/System/RWMutex.cpp b/lib/System/RWMutex.cpp
index deb0470..be41ee6 100644
--- a/lib/System/RWMutex.cpp
+++ b/lib/System/RWMutex.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Config/config.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/System/RWMutex.h"
#include <cstring>
@@ -72,8 +73,7 @@ RWMutexImpl::RWMutexImpl()
#endif
// Initialize the rwlock
- int errorcode = pthread_rwlock_init(rwlock, NULL);
- (void)errorcode;
+ int ATTRIBUTE_UNUSED errorcode = pthread_rwlock_init(rwlock, NULL);
assert(errorcode == 0);
// Assign the data member
diff --git a/lib/System/Win32/ThreadLocal.inc b/lib/System/Win32/ThreadLocal.inc
index e7e3cb7..b13c119 100644
--- a/lib/System/Win32/ThreadLocal.inc
+++ b/lib/System/Win32/ThreadLocal.inc
@@ -17,6 +17,7 @@
//===----------------------------------------------------------------------===//
#include "Win32.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/System/ThreadLocal.h"
namespace llvm {
@@ -42,9 +43,8 @@ const void* ThreadLocalImpl::getInstance() {
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;
}
void ThreadLocalImpl::removeInstance() {
More information about the llvm-commits
mailing list