Evan Haas
8a5fb4c248
translate-c: Ensure all local variables and function params are used
2021-06-23 10:47:47 -07:00
Andrew Kelley
84fe5d4681
fix unused variable errors in runtime safety test cases
2021-06-23 10:44:46 -07:00
Andrew Kelley
3a4a710894
update godbolt test case for unused parameter
2021-06-23 10:44:46 -07:00
Andrew Kelley
189fc964f7
fix unused parameters in compare_output test cases
2021-06-23 10:44:46 -07:00
Andrew Kelley
fc185a6f71
stage1: @shuffle
type and mask params in comptime scope
2021-06-23 09:52:09 -07:00
Jonathan Marler
0134cb0214
nice error for unsupported async sockets on Windows
2021-06-23 12:54:20 +03:00
Evan Haas
0e7897a9a2
translate-c: Remove usage of extern enum
...
Translate enum types as the underlying integer type. Translate enum constants
as top-level integer constants of the correct type (which does not necessarily
match the enum integer type).
If an enum constant's type cannot be translated for some reason, omit it.
See discussion https://github.com/ziglang/zig/issues/2115#issuecomment-827968279
Fixes #9153
2021-06-23 08:44:25 +03:00
Andrew Kelley
06412e04f9
cleanups related to unused params
2021-06-21 17:03:04 -07:00
Jacob G-W
9fffffb07b
fix code broken from previous commit
2021-06-21 17:03:03 -07:00
Jacob G-W
641ecc260f
std, src, doc, test: remove unused variables
2021-06-21 17:03:03 -07:00
Jacob G-W
18c1007a34
stage2 tests: remove unused vars
2021-06-21 17:03:03 -07:00
Jacob G-W
75f7a8913e
stage2 astgen: find unused vars
2021-06-21 17:03:02 -07:00
g-w1
e13a182990
stage2 Sema: implement @intToPtr ( #9144 )
...
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2021-06-21 18:47:34 +03:00
Andrew Kelley
fc1feebdc0
Merge pull request #9168 from LemonBoy/fix-pie
...
std: Fix PIE startup sequence
2021-06-20 20:01:39 -04:00
Dmitry Matveyev
00982f75e9
stage2: Remove special double ampersand parsing case ( #9114 )
...
* Remove parser error on double ampersand
* Add failing test for double ampersand case
* Add error when encountering double ampersand in AstGen
"Bit and" operator should not make sense when one of its operands
is an address.
* Check that 2 ampersands are adjacent to each other in source string
* Remove cases of unused variables in tests
2021-06-20 21:04:14 +03:00
LemonBoy
aa6422d792
tests: Update line numbers
2021-06-19 20:07:07 +02:00
LemonBoy
fd6d5f1609
std: Fix PIE startup sequence
...
* Don't skip the TLS initialization (Fixes #9083 )
* Add a test case where a PIE program is built and run
* Refactor the common initialization code in the Linux startup
sequence.
2021-06-19 18:02:51 +02:00
Daniele Cocca
9e88356282
embedFile: change notation from [X:0] to [N:0]
...
This is for consistency with the documentation on sentinel-terminated
{arrays,slices,pointers} which already use `N` for a comptime-inferred
size rather than `X`.
Also adds a behavioral test to assert that a string literal is returned.
2021-06-16 22:03:02 +01:00
Daniele Cocca
9be2f76741
typeName: amend return type to string literal
...
This was already the case, but the documentation failed to point out
that the returned value is of type `*const [N:0]u8`, i.e. that of a
string literal.
Also adds a behavioral test to assert that this is the case.
2021-06-16 22:03:02 +01:00
Daniele Cocca
171102ea7c
errorName: return a null-terminated slice
2021-06-16 22:02:52 +01:00
Daniele Cocca
00e1c0082c
tagName: return a null-terminated slice
2021-06-16 22:02:42 +01:00
Veikka Tuominen
699b6cdf01
translate-c: move utility functions to a separate namespace
2021-06-14 20:13:34 +03:00
Veikka Tuominen
e63ff4f1c1
add ast-check flag to zig fmt, fix found bugs
2021-06-14 00:16:40 +03:00
jacob gw
b9f07b7ac2
format zig files and add formatting check to ci
2021-06-13 22:33:39 +03:00
LemonBoy
ff79b87fa0
tools: Unbreak many tools
...
Many tools were broken after the recent hash-table refactorings, fix
them and ensure they won't silently break again.
2021-06-13 15:25:18 -04:00
Veikka Tuominen
029fe6c9ab
meta.cast: handle casts from negative ints to ptrs
2021-06-13 16:53:01 +03:00
xackus
aa83cbb697
translate-c: better typename parsing
2021-06-13 16:47:42 +03:00
Veikka Tuominen
6664679c8c
translate-c: don't bother with unwrapping pointers
...
Dereferencing a c pointer implicitly includes an unwrap,
manually adding it just causes bugs.
2021-06-13 15:23:31 +03:00
Jarred Sumner
540b52931a
Improve error message when std.fmt.format is missing arguments
...
Use fmt in fmt so the number in the error message is fmt'd
2021-06-13 10:33:49 +03:00
Evan Haas
ea4a25287e
translate-c: better support for static local variables
...
Don't move static local variables into the top-level scope since this
can cause name clashes if subsequently-defined variables or parameters
in different scopes share the name.
Instead, use a variable within a struct so that the variable's lexical
scope does not change. This solution was suggested by @LemonBoy
Note that a similar name-shadowing problem exists with `extern` variables
declared within block scope, but a different solution will be needed since
they do need to be moved to the top-level scope and we can't rename them.
2021-06-12 23:12:37 +03:00
Exonorid
f63338195d
Renamed @byteOffsetOf to @offsetOf
2021-06-12 19:16:01 +03:00
Veikka Tuominen
2b2efa24d0
std.build: don't default to static linkage
2021-06-12 14:23:07 +03:00
xackus
b5c117d051
translate-c: fix enums that require c_uint type
2021-06-12 11:55:39 +03:00
Evan Haas
45212e3b33
translate-c: Implement flexible arrays
...
Fixes #8759
2021-06-11 21:31:39 +03:00
Veikka Tuominen
c5d4122684
Merge pull request #7959 from MasterQ32/build_rewrite
...
Make build.zig ready for generated files
2021-06-11 19:13:14 +03:00
Veikka Tuominen
4b72b0560d
make remaining enums in build.zig snake_case
2021-06-11 16:01:30 +03:00
Jakub Konka
961d556570
Merge pull request #9069 from ziglang/zld-common-syms
...
zig ld: add common (tentative) symbols support
2021-06-11 10:18:43 +02:00
Felix (xq) Queißner
1c1ea2baa7
Code quality improvements to GeneratedFile, and manual implementation of Builder.addObjectSource.
2021-06-11 10:43:52 +03:00
Felix (xq) Queißner
27bd0971bb
Changes to .path instead of .getPathFn. Changes LibExeObjStep to also provide FileSource.
2021-06-11 10:39:50 +03:00
Felix (xq) Queißner
07acb1ccc9
Changes createExecutable parameter is_dynamic to a enum to make code more readable .
2021-06-11 10:38:57 +03:00
Andrew Kelley
138afd5cbf
zig fmt
2021-06-10 20:13:43 -07:00
Jakub Konka
183d5f4a53
Add standalone test for common symbols
2021-06-10 19:51:41 +02:00
LemonBoy
43a09f7efc
stage1: Fix handling of C ABI parameters split in multiple regs
...
Take into account the increased number of parameters when flattening a
structure into one or more SSE registers.
Fixes #9061
2021-06-10 12:50:25 -04:00
daurnimator
916b645fc1
Have std.fmt functions take case as an enum
2021-06-10 08:33:42 +03:00
Jakub Konka
e8e305b67c
Re-enable multiple wasm32 vector tests
...
Fixes #5339
2021-06-09 23:54:23 -04:00
Lee Cannon
629e2e7844
Add a logging allocator that uses std.log ( #8511 )
2021-06-09 21:42:07 +03:00
Lee Cannon
50822530d3
Provide method to set logging level per scope ( #8584 )
2021-06-09 12:23:45 +03:00
jacob gw
b57ac48773
stage2: compile error for ambiguous decl refrences
...
std: fix compile errors from this change. This is a stage1 bug.
2021-06-08 18:13:12 -04:00
Andrew Kelley
ccfa168284
Merge pull request #9030 from Vexu/stage2
...
Stage2: implement comptime variables
2021-06-08 14:16:57 -04:00
Matthew Borkowski
9ac6d28614
stage1: make @truncate
to an integer type of different sign an error at comptime too
2021-06-08 20:58:30 +03:00