mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
coff: do not pull in std.log into coff.zig definitions
This commit is contained in:
parent
9038528187
commit
02e6960966
2 changed files with 33 additions and 40 deletions
|
|
@ -841,10 +841,7 @@ pub const Coff = struct {
|
||||||
if (self.is_image) {
|
if (self.is_image) {
|
||||||
self.coff_header_offset = coff_header_offset + 4;
|
self.coff_header_offset = coff_header_offset + 4;
|
||||||
const coff_header = self.getCoffHeader();
|
const coff_header = self.getCoffHeader();
|
||||||
if (coff_header.size_of_optional_header == 0) {
|
if (coff_header.size_of_optional_header == 0) return error.MissingPEHeader;
|
||||||
std.log.err("Required PE header missing for image file", .{});
|
|
||||||
return error.MissingPEHeader;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// JK: we used to check for architecture here and throw an error if not x86 or derivative.
|
// JK: we used to check for architecture here and throw an error if not x86 or derivative.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
|
||||||
const tests = @import("tests.zig");
|
const tests = @import("tests.zig");
|
||||||
const nl = std.cstr.line_sep;
|
const nl = std.cstr.line_sep;
|
||||||
|
|
||||||
|
|
@ -1684,41 +1683,38 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void {
|
||||||
// TODO: add isnan check for long double once bitfield support is added
|
// TODO: add isnan check for long double once bitfield support is added
|
||||||
// (needed for x86_64-windows-gnu)
|
// (needed for x86_64-windows-gnu)
|
||||||
// TODO: add isinf check for long double once std.math.isInf supports c_longdouble
|
// TODO: add isinf check for long double once std.math.isInf supports c_longdouble
|
||||||
// TODO https://github.com/ziglang/zig/issues/12630
|
cases.add("NAN and INFINITY",
|
||||||
if (!(builtin.zig_backend == .stage2_llvm and builtin.target.os.tag == .windows)) {
|
\\#include <math.h>
|
||||||
cases.add("NAN and INFINITY",
|
\\#include <stdint.h>
|
||||||
\\#include <math.h>
|
\\#include <stdlib.h>
|
||||||
\\#include <stdint.h>
|
\\union uf { uint32_t u; float f; };
|
||||||
\\#include <stdlib.h>
|
\\#define CHECK_NAN(STR, VAL) { \
|
||||||
\\union uf { uint32_t u; float f; };
|
\\ union uf unpack = {.f = __builtin_nanf(STR)}; \
|
||||||
\\#define CHECK_NAN(STR, VAL) { \
|
\\ if (!isnan(unpack.f)) abort(); \
|
||||||
\\ union uf unpack = {.f = __builtin_nanf(STR)}; \
|
\\ if (unpack.u != VAL) abort(); \
|
||||||
\\ if (!isnan(unpack.f)) abort(); \
|
\\}
|
||||||
\\ if (unpack.u != VAL) abort(); \
|
\\int main(void) {
|
||||||
\\}
|
\\ float f_nan = NAN;
|
||||||
\\int main(void) {
|
\\ if (!isnan(f_nan)) abort();
|
||||||
\\ float f_nan = NAN;
|
\\ double d_nan = NAN;
|
||||||
\\ if (!isnan(f_nan)) abort();
|
\\ if (!isnan(d_nan)) abort();
|
||||||
\\ double d_nan = NAN;
|
\\ CHECK_NAN("0", 0x7FC00000);
|
||||||
\\ if (!isnan(d_nan)) abort();
|
\\ CHECK_NAN("", 0x7FC00000);
|
||||||
\\ CHECK_NAN("0", 0x7FC00000);
|
\\ CHECK_NAN("1", 0x7FC00001);
|
||||||
\\ CHECK_NAN("", 0x7FC00000);
|
\\ CHECK_NAN("0x7FC00000", 0x7FC00000);
|
||||||
\\ CHECK_NAN("1", 0x7FC00001);
|
\\ CHECK_NAN("0x7FC0000F", 0x7FC0000F);
|
||||||
\\ CHECK_NAN("0x7FC00000", 0x7FC00000);
|
\\ CHECK_NAN("0x7FC000F0", 0x7FC000F0);
|
||||||
\\ CHECK_NAN("0x7FC0000F", 0x7FC0000F);
|
\\ CHECK_NAN("0x7FC00F00", 0x7FC00F00);
|
||||||
\\ CHECK_NAN("0x7FC000F0", 0x7FC000F0);
|
\\ CHECK_NAN("0x7FC0F000", 0x7FC0F000);
|
||||||
\\ CHECK_NAN("0x7FC00F00", 0x7FC00F00);
|
\\ CHECK_NAN("0x7FCF0000", 0x7FCF0000);
|
||||||
\\ CHECK_NAN("0x7FC0F000", 0x7FC0F000);
|
\\ CHECK_NAN("0xFFFFFFFF", 0x7FFFFFFF);
|
||||||
\\ CHECK_NAN("0x7FCF0000", 0x7FCF0000);
|
\\ float f_inf = INFINITY;
|
||||||
\\ CHECK_NAN("0xFFFFFFFF", 0x7FFFFFFF);
|
\\ if (!isinf(f_inf)) abort();
|
||||||
\\ float f_inf = INFINITY;
|
\\ double d_inf = INFINITY;
|
||||||
\\ if (!isinf(f_inf)) abort();
|
\\ if (!isinf(d_inf)) abort();
|
||||||
\\ double d_inf = INFINITY;
|
\\ return 0;
|
||||||
\\ if (!isinf(d_inf)) abort();
|
\\}
|
||||||
\\ return 0;
|
, "");
|
||||||
\\}
|
|
||||||
, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
cases.add("signed array subscript. Issue #8556",
|
cases.add("signed array subscript. Issue #8556",
|
||||||
\\#include <stdint.h>
|
\\#include <stdint.h>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue