From 6ce2ac20e1d9095281a233aeb778d0fa2c82dd74 Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 4 Jun 2023 23:26:06 +0200 Subject: better diagnostics --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 2404fd5..d56cd50 100644 --- a/main.c +++ b/main.c @@ -33,12 +33,14 @@ optparse(const char **file, const char **targ, char **args) continue; } if ((x = optval(arg, "std"))) { - if (!strcmp(x, "c89")) ccopt.cstd = STDC89; + if (!strcmp(x, "c89") || !strcmp(x, "c90")) ccopt.cstd = STDC89; else if (!strcmp(x, "c99")) ccopt.cstd = STDC99; else if (!strcmp(x, "c11")) ccopt.cstd = STDC11; else if (!strcmp(x, "c2x")) ccopt.cstd = STDC23; else if (!strcmp(x, "c23")) ccopt.cstd = STDC23; else goto Bad; + } else if (!strcmp(arg, "pedantic")) { + ccopt.pedant = 1; } else Bad: warn(NULL, "invalid option: %'s", arg-1); } } @@ -61,6 +63,7 @@ main(int argc, char **argv) atexit(flushstd); detectcolor(); + ccopt.cstd = STDC99; /* C99 by default */ optparse(&file, &targ, argv); if (!file) { efmt("usage: %s [options] \n", *argv); -- cgit v1.2.3