From e3315ea99ef056fe9a68e27203e4dbb5b4985258 Mon Sep 17 00:00:00 2001 From: --global Date: Sun, 24 Sep 2023 19:56:26 +0300 Subject: [PATCH] Upgraded to clang++ 17 --- Makefile | 27 +++++++++++++++------------ json4cpp | 2 +- net4cpp | 2 +- std | 2 +- yar/yardb.c++ | 6 +++--- yar/yarproxy.c++ | 14 +++++++------- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 4e1b012..9191ca4 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .SUFFIXES: -.SUFFIXES: .cpp .hpp .c++ .c++m .impl.c++ .test.c++ .o .impl.o .test.o +.SUFFIXES: .cpp .hpp .c++ .c++m .impl.c++ .test.c++ .o .impl.o .test.o .DEFAULT_GOAL = all ifndef OS @@ -7,17 +7,17 @@ OS = $(shell uname -s) endif ifeq ($(OS),Linux) -CC = /usr/lib/llvm-15/bin/clang -CXX = /usr/lib/llvm-15/bin/clang++ -CXXFLAGS = -pthread -I/usr/lib/llvm-15/include/c++/v1 -LDFLAGS = -lc++ -lc++experimental -L/usr/lib/llvm-15/lib/c++ +CC = /usr/lib/llvm-17/bin/clang +CXX = /usr/lib/llvm-17/bin/clang++ +CXXFLAGS = -pthread -I/usr/lib/llvm-17/include/c++/v1 +LDFLAGS = -lc++ -L/usr/lib/llvm-17/lib/c++ endif ifeq ($(OS),Darwin) CC = /opt/homebrew/opt/llvm/bin/clang CXX = /opt/homebrew/opt/llvm/bin/clang++ CXXFLAGS =-I/opt/homebrew/opt/llvm/include/c++/v1 -LDFLAGS = -L/opt/homebrew/opt/llvm/lib/c++ +LDFLAGS = -L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++ endif ifeq ($(OS),Github) @@ -27,11 +27,15 @@ CXXFLAGS = -I/usr/local/opt/llvm/include/ -I/usr/local/opt/llvm/include/c++/v1 LDFLAGS = -L/usr/local/opt/llvm/lib/c++ -Wl,-rpath,/usr/local/opt/llvm/lib/c++ endif -CXXFLAGS += -std=c++20 -stdlib=libc++ -fexperimental-library -CXXFLAGS += -fprebuilt-module-path=$(moduledir) +CXXFLAGS += -std=c++20 -stdlib=libc++ CXXFLAGS += -Wall -Wextra CXXFLAGS += -I$(sourcedir) -I$(includedir) -LDFLAGS += -fuse-ld=lld -fexperimental-library +LDFLAGS += -fuse-ld=lld + +PCMFLAGS += -fno-implicit-modules -fno-implicit-module-maps +PCMFLAGS += -fmodule-file=std=./pcm/std.pcm -fmodule-file=net=./pcm/net.pcm -fmodule-file=xson=./pcm/xson.pcm +PCMFLAGS += $(foreach P, $(foreach M, $(modules), $(basename $(notdir $(M)))), -fmodule-file=$(subst -,:,$(P))=./pcm/$(P).pcm) +CXXFLAGS += $(PCMFLAGS) export CC export CXX @@ -67,12 +71,11 @@ $(moduledir)/%.pcm: $(sourcedir)/%.c++m $(objectdir)/%.o: $(moduledir)/%.pcm @mkdir -p $(@D) - $(CXX) $< -c -o $@ + $(CXX) $(PCMFLAGS) $< -c -o $@ $(objectdir)/%.impl.o: $(sourcedir)/%.impl.c++ @mkdir -p $(@D) - $(CXX) $(CXXFLAGS) $< -fmodule-file=$(moduledir)/yar.pcm -c -o $@ -# $(CXX) $(CXXFLAGS) $< -fmodule-file=$(objectdir)/$(basename $(basename $(@F))).pcm -c -o $@ + $(CXX) $(CXXFLAGS) $< -fmodule-file=$(basename $(basename $(@F)))=$(moduledir)/$(basename $(basename $(@F))).pcm -c -o $@ $(objectdir)/%.test.o: $(sourcedir)/%.test.c++ @mkdir -p $(@D) diff --git a/json4cpp b/json4cpp index 45ac5b6..eeafdbc 160000 --- a/json4cpp +++ b/json4cpp @@ -1 +1 @@ -Subproject commit 45ac5b603967f22d1cc85370c3192c82ee485020 +Subproject commit eeafdbccdbffdd8843b3cb4450774227a527f4b2 diff --git a/net4cpp b/net4cpp index 2c1264c..4331063 160000 --- a/net4cpp +++ b/net4cpp @@ -1 +1 @@ -Subproject commit 2c1264c0bafeecdc1e6f9b22788a7b8ad379dcc5 +Subproject commit 43310637e0d2ddd1f52cd04ca14d1308eb187104 diff --git a/std b/std index 0bd7cc3..41681fd 160000 --- a/std +++ b/std @@ -1 +1 @@ -Subproject commit 0bd7cc3af614fc6db5a4e6d1bf2e40b44f20421d +Subproject commit 41681fd2b80d95706d785f98c314cd02db5359a8 diff --git a/yar/yardb.c++ b/yar/yardb.c++ index c670427..189f269 100644 --- a/yar/yardb.c++ +++ b/yar/yardb.c++ @@ -17,7 +17,7 @@ try const auto arguments = span(argv,argc).subspan(1); auto file = "yar.db"s; auto service_or_port = "2112"s; - slog.tag("YarDB"); + slog.appname("YarDB"); slog.level(net::syslog::severity::debug); for(string_view option : arguments) @@ -29,12 +29,12 @@ try else if(option.starts_with("--slog_tag=")) { option.remove_prefix(option.find_first_not_of("--slog_tag=")); - slog.tag(option); + slog.appname(option); } else if(option.starts_with("--slog_level=")) { option.remove_prefix(option.find_first_not_of("--slog_level=")); - auto mask = 0; + auto mask = 0u; auto [ptr,ec] = std::from_chars(option.begin(),option.end(),mask); if(ec != std::errc() or ptr != option.end()) { diff --git a/yar/yarproxy.c++ b/yar/yarproxy.c++ index 084d53d..495762e 100644 --- a/yar/yarproxy.c++ +++ b/yar/yarproxy.c++ @@ -69,14 +69,14 @@ inline void handle(auto& client, auto& replicas) if(method == "GET"s || method == "HEAD"s) { const auto lock = ext::make_lock(replicas); - ranges::any_of(replicas, request_and_response); - ranges::rotate(replicas, ++ranges::begin(replicas)); + [[maybe_unused]] auto r1 = ranges::any_of(replicas, request_and_response); + [[maybe_unused]] auto r2 = ranges::rotate(replicas, ++ranges::begin(replicas)); } else { const auto lock = ext::make_lock(replicas); - ranges::all_of(replicas, request); - ranges::all_of(replicas, response); + [[maybe_unused]] auto r1 = ranges::all_of(replicas, request); + [[maybe_unused]] auto r2 = ranges::all_of(replicas, response); } buffer.seekg(0) >> stream; @@ -94,7 +94,7 @@ try const auto arguments = span(argv,argc).subspan(1); auto replicas = replica_set{}; auto service_or_port = "2113"s; - slog.tag("YarPROXY"); + slog.appname("YarPROXY"); slog.level(net::syslog::severity::debug); for(string_view option : arguments) @@ -106,12 +106,12 @@ try else if(option.starts_with("--slog_tag=")) { option.remove_prefix(option.find_first_not_of("--slog_tag=")); - slog.tag(option); + slog.appname(option); } else if(option.starts_with("--slog_level=")) { option.remove_prefix(option.find_first_not_of("--slog_level=")); - auto mask = 0; + auto mask = 0u; auto [ptr,ec] = std::from_chars(option.begin(),option.end(),mask); if(ec != std::errc() or ptr != option.end()) {