fix the "is valid for C/ObjC but not for C++" warnings

This commit is contained in:
Alug committed 2025-08-02 01:49:48 +02:00
1 parent 531e41689e
commit 03f7acafe3
2 files changed
+25 -8

No files matched your search

+19 -4
View File
@@ -274,10 +274,11 @@ opts+=$(debug_opts)
opts+=$(foreach v,$(passthru_opts),$(if $($(v)),-D$(v)))
opts+=$(WFLAGS) $(CPPFLAGS) $(CFLAGS)
cxxopts:=$(opts) $(CXXFLAGS)
CXXFLAGS+=-std=c++17 # force c17 for c++ since most vpss run older ubuntu versions with old compilers
cxxopts+=-std=c++17 # force c17 for c++ since most vpss run older ubuntu versions with old compilers
opts+=$(WFLAGS) $(CFLAGS)
cxxopts:=$(opts) $(CXXFLAGS)
opts+=$(CWFLAGS) # warning flags that shouldnt be passed to c++ compiler
libs+=$(LDFLAGS) -lstdc++ -lpthread
asflags:=$(ASFLAGS) -x assembler-with-cpp
@@ -393,9 +394,23 @@ endif
endef
$(eval $(call _recipe,c))
$(eval $(call _recipe,cpp))
$(eval $(call _recipe,s,$(asflags)))
# c++ dependency recipe template
# 1: source file suffix
# 2: extra flags to gcc
define _recipe =
$(depdir)/%.d : %.$(1) | $$$$(@D)/
ifndef WINDOWSHELL
ifdef Echo_name
@printf '%-20.20s\r' $$<
endif
endif
$(.)$(cxx) -MM -MF $$@ -MT $(objdir)/$$*.o $(2) $$<
endef
$(eval $(call _recipe,cpp))
# compiling recipe template
# 1: target file suffix
# 2: source file suffix
+6 -4
View File
@@ -41,7 +41,8 @@ ifdef GCC41
WFLAGS+=-Wshadow
endif
#WFLAGS+=-Wlarger-than-%len%
WFLAGS+=-Wpointer-arith -Wbad-function-cast
WFLAGS+=-Wpointer-arith
CWFLAGS+=-Wbad-function-cast
ifdef GCC45
#WFLAGS+=-Wc++-compat
endif
@@ -71,9 +72,10 @@ endif
endif
#WFLAGS+=-Wstrict-prototypes
ifdef GCC40
WFLAGS+=-Wold-style-definition
CWFLAGS+=-Wold-style-definition
endif
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
WFLAGS+=-Wmissing-declarations
CWFLAGS+=-Wmissing-prototypes
ifdef GCC40
WFLAGS+=-Wmissing-field-initializers
endif
@@ -84,7 +86,7 @@ endif
#WFLAGS+=-Wpacked
#WFLAGS+=-Wpadded
#WFLAGS+=-Wredundant-decls
WFLAGS+=-Wnested-externs
CWFLAGS+=-Wnested-externs
#WFLAGS+=-Wunreachable-code
WFLAGS+=-Winline
ifdef DEBUGMODE