[llvm] r174460 - Preprocess Apple llvmCore headers to reflect NDEBUG setting. <rdar://12568983>

Bob Wilson bob.wilson at apple.com
Tue Feb 5 14:59:42 PST 2013


Author: bwilson
Date: Tue Feb  5 16:59:42 2013
New Revision: 174460

URL: http://llvm.org/viewvc/llvm-project?rev=174460&view=rev
Log:
Preprocess Apple llvmCore headers to reflect NDEBUG setting. <rdar://12568983>

If an Apple llvmCore build is done without assertions, and a client uses
the llvmCore headers with assertions enabled, or vice versa, then things will
break because some of the structure sizes in the API are different.  Use the
unifdef tool to make the headers unconditionally match the way the llvmCore
libraries were built.

Modified:
    llvm/trunk/utils/buildit/build_llvm

Modified: llvm/trunk/utils/buildit/build_llvm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/buildit/build_llvm?rev=174460&r1=174459&r2=174460&view=diff
==============================================================================
--- llvm/trunk/utils/buildit/build_llvm (original)
+++ llvm/trunk/utils/buildit/build_llvm Tue Feb  5 16:59:42 2013
@@ -234,6 +234,16 @@ RC_ProjectSourceSubversion=`printf "%d"
 echo "#define LLVM_VERSION ${RC_ProjectSourceVersion}" > $DEST_DIR$DEST_ROOT/include/llvm/Version.h
 echo "#define LLVM_MINOR_VERSION ${RC_ProjectSourceSubversion}" >> $DEST_DIR$DEST_ROOT/include/llvm/Version.h
 
+# Run unifdef to preprocess the installed headers to reflect whether this
+# was a debug or release build.
+for file in `find $DEST_DIR$DEST_ROOT/include -type f -print`; do
+  if [ "$LLVM_ASSERTIONS" = yes ]; then
+    unifdef -UNDEBUG -D_DEBUG -o $file $file
+  else
+    unifdef -DNDEBUG -U_DEBUG -ULLVM_ENABLE_DUMP -o $file $file
+  fi
+done
+
 # Find the right version of strip to use.
 STRIP=strip
 if [ -n "$SDKROOT" ]; then





More information about the llvm-commits mailing list