mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
compiler: define ___OpenBSD and OpenBSDX_Y when targeting openbsd libc
This commit is contained in:
parent
df147734a3
commit
9a9cc9c96d
1 changed files with 15 additions and 0 deletions
|
|
@ -6884,6 +6884,21 @@ fn addCommonCCArgs(
|
||||||
// would be inconsistent with header declarations.
|
// would be inconsistent with header declarations.
|
||||||
(min_ver.major * 100_000_000) + (min_ver.minor * 1_000_000),
|
(min_ver.major * 100_000_000) + (min_ver.minor * 1_000_000),
|
||||||
}));
|
}));
|
||||||
|
} else if (target.isOpenBSDLibC()) {
|
||||||
|
const min_ver = target.os.version_range.semver.min;
|
||||||
|
// The macro in sys/param.h doesn't have the leading underscores, but we don't want to pollute the
|
||||||
|
// global namespace in all compilation units. So we use leading underscores and modify sys/param.h
|
||||||
|
// to just alias this one.
|
||||||
|
try argv.append(try std.fmt.allocPrint(arena, "-D___OpenBSD={d}", .{
|
||||||
|
// Brilliantly, OpenBSD defines this macro to the year and month of the release, so we need to
|
||||||
|
// maintain a manual mapping here whenever we update the headers.
|
||||||
|
202510,
|
||||||
|
}));
|
||||||
|
// We can't avoid pollution for this one...
|
||||||
|
try argv.append(try std.fmt.allocPrint(arena, "-DOpenBSD{d}_{d}", .{
|
||||||
|
min_ver.major,
|
||||||
|
min_ver.minor,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue