mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Allow -c to be specified with -E in cosmocc
This commit is contained in:
parent
4ed4a1095a
commit
f8cfc89eba
10 changed files with 41 additions and 4 deletions
|
@ -79,6 +79,10 @@
|
||||||
#undef __linux__
|
#undef __linux__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __gnu_linux__
|
||||||
|
#undef __gnu_linux__
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __BIGGEST_ALIGNMENT__
|
#ifndef __BIGGEST_ALIGNMENT__
|
||||||
#define __BIGGEST_ALIGNMENT__ 16
|
#define __BIGGEST_ALIGNMENT__ 16
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -155,5 +155,6 @@ exp10 (double x)
|
||||||
|
|
||||||
__strong_reference(exp10, pow10);
|
__strong_reference(exp10, pow10);
|
||||||
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
|
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
|
||||||
|
__weak_reference(exp10, pow10l);
|
||||||
__weak_reference(exp10, exp10l);
|
__weak_reference(exp10, exp10l);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,6 +52,6 @@ long double exp10l(long double x)
|
||||||
return powl(10.0, x);
|
return powl(10.0, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak_reference(exp10l, pow10l);
|
__strong_reference(exp10l, pow10l);
|
||||||
|
|
||||||
#endif /* long double is long */
|
#endif /* long double is long */
|
||||||
|
|
|
@ -116,10 +116,12 @@ main()
|
||||||
return 31;
|
return 31;
|
||||||
if (ctl::to_string(3.14L) != "3.14")
|
if (ctl::to_string(3.14L) != "3.14")
|
||||||
return 32;
|
return 32;
|
||||||
|
#if LDBL_MANT_DIG > 64
|
||||||
if (ctl::to_string(LDBL_MAX) != "1.189731495357232e+4932")
|
if (ctl::to_string(LDBL_MAX) != "1.189731495357232e+4932")
|
||||||
return 33;
|
return 33;
|
||||||
if (ctl::to_string(-LDBL_MAX) != "-1.189731495357232e+4932")
|
if (ctl::to_string(-LDBL_MAX) != "-1.189731495357232e+4932")
|
||||||
return 34;
|
return 34;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckForMemoryLeaks();
|
CheckForMemoryLeaks();
|
||||||
|
|
|
@ -48,7 +48,9 @@ TEST(acoshf, test) {
|
||||||
TEST(acoshl, test) {
|
TEST(acoshl, test) {
|
||||||
volatile long double x = 16;
|
volatile long double x = 16;
|
||||||
EXPECT_STREQ("4", gc(xdtoal(sqrtl(x))));
|
EXPECT_STREQ("4", gc(xdtoal(sqrtl(x))));
|
||||||
|
#if LDBL_MANT_DIG > 64
|
||||||
EXPECT_STREQ(".9624236501192069", gc(xdtoal(_acoshl(1.5))));
|
EXPECT_STREQ(".9624236501192069", gc(xdtoal(_acoshl(1.5))));
|
||||||
|
#endif
|
||||||
EXPECT_STREQ("0", gc(xdtoal(_acoshl(1))));
|
EXPECT_STREQ("0", gc(xdtoal(_acoshl(1))));
|
||||||
EXPECT_TRUE(isnan(_acoshl(NAN)));
|
EXPECT_TRUE(isnan(_acoshl(NAN)));
|
||||||
EXPECT_TRUE(isnan(_acoshl(.5)));
|
EXPECT_TRUE(isnan(_acoshl(.5)));
|
||||||
|
|
|
@ -46,8 +46,10 @@ TEST(asinhf, test) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(asinhl, test) {
|
TEST(asinhl, test) {
|
||||||
|
#if LDBL_MANT_DIG > 64
|
||||||
EXPECT_STREQ(".4812118250596034", gc(xdtoal(_asinhl(+.5))));
|
EXPECT_STREQ(".4812118250596034", gc(xdtoal(_asinhl(+.5))));
|
||||||
EXPECT_STREQ("-.4812118250596034", gc(xdtoal(_asinhl(-.5))));
|
EXPECT_STREQ("-.4812118250596034", gc(xdtoal(_asinhl(-.5))));
|
||||||
|
#endif
|
||||||
EXPECT_STREQ("0", gc(xdtoal(_asinhl(0))));
|
EXPECT_STREQ("0", gc(xdtoal(_asinhl(0))));
|
||||||
EXPECT_STREQ("NAN", gc(xdtoal(_asinhl(NAN))));
|
EXPECT_STREQ("NAN", gc(xdtoal(_asinhl(NAN))));
|
||||||
EXPECT_STREQ("INFINITY", gc(xdtoal(_asinhl(INFINITY))));
|
EXPECT_STREQ("INFINITY", gc(xdtoal(_asinhl(INFINITY))));
|
||||||
|
|
|
@ -99,8 +99,10 @@ TEST(hypotll, test) {
|
||||||
EXPECT_STREQ("1.414213562373095", gc(xdtoal(_hypotl(-1, 1))));
|
EXPECT_STREQ("1.414213562373095", gc(xdtoal(_hypotl(-1, 1))));
|
||||||
EXPECT_STREQ("1.414213626012708", gc(xdtoal(_hypotl(1.0000001, .99999999))));
|
EXPECT_STREQ("1.414213626012708", gc(xdtoal(_hypotl(1.0000001, .99999999))));
|
||||||
EXPECT_STREQ("1.414213626012708", gc(xdtoal(_hypotl(.99999999, 1.0000001))));
|
EXPECT_STREQ("1.414213626012708", gc(xdtoal(_hypotl(.99999999, 1.0000001))));
|
||||||
|
#if LDBL_MANT_DIG > 64
|
||||||
EXPECT_STREQ("1.414213562373095e+4931",
|
EXPECT_STREQ("1.414213562373095e+4931",
|
||||||
gc(xdtoal(_hypotl(1e4931L, 1e4931L))));
|
gc(xdtoal(_hypotl(1e4931L, 1e4931L))));
|
||||||
|
#endif
|
||||||
EXPECT_STREQ("NAN", gc(xdtoal(_hypotl(0, NAN))));
|
EXPECT_STREQ("NAN", gc(xdtoal(_hypotl(0, NAN))));
|
||||||
EXPECT_STREQ("NAN", gc(xdtoal(_hypotl(NAN, 0))));
|
EXPECT_STREQ("NAN", gc(xdtoal(_hypotl(NAN, 0))));
|
||||||
EXPECT_STREQ("NAN", gc(xdtoal(_hypotl(NAN, NAN))));
|
EXPECT_STREQ("NAN", gc(xdtoal(_hypotl(NAN, NAN))));
|
||||||
|
|
|
@ -139,7 +139,9 @@ for x; do
|
||||||
elif [ x"$x" != x"${x#-O}" ]; then # startswith(x, "-O")
|
elif [ x"$x" != x"${x#-O}" ]; then # startswith(x, "-O")
|
||||||
OPT=$x
|
OPT=$x
|
||||||
elif [ x"$x" = x"-c" ]; then
|
elif [ x"$x" = x"-c" ]; then
|
||||||
INTENT=cc
|
if [ x"$INTENT" != x"cpp" ]; then
|
||||||
|
INTENT=cc
|
||||||
|
fi
|
||||||
elif [ x"$x" = x"-E" ] ||
|
elif [ x"$x" = x"-E" ] ||
|
||||||
[ x"$x" = x"-M" ] ||
|
[ x"$x" = x"-M" ] ||
|
||||||
[ x"$x" = x"-MM" ]; then
|
[ x"$x" = x"-MM" ]; then
|
||||||
|
@ -266,7 +268,9 @@ CC_AARCH64="$BIN/aarch64-linux-cosmo-gcc"
|
||||||
if [ x"$PROG" != x"${PROG%++}" ]; then
|
if [ x"$PROG" != x"${PROG%++}" ]; then
|
||||||
CC_X86_64="$BIN/x86_64-linux-cosmo-g++"
|
CC_X86_64="$BIN/x86_64-linux-cosmo-g++"
|
||||||
CC_AARCH64="$BIN/aarch64-linux-cosmo-g++"
|
CC_AARCH64="$BIN/aarch64-linux-cosmo-g++"
|
||||||
CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -fuse-cxa-atexit"
|
if [ x"$INTENT" != x"cpp" ]; then
|
||||||
|
CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -fuse-cxa-atexit"
|
||||||
|
fi
|
||||||
CPPFLAGS="-isystem $BIN/../include/third_party/libcxx $CPPFLAGS"
|
CPPFLAGS="-isystem $BIN/../include/third_party/libcxx $CPPFLAGS"
|
||||||
else
|
else
|
||||||
CFLAGS="$CFLAGS -Wno-implicit-int"
|
CFLAGS="$CFLAGS -Wno-implicit-int"
|
||||||
|
@ -325,6 +329,9 @@ if [ $INTENT = cpp ]; then
|
||||||
if [ -n "$OUTPUT" ]; then
|
if [ -n "$OUTPUT" ]; then
|
||||||
ARGS="$ARGS -o$OUTPUT"
|
ARGS="$ARGS -o$OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
# undefine cpu-specific and linux-specific defines
|
||||||
|
# we get rid of long double too to not lead astray
|
||||||
|
# we shall leave behind unix, __unix, and __unix__
|
||||||
set -- \
|
set -- \
|
||||||
"$CC_X86_64" \
|
"$CC_X86_64" \
|
||||||
-U__k8 \
|
-U__k8 \
|
||||||
|
@ -333,10 +340,21 @@ if [ $INTENT = cpp ]; then
|
||||||
-U__amd64__ \
|
-U__amd64__ \
|
||||||
-U__x86_64 \
|
-U__x86_64 \
|
||||||
-U__x86_64__ \
|
-U__x86_64__ \
|
||||||
|
-U__MMX__ \
|
||||||
|
-U__MMX_WITH_SSE__ \
|
||||||
|
-U__SSE_MATH__ \
|
||||||
|
-U__SEG_FS \
|
||||||
|
-U__SEG_GS \
|
||||||
-U__SSE__ \
|
-U__SSE__ \
|
||||||
|
-U__FXSR__ \
|
||||||
-U__SSE2__ \
|
-U__SSE2__ \
|
||||||
-U__SSE2_MATH__ \
|
-U__SSE2_MATH__ \
|
||||||
|
-Ulinux \
|
||||||
|
-U__linux \
|
||||||
|
-U__linux__ \
|
||||||
|
-U__gnu_linux__ \
|
||||||
-mno-red-zone \
|
-mno-red-zone \
|
||||||
|
-mlong-double-64 \
|
||||||
$PLATFORM \
|
$PLATFORM \
|
||||||
$CPPFLAGS \
|
$CPPFLAGS \
|
||||||
$ARGS
|
$ARGS
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
"__GNUC__"
|
"__GNUC__"
|
||||||
"__APPLE__"
|
"__APPLE__"
|
||||||
"__linux__"
|
"__linux__"
|
||||||
|
"__gnu_linux__"
|
||||||
"__HAIKU__"
|
"__HAIKU__"
|
||||||
"__CYGWIN__"
|
"__CYGWIN__"
|
||||||
"__EMSCRIPTEN__"
|
"__EMSCRIPTEN__"
|
||||||
|
@ -25,10 +26,13 @@
|
||||||
"__NetBSD__"
|
"__NetBSD__"
|
||||||
"__NetBSD_Version__"
|
"__NetBSD_Version__"
|
||||||
"__OpenBSD__"
|
"__OpenBSD__"
|
||||||
|
"__Fuchsia__"
|
||||||
"__COSMOPOLITAN__"
|
"__COSMOPOLITAN__"
|
||||||
"__COSMOCC__"
|
"__COSMOCC__"
|
||||||
"__FATCOSMOCC__"
|
"__FATCOSMOCC__"
|
||||||
"__GLIBC__"
|
"__GLIBC__"
|
||||||
|
"__ELF__"
|
||||||
|
"__GNU__"
|
||||||
"__linux"
|
"__linux"
|
||||||
"__MACH__"
|
"__MACH__"
|
||||||
"__GNUG__"
|
"__GNUG__"
|
||||||
|
@ -128,6 +132,8 @@
|
||||||
"__ARM_FP16_IEEE"
|
"__ARM_FP16_IEEE"
|
||||||
"__ARM_FP_FAST"
|
"__ARM_FP_FAST"
|
||||||
"__powerpc__"
|
"__powerpc__"
|
||||||
|
"__POWERPC__"
|
||||||
|
"__ppc__"
|
||||||
"__powerpc64__"
|
"__powerpc64__"
|
||||||
"__POWER9_VECTOR__"
|
"__POWER9_VECTOR__"
|
||||||
"__wasm_simd128__"
|
"__wasm_simd128__"
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
'("__cplusplus"
|
'("__cplusplus"
|
||||||
"__OBJC__"
|
"__OBJC__"
|
||||||
"__STRICT_ANSI__"
|
"__STRICT_ANSI__"
|
||||||
"__ELF__"
|
|
||||||
"__VERSION__"
|
"__VERSION__"
|
||||||
"__OPTIMIZE__"
|
"__OPTIMIZE__"
|
||||||
"__OPTIMIZE_SIZE__"
|
"__OPTIMIZE_SIZE__"
|
||||||
|
@ -29,6 +28,7 @@
|
||||||
"__LP64__"
|
"__LP64__"
|
||||||
"__SSP__"
|
"__SSP__"
|
||||||
"__SSP_ALL__"
|
"__SSP_ALL__"
|
||||||
|
"__unix"
|
||||||
"__unix__"
|
"__unix__"
|
||||||
"__vax__"
|
"__vax__"
|
||||||
"__ns16000__"
|
"__ns16000__"
|
||||||
|
|
Loading…
Reference in a new issue