Search code examples
cxcodexcode5llvm-clang

LLVM precompile concatenate issue


I concatenate my full app version using these macros:

#define MAJOR 3
#define BUILD 432

#define CONCATENATE_DIRECT(s1, s2) s1##s2
#define CONCATENATE(s1, s2) CONCATENATE_DIRECT(s1, s2)

#define VERSION CONCATENATE(CONCATENATE(MAJOR, .), BUILD)

The output should be 3.432 and it worked perfectly until I recently updated to Xcode 5 and LLVM 5.1. Now the output is: 3##.##432


Solution

  • I have several different preprocessor flags set and one of them was -traditional. This is the one that messed up things. After removing it everything went back to normal again.

    The # and ## operators are not available in traditional C.

    See more here