aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libtcc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libtcc.c b/libtcc.c
index 58dddb9..68c3f9d 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1657,6 +1657,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
int optind = 0;
int run = 0;
int x;
+ int last_o = -1;
CString linker_arg; /* collect -Wl options */
char buf[1024];
@@ -1887,9 +1888,7 @@ reparse:
tcc_warning("unsupported language '%s'", optarg);
break;
case TCC_OPTION_O:
- x = atoi(optarg);
- if (x > 0)
- tcc_define_symbol(s, "__OPTIMIZE__", NULL);
+ last_o = atoi(optarg);
break;
case TCC_OPTION_mms_bitfields:
s->ms_bitfields = 1;
@@ -1908,6 +1907,9 @@ unsupported_option:
}
}
+ if (last_o > 0)
+ tcc_define_symbol(s, "__OPTIMIZE__", NULL);
+
if (linker_arg.size) {
r = linker_arg.data;
goto arg_err;