Skip to content

Commit 3bec8d7

Browse files
committed
auto merge of #14384 : luqmana/rust/mca, r=alexcrichton
Only add `-Qunused-arguments` for clang.
2 parents 9c870b3 + 69e246f commit 3bec8d7

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

mk/platform.mk

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,6 @@ endef
9797
$(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS,\
9898
$(eval $(call SET_FROM_CFG,$(cvar))))
9999

100-
ifeq ($(CFG_USING_CLANG),1)
101-
# The -Qunused-arguments sidesteps spurious warnings from clang
102-
CFLAGS += -Qunused-arguments
103-
CXXFLAGS += -Qunused-arguments
104-
CPPFLAGS += -Qunused-arguments
105-
endif
106-
107100
CFG_RLIB_GLOB=lib$(1)-*.rlib
108101

109102
# x86_64-unknown-linux-gnu configuration
@@ -516,6 +509,21 @@ CFG_LDPATH_x86_64-unknown-freebsd :=
516509
CFG_RUN_x86_64-unknown-freebsd=$(2)
517510
CFG_RUN_TARG_x86_64-unknown-freebsd=$(call CFG_RUN_x86_64-unknown-freebsd,,$(2))
518511

512+
513+
# The -Qunused-arguments sidesteps spurious warnings from clang
514+
define FILTER_FLAGS
515+
ifeq ($$(CFG_USING_CLANG),1)
516+
ifneq ($(findstring clang,$$(shell $(CC_$(1)) -v)),)
517+
CFG_GCCISH_CFLAGS_$(1) += -Qunused-arguments
518+
CFG_GCCISH_CXXFLAGS_$(1) += -Qunused-arguments
519+
endif
520+
endif
521+
endef
522+
523+
$(foreach target,$(CFG_TARGET),\
524+
$(eval $(call FILTER_FLAGS,$(target))))
525+
526+
519527
ifeq ($(CFG_CCACHE_CPP2),1)
520528
CCACHE_CPP2=1
521529
export CCACHE_CPP

0 commit comments

Comments
 (0)