diff options
Diffstat (limited to 'tests/t0024-abi-predefined.sh')
| -rwxr-xr-x | tests/t0024-abi-predefined.sh | 191 |
1 files changed, 191 insertions, 0 deletions
diff --git a/tests/t0024-abi-predefined.sh b/tests/t0024-abi-predefined.sh new file mode 100755 index 0000000..984f0a2 --- /dev/null +++ b/tests/t0024-abi-predefined.sh @@ -0,0 +1,191 @@ +#!/bin/sh +set -eu +base="${TMPDIR-/tmp}/mcpu-cpp-abi-predef-$$" +mkdir -p "$base" +trap 'rm -rf "$base"' EXIT HUP INT TERM + +cat > "$base/main.c" <<'EOT' +arch = _ARCH_MCPU; +cpp_version = __MCPU_CPP_VERSION__; +old_version = __VERSION__; +byte_order = __BYTE_ORDER__; +mcpu_byte_order = __MCPU_BYTE_ORDER__; +word_order = __MCPU_WORD_ORDER__; +old_float_word_order = __FLOAT_WORD_ORDER__; +register_width = __MCPU_MACHINE_REGISTER_WIDTH__; +real_io_limit = __MCPU_REAL_IO_LIMIT__; +math_fn_limit = __MCPU_MATH_FN_LIMIT__; +pointer_width = __MCPU_POINTER_WIDTH__; +int_max_width = __MCPU_INT_MAX_WIDTH__; +real_max_width = __MCPU_REAL_MAX_WIDTH__; +complex_max_width = __MCPU_COMPLEX_MAX_WIDTH__; +size_type = __MCPU_SIZE_TYPE__; +size_width = __MCPU_SIZE_WIDTH__; +size_sizeof = __MCPU_SIZEOF_SIZE__; +size_max = __MCPU_SIZE_MAX__; +ssize_type = __MCPU_SSIZE_TYPE__; +ssize_width = __MCPU_SSIZE_WIDTH__; +ssize_sizeof = __MCPU_SIZEOF_SSIZE__; +ssize_max = __MCPU_SSIZE_MAX__; +ptrdiff_type = __PTRDIFF_TYPE__; +ptrdiff_width = __PTRDIFF_WIDTH__; +ptrdiff_max = __PTRDIFF_MAX__; +sizeof_ptrdiff = __SIZEOF_PTRDIFF__; +old_sizeof_ptrdiff_t = __SIZEOF_PTRDIFF_T__; +intptr_type = __INTPTR_TYPE__; +uintptr_type = __UINTPTR_TYPE__; +intptr_width = __INTPTR_WIDTH__; +uintptr_width = __UINTPTR_WIDTH__; +intptr_max = __INTPTR_MAX__; +uintptr_max = __UINTPTR_MAX__; +char8_type = __CHAR8_TYPE__; +char16_type = __CHAR16_TYPE__; +char8_width = __CHAR8_WIDTH__; +char16_width = __CHAR16_WIDTH__; +sizeof_char8 = __SIZEOF_CHAR8__; +sizeof_char16 = __SIZEOF_CHAR16__; +register_prefix = [__REGISTER_PREFIX__]; +local_label_prefix = [__LOCAL_LABEL_PREFIX__]; +user_label_prefix = [__USER_LABEL_PREFIX__]; +immediate_prefix = [__IMMEDIATE_PREFIX__]; +int128_type = __INT128_TYPE__; +uint128_type = __UINT128_TYPE__; +int128_width = __INT128_WIDTH__; +int128_decimal = __INT128_DECIMAL_DIG__; +uint128_decimal = __UINT128_DECIMAL_DIG__; +sizeof_int128 = __SIZEOF_INT128__; +sizeof_uint128 = __SIZEOF_UINT128__; +int128_max = __INT128_MAX__; +int128_min_must_not_exist = __INT128_MIN__; +uint128_max = __UINT128_MAX__; +int1024_type = __INT1024_TYPE__; +int1024_width = __INT1024_WIDTH__; +int1024_max_must_not_exist = __INT1024_MAX__; +int1024_decimal = __INT1024_DECIMAL_DIG__; +sizeof_int1024 = __SIZEOF_INT1024__; +real128_type = __REAL128_TYPE__; +complex128_type = __COMPLEX128_TYPE__; +real128_width = __REAL128_WIDTH__; +complex128_width = __COMPLEX128_WIDTH__; +sizeof_real128 = __SIZEOF_REAL128__; +sizeof_real128_exp = __SIZEOF_REAL128_EXP__; +real128_max_strlen = __REAL128_MAX_STRLEN__; +sizeof_complex128 = __SIZEOF_COMPLEX128__; +real128_mant = __REAL128_MANT_DIG__; +real128_decimal = __REAL128_DECIMAL_DIG__; +real128_old_dig_must_not_exist = __REAL128_DIG__; +real128_max = __REAL128_MAX__; +real128_min = __REAL128_MIN__; +real128_epsilon = __REAL128_EPSILON__; +real128_max_exp = __REAL128_MAX_EXP__; +real128_min_exp = __REAL128_MIN_EXP__; +real1024_type = __REAL1024_TYPE__; +real1024_width = __REAL1024_WIDTH__; +real1024_max_must_not_exist = __REAL1024_MAX__; +real1024_mant = __REAL1024_MANT_DIG__; +real1024_decimal = __REAL1024_DECIMAL_DIG__; +sizeof_real1024 = __SIZEOF_REAL1024__; +sizeof_real1024_exp = __SIZEOF_REAL1024_EXP__; +real1024_max_strlen = __REAL1024_MAX_STRLEN__; +complex1024_type = __COMPLEX1024_TYPE__; +complex1024_width = __COMPLEX1024_WIDTH__; +sizeof_complex1024 = __SIZEOF_COMPLEX1024__; +int65536_type = __INT65536_TYPE__; +int65536_width = __INT65536_WIDTH__; +sizeof_int65536 = __SIZEOF_INT65536__; +char_type_must_not_exist = __CHAR_TYPE__; +wchar_type_must_not_exist = __WCHAR_TYPE__; +EOT + +"$MCPU_CPP" --no-config "$base/main.c" -o "$base/out" + +grep '^arch = 1;$' "$base/out" >/dev/null +grep '^cpp_version = "1\.0\.2";$' "$base/out" >/dev/null +grep '^old_version = __VERSION__;$' "$base/out" >/dev/null +grep '^byte_order = \(1234\|4321\);$' "$base/out" >/dev/null +grep '^mcpu_byte_order = \(1234\|4321\);$' "$base/out" >/dev/null +grep '^word_order = \(1234\|4321\);$' "$base/out" >/dev/null +grep '^old_float_word_order = __FLOAT_WORD_ORDER__;$' "$base/out" >/dev/null +grep '^register_width = 64;$' "$base/out" >/dev/null +grep '^pointer_width = 64;$' "$base/out" >/dev/null +grep '^int_max_width = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^real_max_width = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^complex_max_width = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^size_type = uint[0-9][0-9]*;$' "$base/out" >/dev/null +grep '^size_width = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^size_sizeof = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^size_max = 0x[0-9a-f][0-9a-f]*;$' "$base/out" >/dev/null +grep '^ssize_type = int[0-9][0-9]*;$' "$base/out" >/dev/null +grep '^ssize_width = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^ssize_sizeof = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^ssize_max = 0x[0-9a-f][0-9a-f]*;$' "$base/out" >/dev/null +grep '^ptrdiff_type = int64;$' "$base/out" >/dev/null +grep '^ptrdiff_width = 64;$' "$base/out" >/dev/null +grep '^ptrdiff_max = 0x7fffffffffffffff;$' "$base/out" >/dev/null +grep '^sizeof_ptrdiff = 8;$' "$base/out" >/dev/null +grep '^old_sizeof_ptrdiff_t = __SIZEOF_PTRDIFF_T__;$' "$base/out" >/dev/null +grep '^intptr_type = int64;$' "$base/out" >/dev/null +grep '^uintptr_type = uint64;$' "$base/out" >/dev/null +grep '^intptr_width = 64;$' "$base/out" >/dev/null +grep '^uintptr_width = 64;$' "$base/out" >/dev/null +grep '^intptr_max = 0x7fffffffffffffff;$' "$base/out" >/dev/null +grep '^uintptr_max = 0xffffffffffffffff;$' "$base/out" >/dev/null +grep '^char8_type = char8;$' "$base/out" >/dev/null +grep '^char16_type = char16;$' "$base/out" >/dev/null +grep '^char8_width = 8;$' "$base/out" >/dev/null +grep '^char16_width = 16;$' "$base/out" >/dev/null +grep '^sizeof_char8 = 1;$' "$base/out" >/dev/null +grep '^sizeof_char16 = 2;$' "$base/out" >/dev/null +grep '^register_prefix = \[\];$' "$base/out" >/dev/null +grep '^local_label_prefix = \[\];$' "$base/out" >/dev/null +grep '^user_label_prefix = \[\];$' "$base/out" >/dev/null +grep '^immediate_prefix = \[\];$' "$base/out" >/dev/null +grep '^int128_type = int128;$' "$base/out" >/dev/null +grep '^uint128_type = uint128;$' "$base/out" >/dev/null +grep '^int128_width = 128;$' "$base/out" >/dev/null +grep '^int128_decimal = 39;$' "$base/out" >/dev/null +grep '^uint128_decimal = 39;$' "$base/out" >/dev/null +grep '^sizeof_int128 = 16;$' "$base/out" >/dev/null +grep '^sizeof_uint128 = 16;$' "$base/out" >/dev/null +grep '^sizeof_real128_exp = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^real128_max_strlen = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^int128_max = 0x7fffffffffffffffffffffffffffffff;$' "$base/out" >/dev/null +grep '^int128_min_must_not_exist = __INT128_MIN__;$' "$base/out" >/dev/null +grep '^uint128_max = 0xffffffffffffffffffffffffffffffff;$' "$base/out" >/dev/null +grep '^int1024_type = int1024;$' "$base/out" >/dev/null +grep '^int1024_width = 1024;$' "$base/out" >/dev/null +grep '^int1024_max_must_not_exist = __INT1024_MAX__;$' "$base/out" >/dev/null +grep '^int1024_decimal = 308;$' "$base/out" >/dev/null +grep '^sizeof_int1024 = 128;$' "$base/out" >/dev/null +grep '^real128_type = real128;$' "$base/out" >/dev/null +grep '^complex128_type = complex128;$' "$base/out" >/dev/null +grep '^real128_width = 128;$' "$base/out" >/dev/null +grep '^complex128_width = 128;$' "$base/out" >/dev/null +grep '^sizeof_real128 = 16;$' "$base/out" >/dev/null +grep '^sizeof_complex128 = 32;$' "$base/out" >/dev/null +grep '^real128_mant = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^real128_decimal = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^real128_old_dig_must_not_exist = __REAL128_DIG__;$' "$base/out" >/dev/null +grep '^real128_max = [0-9][0-9.]*e+[0-9][0-9]*;$' "$base/out" >/dev/null +grep '^real128_min = [0-9][0-9.]*e-[0-9][0-9]*;$' "$base/out" >/dev/null +grep '^real128_epsilon = [0-9][0-9.]*e-[0-9][0-9]*;$' "$base/out" >/dev/null +grep '^real128_max_exp = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^real128_min_exp = -[1-9][0-9]*;$' "$base/out" >/dev/null +grep '^real1024_type = real1024;$' "$base/out" >/dev/null +grep '^real1024_width = 1024;$' "$base/out" >/dev/null +grep '^real1024_max_must_not_exist = __REAL1024_MAX__;$' "$base/out" >/dev/null +grep '^real1024_mant = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^real1024_decimal = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^sizeof_real1024 = 128;$' "$base/out" >/dev/null +grep '^sizeof_real1024_exp = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^real1024_max_strlen = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^complex1024_type = complex1024;$' "$base/out" >/dev/null +grep '^complex1024_width = 1024;$' "$base/out" >/dev/null +grep '^sizeof_complex1024 = 256;$' "$base/out" >/dev/null +grep '^int65536_type = int65536;$' "$base/out" >/dev/null +grep '^int65536_width = 65536;$' "$base/out" >/dev/null +grep '^sizeof_int65536 = 8192;$' "$base/out" >/dev/null +grep '^real_io_limit = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^math_fn_limit = [1-9][0-9]*;$' "$base/out" >/dev/null +grep '^char_type_must_not_exist = __CHAR_TYPE__;$' "$base/out" >/dev/null +grep '^wchar_type_must_not_exist = __WCHAR_TYPE__;$' "$base/out" >/dev/null |
