Commit Graph

3087 Commits

Author SHA1 Message Date
gingerBill
9692496989 Add intrinsics.type_field_type 2022-04-27 12:27:53 +01:00
Jeroen van Rijn
a5342a0126 Address edge cases. 2022-04-26 13:14:09 +02:00
Jeroen van Rijn
f4723aea4c Remove redundant bit for non-Windows. 2022-04-24 13:37:26 +02:00
Jeroen van Rijn
76d48b38d3 Compiler: Allow -out: to not have an extension on *nix for executables (only). 2022-04-24 13:37:26 +02:00
Jeroen van Rijn
3cab2592c3 Compiler: Add early error for output path being a directory.
- Introduce new `Path` type and an array of build paths on the build context.
- Resolve input and output paths/files early (before parsing).
- Error early if inputs are missing or outputs are directories.
- Plumb new file path generation into linker stage instead of its adhoc method.

TODO:
- Remove more adhoc file path generation in parser and linker stage.
- Make intermediate object file generation use new path system.
- Round out and robustify Path helper functions.
2022-04-24 13:37:26 +02:00
gingerBill
8a9f7fc684 Fix #1713 2022-04-14 15:09:03 +01:00
Jeroen van Rijn
bb9165edd2 Add -help to CI tests. 2022-04-05 20:45:00 +02:00
Jeroen van Rijn
ad0a413b40 Give build/run/check/test/doc a -file flag.
A package has canonically always been a directory, but odin allowing you to build a single-file package confused newcomers who didn't understand why they could then not access variables and procedures from another file in the same directory.

This change disallows building single-file packages by default, requiring the `-file` flag to acknowledge you understand the nuance.

`-help` for these commands also clarifies the difference.

```
W:\Odin>odin build -help
odin is a tool for managing Odin source code
Usage:
        odin build [arguments]

        build   Compile directory of .odin files as an executable.
                One must contain the program's entry point, all must be in the same package.
                Use `-file` to build a single file instead.
                Examples:
                        odin build .                    # Build package in current directory
                        odin build <dir>                # Build package in <dir>
                        odin build filename.odin -file  # Build single-file package, must contain entry point.

        Flags

        -file
                Tells `odin build` to treat the given file as a self-contained package.
                This means that `<dir>/a.odin` won't have access to `<dir>/b.odin`'s contents.
```

```
W:\Odin>odin run examples\demo\demo.odin
ERROR: `odin run` takes a package as its first argument.
Did you mean `odin run examples\demo\demo.odin -file`?
The `-file` flag tells it to treat a file as a self-contained package.
```
2022-04-05 20:26:18 +02:00
Jeroen van Rijn
2e6ad2a711 Add extra help line for define/config. 2022-04-03 21:06:06 +02:00
gingerBill
d10d54710c Merge pull request #1686 from Kelimion/compile-time-assert
Allow optional message for `#assert`.
2022-04-02 15:02:46 +01:00
gingerBill
1ec997461d Add extra checks to atomic intrinsics 2022-04-02 15:00:28 +01:00
gingerBill
a232c0888c intrinsics.atomic_type_is_lock_free 2022-04-02 14:38:42 +01:00
Jeroen van Rijn
cb5a6b531a Allow optional message for #assert. 2022-04-02 15:31:50 +02:00
gingerBill
9f2d710c35 Change intrinsics.Atomic_Memory_Order fields to use Ada_Case rather than snake_case 2022-03-31 12:57:24 +01:00
gingerBill
1eac3482a6 Add checks for memory ordering on fences 2022-03-31 01:01:51 +01:00
gingerBill
6636376a81 Correct weak handling 2022-03-31 00:58:01 +01:00
gingerBill
6bc0c611ab Enforce success failure pairings of compare_exchange_*_explicit at compile time 2022-03-31 00:49:53 +01:00
gingerBill
203382461b Replace the atomic intrinsics
Matching C11 in style
2022-03-31 00:14:49 +01:00
gingerBill
72ae061769 Add intrinsics.wasm_memory_grow intrinsics.wasm_memory_size 2022-03-30 17:29:37 +01:00
gingerBill
5f3bfa66c5 Merge branch 'master' of https://github.com/odin-lang/Odin 2022-03-30 16:15:54 +01:00
gingerBill
3a4630e6b4 Correct atomic_cxchg_* atomic_cxchgweak_* intrinsics behaviour to monotonic on failure for acq, rel, and acqrel 2022-03-30 16:15:23 +01:00
gingerBill
abf0fd7efc Merge pull request #1671 from colrdavidson/add_nocrt
Make no crt work on Linux
2022-03-30 12:58:12 +01:00
Colin Davidson
a632db3618 Make no crt work on Linux 2022-03-30 04:45:22 -07:00
gitlost
8661457512 Use WIFEXITED() and WEXITSTATUS() on Unix system() exit code
(ensures Odin run returns correct exit code of built executable)
Adds test "tests/core/os/test_core_os_exit.odin" (Unix only)
2022-03-24 19:31:46 +00:00
gingerBill
f702c782f1 Make constant string backing structures use PrivateLinkage compared to InternalLinkage 2022-03-24 12:18:17 +00:00
gingerBill
3f935bea25 union #shared_nil
This adds a feature to `union` which requires all the variants to have a `nil` value and on assign to the union, checks whether that value is `nil` or not. If the value is `nil`, the union will be `nil` (thus sharing the `nil` value)
2022-03-24 11:55:03 +00:00
gitlost
10c5825715 Fix issue #829 "Compiler crashes when declaring maps with procedure"
Inits `o->value` in `check_expr_base_internal()` so doesn't accidentally
  use last (the proc lit was being set to that of previous string)
