From a6a19f1e38769ed23fbb03bb0c2eacee6dbd7d89 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Fri, 6 Feb 2015 01:25:07 +0000 Subject: Preprocessor: support __BIGGEST_ALIGNMENT__ macro For compatibility with GCC (and because it's generally helpful information otherwise inaccessible to the preprocessor). This appears to be canonically the alignment of max_align_t (e.g. on i386, __BIGGEST_ALIGNMENT__ is 4 even though vector types will be given greater alignment). Patch mostly by Mats Petersson llvm-svn: 228367 --- clang/lib/Frontend/InitPreprocessor.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Frontend/InitPreprocessor.cpp') diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index f4241a9..896277a 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -710,6 +710,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__POINTER_WIDTH__", Twine((int)TI.getPointerWidth(0))); + // Define __BIGGEST_ALIGNMENT__ to be compatible with gcc. + Builder.defineMacro("__BIGGEST_ALIGNMENT__", + Twine(TI.getSuitableAlign() / TI.getCharWidth()) ); + if (!LangOpts.CharIsSigned) Builder.defineMacro("__CHAR_UNSIGNED__"); -- cgit v1.1