diff options
| author | Michael Matz <matz@suse.de> | 2016-10-17 20:50:54 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-12-15 17:49:55 +0100 |
| commit | 7ae35bf1bb21858c369ab09f5562ecd30847f669 (patch) | |
| tree | 3b1696cca7b80e4e859d6aadb69e60c2f3e0f494 /libtcc.c | |
| parent | a158260e842fcfe2b49c3dc2ebc212e3fc5f3d90 (diff) | |
| download | tinycc-7ae35bf1bb21858c369ab09f5562ecd30847f669.tar.gz tinycc-7ae35bf1bb21858c369ab09f5562ecd30847f669.tar.bz2 | |
Handle multiple -O options
the last one wins, i.e. "-O2 -O0" does _not_ set __OPTIMIZ__.
Diffstat (limited to 'libtcc.c')
| -rw-r--r-- | libtcc.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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; |
