Skip to content

mk: Add clang specific flag more selectively. #14384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions mk/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ endef
$(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS,\
$(eval $(call SET_FROM_CFG,$(cvar))))

ifeq ($(CFG_USING_CLANG),1)
# The -Qunused-arguments sidesteps spurious warnings from clang
CFLAGS += -Qunused-arguments
CXXFLAGS += -Qunused-arguments
CPPFLAGS += -Qunused-arguments
endif

CFG_RLIB_GLOB=lib$(1)-*.rlib

# x86_64-unknown-linux-gnu configuration
Expand Down Expand Up @@ -516,6 +509,21 @@ CFG_LDPATH_x86_64-unknown-freebsd :=
CFG_RUN_x86_64-unknown-freebsd=$(2)
CFG_RUN_TARG_x86_64-unknown-freebsd=$(call CFG_RUN_x86_64-unknown-freebsd,,$(2))


# The -Qunused-arguments sidesteps spurious warnings from clang
define FILTER_FLAGS
ifeq ($$(CFG_USING_CLANG),1)
ifneq ($(findstring clang,$$(shell $(CC_$(1)) -v)),)
CFG_GCCISH_CFLAGS_$(1) += -Qunused-arguments
CFG_GCCISH_CXXFLAGS_$(1) += -Qunused-arguments
endif
endif
endef

$(foreach target,$(CFG_TARGET),\
$(eval $(call FILTER_FLAGS,$(target))))


ifeq ($(CFG_CCACHE_CPP2),1)
CCACHE_CPP2=1
export CCACHE_CPP
Expand Down