diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-28 17:17:58 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-28 17:17:58 -0400 |
| commit | bc3667cc3de2a6df699a61b4549037c84f75fe03 (patch) | |
| tree | 6137a5f9f77553afbfa350674b6de7674a17b869 | |
| parent | c4533e5706838222bf8de094a06c40202566de0e (diff) | |
Conditional flags for running tomo with clang vs gcc
| -rw-r--r-- | src/tomo.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -106,9 +106,6 @@ int main(int argc, char *argv[]) #ifdef __OpenBSD__ ldlibs = Texts(ldlibs, Text(" -lexecinfo -lpthread")); -#else - cflags = Texts(cflags, Text(" -fsanitize=signed-integer-overflow -fno-sanitize-recover" - " -fno-signaling-nans -fno-trapping-math")); #endif USE_COLOR = getenv("COLOR") ? strcmp(getenv("COLOR"), "1") == 0 : isatty(STDOUT_FILENO); @@ -171,6 +168,12 @@ int main(int argc, char *argv[]) {"f", false, &Bool$info, &clean_build}, ); + bool is_gcc = (system(String(cc, " -v 2>&1 | grep 'gcc version' >/dev/null")) == 0); + if (is_gcc) { + cflags = Texts(cflags, Text(" -fsanitize=signed-integer-overflow -fno-sanitize-recover" + " -fno-signaling-nans -fno-trapping-math")); + } + if (show_codegen.length > 0 && Text$equal_values(show_codegen, Text("pretty"))) show_codegen = Text("sed '/^#line/d;/^$/d' | indent -o /dev/stdout | bat -l c -P"); |
