Skip to content

Compilation error in RuntimeLibcalls.cpp possibly from unintended macro inclusion #167249

@sofiedotcafe

Description

@sofiedotcafe

Hi,

I'm encountering a build failure while compiling the pull request [clang]: reflection operator parsing for global namespace and primitive types #164692 (the branch is at changkhothuychung:refl-parse) with it failing on RuntimeLibcalls.cpp. It appears that GET_RUNTIME_LIBCALL_ENUM is being defined, despite not being explicitly set within the RuntimeLibcalls.cpp translation unit.

This behavior suggests that GET_RUNTIME_LIBCALL_ENUM is being unintentionally defined or inherited through an unexpected include path or macro leakage, even though it should be conditionally guarded. I presume this is an build environment issue, but how could that even cause this?

Here’s a snippet of the error for reference:

In file included from /build/llvm-src-22.0.0-unstable-2025-10-19/llvm/include/llvm/IR/RuntimeLibcalls.h:171,
                 from /build/llvm-src-22.0.0-unstable-2025-10-19/llvm/lib/IR/RuntimeLibcalls.cpp:9:
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc: In static member function 'static llvm::iota_range<llvm::RTLIB::LibcallImpl> llvm::RTLIB::RuntimeLibcallsInfo::lookupLibcallImplName(llvm::StringRef)':
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:11:1: error: 'namespace' definition is not allowed here
   11 | namespace llvm {
      | ^~~~~~~~~
Full build error
In file included from /build/llvm-src-22.0.0-unstable-2025-10-19/llvm/include/llvm/IR/RuntimeLibcalls.h:171,
                 from /build/llvm-src-22.0.0-unstable-2025-10-19/llvm/lib/IR/RuntimeLibcalls.cpp:9:
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc: In static member function 'static llvm::iota_range<llvm::RTLIB::LibcallImpl> llvm::RTLIB::RuntimeLibcallsInfo::lookupLibcallImplName(llvm::StringRef)':
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:11:1: error: 'namespace' definition is not allowed here
   11 | namespace llvm {
      | ^~~~~~~~~
In file included from /build/llvm-src-22.0.0-unstable-2025-10-19/llvm/lib/IR/RuntimeLibcalls.cpp:23:
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc: At global scope:
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:13:6: error: multiple definition of 'enum llvm::RTLIB::Libcall'
   13 | enum Libcall : unsigned short {
      |      ^~~~~~~
In file included from /build/llvm-src-22.0.0-unstable-2025-10-19/llvm/include/llvm/IR/RuntimeLibcalls.h:33:
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:13:6: note: previous definition here
   13 | enum Libcall : unsigned short {
      |      ^~~~~~~
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:842:6: error: multiple definition of 'enum llvm::RTLIB::LibcallImpl'
  842 | enum LibcallImpl : unsigned short {
      |      ^~~~~~~~~~~
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:842:6: note: previous definition here
  842 | enum LibcallImpl : unsigned short {
      |      ^~~~~~~~~~~
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:2587:18: error: redefinition of 'constexpr const size_t llvm::RTLIB::NumLibcallImpls'
 2587 | constexpr size_t NumLibcallImpls = 1743;
      |                  ^~~~~~~~~~~~~~~
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:2587:18: note: 'constexpr const size_t llvm::RTLIB::NumLibcallImpls' previously defined here
 2587 | constexpr size_t NumLibcallImpls = 1743;
      |                  ^~~~~~~~~~~~~~~
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:9466:17: error: 'Name' was not declared in this scope
 9466 |   size_t Size = Name.size();
      |                 ^~~~
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:9467:3: error: expected unqualified-id before 'if'
 9467 |   if (Size == 0 || Size > 53)
      |   ^~
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:9469:2: error: expected unqualified-id before 'return'
 9469 |  return lookupLibcallImplNameImpl(Name);
      |  ^~~~~~
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc: In member function 'void llvm::RTLIB::RuntimeLibcallsInfo::setTargetRuntimeLibcallSets(const llvm::Triple&, llvm::ExceptionHandling, llvm::FloatABI::ABIType, llvm::EABI, llvm::StringRef)':
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:23006:57: warning: enumerated and non-enumerated type in conditional expression [-Wextra]
23006 |         setLibcallImplCallingConv(Impl, TT.isWatchABI() ? DefaultCC :
      |                                         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
23007 |     (isAAPCS_ABI(TT, ABIName) ? CallingConv::ARM_AAPCS : CallingConv::ARM_APCS));
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:23019:57: warning: enumerated and non-enumerated type in conditional expression [-Wextra]
23019 |         setLibcallImplCallingConv(Impl, TT.isWatchABI() ? DefaultCC :
      |                                         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
23020 |     (isAAPCS_ABI(TT, ABIName) ? CallingConv::ARM_AAPCS : CallingConv::ARM_APCS));
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/llvm-src-22.0.0-unstable-2025-10-19/llvm/build/include/llvm/IR/RuntimeLibcalls.inc:23034:57: warning: enumerated and non-enumerated type in conditional expression [-Wextra]
23034 |         setLibcallImplCallingConv(Impl, TT.isWatchABI() ? DefaultCC :
      |                                         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
23035 |     (isAAPCS_ABI(TT, ABIName) ? CallingConv::ARM_AAPCS : CallingConv::ARM_APCS));
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions