Skip to content

Commit 412256e

Browse files
committed
fix: add extra flags based on clang and some additional flags
1 parent e47dcad commit 412256e

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/Makefile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,27 @@ ifneq ($(filter fast staticfast,$(MAKECMDGOALS)),)
9090
OPTFLAGS += $(OPTFLAGS_SPECIFIC)
9191
endif
9292

93-
CXXFLAGS := -std=c++17 -Wall $(OPTFLAGS) $(CXXFLAGS_SPECIFIC)
93+
94+
### Suppress specific warnings for clang
95+
COMPILER_NAME := $(shell $(CPP) --version | head -n 1)
96+
ifeq ($(findstring clang,$(COMPILER_NAME)),clang)
97+
CLANG_VERSION_MAJOR := $(shell $(CPP) -dumpversion | cut -d. -f1)
98+
ifneq (,$(filter $(CLANG_VERSION_MAJOR),17 18 19 20))
99+
CLANG_VLA_FLAG := -Wno-vla-cxx-extension
100+
else
101+
CLANG_VLA_FLAG := -Wno-vla-extension
102+
endif
103+
endif
104+
105+
EXTRA_WARN_SUPPRESS := \
106+
-Wno-unused-parameter \
107+
-Wno-unused-variable \
108+
-Wno-sign-compare \
109+
-Wno-reorder-ctor \
110+
-Wno-unused-function
111+
112+
113+
CXXFLAGS := -std=c++17 -Wall $(OPTFLAGS) $(CXXFLAGS_SPECIFIC) $(CLANG_VLA_FLAG) $(EXTRA_WARN_SUPPRESS)
94114
ICFLAGS := -I$(GSLINCDIR) -I$(BOOSTINCDIR) -I$(HDF5INCDIR) -I.
95115

96116
LIBS := -lm -lz -ldl -lpthread

0 commit comments

Comments
 (0)