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) {
|
||||
self.coff_header_offset = coff_header_offset + 4;
|
||||
const coff_header = self.getCoffHeader();
|
||||
if (coff_header.size_of_optional_header == 0) {
|
||||
std.log.err("Required PE header missing for image file", .{});
|
||||
return error.MissingPEHeader;
|
||||
}
|
||||
if (coff_header.size_of_optional_header == 0) return error.MissingPEHeader;
|
||||
}
|
||||
|
||||
// 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 builtin = @import("builtin");
|
||||
const tests = @import("tests.zig");
|
||||
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
|
||||
// (needed for x86_64-windows-gnu)
|
||||
// TODO: add isinf check for long double once std.math.isInf supports c_longdouble
|
||||
// TODO https://github.com/ziglang/zig/issues/12630
|
||||
if (!(builtin.zig_backend == .stage2_llvm and builtin.target.os.tag == .windows)) {
|
||||
cases.add("NAN and INFINITY",
|
||||
\\#include <math.h>
|
||||
\\#include <stdint.h>
|
||||
\\#include <stdlib.h>
|
||||
\\union uf { uint32_t u; float f; };
|
||||
\\#define CHECK_NAN(STR, VAL) { \
|
||||
\\ union uf unpack = {.f = __builtin_nanf(STR)}; \
|
||||
\\ if (!isnan(unpack.f)) abort(); \
|
||||
\\ if (unpack.u != VAL) abort(); \
|
||||
\\}
|
||||
\\int main(void) {
|
||||
\\ float f_nan = NAN;
|
||||
\\ if (!isnan(f_nan)) abort();
|
||||
\\ double d_nan = NAN;
|
||||
\\ if (!isnan(d_nan)) abort();
|
||||
\\ CHECK_NAN("0", 0x7FC00000);
|
||||
\\ CHECK_NAN("", 0x7FC00000);
|
||||
\\ CHECK_NAN("1", 0x7FC00001);
|
||||
\\ CHECK_NAN("0x7FC00000", 0x7FC00000);
|
||||
\\ CHECK_NAN("0x7FC0000F", 0x7FC0000F);
|
||||
\\ CHECK_NAN("0x7FC000F0", 0x7FC000F0);
|
||||
\\ CHECK_NAN("0x7FC00F00", 0x7FC00F00);
|
||||
\\ CHECK_NAN("0x7FC0F000", 0x7FC0F000);
|
||||
\\ CHECK_NAN("0x7FCF0000", 0x7FCF0000);
|
||||
\\ CHECK_NAN("0xFFFFFFFF", 0x7FFFFFFF);
|
||||
\\ float f_inf = INFINITY;
|
||||
\\ if (!isinf(f_inf)) abort();
|
||||
\\ double d_inf = INFINITY;
|
||||
\\ if (!isinf(d_inf)) abort();
|
||||
\\ return 0;
|
||||
\\}
|
||||
, "");
|
||||
}
|
||||
cases.add("NAN and INFINITY",
|
||||
\\#include <math.h>
|
||||
\\#include <stdint.h>
|
||||
\\#include <stdlib.h>
|
||||
\\union uf { uint32_t u; float f; };
|
||||
\\#define CHECK_NAN(STR, VAL) { \
|
||||
\\ union uf unpack = {.f = __builtin_nanf(STR)}; \
|
||||
\\ if (!isnan(unpack.f)) abort(); \
|
||||
\\ if (unpack.u != VAL) abort(); \
|
||||
\\}
|
||||
\\int main(void) {
|
||||
\\ float f_nan = NAN;
|
||||
\\ if (!isnan(f_nan)) abort();
|
||||
\\ double d_nan = NAN;
|
||||
\\ if (!isnan(d_nan)) abort();
|
||||
\\ CHECK_NAN("0", 0x7FC00000);
|
||||
\\ CHECK_NAN("", 0x7FC00000);
|
||||
\\ CHECK_NAN("1", 0x7FC00001);
|
||||
\\ CHECK_NAN("0x7FC00000", 0x7FC00000);
|
||||
\\ CHECK_NAN("0x7FC0000F", 0x7FC0000F);
|
||||
\\ CHECK_NAN("0x7FC000F0", 0x7FC000F0);
|
||||
\\ CHECK_NAN("0x7FC00F00", 0x7FC00F00);
|
||||
\\ CHECK_NAN("0x7FC0F000", 0x7FC0F000);
|
||||
\\ CHECK_NAN("0x7FCF0000", 0x7FCF0000);
|
||||
\\ CHECK_NAN("0xFFFFFFFF", 0x7FFFFFFF);
|
||||
\\ float f_inf = INFINITY;
|
||||
\\ if (!isinf(f_inf)) abort();
|
||||
\\ double d_inf = INFINITY;
|
||||
\\ if (!isinf(d_inf)) abort();
|
||||
\\ return 0;
|
||||
\\}
|
||||
, "");
|
||||
|
||||
cases.add("signed array subscript. Issue #8556",
|
||||
\\#include <stdint.h>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue