Commit Graph

805 Commits

Author SHA1 Message Date
gingerBill
d5a78a9cf1 Remove canonical hash shortcut 2026-03-17 09:43:16 +00:00
gingerBill
a8c6ea7c8a Implement a new StringInterner 2026-03-17 09:18:39 +00:00
gingerBill
1744f57d01 Use permanent_alloc_item directly rather than through the gb_alloc_item generic interface 2026-03-16 16:03:27 +00:00
gingerBill
f1dbe9c242 [dynamic; N]T proof of concept: fixed capacity dynamic array (akin to small_array.Small_Array(N, T)) 2026-03-11 16:46:33 +00:00
Jeroen van Rijn
6434bf4b65 Limit maximum exponent in parsing of float/integer literals 2026-03-07 12:38:04 +01:00
Krzesimir Nowak
1f00da471c Make sure to assign proper comment as package docs
So far, the first comment found was marked as package docs, which
meant that for the following code, the TODO comment would be assigned
to the package declaration instead of the comment directly preceding
the package declaration.

    // TODO: drop after finished with refactoring
    #+ feature using-stmt
    // Package foo implements this and that.
    package foo
2026-03-02 21:26:04 +01:00
Krzesimir Nowak
b8f2daa5b2 Kill deprecated file tags
We had the recommended form of file tags for long enough. Also there
were some issues with the deprecated file tags - they were ignored if
the appeared after recommended file tags, and could possibly show up
in package docs.
2026-03-02 21:26:04 +01:00
Krzesimir Nowak
4ab536a85a Drop pointless code
Modifies a local variable after it was stored in an out parameter, so
this modification has no effect.
2026-03-02 21:24:59 +01:00
Krzesimir Nowak
8bdf82ac8d Fix separating of diverging procedure types from block statements
To avoid creating a procedure literal from a procedure type and a
following block statement, one can insert a semicolon or an empty line
between the two:

    // procedure literals
    p1 :: proc() {…}
    p2 :: proc()
    {…}
    // procedure type followed by a block statement
    p3 :: proc()

    {…}

The empty line as a separator did not work if the procedure type had a
diverging result:

    // all of these are procedure literals
    p4 :: proc() -> ! {…}
    p5 :: proc() -> !
    {…}
    p6 :: proc() -> !

    {…}

The least annoying fix I came up with is to insert implicit semicolon
after the "not" token. I only needed to make sure that the inserted
implicit semicolon is being skipped when the "not" token is a part of
unary expression to avoid breaking an oddly-formatted code like:

    b := get_some_bool()
    if !
       b {…}

One small side-effect of this change is that in code like below:

    Proc_Type :: proc() -> !

    // Some comment
    Some_Other_Type :: enum byte {…}

The "// Some comment" is not associated with "Proc_Type" anymore. In
Odin's standard library this only happens in one place, in
`base/runtime/core.odin`:

    Assertion_Failure_Proc :: #type proc(prefix, message: string, loc: Source_Code_Location) -> !

    // Allocation Stuff
    Allocator_Mode :: enum byte {
    	Alloc,
    	…,
    }
