summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-06-19 14:25:52 +0800
committerruki <[email protected]>2017-06-19 14:25:52 +0800
commita7a3cc2feea64ced59e5c861f6d486adf6ec32b1 (patch)
treed251cf2e674aa51eeb04aa6f1b9cdececd3c0134
parentf2620eea847263299cae03a36726140152530291 (diff)
fix unused args errors for gcc/clang
-rw-r--r--xmake/platforms/linux/check.lua1
-rw-r--r--xmake/platforms/macosx/check.lua1
-rw-r--r--xmake/tools/clang.lua7
-rw-r--r--xmake/tools/gcc.lua14
4 files changed, 7 insertions, 16 deletions
diff --git a/xmake/platforms/linux/check.lua b/xmake/platforms/linux/check.lua
index 260c8ca9f..e734850f0 100644
--- a/xmake/platforms/linux/check.lua
+++ b/xmake/platforms/linux/check.lua
@@ -69,7 +69,6 @@ function _toolchains(config)
checker.toolchain_insert(toolchains, "cxx", "", "$(env CXX)", "the linker")
checker.toolchain_insert(toolchains, "ld", "", "$(env LD)", "the linker")
checker.toolchain_insert(toolchains, "ld", "", "$(env CXX)", "the linker")
- checker.toolchain_insert(toolchains, "ld", "", "$(env CC)", "the linker")
checker.toolchain_insert(toolchains, "ar", "", "$(env AR)", "the static library archiver")
checker.toolchain_insert(toolchains, "sh", "", "$(env SH)", "the shared library linker")
checker.toolchain_insert(toolchains, "mm", "", "$(env MM)", "the objc compiler")
diff --git a/xmake/platforms/macosx/check.lua b/xmake/platforms/macosx/check.lua
index aec349e4c..833087684 100644
--- a/xmake/platforms/macosx/check.lua
+++ b/xmake/platforms/macosx/check.lua
@@ -41,7 +41,6 @@ function _toolchains(config)
checker.toolchain_insert(toolchains, "cxx", "", "$(env CXX)", "the linker")
checker.toolchain_insert(toolchains, "ld", "", "$(env LD)", "the linker")
checker.toolchain_insert(toolchains, "ld", "", "$(env CXX)", "the linker")
- checker.toolchain_insert(toolchains, "ld", "", "$(env CC)", "the linker")
checker.toolchain_insert(toolchains, "ar", "", "$(env AR)", "the static library archiver")
checker.toolchain_insert(toolchains, "sh", "", "$(env SH)", "the shared library linker")
checker.toolchain_insert(toolchains, "cc", "xcrun -sdk macosx ", "clang", "the c compiler")
diff --git a/xmake/tools/clang.lua b/xmake/tools/clang.lua
index 7e3ce7d97..c49fb1b02 100644
--- a/xmake/tools/clang.lua
+++ b/xmake/tools/clang.lua
@@ -34,13 +34,6 @@ function init(shellname, kind)
-- init shflags
_super._g.shflags = { "-dynamiclib", "-fPIC" }
- -- link stdc++ for clang
- _super._g.ldflags = {}
- if _super._g.shellname:find("clang", 1, true) then
- table.insert(_super._g.ldflags, "-lstdc++")
- table.insert(_super._g.shflags, "-lstdc++")
- end
-
-- suppress warning
_super._g.cxflags = {"-Qunused-arguments"}
_super._g.mxflags = {"-Qunused-arguments"}
diff --git a/xmake/tools/gcc.lua b/xmake/tools/gcc.lua
index 17cc31072..16a85867f 100644
--- a/xmake/tools/gcc.lua
+++ b/xmake/tools/gcc.lua
@@ -49,17 +49,17 @@ function init(shellname, kind)
-- init shflags
_g.shflags = { "-shared", "-fPIC" }
- -- link stdc++ for gcc
- _g.ldflags = {}
- if _g.shellname:find("gcc", 1, true) then
- table.insert(_g.ldflags, "-lstdc++")
- table.insert(_g.shflags, "-lstdc++")
- end
-
-- init cxflags for the kind: shared
_g.shared = {}
_g.shared.cxflags = {"-fPIC"}
+ -- suppress warning for clang (gcc -> clang on macosx)
+ if try { function () check("-Qunused-arguments"); return true end } then
+ _g.cxflags = {"-Qunused-arguments"}
+ _g.mxflags = {"-Qunused-arguments"}
+ _g.asflags = {"-Qunused-arguments"}
+ end
+
-- init flags map
_g.mapflags =
{