Commit Graph

518 Commits

Author SHA1 Message Date
gingerBill
252be0fb41 Make all maps use heap allocator implicitly 2023-01-03 11:59:52 +00:00
gingerBill
600f2b7284 Use heap_allocator for all hash set types 2023-01-03 11:53:59 +00:00
gingerBill
c293f5b7eb Remove unneeded mutex 2023-01-02 16:56:05 +00:00
gingerBill
529383f5b1 Correct a race condition when checking the procedure body 2023-01-02 15:30:04 +00:00
gingerBill
bfdcf900ef Remove global_ prefix from global_thread_pool_* procedures 2023-01-02 00:56:06 +00:00
gingerBill
5c519f0e8d Remove the synchronization primitive init/destroy calls 2023-01-01 16:19:21 +00:00
gingerBill
b9a2426e57 Merge branch 'master' into compiler-improvements-2022-12 2022-12-21 23:59:31 +00:00
gingerBill
c1f5be24e2 Remove dead code in the compiler 2022-12-18 22:49:10 +00:00
gingerBill
ac5f5a33e9 gb_internal a lot 2022-12-18 21:17:07 +00:00
Thomas Stibor
1ca7da6914 Enable -out:<filepath> for build and runs with the attribute @(test)
According to the odin help command
$ odin help test
...
-out:<filepath>
	Set the file name of the outputted executable
	Example: -out:foo.exe

building and running tests the executable output filepath shall be
specified. However, the -out parameter is disabled, resulting in error message:

Unknown flag for 'odin test': 'out'
'out' is supported with the following commands:
	run, build

Omitting the -out parameter results in default filepath '01.bin' (on Linux).
However, it is desirable for user specifying the output filepath, e.g. by
using this Makefile snippet:

TARGET=main
FLAGS=-warnings-as-errors -verbose-errors

all: run

run:
        @odin run . $(FLAGS) -out:$(TARGET)

test:
        @odin test . $(FLAGS) -out:$(TARGET)

clean:
        @rm -f $(TARGET)

In addition a typo is fixed.
2022-12-14 14:26:32 +01:00
gingerBill
a71daee545 Allow for -use-static-map-calls which generates a get procedure per map; add runtime.map_get 2022-11-08 14:58:05 +00:00
Jeroen van Rijn
9eec9f5788 Add -minimum-os-version flag
Allow for Darwin targets to specify the minimum OS version:
e.g. -minimum-os-version:12.0.0
2022-11-01 15:04:44 +01:00
Jeroen van Rijn
2d5779b660 Add missing newline. 2022-11-01 00:47:16 +01:00
Jeroen van Rijn
53a030c65b Clarify -define help. 2022-11-01 00:38:54 +01:00
Jeroen van Rijn
413f96553a Remove formerly deprecated -opt flag. 2022-10-28 21:38:20 +02:00
Jeroen van Rijn
85a263130d Add LLVM > 14 check to main.cpp for Darwin. 2022-10-27 02:55:38 +02:00
gingerBill
af76d26771 Simplify win32 resource file linking 2022-09-07 11:22:43 +01:00
Jeroen van Rijn
fc2cd3e1d5 Add help verb, e.g. odin help build. 2022-09-05 22:28:16 +02:00
Jeroen van Rijn
a5a9347308 Improve error message when you use -file as the verb. 2022-09-05 21:59:56 +02:00
Joakim Hentula
28f440dd9e Do not remove .rc extension from resource path to prevent expansion to full path assuming it's a directory if a folder with the same name exists in the same folder as the resource file 2022-08-10 14:03:04 +01:00
Ian Lilley
c1c8ceafc2 find windows sdk bin path for rc.exe 2022-08-07 17:52:29 -04:00
Wes Hardee
23842a8950 fix -build-mode:shared on MacOS 2022-06-30 12:40:32 -05:00
gingerBill
8c0c327df9 Improvements to -strict-style and trailing commas 2022-06-13 11:00:13 +01:00
gingerBill
f3aefbc443 @(require_target_feature=<string>) @(enable_target_feature=<string>)
require_target_feature - required by the target micro-architecture
enable_target_feature - will be enabled for the specified procedure only
2022-05-30 14:53:12 +01:00
gingerBill
542e45de26 Increase minimum macOS version to 10.12.0 2022-05-18 12:30:26 +01:00
gingerBill
5931e2383b Remove unneeded #if defined 2022-05-04 16:58:40 +01:00
gingerBill
9f95d6fa65 Minor move around for path sets 2022-05-04 16:17:24 +01:00
gingerBill
982a1aebb3 Remove stray line 2022-05-04 16:14:42 +01:00
gingerBill
cec049b7d3 Make the link order of foreign imports deterministic 2022-05-04 16:04:26 +01:00
Jeroen van Rijn
dc323cfa1d Small fix to deprecation warning. 2022-05-04 13:29:52 +02:00
Jeroen van Rijn
47f637d23b Add deprecation warnings for -opt and flag=value insted of flag:value. 2022-05-03 13:37:07 +02:00
Jeroen van Rijn
59f55a2119 Make big_int_from_string return an error if not an integer. 2022-05-03 13:15:49 +02:00
Jeroen van Rijn
8bac82320f Fix -opt: parsing. 2022-05-03 11:44:55 +02:00
Jeroen van Rijn
e53ba3b116 Allow -error-pos-style:default as an alias for odin 2022-04-28 18:18:25 +02:00
Jeroen van Rijn
1ed84a064b Make -error-pos-style case-insensitive. 2022-04-28 18:12:55 +02:00
Jeroen van Rijn
a1002e6960 Fix -error-pos-style:unix 2022-04-28 17:46:36 +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
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
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
a7adb2fb6e Merge branch 'master' into freestanding_amd64 2022-03-14 11:02:59 +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
Sébastien Marie
f76f70c7cf openbsd: defaults to PIE executable
OpenBSD uses PIE code by default to allow the system to load the binary at a random location.

don't pass -no-pie to preserve this behaviour, and build objects with -fPIC (LLVMRelocPIC).
2022-02-28 15:24:22 +00:00