Adds test to "tests/issues" and changes CI to use new "run" shells
2022-03-23 12:56:37 +00:00
gingerBill
559fcfa291 Merge pull request #1632 from gitlost/const_in_if_#1592
Fix issue #1592 "LLVM code gen error when using a constant in an if"
2022-03-21 11:16:59 +00:00
gingerBill
a68f0b2d72 Improve procedure group selection based on the minimum number of arguments 2022-03-18 22:18:12 +00:00
gitlost
fdbbf24271 Fix issue #1592 "LLVM code gen error when using a constant in an if"
Changes lb_build_if_stmt() to return null lbValue if condition is
  cmpAnd, cmpOr or non-const neg and check in lb_build_if_stmt()
  to avoid short circuiting if that's the case
Adds test to "tests/issues" and adds step in CI to check this dir
2022-03-18 13:57:22 +00:00
gingerBill
6ea9ba16e7 Fix #1610 2022-03-14 12:38:56 +00:00
gingerBill
286549693e Fix #1609 2022-03-14 12:28:28 +00:00
gingerBill
4474144c24 Merge pull request #1505 from jasonKercher/fix_odin_test
fix `odin test`
2022-03-14 12:09:39 +00:00
gingerBill
a7adb2fb6e Merge branch 'master' into freestanding_amd64 2022-03-14 11:02:59 +00:00
gingerBill
f907516cbd #Fix 1615 Replace llvm.readcyclecounter with cntvct_el0 on arm64 2022-03-12 10:48:31 +00:00
Jason Kercher
d2bc41a2df Merge remote-tracking branch 'upstream/master' into fix_odin_test 2022-03-09 17:17:40 -05:00
gingerBill
dc8d28c383 Fix #1607 2022-03-09 15:15:30 +00:00
gingerBill
8e4d6b3e5d Fix typo 2022-03-09 11:24:36 +00:00
gingerBill
ba412fd87b Fix typo 2022-03-09 09:36:21 +00:00
gingerBill
ff60b752bd Replace #if with if where possible 2022-03-08 22:35:10 +00:00
gingerBill
17dab04422 Refactor link flag creation for nix systems 2022-03-08 11:13:59 +00:00
kstrb
1cd89b2da3 Linux: allow 'foreign import' of object files 2022-03-05 17:28:34 +01:00
gingerBill
07062324d7 Merge pull request #1575 from jockus/fix_relative_slice_len
Add relative slice to type checks for built in len
2022-03-04 11:48:29 +00:00
Jeroen van Rijn
bee475c38a Merge pull request #1582 from semarie/more-ci
CI: add linux i386, Darwin arm64 and Windows 386
2022-03-03 17:07:40 +01:00
Sébastien Marie
fad851d80c check for semi-colon before EOF too 2022-03-03 15:57:51 +00:00
Sébastien Marie
499c657ffa rename architecture from 386 to i386 2022-03-03 15:28:18 +00:00
Joakim Hentula
a5dde78f08 Add relative slice to type checks for built in len 2022-03-02 16:44:33 +00:00
gingerBill
49fecbdc5e Improve error message when there is "no field" found for a large anonymous struct 2022-03-01 14:49:05 +00:00
gingerBill
d4ccb69ccc Check if directory exists with the same target executable name when building a directory 2022-02-28 21:49:19 +00:00
gingerBill
410b85b5c7 Disallow @(thread_local) on wasm targets 2022-02-28 15:40:00 +00:00