| ... | @@ -1910,6 +1910,30 @@ pub const Target = struct { | ... | @@ -1910,6 +1910,30 @@ pub const Target = struct { |
| 1910 | } | 1910 | } |
| 1911 | } | 1911 | } |
| 1912 | | 1912 | |
| | 1913 | /// Default signedness of `char` for the native C compiler for this target |
| | 1914 | /// Note that char signedness is implementation-defined and many compilers provide |
| | 1915 | /// an option to override the default signedness e.g. GCC's -funsigned-char / -fsigned-char |
| | 1916 | pub fn charSignedness(target: Target) std.builtin.Signedness { |
| | 1917 | switch (target.cpu.arch) { |
| | 1918 | .aarch64, |
| | 1919 | .aarch64_32, |
| | 1920 | .aarch64_be, |
| | 1921 | .arm, |
| | 1922 | .armeb, |
| | 1923 | .thumb, |
| | 1924 | .thumbeb, |
| | 1925 | => return if (target.os.tag.isDarwin() or target.os.tag == .windows) .signed else .unsigned, |
| | 1926 | .powerpc, .powerpc64 => return if (target.os.tag.isDarwin()) .signed else .unsigned, |
| | 1927 | .powerpc64le, |
| | 1928 | .s390x, |
| | 1929 | .xcore, |
| | 1930 | .arc, |
| | 1931 | .msp430, |
| | 1932 | => return .unsigned, |
| | 1933 | else => return .signed, |
| | 1934 | } |
| | 1935 | } |
| | 1936 | |
| 1913 | pub const CType = enum { | 1937 | pub const CType = enum { |
| 1914 | char, | 1938 | char, |
| 1915 | short, | 1939 | short, |