2026-03-01 14:49:24 +01:00
gingerBill
a7ed7ccd0c Merge pull request #6259 from odin-lang/bill/range-init
`for init; x in y {}` style loops (proof of concept)
2026-02-17 11:11:56 +00:00
Krzesimir Nowak
a84179de1f Do not allow duplicate #partial directives on switch statement 2026-02-15 16:37:14 +01:00
gingerBill
8cb7965aa5 for init; x in y {} style loops 2026-02-11 15:33:14 +00:00
gingerBill
b1633b9ebb Require all values from a procedure iterator if the procedure is marked with @(require_results) 2026-02-11 14:05:06 +00:00
Krzesimir Nowak
6cc6f06d4d Stop silently ignoring unknown directives on an inline asm expression 2026-02-11 13:22:13 +01:00
gingerBill
19b545e7cb Merge branch 'master' into bill/feature-using-stmt 2026-01-30 10:49:55 +00:00
Faker-09
30ef01ee8d Merge branch 'odin-lang:master' into vet_flags 2026-01-29 11:35:24 -05:00
gingerBill
07d814d9cf Add struct #simple to force a struct to use simple comparison if all of the fields "nearly simply comparable". 2026-01-29 10:49:26 +00:00
Shane Shrybman
f6322b4b31 Fix for vet flags. All combinations of vet flags on the command line and top of file are working 2026-01-28 14:18:30 -05:00
gingerBill
83a10e929f Require space after the prefix of #+build style tags 2026-01-26 10:49:24 +00:00
gingerBill
cc4a7ec11c Merge pull request #6166 from laytan/vet-file-tags-in-addition-to-command-line
make #+vet tags always work in addition to command line flags
2026-01-24 13:55:41 +00:00
Jeroen van Rijn
1c529d8cb2 Fix #6165 2026-01-24 14:06:31 +01:00
Laytan Laats
a9a65b5377 make #+vet tags always work in addition to command line flags 2026-01-24 12:59:55 +01:00
Jeroen van Rijn
ce71227b6b Fix #6130 2026-01-22 15:20:39 +01:00
gingerBill
59ae82634e Add preserve/most and preserve/all 2026-01-15 17:52:36 +00:00
gingerBill
5f07055ac1 Add #must_tail and "preserve/none" calling convention 2026-01-15 17:28:28 +00:00
gingerBill
0366cd3304 Add #must_tail (similar syntax to #force_inline 2026-01-15 16:32:52 +00:00
Krzesimir Nowak
0bf4ffe469 Fix handling of #force_inline 2025-12-29 22:08:56 +01:00
gingerBill
2e6554b8c8 Disallow importing directories with an .odin extension/suffix 2025-12-26 11:49:46 +00:00
gingerBill
d139c72fc2 Make using as a statement an opt-in with #+feature using-stmt 2025-12-21 11:53:44 +00:00
Krzesimir Nowak
a5809d0185 Fix #packed #all_or_none 2025-12-18 15:04:34 +01:00
gingerBill
fc2cb8fb39 Remove #no_copy 2025-11-05 13:44:14 +00:00
gingerBill
593d2e6daa Add #all_or_none 2025-11-05 13:30:40 +00:00
gingerBill
0972690e14 Add suggestion for T[] to be []T if a type is allowed in that parsing context 2025-10-30 09:16:19 +00:00
gingerBill
025cb03242 Add all-bits to feature tag 2025-10-09 15:02:16 +01:00
gingerBill
547477abf6 Add #+test to replace _test.odin 2025-09-28 20:47:32 +01:00
gingerBill
5ea2e1fe60 Minimize mutex usage when in single threaded mode. 2025-09-10 21:41:52 +01:00
gingerBill
34e3d30780 More thread contention removal 2025-09-10 20:51:52 +01:00
gingerBill
7b5cee9f1e Correct #+feature check 2025-08-08 10:50:24 +01:00
gingerBill
ee01643229 Add -integer-division-by-zero:self 2025-08-08 10:41:05 +01:00
gingerBill
991883d0e1 Add #+feature integer-division-by-zero:<string> 2025-08-08 10:24:44 +01:00
gingerBill
513e6daace Merge pull request #5081 from Lperlind/vet-explicit-allocators
Add -vet-explicit-allocators
2025-07-22 11:06:12 +01:00
Harold Brenes
7c917d56e9 Check for invalid subtargets.
- Add 'ios' pseudo-subtarget which triggets with either iPhone or iPhoneSimulator subtargets.

- Treat an explicit 'default' subtarget as exclusive only to the default subtarget, not an other platform-compatible subtargets.

- 'generic' continues to resolve to true for any platform-compatible subtarget as it names appears to imply such behavior.
2025-07-20 14:35:06 -04:00
Harold Brenes
b811414ed1 Use fi.is_dir instead of path_is_directory() when checking if an import is a directory with a .odin extension. 2025-07-13 15:24:53 -04:00
gingerBill
38faec757d Correct consume comment groups in both parsers 2025-07-11 18:41:40 +01:00
Hayden Gray
ccdd14394e [parser.cpp] - packages with .odin in the name no longer attempt
to parse as odin files
2025-06-05 11:24:50 -04:00
gingerBill
74bab6d42f Fix #5232 by adding an edge case 2025-05-29 16:29:52 +01:00
Lucas Perlind
65b4c793f0 Add -vet-explicit-allocators
This vet flag will make it so that allocators must be explicitly used
in places where context.allocator and context.temp_allocator are a
procedure parameter.

The goal of this flag is to prevent using the context.allocator in
cases where a different allocator was meant to be used.
Some code bases default context.allocator to nil/panic allocator
to catch this at runtime. This effectively makes it a compile
time error instead.
2025-04-27 22:47:03 +10:00
gingerBill
1f814c33dc Support subtargets in build tags: #build darwin:generic and #build linux:android, darwin:ios 2025-04-10 11:36:03 +01:00
gingerBill
d23453811d Improve semicolon checking rules when parsing 2025-02-24 13:13:36 +00:00
gingerBill
de755f95ec Minor rearrange for parsing field lists 2025-02-22 17:58:14 +00:00