zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit a7029496d153bd2ba4e91ef561a399cad6d77307 (tree)
parent 377e8579f9539c56fc5988c9a452a01438af89f3
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 31 Jul 2024 14:03:20 -0700

remove hard tabs from source code

these are illegal according to the spec

Diffstat:
Mlib/std/crypto/ml_kem.zig | 6+++---
Mlib/std/macho.zig | 9++++-----
Mlib/std/zig/system/darwin/macos.zig | 92++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mlib/std/zig/system/linux.zig | 60++++++++++++++++++++++++++++++------------------------------
Msrc/link/tapi/yaml/test.zig | 5+----
Mtest/run_translated_c.zig | 12++++++------
Mtest/translate_c.zig | 34+++++++++++++++++-----------------
7 files changed, 107 insertions(+), 111 deletions(-)

diff --git a/lib/std/crypto/ml_kem.zig b/lib/std/crypto/ml_kem.zig @@ -677,10 +677,10 @@ fn montReduce(x: i32) i16 { // Note gcd(2¹⁶, q) = 1 as q is prime. Write q' := 62209 = q⁻¹ mod R. // First we compute // - // m := ((x mod R) q') mod R + // m := ((x mod R) q') mod R // = x q' mod R - // = int16(x q') - // = int16(int32(x) * int32(q')) + // = int16(x q') + // = int16(int32(x) * int32(q')) // // Note that x q' might be as big as 2³² and could overflow the int32 // multiplication in the last line. However for any int32s a and b, diff --git a/lib/std/macho.zig b/lib/std/macho.zig @@ -203,8 +203,7 @@ pub const symtab_command = extern struct { /// local symbols (static and debugging symbols) - grouped by module /// defined external symbols - grouped by module (sorted by name if not lib) /// undefined external symbols (sorted by name if MH_BINDATLOAD is not set, -/// and in order the were seen by the static -/// linker if MH_BINDATLOAD is set) +/// and in order the were seen by the static linker if MH_BINDATLOAD is set) /// In this load command there are offsets and counts to each of the three groups /// of symbols. /// @@ -219,9 +218,9 @@ pub const symtab_command = extern struct { /// shared library. For executable and object modules, which are files /// containing only one module, the information that would be in these three /// tables is determined as follows: -/// table of contents - the defined external symbols are sorted by name -/// module table - the file contains only one module so everything in the -/// file is part of the module. +/// table of contents - the defined external symbols are sorted by name +/// module table - the file contains only one module so everything in the file +/// is part of the module. /// reference symbol table - is the defined and undefined external symbols /// /// For dynamically linked shared library files this load command also contains diff --git a/lib/std/zig/system/darwin/macos.zig b/lib/std/zig/system/darwin/macos.zig @@ -303,16 +303,16 @@ test "detect" { \\<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> \\<plist version="1.0"> \\<dict> - \\ <key>ProductBuildVersion</key> - \\ <string>7W98</string> - \\ <key>ProductCopyright</key> - \\ <string>Apple Computer, Inc. 1983-2004</string> - \\ <key>ProductName</key> - \\ <string>Mac OS X</string> - \\ <key>ProductUserVisibleVersion</key> - \\ <string>10.3.9</string> - \\ <key>ProductVersion</key> - \\ <string>10.3.9</string> + \\ <key>ProductBuildVersion</key> + \\ <string>7W98</string> + \\ <key>ProductCopyright</key> + \\ <string>Apple Computer, Inc. 1983-2004</string> + \\ <key>ProductName</key> + \\ <string>Mac OS X</string> + \\ <key>ProductUserVisibleVersion</key> + \\ <string>10.3.9</string> + \\ <key>ProductVersion</key> + \\ <string>10.3.9</string> \\</dict> \\</plist> , @@ -323,18 +323,18 @@ test "detect" { \\<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> \\<plist version="1.0"> \\<dict> - \\ <key>ProductBuildVersion</key> - \\ <string>19G68</string> - \\ <key>ProductCopyright</key> - \\ <string>1983-2020 Apple Inc.</string> - \\ <key>ProductName</key> - \\ <string>Mac OS X</string> - \\ <key>ProductUserVisibleVersion</key> - \\ <string>10.15.6</string> - \\ <key>ProductVersion</key> - \\ <string>10.15.6</string> - \\ <key>iOSSupportVersion</key> - \\ <string>13.6</string> + \\ <key>ProductBuildVersion</key> + \\ <string>19G68</string> + \\ <key>ProductCopyright</key> + \\ <string>1983-2020 Apple Inc.</string> + \\ <key>ProductName</key> + \\ <string>Mac OS X</string> + \\ <key>ProductUserVisibleVersion</key> + \\ <string>10.15.6</string> + \\ <key>ProductVersion</key> + \\ <string>10.15.6</string> + \\ <key>iOSSupportVersion</key> + \\ <string>13.6</string> \\</dict> \\</plist> , @@ -345,18 +345,18 @@ test "detect" { \\<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> \\<plist version="1.0"> \\<dict> - \\ <key>ProductBuildVersion</key> - \\ <string>20A2408</string> - \\ <key>ProductCopyright</key> - \\ <string>1983-2020 Apple Inc.</string> - \\ <key>ProductName</key> - \\ <string>macOS</string> - \\ <key>ProductUserVisibleVersion</key> - \\ <string>11.0</string> - \\ <key>ProductVersion</key> - \\ <string>11.0</string> - \\ <key>iOSSupportVersion</key> - \\ <string>14.2</string> + \\ <key>ProductBuildVersion</key> + \\ <string>20A2408</string> + \\ <key>ProductCopyright</key> + \\ <string>1983-2020 Apple Inc.</string> + \\ <key>ProductName</key> + \\ <string>macOS</string> + \\ <key>ProductUserVisibleVersion</key> + \\ <string>11.0</string> + \\ <key>ProductVersion</key> + \\ <string>11.0</string> + \\ <key>iOSSupportVersion</key> + \\ <string>14.2</string> \\</dict> \\</plist> , @@ -367,18 +367,18 @@ test "detect" { \\<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> \\<plist version="1.0"> \\<dict> - \\ <key>ProductBuildVersion</key> - \\ <string>20C63</string> - \\ <key>ProductCopyright</key> - \\ <string>1983-2020 Apple Inc.</string> - \\ <key>ProductName</key> - \\ <string>macOS</string> - \\ <key>ProductUserVisibleVersion</key> - \\ <string>11.1</string> - \\ <key>ProductVersion</key> - \\ <string>11.1</string> - \\ <key>iOSSupportVersion</key> - \\ <string>14.3</string> + \\ <key>ProductBuildVersion</key> + \\ <string>20C63</string> + \\ <key>ProductCopyright</key> + \\ <string>1983-2020 Apple Inc.</string> + \\ <key>ProductName</key> + \\ <string>macOS</string> + \\ <key>ProductUserVisibleVersion</key> + \\ <string>11.1</string> + \\ <key>ProductVersion</key> + \\ <string>11.1</string> + \\ <key>iOSSupportVersion</key> + \\ <string>14.3</string> \\</dict> \\</plist> , diff --git a/lib/std/zig/system/linux.zig b/lib/std/zig/system/linux.zig @@ -109,12 +109,12 @@ const RiscvCpuinfoParser = CpuinfoParser(RiscvCpuinfoImpl); test "cpuinfo: RISC-V" { try testParser(RiscvCpuinfoParser, .riscv64, &Target.riscv.cpu.sifive_u74, - \\processor : 0 - \\hart : 1 - \\isa : rv64imafdc - \\mmu : sv39 - \\isa-ext : - \\uarch : sifive,u74-mc + \\processor : 0 + \\hart : 1 + \\isa : rv64imafdc + \\mmu : sv39 + \\isa-ext : + \\uarch : sifive,u74-mc ); } @@ -177,16 +177,16 @@ const PowerpcCpuinfoParser = CpuinfoParser(PowerpcCpuinfoImpl); test "cpuinfo: PowerPC" { try testParser(PowerpcCpuinfoParser, .powerpc, &Target.powerpc.cpu.@"970", - \\processor : 0 - \\cpu : PPC970MP, altivec supported - \\clock : 1250.000000MHz - \\revision : 1.1 (pvr 0044 0101) + \\processor : 0 + \\cpu : PPC970MP, altivec supported + \\clock : 1250.000000MHz + \\revision : 1.1 (pvr 0044 0101) ); try testParser(PowerpcCpuinfoParser, .powerpc64le, &Target.powerpc.cpu.pwr8, - \\processor : 0 - \\cpu : POWER8 (raw), altivec supported - \\clock : 2926.000000MHz - \\revision : 2.0 (pvr 004d 0200) + \\processor : 0 + \\cpu : POWER8 (raw), altivec supported + \\clock : 2926.000000MHz + \\revision : 2.0 (pvr 004d 0200) ); } @@ -304,25 +304,25 @@ test "cpuinfo: ARM" { \\CPU revision : 7 ); try testParser(ArmCpuinfoParser, .arm, &Target.arm.cpu.cortex_a7, - \\processor : 0 - \\model name : ARMv7 Processor rev 3 (v7l) - \\BogoMIPS : 18.00 - \\Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae - \\CPU implementer : 0x41 + \\processor : 0 + \\model name : ARMv7 Processor rev 3 (v7l) + \\BogoMIPS : 18.00 + \\Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae + \\CPU implementer : 0x41 \\CPU architecture: 7 - \\CPU variant : 0x0 - \\CPU part : 0xc07 - \\CPU revision : 3 + \\CPU variant : 0x0 + \\CPU part : 0xc07 + \\CPU revision : 3 \\ - \\processor : 4 - \\model name : ARMv7 Processor rev 3 (v7l) - \\BogoMIPS : 90.00 - \\Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae - \\CPU implementer : 0x41 + \\processor : 4 + \\model name : ARMv7 Processor rev 3 (v7l) + \\BogoMIPS : 90.00 + \\Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae + \\CPU implementer : 0x41 \\CPU architecture: 7 - \\CPU variant : 0x2 - \\CPU part : 0xc0f - \\CPU revision : 3 + \\CPU variant : 0x2 + \\CPU part : 0xc0f + \\CPU revision : 3 ); try testParser(ArmCpuinfoParser, .aarch64, &Target.aarch64.cpu.cortex_a72, \\processor : 0 diff --git a/src/link/tapi/yaml/test.zig b/src/link/tapi/yaml/test.zig @@ -237,10 +237,7 @@ test "double quoted string" { try testing.expectEqualStrings( \\"here" are some escaped quotes , arr[1]); - try testing.expectEqualStrings( - \\newlines and tabs - \\are supported - , arr[2]); + try testing.expectEqualStrings("newlines and tabs\nare\tsupported", arr[2]); try testing.expectEqualStrings( \\let's have \\some fun! diff --git a/test/run_translated_c.zig b/test/run_translated_c.zig @@ -26,17 +26,17 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void { \\void baz(void); \\struct foo { int x; }; \\void bar() { - \\ struct foo tmp; + \\ struct foo tmp; \\} \\ \\void baz() { - \\ struct foo tmp; + \\ struct foo tmp; \\} \\ \\int main(void) { - \\ bar(); - \\ baz(); - \\ return 0; + \\ bar(); + \\ baz(); + \\ return 0; \\} , ""); @@ -53,7 +53,7 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void { cases.add("parenthesized string literal", \\void foo(const char *s) {} \\int main(void) { - \\ foo(("bar")); + \\ foo(("bar")); \\} , ""); diff --git a/test/translate_c.zig b/test/translate_c.zig @@ -133,20 +133,20 @@ pub fn addCases(cases: *tests.TranslateCContext) void { cases.add("scoped typedef", \\void foo() { - \\ typedef union { - \\ int A; - \\ int B; - \\ int C; - \\ } Foo; - \\ Foo a = {0}; - \\ { - \\ typedef union { - \\ int A; - \\ int B; - \\ int C; - \\ } Foo; - \\ Foo a = {0}; - \\ } + \\ typedef union { + \\ int A; + \\ int B; + \\ int C; + \\ } Foo; + \\ Foo a = {0}; + \\ { + \\ typedef union { + \\ int A; + \\ int B; + \\ int C; + \\ } Foo; + \\ Foo a = {0}; + \\ } \\} , &[_][]const u8{ \\pub export fn foo() void { @@ -2043,18 +2043,18 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\ break; \\ } \\ case 4: - \\ case 5: + \\ case 5: \\ res = 69; \\ { \\ res = 5; - \\ return; + \\ return; \\ } \\ case 6: \\ switch (res) { \\ case 9: break; \\ } \\ res = 1; - \\ return; + \\ return; \\ } \\} , &[_][]const u8{