|
1 | 1 | const std = @import("std");
|
2 |
| -const builtin = @import("builtin"); |
3 | 2 | const tests = @import("tests.zig");
|
4 | 3 | const nl = std.cstr.line_sep;
|
5 | 4 |
|
@@ -1684,41 +1683,38 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void {
|
1684 | 1683 | // TODO: add isnan check for long double once bitfield support is added
|
1685 | 1684 | // (needed for x86_64-windows-gnu)
|
1686 | 1685 | // TODO: add isinf check for long double once std.math.isInf supports c_longdouble
|
1687 |
| - // TODO https://github.com/ziglang/zig/issues/12630 |
1688 |
| - if (!(builtin.zig_backend == .stage2_llvm and builtin.target.os.tag == .windows)) { |
1689 |
| - cases.add("NAN and INFINITY", |
1690 |
| - \\#include <math.h> |
1691 |
| - \\#include <stdint.h> |
1692 |
| - \\#include <stdlib.h> |
1693 |
| - \\union uf { uint32_t u; float f; }; |
1694 |
| - \\#define CHECK_NAN(STR, VAL) { \ |
1695 |
| - \\ union uf unpack = {.f = __builtin_nanf(STR)}; \ |
1696 |
| - \\ if (!isnan(unpack.f)) abort(); \ |
1697 |
| - \\ if (unpack.u != VAL) abort(); \ |
1698 |
| - \\} |
1699 |
| - \\int main(void) { |
1700 |
| - \\ float f_nan = NAN; |
1701 |
| - \\ if (!isnan(f_nan)) abort(); |
1702 |
| - \\ double d_nan = NAN; |
1703 |
| - \\ if (!isnan(d_nan)) abort(); |
1704 |
| - \\ CHECK_NAN("0", 0x7FC00000); |
1705 |
| - \\ CHECK_NAN("", 0x7FC00000); |
1706 |
| - \\ CHECK_NAN("1", 0x7FC00001); |
1707 |
| - \\ CHECK_NAN("0x7FC00000", 0x7FC00000); |
1708 |
| - \\ CHECK_NAN("0x7FC0000F", 0x7FC0000F); |
1709 |
| - \\ CHECK_NAN("0x7FC000F0", 0x7FC000F0); |
1710 |
| - \\ CHECK_NAN("0x7FC00F00", 0x7FC00F00); |
1711 |
| - \\ CHECK_NAN("0x7FC0F000", 0x7FC0F000); |
1712 |
| - \\ CHECK_NAN("0x7FCF0000", 0x7FCF0000); |
1713 |
| - \\ CHECK_NAN("0xFFFFFFFF", 0x7FFFFFFF); |
1714 |
| - \\ float f_inf = INFINITY; |
1715 |
| - \\ if (!isinf(f_inf)) abort(); |
1716 |
| - \\ double d_inf = INFINITY; |
1717 |
| - \\ if (!isinf(d_inf)) abort(); |
1718 |
| - \\ return 0; |
1719 |
| - \\} |
1720 |
| - , ""); |
1721 |
| - } |
| 1686 | + cases.add("NAN and INFINITY", |
| 1687 | + \\#include <math.h> |
| 1688 | + \\#include <stdint.h> |
| 1689 | + \\#include <stdlib.h> |
| 1690 | + \\union uf { uint32_t u; float f; }; |
| 1691 | + \\#define CHECK_NAN(STR, VAL) { \ |
| 1692 | + \\ union uf unpack = {.f = __builtin_nanf(STR)}; \ |
| 1693 | + \\ if (!isnan(unpack.f)) abort(); \ |
| 1694 | + \\ if (unpack.u != VAL) abort(); \ |
| 1695 | + \\} |
| 1696 | + \\int main(void) { |
| 1697 | + \\ float f_nan = NAN; |
| 1698 | + \\ if (!isnan(f_nan)) abort(); |
| 1699 | + \\ double d_nan = NAN; |
| 1700 | + \\ if (!isnan(d_nan)) abort(); |
| 1701 | + \\ CHECK_NAN("0", 0x7FC00000); |
| 1702 | + \\ CHECK_NAN("", 0x7FC00000); |
| 1703 | + \\ CHECK_NAN("1", 0x7FC00001); |
| 1704 | + \\ CHECK_NAN("0x7FC00000", 0x7FC00000); |
| 1705 | + \\ CHECK_NAN("0x7FC0000F", 0x7FC0000F); |
| 1706 | + \\ CHECK_NAN("0x7FC000F0", 0x7FC000F0); |
| 1707 | + \\ CHECK_NAN("0x7FC00F00", 0x7FC00F00); |
| 1708 | + \\ CHECK_NAN("0x7FC0F000", 0x7FC0F000); |
| 1709 | + \\ CHECK_NAN("0x7FCF0000", 0x7FCF0000); |
| 1710 | + \\ CHECK_NAN("0xFFFFFFFF", 0x7FFFFFFF); |
| 1711 | + \\ float f_inf = INFINITY; |
| 1712 | + \\ if (!isinf(f_inf)) abort(); |
| 1713 | + \\ double d_inf = INFINITY; |
| 1714 | + \\ if (!isinf(d_inf)) abort(); |
| 1715 | + \\ return 0; |
| 1716 | + \\} |
| 1717 | + , ""); |
1722 | 1718 |
|
1723 | 1719 | cases.add("signed array subscript. Issue #8556",
|
1724 | 1720 | \\#include <stdint.h>
|
|
0 commit comments