summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-02-02 22:48:27 +0800
committerruki <[email protected]>2023-02-02 22:48:27 +0800
commit8e993a27b90ae09dc0e2dbed4b4a21a30f926a87 (patch)
tree727842ffb3b35f75b34e59ad6a8523e5fc193e61
parent1e6070141e6fd21d7dc4cf3e7c70755efd6f0171 (diff)
add asflags checker
-rw-r--r--xmake/plugins/check/checker.lua1
-rw-r--r--xmake/plugins/check/checkers/api/target/asflags.lua33
2 files changed, 34 insertions, 0 deletions
diff --git a/xmake/plugins/check/checker.lua b/xmake/plugins/check/checker.lua
index bf7b87397..9d0526bd4 100644
--- a/xmake/plugins/check/checker.lua
+++ b/xmake/plugins/check/checker.lua
@@ -43,6 +43,7 @@ function checkers()
["api.target.cflags"] = {description = "Check c compiler flags configuration in target."},
["api.target.cxflags"] = {description = "Check c/c++ compiler flags configuration in target."},
["api.target.cxxflags"] = {description = "Check c++ compiler flags configuration in target."},
+ ["api.target.asflags"] = {description = "Check assembler flags configuration in target."},
["api.target.ldflags"] = {description = "Check binary linker flags configuration in target."},
["api.target.shflags"] = {description = "Check shared library linker flags configuration in target."},
-- clang tidy checker
diff --git a/xmake/plugins/check/checkers/api/target/asflags.lua b/xmake/plugins/check/checkers/api/target/asflags.lua
new file mode 100644
index 000000000..ad98a329b
--- /dev/null
+++ b/xmake/plugins/check/checkers/api/target/asflags.lua
@@ -0,0 +1,33 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file asflags.lua
+--
+
+-- imports
+import("core.tool.compiler")
+import(".api_checker")
+
+function main()
+ api_checker.check_targets("asflags", {check = function(target, value)
+ local compinst = target:compiler("as")
+ if not compinst:has_flags(value) then
+ return false, string.format("%s: unknown assembler flag '%s'", compinst:name(), value)
+ end
+ return true
+ end})
+end