It seems the xcore cmath.h file is buggy. We are exposing the math.h macro. Looking at an upstream version of the math.h header, the log2 macro has an __cplusplus guard around it. This is the correct fix. Patch is wrong. http://llvm-reviews.chandlerc.com/D2618