[PATCH] D111782: [AIX][cmake] Set atomics related macros when build with xlclang

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 15 02:48:17 PDT 2021


lkail added a comment.

In D111782#3064012 <https://reviews.llvm.org/D111782#3064012>, @jsji wrote:

> Can we set `LLVM_COMPILER_IS_GCC_COMPATIBLE` in `./llvm/cmake/modules/DetermineGCCCompatible.cmake` instead?

xlclang is in theory compatible with gcc's command line syntax as clang, but there are some unexpected behaviors appearing if enable it in current LLVM cmake system. For example, when `LLVM_ENABLE_WERROR` is set which is our default configuration, current cmake config only add `-Werror` when `LLVM_COMPILER_IS_GCC_COMPATIBLE`

  cmake
  # Warnings-as-errors handling for GCC-compatible compilers:                                                                                                                                   
  if ( LLVM_COMPILER_IS_GCC_COMPATIBLE )                                                                                                                                                        
    append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)                                                                                                                       
    append_if(LLVM_ENABLE_WERROR "-Wno-error" CMAKE_REQUIRED_FLAGS)                                                                                                                             
  endif( LLVM_COMPILER_IS_GCC_COMPATIBLE ) 

If `-Werror` is added to xlclang's compile flags, some files are unable to compile due to treating warning as error

  /home/lkail/llvm/dev/llvm-project/llvm/lib/Support/BuryPointer.cpp:22:3: error: 1540-2990 The attribute " __attribute__((used))" is not supported. The attribute is ignored.
    LLVM_ATTRIBUTE_USED static const void *GraveYard[kGraveYardMaxSize];


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111782/new/

https://reviews.llvm.org/D111782



More information about the llvm-commits mailing list