aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cli.c4
-rw-r--r--src/common.c8
-rw-r--r--src/common.h1
3 files changed, 11 insertions, 2 deletions
diff --git a/src/cli.c b/src/cli.c
index cd5e1d9..7fe2119 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -61,8 +61,8 @@ CliArgs* parse_cli_args(int argc, char** argv) {
} else if (strcmp(argv[i], "--version") == 0) {
print_version();
exit(0);
- } else if (strcmp(argv[i], "-std=gnu23") == 0) {
- // ignore -std=gnu23
+ } else if (str_starts_with(argv[i], "-std=")) {
+ // ignore -std=*
} else if (strcmp(argv[i], "--wasm") == 0) {
opt_wasm = true;
} else {
diff --git a/src/common.c b/src/common.c
index 61b2805..af35064 100644
--- a/src/common.c
+++ b/src/common.c
@@ -13,6 +13,14 @@ void fatal_error(const char* msg, ...) {
exit(1);
}
+bool str_starts_with(const char* s, const char* prefix) {
+ size_t l1 = strlen(s);
+ size_t l2 = strlen(prefix);
+ if (l1 < l2)
+ return false;
+ return strncmp(s, prefix, l2) == 0;
+}
+
bool str_ends_with(const char* s, const char* suffix) {
size_t l1 = strlen(s);
size_t l2 = strlen(suffix);
diff --git a/src/common.h b/src/common.h
index b6fc238..bb94e79 100644
--- a/src/common.h
+++ b/src/common.h
@@ -12,6 +12,7 @@ _Noreturn void fatal_error(const char* msg, ...);
#define unimplemented() fatal_error("%s:%d: unimplemented", __FILE__, __LINE__)
+bool str_starts_with(const char* s, const char* prefix);
bool str_ends_with(const char* s, const char* suffix);
typedef struct {