diff options
| author | ruki <[email protected]> | 2022-11-05 21:36:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-11-05 21:36:17 +0800 |
| commit | 5796e77bdb782277ecc82090496aebcea65aa87f (patch) | |
| tree | 1f442c835356e8b93dec6167466e903eb025c6c3 /xmake/modules | |
| parent | 7c5bd94cde348e8d656a0cb577bef83c7e20a070 (diff) | |
improve exceptions
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/core/tools/clang.lua | 22 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 11 |
2 files changed, 23 insertions, 10 deletions
diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index 08822e367..521f31361 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -142,3 +142,25 @@ function nf_symbol(self, level) return _super.nf_symbol(self, level) end end + +-- make the exception flag +-- +-- e.g. +-- set_exceptions("cxx") +-- set_exceptions("objc") +-- set_exceptions("no-cxx") +-- set_exceptions("no-objc") +-- set_exceptions("cxx", "objc") +function nf_exception(self, exp) + local maps = { + cxx = "-fcxx-exceptions", + ["no-cxx"] = "-fno-cxx-exceptions", + objc = "-fobjc-exceptions", + ["no-objc"] = "-fno-objc-exceptions" + } + local value = maps[exp] + if value then + return {exp:startswith("no-") and "-fno-exceptions" or "-fexceptions", value} + end +end + diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index cd11743c7..412a0cdbf 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -311,16 +311,7 @@ end -- set_exceptions("no-objc") -- set_exceptions("cxx", "objc") function nf_exception(self, exp) - local maps = { - cxx = "-fcxx-exceptions", - ["no-cxx"] = "-fno-cxx-exceptions", - objc = "-fobjc-exceptions", - ["no-objc"] = "-fno-objc-exceptions" - } - local value = maps[exp] - if value then - return {exp:startswith("no-") and "-fno-exceptions" or "-fexceptions", value} - end + return exp:startswith("no-") and "-fno-exceptions" or "-fexceptions" end -- make the c precompiled header flag |
