Skip to content

Commit 9eab39c

Browse files
committed
build: patch nix cpp toolchain compatibility
1 parent a5bcc03 commit 9eab39c

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ endif()
4242

4343
include(limit_jobs)
4444
# Configure Seastar compile options to align with Scylla
45+
if(DEFINED ENV{NIX_CC})
46+
add_compile_definitions(FMT_USE_CONSTEVAL=0)
47+
endif()
4548
set(CMAKE_CXX_STANDARD "23" CACHE INTERNAL "")
4649
set(CMAKE_CXX_EXTENSIONS ON CACHE INTERNAL "")
4750
set(CMAKE_CXX_SCAN_FOR_MODULES OFF CACHE INTERNAL "")

cmake/mode.common.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(disabled_warnings
66
overloaded-virtual
77
unsupported-friend
88
enum-constexpr-conversion
9+
unnecessary-virtual-specifier
910
unused-parameter)
1011
include(CheckCXXCompilerFlag)
1112
foreach(warning ${disabled_warnings})

configure.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,7 @@ def get_warning_options(cxx):
15481548
'-Wno-unsupported-friend',
15491549
'-Wno-missing-field-initializers',
15501550
'-Wno-deprecated-copy',
1551+
'-Wno-unnecessary-virtual-specifier',
15511552
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77728
15521553
'-Wno-psabi',
15531554
'-Wno-enum-constexpr-conversion',
@@ -1675,6 +1676,9 @@ def dynamic_linker_option():
16751676
if args.target != '':
16761677
user_cflags += ' -march=' + args.target
16771678

1679+
if os.environ.get('NIX_CC'):
1680+
user_cflags += ' -DFMT_USE_CONSTEVAL=0'
1681+
16781682
for mode in modes:
16791683
# Those flags are passed not only to Scylla objects, but also to libraries
16801684
# that we compile ourselves.

flake.nix

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@
3939
lib = pkgs.lib;
4040
llvm = pkgs.llvmPackages;
4141

42+
antlr3Cpp = pkgs.antlr3.overrideAttrs (old: {
43+
postInstall = (old.postInstall or "") + ''
44+
sed -i \
45+
-e 's/const ANTLR_INT32[[:space:]]*m_decisionNumber;/ANTLR_INT32 m_decisionNumber;/' \
46+
-e 's/const ANTLR_INT32\* const[[:space:]]*m_eot;/const ANTLR_INT32* m_eot;/' \
47+
-e 's/const ANTLR_INT32\* const[[:space:]]*m_eof;/const ANTLR_INT32* m_eof;/' \
48+
-e 's/const ANTLR_INT32\* const[[:space:]]*m_min;/const ANTLR_INT32* m_min;/' \
49+
-e 's/const ANTLR_INT32\* const[[:space:]]*m_max;/const ANTLR_INT32* m_max;/' \
50+
-e 's/const ANTLR_INT32\* const[[:space:]]*m_accept;/const ANTLR_INT32* m_accept;/' \
51+
-e 's/const ANTLR_INT32\* const[[:space:]]*m_special;/const ANTLR_INT32* m_special;/' \
52+
-e 's/const ANTLR_INT32\* const \*const[[:space:]]*m_transition;/const ANTLR_INT32* const * m_transition;/' \
53+
"$out/include/antlr3cyclicdfa.hpp"
54+
'';
55+
});
56+
4257
pythonEnv = pkgs.python3.withPackages (
4358
ps: with ps; [
4459
aiohttp
@@ -107,7 +122,7 @@
107122
flake = true;
108123
shell = true;
109124
srcPath = self;
110-
antlr3Package = pkgs.antlr3;
125+
antlr3Package = antlr3Cpp;
111126
fmtPackage = pkgs.fmt_10.overrideAttrs (old: {
112127
cmakeFlags = (old.cmakeFlags or [ ]) ++ [
113128
"-DFMT_TEST=OFF"

0 commit comments

Comments
 (0)