Commit Graph

6116 Commits

Author SHA1 Message Date
Jeroen van Rijn
27667ce36b iff -> if and only if (⟺) 2026-03-13 11:54:15 +01:00
Fredrik Vaeng Røtnes
b4405d01f8 Fix typo in error message for using statement
Change "It you do require..." to "If you do require..."
2026-03-12 16:37:05 +01:00
Jeroen van Rijn
7a8b6d189e Merge pull request #6404 from botero-dev/android-platforms
Add support for other Android architectures
2026-03-11 22:34:25 +01:00
Andrés Botero
9df092759e Add support for other Android architectures 2026-03-11 15:37:37 -05:00
gingerBill
b7bb7a1dc4 Use scope_reserve call directly 2026-03-11 14:22:36 +00:00
bymehul
763c8d3a42 Fix generic cycle deadlock in struct layout 2026-03-11 03:04:26 +05:30
bymehul
c9e55d3add fix: handle full-width bit_field literal masks 2026-03-10 23:21:19 +05:30
Krzesimir Nowak
7320f10de6 Fix tokenizer init 2026-03-08 12:09:12 +01:00
Jeroen van Rijn
6434bf4b65 Limit maximum exponent in parsing of float/integer literals 2026-03-07 12:38:04 +01:00
Franz Hoeltermann
b351b58ddc Fix #6270 2026-03-03 17:22:31 +01:00
Jeroen van Rijn
b80ffe6ad7 Merge pull request #6363 from odin-lang/bill/bit_set_rtti
Update `Type_Info_Bit_Set`
2026-03-03 13:48:37 +01:00
gingerBill
a5e1eb56ab Add explicit_underlying: bool RTTI field for bit_set; add runtime.type_info_underlying 2026-03-03 12:26:42 +00: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
Jeroen van Rijn
a4ee06ca75 Merge pull request #6355 from louisnovy/fix-bit_set-parapoly-specialization
Fix bit_set parapoly specialization #6240
2026-03-02 12:59:48 +01:00
Louis Novy
e3d6fe72f8 fix broken bit_set parapoly specialization #6240 2026-03-01 20:58:43 -08:00
gingerBill
e029cfc279 Merge pull request #6350 from krnowak/krnowak/diverging-semicolon
Fix separating of diverging procedure types from block statements
2026-03-01 22:19:04 +00:00
Franz
5e009f5e83 Fix name canonicalization for typed ranges in bit_set (#6353) 2026-03-01 15:43:17 +01:00
Jeroen van Rijn
579b2612b1 Fix #6347 2026-03-01 14:54:26 +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
c0468446f6 Ignore const nil "optimization" and fix c: Maybe(string); c == "" bug. 2026-02-24 18:52:42 +00:00
Jeroen van Rijn
5d94c01e47 Disable LLVMTailCallKindMustTail under LLVM 18 2026-02-21 23:29:32 +01:00
gingerBill
7c9ac5a777 Try to improve the error handling for procedure groups 2026-02-19 13:51:20 +00: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
gingerBill
a8cc056e3a Merge pull request #6278 from ske2004/spread-string
Add broadcasting to strings (fix #1837)
2026-02-16 13:30:50 +00:00
Krzesimir Nowak
a84179de1f Do not allow duplicate #partial directives on switch statement 2026-02-15 16:37:14 +01:00
ske
9d439bd630 Add broadcasting to strings (fix #1837) 2026-02-14 16:23:51 -03:00
tpat7187
4fce910973 Minor Spelling mistake in Using error line 2026-02-14 15:51:03 +00:00
Jeroen van Rijn
6386b395de Add -did-you-mean-limit:N
```
-did-you-mean-limit:<integer>
        Sets the maximum number of suggestions the compiler provides.
        Must be an integer >0.
        If not set, the default limit is 10.
```
e.g. with a limit of 5

```
W:/Scratch/main.odin(44:7) Error: Undeclared name 'B1' for type 'E'
	e = .B1
	     ^^
	Suggestion: Did you mean?
		A23
		A02
		A19
		A20
		A21
		... and 25 more ...
```
2026-02-13 15:15:03 +01:00
gingerBill
6412c84690 Merge branch 'master' into bill/range-init 2026-02-12 13:15:39 +00:00
Laytan Laats
d49ab07d35 fix typo 2026-02-11 20:05:45 +01:00
Jeroen van Rijn
bd3cf2a1e6 Remove -show-import-graph header
This allows you to pipe the output to a file and have a working graph without any editing.
(Provided you don't also use additional -flags like `-show-timings`.)
2026-02-11 16:33:52 +01:00
gingerBill
8cb7965aa5 for init; x in y {} style loops 2026-02-11 15:33:14 +00:00
Jeroen van Rijn
2e58c62a80 Clarify -lto help text 2026-02-11 15:13:24 +01: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
ae91b9b369 Add -show-import-graph 2026-02-10 22:16:15 +00:00
gingerBill
6f7a64a47d Change LTO rules for all platforms 2026-02-04 17:15:48 +00:00
gingerBill
b942f72cb0 Add docs for -lto:<string>; remove -lld and -radlink flags docs; with -lto default to -use-separate-modules and -linker:lld 2026-02-04 12:45:26 +00:00
Jesse Meyer
b8276065f9 Merge branch 'master' into lto-support 2026-02-03 20:52:52 -05:00
Jesse Meyer
bd6148dd6b Fix Windows LTO: preserve required procedures with llvm.used
On Windows with LTO, required procedures with external linkage need to
be added to @llvm.used to survive linker-level dead code elimination.

LLVM may generate implicit calls to runtime builtins (e.g., __extendhfsf2
for f16 conversions) during instruction lowering, after the IR is
finalized. Without @llvm.used, the linker discards these procedures
before the implicit calls are generated.

This adds required procedures to @llvm.used at creation time. The fix
is Windows-specific; other platforms handle this correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 20:16:44 -05:00
Jesse Meyer
a0562dfd6e Fix lld-link LTO jobs flag syntax on Windows
lld-link doesn't recognize /lldltojobs:N as a standalone flag and
treats it as a file path. Use /opt:lldltojobs=N instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 20:16:20 -05:00
Jesse Meyer
9eba12948a Skip sanitizer IR passes when LTO is enabled
With ThinLTO, the linker runs sanitizer passes at link time via
-fsanitize= flags, where it has whole-program visibility. Running
them at bitcode emission too double-instruments every module,
producing hundreds of "Redundant instrumentation detected" warnings.
Per-function sanitize/no_sanitize attributes are preserved in the
bitcode and respected by the linker's pass.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 20:16:20 -05:00
Jesse Meyer
43ad4a1d9f Add ThinLTO support via -lto:thin and -lto:thin-files flags
- Add -lto:thin and -lto:thin-files CLI flags with validation
- Emit LLVM bitcode (.bc) instead of object files when LTO is enabled
- Pass -flto=thin and -flto-jobs to clang/lld linkers
- Guard linkage corrections to skip declarations without definitions
  (required for LTO where declarations appear across modules)
- Allow module-per-file with LTO even at higher optimization levels

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 20:16:20 -05:00
gingerBill
f3daaa62fe Merge pull request #6220 from laytan/fix-lto-macos
fix LTO on MacOS
2026-02-02 18:46:18 +00:00
Laytan Laats
afbbb829ea fix LTO on MacOS
If no `-minimum-os-version` is given, ignore the `override-module`
warnings. The user not using, `-minimum-os-version` opts you into linker
warnings about target versions.

If a `-minimum-os-version` is provided, normalize it to a full version
`11` to `11.0.0` for example. The linker seems to want that when doing
LTO.
2026-02-02 18:13:48 +01:00
Jeroen van Rijn
6a07f70c1c support -> supported 2026-02-02 17:57:50 +01:00
gingerBill
bb7496a2fc Add intrinsics.count_trailing_ones and intrinsics.count_leading_ones 2026-02-02 14:28:16 +00:00
gingerBill
a936f3fb7d Comment out t->Struct.are_offsets_being_processed.load() 2026-02-02 11:41:33 +00:00