History

Add __STDC_xxx test features related to ISO/IEC C11 when -std=c11 is passed.

Christian Jullien committed 7 years ago

Commit 8482f9e1 parent 065a3b31 file · +40 −13Browse files

Unified · Split

libtcc.c+40−13
@@ -1608,7 +1608,7 @@ static int args_parser_make_argv(const char *r, int *argc, char ***argv) · 1607 unmodified lines
1608 CString str;1608 CString str;
1609 for(;;) {1609 for(;;) {
1610 while (c = (unsigned char)*r, c && c <= ' ')1610 while (c = (unsigned char)*r, c && c <= ' ')
1611 ++r;1611 ++r;
1612 if (c == 0)1612 if (c == 0)
1613 break;1613 break;
1614 q = 0;1614 q = 0;
@@ -1681,7 +1681,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int *pargc, char ***pargv, int optind) · 66 unmodified lines
1681 r = argv[optind];1681 r = argv[optind];
1682 if (r[0] == '@' && r[1] != '\0') {1682 if (r[0] == '@' && r[1] != '\0') {
1683 args_parser_listfile(s, r + 1, optind, &argc, &argv);1683 args_parser_listfile(s, r + 1, optind, &argc, &argv);
1684 continue;1684 continue;
1685 }1685 }
1686 optind++;1686 optind++;
1687 if (tool) {1687 if (tool) {
@@ -1792,15 +1792,42 @@ reparse: · 104 unmodified lines
1792 break;1792 break;
1793 case TCC_OPTION_std:1793 case TCC_OPTION_std:
1794 if (*optarg == '=') {1794 if (*optarg == '=') {
1795 ++optarg;1795 if (strcmp(optarg, "=c11") == 0) {
1796 if (strcmp(optarg, "c11") == 0) {
1797 tcc_undefine_symbol(s, "__STDC_VERSION__");1796 tcc_undefine_symbol(s, "__STDC_VERSION__");
1798 tcc_define_symbol(s, "__STDC_VERSION__", "201112L");1797 tcc_define_symbol(s, "__STDC_VERSION__", "201112L");
1798 /*
1799 * The integer constant 1, intended to indicate
1800 * that the implementation does not support atomic
1801 * types (including the _Atomic type qualifier) and
1802 * the <stdatomic.h> header.
1803 */
1804 tcc_define_symbol(s, "__STDC_NO_ATOMICS__", "1");
1805 /*
1806 * The integer constant 1, intended to indicate
1807 * that the implementation does not support complex
1808 * types or the <complex.h> header.
1809 */
1810 tcc_define_symbol(s, "__STDC_NO_COMPLEX__", "1");
1811 /*
1812 * The integer constant 1, intended to indicate
1813 * that the implementation does not support the
1814 * <threads.h> header.
1815 */
1816 tcc_define_symbol(s, "__STDC_NO_THREADS__", "1");
1817 /*
1818 * __STDC_NO_VLA__, tcc supports VLA.
1819 * The integer constant 1, intended to indicate
1820 * that the implementation does not support
1821 * variable length arrays or variably modified
1822 * types.
1823 */
1799 s->cversion = 201112;1824 s->cversion = 201112;
1800 }1825 }
1801 }1826 }
1802 /* silently ignore other values, a current purpose:1827 /*
1803 allow to use a tcc as a reference compiler for "make test" */1828 * silently ignore other values, a current purpose:
1829 * allow to use a tcc as a reference compiler for "make test"
1830 */
1804 break;1831 break;
1805 case TCC_OPTION_shared:1832 case TCC_OPTION_shared:
1806 x = TCC_OUTPUT_DLL;1833 x = TCC_OUTPUT_DLL;
@@ -1823,10 +1850,10 @@ reparse: · 16 unmodified lines
1823 case TCC_OPTION_isystem:1850 case TCC_OPTION_isystem:
1824 tcc_add_sysinclude_path(s, optarg);1851 tcc_add_sysinclude_path(s, optarg);
1825 break;1852 break;
1826 case TCC_OPTION_include:1853 case TCC_OPTION_include:
1827 dynarray_add(&s->cmd_include_files,1854 dynarray_add(&s->cmd_include_files,
1828 &s->nb_cmd_include_files, tcc_strdup(optarg));1855 &s->nb_cmd_include_files, tcc_strdup(optarg));
1829 break;1856 break;
1830 case TCC_OPTION_nostdinc:1857 case TCC_OPTION_nostdinc:
1831 s->nostdinc = 1;1858 s->nostdinc = 1;
1832 break;1859 break;
@@ -1886,9 +1913,9 @@ reparse: · 53 unmodified lines
1886 if (tcc_set_linker(s, linker_arg.data))1913 if (tcc_set_linker(s, linker_arg.data))
1887 cstr_free(&linker_arg);1914 cstr_free(&linker_arg);
1888 break;1915 break;
1889 case TCC_OPTION_Wp:1916 case TCC_OPTION_Wp:
1890 r = optarg;1917 r = optarg;
1891 goto reparse;1918 goto reparse;
1892 case TCC_OPTION_E:1919 case TCC_OPTION_E:
1893 x = TCC_OUTPUT_PREPROCESS;1920 x = TCC_OUTPUT_PREPROCESS;
1894 goto set_output_type;1921 goto set_output_type;

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