[clang] Switch builtin strings to use string tables (PR #118734)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 6 04:06:18 PST 2024


https://github.com/nikic requested changes to this pull request.

Fails to build with GCC:
```

FAILED: tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Builtins.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/llvm-project-build-stage1/tools/clang/lib/Basic -I/var/llvm-compile-time-tracker/llvm-project/clang/lib/Basic -I/var/llvm-compile-time-tracker/llvm-project/clang/include -I/tmp/llvm-project-build-stage1/tools/clang/include -I/tmp/llvm-project-build-stage1/include -I/var/llvm-compile-time-tracker/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -std=c++17 -MD -MT tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Builtins.cpp.o -MF tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Builtins.cpp.o.d -o tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Builtins.cpp.o -c /var/llvm-compile-time-tracker/llvm-project/clang/lib/Basic/Builtins.cpp
In file included from /var/llvm-compile-time-tracker/llvm-project/clang/lib/Basic/Builtins.cpp:13:
/var/llvm-compile-time-tracker/llvm-project/clang/include/clang/Basic/Builtins.h:137:3: error: ‘#pragma’ is not allowed here
  137 |   _Pragma("GCC diagnostic push")                                               \
      |   ^~~~~~~
/var/llvm-compile-time-tracker/llvm-project/clang/include/clang/Basic/Builtins.h:149:3: note: in expansion of macro ‘CLANG_BUILTIN_DETAIL_STR_TABLE’
  149 |   CLANG_BUILTIN_DETAIL_STR_TABLE(#ID "\0" TYPE "\0" ATTRS "\0" /*FEATURE*/ "\0")
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/llvm-compile-time-tracker/llvm-project/clang/lib/Basic/Builtins.cpp:34:9: note: in expansion of macro ‘CLANG_BUILTIN_STR_TABLE’
   34 |         CLANG_BUILTIN_STR_TABLE("not a builtin function", "", "")
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/var/llvm-compile-time-tracker/llvm-project/clang/lib/Basic/Builtins.cpp: In member function ‘std::pair<const char*, const clang::Builtin::Info&> clang::Builtin::Context::getStrTableAndInfo(unsigned int) const’:
/var/llvm-compile-time-tracker/llvm-project/clang/lib/Basic/Builtins.cpp:48:65: error: could not convert ‘{<expression error>, <expression error>}’ from ‘<brace-enclosed initializer list>’ to ‘std::pair<const char*, const clang::Builtin::Info&>’
   48 |     return {BuiltinStorage.StringTable, BuiltinStorage.Infos[ID]};
      |                                                                 ^
      |                                                                 |
      |                                                                 <brace-enclosed initializer list>
```

https://github.com/llvm/llvm-project/pull/118734


More information about the cfe-commits mailing list