History

Accept option "-Os" and define "__OPTIMIZE_SIZE__"

Some headers and source code change macros and implementation, when __OPTIMIZE_SIZE__ is defined. This does not change our generated code.

Detlef Riekenberg committed 4 years ago

Commit 3ce7bc61 parent b3bebdb2 files · +7 −1Browse files

Unified · Split

2 files
  1. libtcc.c +5 −1
  2. tccpp.c +2 −0
libtcc.c+5−1
@@ -1997,7 +1997,11 @@ reparse: · 1996 unmodified lines
19971997 s->filetype = x | (s->filetype & ~AFF_TYPE_MASK);
19981998 break;
19991999 case TCC_OPTION_O:
2000− s->optimize = atoi(optarg);
2000+ /* Use "-O" as alias for "-O1". */
2001+ /* Other common used values: "-O0", "-O1", "-O2", "-O3" and "-Os" */
2002+ /* no failure with unsupported options */
2003+ x = *optarg;
2004+ s->optimize = isnum(x) ? atoi(optarg) : (x) ? x : 1;
20012005 break;
20022006 case TCC_OPTION_print_search_dirs:
20032007 x = OPT_PRINT_DIRS;
tccpp.c+2−0
@@ -3733,6 +3733,8 @@ static void tcc_predefs(TCCState *s1, CString *cs, int is_asm) · 3732 unmodified lines
37333733 putdef(cs, "__CHAR_UNSIGNED__");
37343734 if (s1->optimize > 0)
37353735 putdef(cs, "__OPTIMIZE__");
3736+ if (s1->optimize == 's')
3737+ putdef(cs, "__OPTIMIZE_SIZE__");
37363738 if (s1->option_pthread)
37373739 putdef(cs, "_REENTRANT");
37383740 if (s1->leading_underscore)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t