summaryrefslogtreecommitdiffstatshomepage
path: root/scripts/genie.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/genie.lua')
-rw-r--r--scripts/genie.lua41
1 files changed, 37 insertions, 4 deletions
diff --git a/scripts/genie.lua b/scripts/genie.lua
index 0c1a6abb179..a9f6f11be05 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -387,6 +387,11 @@ newoption {
}
newoption {
+ trigger = "SANITIZE",
+ description = "Specifies the santizer(s) to use."
+}
+
+newoption {
trigger = "PROJECT",
description = "Select projects to be built. Will look into project folder for files.",
}
@@ -950,14 +955,42 @@ end
buildoptions_cpp {
"-Woverloaded-virtual",
}
-
---ifdef SANITIZE
---CCOMFLAGS += -fsanitize=$(SANITIZE)
+
+if _OPTIONS["SANITIZE"] then
+ buildoptions {
+ "-fsanitize=".. _OPTIONS["SANITIZE"]
+ }
+ linkoptions {
+ "-fsanitize=".. _OPTIONS["SANITIZE"]
+ }
+ if string.find(_OPTIONS["SANITIZE"], "address") then
+ buildoptions {
+ "-fsanitize-address-use-after-scope"
+ }
+ linkoptions {
+ "-fsanitize-address-use-after-scope"
+ }
+ end
+ if string.find(_OPTIONS["SANITIZE"], "undefined") then
+ -- 'function' produces errors without delegates by design
+ -- 'alignment' produces a lot of errors which we are not interested in
+ -- 'nullability' errors are not actually undefined behavior but unintentional
+ buildoptions {
+ "-fno-sanitize=function",
+ "-fno-sanitize=alignment",
+ "-fsanitize=nullability"
+ }
+ linkoptions {
+ "-fno-sanitize=function",
+ "-fno-sanitize=alignment",
+ "-fsanitize=nullability"
+ }
+ end
+end
--ifneq (,$(findstring thread,$(SANITIZE)))
--CCOMFLAGS += -fPIE
--endif
---endif