Logan Chien
2011-Feb-13 06:00 UTC
[LLVMdev] Code/comment seems not synchronized in Mutex.cpp and RWMutex.cpp
Hi, I'm confused by the comment and the source code of lib/Support/Mutex.cpp and lib/Support/RWMutex.cpp. In these files there are: // This variable is useful for situations where the pthread library has been // compiled with weak linkage for its interface symbols. This allows the // threading support to be turned off by simply *not linking against -lpthread*. // In that situation, the value of *pthread_mutex_init* will be 0 and // consequently pthread_enabled will be false. In such situations, all the // ... static const bool pthread_enabled = *true*; But pthread_enabled has no relation with pthread_mutex_init. I've check the log, pthread_enabled has been assigned to true since 2006. It was: static const bool pthread_enabled = *static_cast<bool>(pthread_mutex_init)*; * Shall we update or remove the comment?* Note: If we rollback the code, then 2 warnings will be generated: lib/Support/Mutex.cpp:55: warning: the address of ‘int pthread_mutex_init( pthread_mutex_t*, const pthread_mutexattr_t*)’ will always evaluate as ‘true’ lib/Support/RWMutex.cpp:57: warning: the address of ‘int pthread_mutex_init( pthread_mutex_t*, const pthread_mutexattr_t*)’ will always evaluate as ‘true’ Thanks, Logan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110213/c22b6471/attachment.html>