[llvm-commits] [patch] pr7852 - Make LLVM robust to #define ARCH pollution by removing fragile macros.

Xerxes RĂ„nby xerxes at zafena.se
Tue Aug 10 03:45:08 PDT 2010


patch: http://llvm.org/bugs/attachment.cgi?id=5357

Remove use of fragile macros to define native target init function names in
include/llvm/Target/TargetSelect.h and llvm/include/llvm-c/Target.h

Instead of using macros the native target init function names are
resolved at config.h generation time by setting three new defines.
/* LLVM name for the native Target init function, if available */
#cmakedefine LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target

/* LLVM name for the native TargetInfo init function, if available */
#cmakedefine LLVM_NATIVE_TARGETINFO
LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo

/* LLVM name for the native AsmPrinter init function, if available */
#cmakedefine LLVM_NATIVE_ASMPRINTER
LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter

Updated include/llvm/Target/TargetSelect.h and
llvm/include/llvm-c/Target.h use the new defines.

Changed LLVM_NATIVE_ARCH define to actually contain the
${LLVM_NATIVE_ARCH} value.

I have tested this patch using cmake and configure.
I need help regenerating the configure using autotools 2.60 since i have
changed autoconf/configure.ac.

Cheers
Xerxes






More information about the llvm-commits mailing list