On Sat, Apr 16, 2022 at 10:21 PM Paul Eggert <egg...@cs.ucla.edu> wrote: > > On 4/15/22 09:22, Mattias Engdegård wrote: > > Paul, would you consider something like that patch (repeated here) for > > gnulib? > > Sure, I installed the attached into Gnulib master on Savannah. > > I suppose it wouldn't hurt for an old Mac OS X expert to check the other > uses of __clang_major__ in Emacs.
This looks like Apple Clang vs LLVM Clang. You should use __apple_build_version__ to differentiate between the two. Stepping back a bit, rather than doing the Clang gyrations everywhere you use __clang_major__ , maybe you should define a couple of macros like GNULIB_LLVM_CLANG_VER and GNULIB_APPLE_CLANG_VER in a fashion similar to GCC_VERSION from https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html: #define GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) Then you can check versions in the code like: #if defined(__clang__) && defined(__apple_build_version__) # define GNULIB_APPLE_CLANG_VER (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) #elif defined(__clang__) # define GNULIB_LLVM_CLANG_VER (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) #elif defined(__GNUC__) # define GNULIB_GCC_VER (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif #if (GNULIB_GCC_VER >= 40200) || \ (GNULIB_APPLE_CLANG_VER >= 40200) || \ (GNULIB_LLVM_CLANG_VER >= 30200) ... #endif Jeff