| author | |
| committer | |
| log | 0132be7bf3fd02cfb8c31ffdeaddae918a76b295 |
| tree | 91b154b7d461f5ae6be6f2ed04858f3243d9517c |
| parent | c82e1fe880629beea5660c675cfc698807205601 |
To be consistent with the other functions that answer C ABI questions.5 files changed, 7 insertions(+), 7 deletions(-)
lib/compiler/aro/aro/Compilation.zig+1-1| ... | ... | @@ -1087,7 +1087,7 @@ pub fn fixedEnumTagSpecifier(comp: *const Compilation) ?Type.Specifier { |
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | 1089 | pub fn getCharSignedness(comp: *const Compilation) std.builtin.Signedness { |
| 1090 | return comp.langopts.char_signedness_override orelse comp.target.charSignedness(); | |
| 1090 | return comp.langopts.char_signedness_override orelse comp.target.cCharSignedness(); | |
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | /// Add built-in aro headers directory to system include paths |
lib/std/Target.zig+1-1| ... | ... | @@ -2695,7 +2695,7 @@ pub fn stackAlignment(target: Target) u16 { |
| 2695 | 2695 | /// Default signedness of `char` for the native C compiler for this target |
| 2696 | 2696 | /// Note that char signedness is implementation-defined and many compilers provide |
| 2697 | 2697 | /// an option to override the default signedness e.g. GCC's -funsigned-char / -fsigned-char |
| 2698 | pub fn charSignedness(target: Target) std.builtin.Signedness { | |
| 2698 | pub fn cCharSignedness(target: Target) std.builtin.Signedness { | |
| 2699 | 2699 | if (target.os.tag.isDarwin() or target.os.tag == .windows or target.os.tag == .uefi) return .signed; |
| 2700 | 2700 | |
| 2701 | 2701 | return switch (target.cpu.arch) { |
src/Type.zig+3-3| ... | ... | @@ -2331,7 +2331,7 @@ pub fn isInt(self: Type, zcu: *const Zcu) bool { |
| 2331 | 2331 | /// Returns true if and only if the type is a fixed-width, signed integer. |
| 2332 | 2332 | pub fn isSignedInt(ty: Type, zcu: *const Zcu) bool { |
| 2333 | 2333 | return switch (ty.toIntern()) { |
| 2334 | .c_char_type => zcu.getTarget().charSignedness() == .signed, | |
| 2334 | .c_char_type => zcu.getTarget().cCharSignedness() == .signed, | |
| 2335 | 2335 | .isize_type, .c_short_type, .c_int_type, .c_long_type, .c_longlong_type => true, |
| 2336 | 2336 | else => switch (zcu.intern_pool.indexToKey(ty.toIntern())) { |
| 2337 | 2337 | .int_type => |int_type| int_type.signedness == .signed, |
| ... | ... | @@ -2343,7 +2343,7 @@ pub fn isSignedInt(ty: Type, zcu: *const Zcu) bool { |
| 2343 | 2343 | /// Returns true if and only if the type is a fixed-width, unsigned integer. |
| 2344 | 2344 | pub fn isUnsignedInt(ty: Type, zcu: *const Zcu) bool { |
| 2345 | 2345 | return switch (ty.toIntern()) { |
| 2346 | .c_char_type => zcu.getTarget().charSignedness() == .unsigned, | |
| 2346 | .c_char_type => zcu.getTarget().cCharSignedness() == .unsigned, | |
| 2347 | 2347 | .usize_type, .c_ushort_type, .c_uint_type, .c_ulong_type, .c_ulonglong_type => true, |
| 2348 | 2348 | else => switch (zcu.intern_pool.indexToKey(ty.toIntern())) { |
| 2349 | 2349 | .int_type => |int_type| int_type.signedness == .unsigned, |
| ... | ... | @@ -2374,7 +2374,7 @@ pub fn intInfo(starting_ty: Type, zcu: *const Zcu) InternPool.Key.IntType { |
| 2374 | 2374 | }, |
| 2375 | 2375 | .usize_type => return .{ .signedness = .unsigned, .bits = target.ptrBitWidth() }, |
| 2376 | 2376 | .isize_type => return .{ .signedness = .signed, .bits = target.ptrBitWidth() }, |
| 2377 | .c_char_type => return .{ .signedness = zcu.getTarget().charSignedness(), .bits = target.cTypeBitSize(.char) }, | |
| 2377 | .c_char_type => return .{ .signedness = zcu.getTarget().cCharSignedness(), .bits = target.cTypeBitSize(.char) }, | |
| 2378 | 2378 | .c_short_type => return .{ .signedness = .signed, .bits = target.cTypeBitSize(.short) }, |
| 2379 | 2379 | .c_ushort_type => return .{ .signedness = .unsigned, .bits = target.cTypeBitSize(.ushort) }, |
| 2380 | 2380 | .c_int_type => return .{ .signedness = .signed, .bits = target.cTypeBitSize(.int) }, |
src/arch/x86_64/CodeGen.zig+1-1| ... | ... | @@ -109873,7 +109873,7 @@ fn intInfo(cg: *CodeGen, ty: Type) ?std.builtin.Type.Int { |
| 109873 | 109873 | .anyerror => .{ .signedness = .unsigned, .bits = zcu.errorSetBits() }, |
| 109874 | 109874 | .isize => .{ .signedness = .signed, .bits = cg.target.ptrBitWidth() }, |
| 109875 | 109875 | .usize => .{ .signedness = .unsigned, .bits = cg.target.ptrBitWidth() }, |
| 109876 | .c_char => .{ .signedness = cg.target.charSignedness(), .bits = cg.target.cTypeBitSize(.char) }, | |
| 109876 | .c_char => .{ .signedness = cg.target.cCharSignedness(), .bits = cg.target.cTypeBitSize(.char) }, | |
| 109877 | 109877 | .c_short => .{ .signedness = .signed, .bits = cg.target.cTypeBitSize(.short) }, |
| 109878 | 109878 | .c_ushort => .{ .signedness = .unsigned, .bits = cg.target.cTypeBitSize(.short) }, |
| 109879 | 109879 | .c_int => .{ .signedness = .signed, .bits = cg.target.cTypeBitSize(.int) }, |
src/codegen/c/Type.zig+1-1| ... | ... | @@ -78,7 +78,7 @@ pub fn isInteger(ctype: CType) bool { |
| 78 | 78 | |
| 79 | 79 | pub fn signedness(ctype: CType, mod: *Module) std.builtin.Signedness { |
| 80 | 80 | return switch (ctype.index) { |
| 81 | .char => mod.resolved_target.result.charSignedness(), | |
| 81 | .char => mod.resolved_target.result.cCharSignedness(), | |
| 82 | 82 | .@"signed char", |
| 83 | 83 | .short, |
| 84 | 84 | .int, |