Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement the native operating system version detection for FreeBSD #4582

Closed
andrewrk opened this issue Feb 29, 2020 · 0 comments · Fixed by #5416
Closed

implement the native operating system version detection for FreeBSD #4582

andrewrk opened this issue Feb 29, 2020 · 0 comments · Fixed by #5416
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness. os-freebsd standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@andrewrk
Copy link
Member

This is a follow-up task from #4550.

zig/lib/std/zig/system.zig

Lines 229 to 231 in 7617610

.freebsd => {
// TODO Detect native operating system version.
},

zig/lib/std/target.zig

Lines 115 to 181 in 7617610

/// The version ranges here represent the minimum OS version to be supported
/// and the maximum OS version to be supported. The default values represent
/// the range that the Zig Standard Library bases its abstractions on.
///
/// The minimum version of the range is the main setting to tweak for a target.
/// Usually, the maximum target OS version will remain the default, which is
/// the latest released version of the OS.
///
/// To test at compile time if the target is guaranteed to support a given OS feature,
/// one should check that the minimum version of the range is greater than or equal to
/// the version the feature was introduced in.
///
/// To test at compile time if the target certainly will not support a given OS feature,
/// one should check that the maximum version of the range is less than the version the
/// feature was introduced in.
///
/// If neither of these cases apply, a runtime check should be used to determine if the
/// target supports a given OS feature.
///
/// Binaries built with a given maximum version will continue to function on newer operating system
/// versions. However, such a binary may not take full advantage of the newer operating system APIs.
pub const VersionRange = union {
none: void,
semver: Version.Range,
linux: LinuxVersionRange,
windows: WindowsVersion.Range,
/// The default `VersionRange` represents the range that the Zig Standard Library
/// bases its abstractions on.
pub fn default(tag: Tag) VersionRange {
switch (tag) {
.freestanding,
.ananas,
.cloudabi,
.dragonfly,
.fuchsia,
.kfreebsd,
.lv2,
.solaris,
.haiku,
.minix,
.rtems,
.nacl,
.cnk,
.aix,
.cuda,
.nvcl,
.amdhsa,
.ps4,
.elfiamcu,
.mesa3d,
.contiki,
.amdpal,
.hermit,
.hurd,
.wasi,
.emscripten,
.uefi,
.other,
=> return .{ .none = {} },
.freebsd => return .{
.semver = Version.Range{
.min = .{ .major = 12, .minor = 0 },
.max = .{ .major = 12, .minor = 1 },
},
},

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. os-freebsd frontend Tokenization, parsing, AstGen, Sema, and Liveness. labels Feb 29, 2020
@andrewrk andrewrk added this to the 0.7.0 milestone Feb 29, 2020
jethron added a commit to jethron/zig that referenced this issue Apr 18, 2020
jethron added a commit to jethron/zig that referenced this issue Apr 26, 2020
jethron added a commit to jethron/zig that referenced this issue May 2, 2020
jethron added a commit to jethron/zig that referenced this issue May 2, 2020
jethron added a commit to jethron/zig that referenced this issue May 2, 2020
jethron added a commit to jethron/zig that referenced this issue May 11, 2020
jethron added a commit to jethron/zig that referenced this issue May 24, 2020
andrewrk pushed a commit that referenced this issue May 25, 2020
* target: Implement OS version detection for FreeBSD

Fixes #4582

* freebsd version: handle errors explicitly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. frontend Tokenization, parsing, AstGen, Sema, and Liveness. os-freebsd standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant