diff options
| author | ruki <[email protected]> | 2026-03-26 22:48:11 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-03-26 22:48:11 +0800 |
| commit | 1a4df91ebd7250f30a57a7563f5edd5c850f3059 (patch) | |
| tree | 24cc8d1578f5e36d7fe070f983a03d2e0483bb53 | |
| parent | fe60194acb7098fc0824bea9b653fb5a28114a3d (diff) | |
revert gcc has_flags
| -rw-r--r-- | xmake/modules/core/tools/gcc/has_flags.lua | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/xmake/modules/core/tools/gcc/has_flags.lua b/xmake/modules/core/tools/gcc/has_flags.lua index 32662e1a0..5539fc0f4 100644 --- a/xmake/modules/core/tools/gcc/has_flags.lua +++ b/xmake/modules/core/tools/gcc/has_flags.lua @@ -50,28 +50,19 @@ function _check_from_knownargs(flags, opt, islinker) local flag = flags[1] local known_flags = _g.known_flags if known_flags == nil then - known_flags = hashset.from({ - "-O", "-O0", "-O1", "-O2", "-O3", "-Os", - "-g", "-g0", "-g1", "-g2", "-g3", - "-c", "-S", "-E", "-v", - "-pipe", "-pthread", "-shared", "-static", - "-fPIC", "-fPIE", "-fpic", "-fpie", - "-fno-exceptions", "-fexceptions", - "-fno-rtti", "-frtti", - "-fomit-frame-pointer", "-fno-omit-frame-pointer", - "-ffunction-sections", "-fdata-sections", - "-fno-strict-aliasing", "-fstrict-aliasing", - "-fstack-protector", "-fno-stack-protector", - "-fno-common", - "-MMD", "-MD", "-MP", - "-Wall", "-Wextra", "-Werror", "-pedantic", - "-w" - }) + known_flags = hashset.from({"-O", "-O0", "-O1", "-O2", "-O3", "-Os", "-g"}) _g.known_flags = known_flags end if known_flags:has(flag) then return true end + if not islinker then + if flag:startswith("-D") or + flag:startswith("-U") or + flag:startswith("-I") then + return true + end + end end -- attempt to check it from the argument list |
