aboutsummaryrefslogtreecommitdiff
path: root/src/tomo.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-26 01:53:38 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-26 01:53:38 -0400
commitc77380f353e85bcd9ba03c29b292022c694b9667 (patch)
tree363173a15204b18416de1cce953b6cd7197d3582 /src/tomo.c
parent878976eccf34de81b03611915485ff22ed0f819f (diff)
Add `--version` flag to show current compiler version's git commit date
and hash
Diffstat (limited to 'src/tomo.c')
-rw-r--r--src/tomo.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tomo.c b/src/tomo.c
index 9f273ab3..f0b4cfca 100644
--- a/src/tomo.c
+++ b/src/tomo.c
@@ -54,6 +54,7 @@ static OptionalList_t files = NONE_LIST,
uninstall = NONE_LIST,
libraries = NONE_LIST;
static OptionalBool_t verbose = false,
+ show_version = false,
quiet = false,
show_parse_tree = false,
stop_at_transpile = false,
@@ -163,6 +164,7 @@ int main(int argc, char *argv[])
{"args", true, List$info(&Text$info), &args},
{"verbose", false, &Bool$info, &verbose},
{"v", false, &Bool$info, &verbose},
+ {"version", false, &Bool$info, &show_version},
{"parse", false, &Bool$info, &show_parse_tree},
{"p", false, &Bool$info, &show_parse_tree},
{"quiet", false, &Bool$info, &quiet},
@@ -190,6 +192,11 @@ int main(int argc, char *argv[])
{"m", false, &Bool$info, &source_mapping},
);
+ if (show_version) {
+ print("Tomo version: ", TOMO_VERSION);
+ return 0;
+ }
+
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"