Unified · Split
| @@ -733,6 +733,7 @@ LIBTCCAPI TCCState *tcc_new(void) · 732 unmodified lines | |||
| 733 | ++nb_states; | 733 | ++nb_states; |
| 734 | 734 | ||
| 735 | s->nocommon = 1; | 735 | s->nocommon = 1; |
| 736 | s->cversion = 199901; /* default unless -std=c11 is supplied */ | ||
| 736 | s->warn_implicit_function_declaration = 1; | 737 | s->warn_implicit_function_declaration = 1; |
| 737 | s->ms_extensions = 1; | 738 | s->ms_extensions = 1; |
| 738 | 739 | ||
| @@ -1790,8 +1791,16 @@ reparse: · 1051 unmodified lines | |||
| 1790 | s->static_link = 1; | 1791 | s->static_link = 1; |
| 1791 | break; | 1792 | break; |
| 1792 | case TCC_OPTION_std: | 1793 | case TCC_OPTION_std: |
| 1793 | /* silently ignore, a current purpose: | 1794 | if (*optarg == '=') { |
| 1794 | allow to use a tcc as a reference compiler for "make test" */ | 1795 | ++optarg; |
| 1796 | if (strcmp(optarg, "c11") == 0) { | ||
| 1797 | tcc_undefine_symbol(s, "__STDC_VERSION__"); | ||
| 1798 | tcc_define_symbol(s, "__STDC_VERSION__", "201112L"); | ||
| 1799 | s->cversion = 201112; | ||
| 1800 | } | ||
| 1801 | } | ||
| 1802 | /* silently ignore other values, a current purpose: | ||
| 1803 | allow to use a tcc as a reference compiler for "make test" */ | ||
| 1795 | break; | 1804 | break; |
| 1796 | case TCC_OPTION_shared: | 1805 | case TCC_OPTION_shared: |
| 1797 | x = TCC_OUTPUT_DLL; | 1806 | x = TCC_OUTPUT_DLL; |
| @@ -33,6 +33,8 @@ static const char help[] = · 32 unmodified lines | |||
| 33 | " -o outfile set output filename\n" | 33 | " -o outfile set output filename\n" |
| 34 | " -run run compiled source\n" | 34 | " -run run compiled source\n" |
| 35 | " -fflag set or reset (with 'no-' prefix) 'flag' (see tcc -hh)\n" | 35 | " -fflag set or reset (with 'no-' prefix) 'flag' (see tcc -hh)\n" |
| 36 | " -std=c99 Conform to the ISO 1999 C standard (default).\n" | ||
| 37 | " -std=c11 Conform to the ISO 2011 C standard.\n" | ||
| 36 | " -Wwarning set or reset (with 'no-' prefix) 'warning' (see tcc -hh)\n" | 38 | " -Wwarning set or reset (with 'no-' prefix) 'warning' (see tcc -hh)\n" |
| 37 | " -w disable all warnings\n" | 39 | " -w disable all warnings\n" |
| 38 | " -v -vv show version, show search paths or loaded files\n" | 40 | " -v -vv show version, show search paths or loaded files\n" |
| @@ -651,6 +651,7 @@ struct TCCState { · 650 unmodified lines | |||
| 651 | int rdynamic; /* if true, all symbols are exported */ | 651 | int rdynamic; /* if true, all symbols are exported */ |
| 652 | int symbolic; /* if true, resolve symbols in the current module first */ | 652 | int symbolic; /* if true, resolve symbols in the current module first */ |
| 653 | int filetype; /* file type for compilation (NONE,C,ASM) */ | 653 | int filetype; /* file type for compilation (NONE,C,ASM) */ |
| 654 | int cversion; /* supported C ISO version, 199901 (the default), 201112, ... */ | ||
| 654 | 655 | ||
| 655 | char *tcc_lib_path; /* CONFIG_TCCDIR or -B option */ | 656 | char *tcc_lib_path; /* CONFIG_TCCDIR or -B option */ |
| 656 | char *soname; /* as specified on the command line (-soname) */ | 657 | char *soname; /* as specified on the command line (-soname) */ |