[llvm-commits] [llvm] r145214 - in /llvm/trunk: autoconf/configure.ac cmake/config-ix.cmake include/llvm/Config/config.h.cmake include/llvm/Config/llvm-config.h.cmake include/llvm/Config/llvm-config.h.in include/llvm/Support/Valgrind.h lib/Support/Mutex.cpp lib/Support/RWMutex.cpp lib/Support/ThreadLocal.cpp lib/Support/Threading.cpp

Dylan Noblesmith nobled at dreamwidth.org
Sun Nov 27 16:48:58 PST 2011


Author: nobled
Date: Sun Nov 27 18:48:58 2011
New Revision: 145214

URL: http://llvm.org/viewvc/llvm-project?rev=145214&view=rev
Log:
rename ENABLE_THREADS to LLVM_ENABLE_THREADS

Now that it needs to be exported in a public header (Valgrind.h)
it should be prefixed to avoid collision with other projects.
Add it to llvm-config.h as well.

This'll require regenerating the configure script after this
commit, but I don't have the required autoconf version.

Modified:
    llvm/trunk/autoconf/configure.ac
    llvm/trunk/cmake/config-ix.cmake
    llvm/trunk/include/llvm/Config/config.h.cmake
    llvm/trunk/include/llvm/Config/llvm-config.h.cmake
    llvm/trunk/include/llvm/Config/llvm-config.h.in
    llvm/trunk/include/llvm/Support/Valgrind.h
    llvm/trunk/lib/Support/Mutex.cpp
    llvm/trunk/lib/Support/RWMutex.cpp
    llvm/trunk/lib/Support/ThreadLocal.cpp
    llvm/trunk/lib/Support/Threading.cpp

Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=145214&r1=145213&r2=145214&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Sun Nov 27 18:48:58 2011
@@ -538,12 +538,13 @@
                              [Use threads if available (default is YES)]),,
                              enableval=default)
 case "$enableval" in
-  yes) AC_SUBST(ENABLE_THREADS,[1]) ;;
-  no)  AC_SUBST(ENABLE_THREADS,[0]) ;;
-  default) AC_SUBST(ENABLE_THREADS,[1]) ;;
+  yes) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;;
+  no)  AC_SUBST(LLVM_ENABLE_THREADS,[0]) ;;
+  default) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;;
   *) AC_MSG_ERROR([Invalid setting for --enable-threads. Use "yes" or "no"]) ;;
 esac
-AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled])
+AC_DEFINE_UNQUOTED([LLVM_ENABLE_THREADS],$LLVM_ENABLE_THREADS,
+                   [Define if threads enabled])
 
 dnl Allow disablement of pthread.h
 AC_ARG_ENABLE(pthreads,
@@ -1144,7 +1145,7 @@
 
 dnl pthread locking functions are optional - but llvm will not be thread-safe
 dnl without locks.
-if test "$ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then
+if test "$LLVM_ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then
   AC_CHECK_LIB(pthread, pthread_mutex_init)
   AC_SEARCH_LIBS(pthread_mutex_lock,pthread,
                  AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],
@@ -1235,7 +1236,7 @@
 AC_CHECK_HEADERS([sys/types.h sys/ioctl.h malloc/malloc.h mach/mach.h])
 AC_CHECK_HEADERS([valgrind/valgrind.h])
 AC_CHECK_HEADERS([fenv.h])
-if test "$ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then
+if test "$LLVM_ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then
   AC_CHECK_HEADERS(pthread.h,
                    AC_SUBST(HAVE_PTHREAD, 1),
                    AC_SUBST(HAVE_PTHREAD, 0))

Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=145214&r1=145213&r2=145214&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Sun Nov 27 18:48:58 2011
@@ -379,14 +379,15 @@
 set(RETSIGTYPE void)
 
 if( LLVM_ENABLE_THREADS )
-  if( HAVE_PTHREAD_H OR WIN32 )
-    set(ENABLE_THREADS 1)
+  # Check if threading primitives aren't supported on this platform
+  if( NOT HAVE_PTHREAD_H AND NOT WIN32 )
+    set(LLVM_ENABLE_THREADS 0)
   endif()
 endif()
 
-if( ENABLE_THREADS )
+if( LLVM_ENABLE_THREADS )
   message(STATUS "Threads enabled.")
-else( ENABLE_THREADS )
+else( LLVM_ENABLE_THREADS )
   message(STATUS "Threads disabled.")
 endif()
 

Modified: llvm/trunk/include/llvm/Config/config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=145214&r1=145213&r2=145214&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/config.h.cmake Sun Nov 27 18:48:58 2011
@@ -32,9 +32,6 @@
 /* Define if position independent code is enabled */
 #cmakedefine ENABLE_PIC
 
-/* Define if threads enabled */
-#cmakedefine ENABLE_THREADS ${ENABLE_THREADS}
-
 /* Define if timestamp information (e.g., __DATE___) is allowed */
 #cmakedefine ENABLE_TIMESTAMPS ${ENABLE_TIMESTAMPS}
 
@@ -554,6 +551,9 @@
 /* Installation directory for documentation */
 #cmakedefine LLVM_DOCSDIR "${LLVM_DOCSDIR}"
 
+/* Define if threads enabled */
+#cmakedefine01 LLVM_ENABLE_THREADS
+
 /* Installation directory for config files */
 #cmakedefine LLVM_ETCDIR "${LLVM_ETCDIR}"
 

Modified: llvm/trunk/include/llvm/Config/llvm-config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/llvm-config.h.cmake?rev=145214&r1=145213&r2=145214&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/llvm-config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/llvm-config.h.cmake Sun Nov 27 18:48:58 2011
@@ -31,6 +31,9 @@
 /* Installation directory for documentation */
 #cmakedefine LLVM_DOCSDIR "${LLVM_DOCSDIR}"
 
+/* Define if threads enabled */
+#cmakedefine01 LLVM_ENABLE_THREADS
+
 /* Installation directory for config files */
 #cmakedefine LLVM_ETCDIR "${LLVM_ETCDIR}"
 

Modified: llvm/trunk/include/llvm/Config/llvm-config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/llvm-config.h.in?rev=145214&r1=145213&r2=145214&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/llvm-config.h.in (original)
+++ llvm/trunk/include/llvm/Config/llvm-config.h.in Sun Nov 27 18:48:58 2011
@@ -31,6 +31,9 @@
 /* Installation directory for documentation */
 #undef LLVM_DOCSDIR
 
+/* Define if threads enabled */
+#undef LLVM_ENABLE_THREADS
+
 /* Installation directory for config files */
 #undef LLVM_ETCDIR
 

Modified: llvm/trunk/include/llvm/Support/Valgrind.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Valgrind.h?rev=145214&r1=145213&r2=145214&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Valgrind.h (original)
+++ llvm/trunk/include/llvm/Support/Valgrind.h Sun Nov 27 18:48:58 2011
@@ -20,7 +20,7 @@
 #include "llvm/Config/config.h"
 #include <stddef.h>
 
-#if ENABLE_THREADS != 0 && !defined(NDEBUG)
+#if LLVM_ENABLE_THREADS != 0 && !defined(NDEBUG)
 // tsan (Thread Sanitizer) is a valgrind-based tool that detects these exact
 // functions by name.
 extern "C" {
@@ -42,7 +42,7 @@
   // Otherwise valgrind may continue to execute the old version of the code.
   void ValgrindDiscardTranslations(const void *Addr, size_t Len);
 
-#if ENABLE_THREADS != 0 && !defined(NDEBUG)
+#if LLVM_ENABLE_THREADS != 0 && !defined(NDEBUG)
   // Thread Sanitizer is a valgrind tool that finds races in code.
   // See http://code.google.com/p/data-race-test/wiki/DynamicAnnotations .
 

Modified: llvm/trunk/lib/Support/Mutex.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Mutex.cpp?rev=145214&r1=145213&r2=145214&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Mutex.cpp (original)
+++ llvm/trunk/lib/Support/Mutex.cpp Sun Nov 27 18:48:58 2011
@@ -19,7 +19,7 @@
 //===          independent code.
 //===----------------------------------------------------------------------===//
 
-#if !defined(ENABLE_THREADS) || ENABLE_THREADS == 0
+#if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0
 // Define all methods as no-ops if threading is explicitly disabled
 namespace llvm {
 using namespace sys;

Modified: llvm/trunk/lib/Support/RWMutex.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/RWMutex.cpp?rev=145214&r1=145213&r2=145214&view=diff
==============================================================================
--- llvm/trunk/lib/Support/RWMutex.cpp (original)
+++ llvm/trunk/lib/Support/RWMutex.cpp Sun Nov 27 18:48:58 2011
@@ -20,7 +20,7 @@
 //===          independent code.
 //===----------------------------------------------------------------------===//
 
-#if !defined(ENABLE_THREADS) || ENABLE_THREADS == 0
+#if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0
 // Define all methods as no-ops if threading is explicitly disabled
 namespace llvm {
 using namespace sys;

Modified: llvm/trunk/lib/Support/ThreadLocal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ThreadLocal.cpp?rev=145214&r1=145213&r2=145214&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ThreadLocal.cpp (original)
+++ llvm/trunk/lib/Support/ThreadLocal.cpp Sun Nov 27 18:48:58 2011
@@ -19,7 +19,7 @@
 //===          independent code.
 //===----------------------------------------------------------------------===//
 
-#if !defined(ENABLE_THREADS) || ENABLE_THREADS == 0
+#if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0
 // Define all methods as no-ops if threading is explicitly disabled
 namespace llvm {
 using namespace sys;

Modified: llvm/trunk/lib/Support/Threading.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Threading.cpp?rev=145214&r1=145213&r2=145214&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Threading.cpp (original)
+++ llvm/trunk/lib/Support/Threading.cpp Sun Nov 27 18:48:58 2011
@@ -24,7 +24,7 @@
 static sys::Mutex* global_lock = 0;
 
 bool llvm::llvm_start_multithreaded() {
-#if ENABLE_THREADS != 0
+#if LLVM_ENABLE_THREADS != 0
   assert(!multithreaded_mode && "Already multithreaded!");
   multithreaded_mode = true;
   global_lock = new sys::Mutex(true);
@@ -39,7 +39,7 @@
 }
 
 void llvm::llvm_stop_multithreaded() {
-#if ENABLE_THREADS != 0
+#if LLVM_ENABLE_THREADS != 0
   assert(multithreaded_mode && "Not currently multithreaded!");
 
   // We fence here to insure that all threaded operations are complete BEFORE we
@@ -63,7 +63,7 @@
   if (multithreaded_mode) global_lock->release();
 }
 
-#if ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H)
+#if LLVM_ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H)
 #include <pthread.h>
 
 struct ThreadInfo {
@@ -102,7 +102,7 @@
  error:
   ::pthread_attr_destroy(&Attr);
 }
-#elif ENABLE_THREADS!=0 && defined(LLVM_ON_WIN32)
+#elif LLVM_ENABLE_THREADS!=0 && defined(LLVM_ON_WIN32)
 #include "Windows/Windows.h"
 #include <process.h>
 





More information about the llvm-commits mailing list