aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-13 14:25:13 +0100
committerlemon <lsof@mailbox.org>2025-12-13 14:25:13 +0100
commitf403e250bf4474cead6a6cbe5e917488f39163e9 (patch)
tree4665b86a397692ce0204301a82d0bf5df3e64cd7 /main.c
parent854df54e1839c8b96d1aaa9aeaa32c2ebbf535f8 (diff)
Add -O optimization flag
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main.c b/main.c
index 9cf55af..5fa90fd 100644
--- a/main.c
+++ b/main.c
@@ -185,6 +185,10 @@ optparse(char **args)
}
} else if (*arg == 'g') {
/* TODO debug info */
+ } else if (*arg == 'O') {
+ if (!arg[1] || (uint)arg[1] - '1' < 9) ccopt.o = OPT1;
+ else if (arg[1] == '0') ccopt.o = OPT0;
+ else goto Bad;
} else if (*arg == 'D' || *arg == 'U') {
void cpppredef(bool undef, const char *cmd);
const char *def = arg[1] ? arg+1 : *++args;
@@ -510,6 +514,8 @@ prihelp(void)
" -llib \tLink with library\n"
" -fpie \tEmit code for position independent executable\n"
" -fpic \tEmit position independent code\n"
+ " -O0 \tTurn off optimizations\n"
+ " -O1 \tTurn on more optimizations\n"
" -x[c|o] \tSpecify type of next input file (C, object)\n"
);
}