compiler-rt: do not depend on usingnamespace

The idea is to depend on this language feature as little as possible
with the hopes that it can be adjusted to be less of an anti-pattern.
This also helps self-hosted, which does not yet implement
`usingnamespace`, get closer to being able to build compiler-rt.
This commit is contained in:
Andrew Kelley 2021-08-12 10:43:24 -07:00
parent 6eecc4af99
commit fc55814faa
19 changed files with 75 additions and 21 deletions

View File

@ -595,9 +595,9 @@ comptime {
@export(__muloti4, .{ .name = "__muloti4", .linkage = linkage });
const __mulodi4 = @import("compiler_rt/mulodi4.zig").__mulodi4;
@export(__mulodi4, .{ .name = "__mulodi4", .linkage = linkage });
}
pub usingnamespace @import("compiler_rt/atomics.zig");
_ = @import("compiler_rt/atomics.zig");
}
// Avoid dragging in the runtime safety mechanisms into this .o file,
// unless we're trying to test this file.

View File

@ -171,7 +171,10 @@ pub const Feature = enum {
zcz_gp,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
@setEvalBranchQuota(2000);

View File

@ -120,7 +120,10 @@ pub const Feature = enum {
xnack_support,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -179,7 +179,10 @@ pub const Feature = enum {
zcz,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
@setEvalBranchQuota(10000);

View File

@ -41,7 +41,10 @@ pub const Feature = enum {
xmegau,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -10,7 +10,10 @@ pub const Feature = enum {
dwarfris,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -38,7 +38,10 @@ pub const Feature = enum {
zreg,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -59,7 +59,10 @@ pub const Feature = enum {
xgot,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -11,7 +11,10 @@ pub const Feature = enum {
hwmultf5,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -35,7 +35,10 @@ pub const Feature = enum {
sm_80,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -72,7 +72,10 @@ pub const Feature = enum {
vsx,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -64,7 +64,10 @@ pub const Feature = enum {
save_restore,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -26,7 +26,10 @@ pub const Feature = enum {
vis3,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -294,7 +294,10 @@ pub const Feature = enum {
LongConstantCompositeINTEL,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
@setEvalBranchQuota(2000);

View File

@ -43,7 +43,10 @@ pub const Feature = enum {
vector_packed_decimal_enhancement,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -8,7 +8,10 @@ pub const Feature = enum {
vpu,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -18,7 +18,10 @@ pub const Feature = enum {
unimplemented_simd128,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;

View File

@ -147,7 +147,10 @@ pub const Feature = enum {
xsaves,
};
pub usingnamespace CpuFeature.feature_set_fns(Feature);
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
@ -2240,8 +2243,8 @@ pub const cpu = struct {
.features = featureSet(&[_]Feature{
.cx8,
.slow_unaligned_mem_16,
.vzeroupper,
.soft_float,
.vzeroupper,
}),
};
pub const nehalem = CpuModel{

View File

@ -1066,7 +1066,10 @@ fn processOneTarget(job: Job) anyerror!void {
try w.writeAll(
\\};
\\
\\pub usingnamespace CpuFeature.feature_set_fns(Feature);
\\pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
\\pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
\\pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
\\pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
\\
\\pub const all_features = blk: {
\\