History

Add more STDC_ C11 compatible constants

Christian Jullien committed 7 years ago

Commit d44d8cd1 parent ecb90de1 file · +56 −29Browse files

Unified · Split

libtcc.c+56−29
@@ -1793,35 +1793,62 @@ reparse: · 1792 unmodified lines
17931793 case TCC_OPTION_std:
17941794 if (*optarg == '=') {
17951795 if (strcmp(optarg, "=c11") == 0) {
1796− tcc_undefine_symbol(s, "__STDC_VERSION__");
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− */
1824− s->cversion = 201112;
1796+ tcc_undefine_symbol(s, "__STDC_VERSION__");
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+ */
1824+#if !defined(TCC_TARGET_PE)
1825+ /*
1826+ * An integer constant of the form yyyymmL (for
1827+ * example, 199712L). If this symbol is defined,
1828+ * then every character in the Unicode required
1829+ * set, when stored in an object of type
1830+ * wchar_t, has the same value as the short
1831+ * identifier of that character.
1832+ */
1833+ tcc_define_symbol(s, "__STDC_ISO_10646__", "201605L");
1834+ /*
1835+ * The integer constant 1, intended to indicate
1836+ * that values of type char16_t are UTF−16
1837+ * encoded. If some other encoding is used, the
1838+ * macro shall not be defined and the actual
1839+ * encoding used is implementation defined.
1840+ */
1841+ tcc_define_symbol(s, "__STDC_UTF_16__", "1");
1842+ /*
1843+ * The integer constant 1, intended to indicate
1844+ * that values of type char32_t are UTF−32
1845+ * encoded. If some other encoding is used, the
1846+ * macro shall not be defined and the actual
1847+ * encoding used is implementationdefined.
1848+ */
1849+ tcc_define_symbol(s, "__STDC_UTF_32__", "1");
1850+#endif /* !TCC_TARGET_PE */
1851+ s->cversion = 201112;
18251852 }
18261853 }
18271854 /*