Browse Source

Merge branch 'master' of https://github.com/odin-lang/Odin

gingerBill 1 year ago
parent
commit
620dd2c812
8 changed files with 44 additions and 28 deletions
  1. 14 14
      .github/workflows/ci.yml
  2. 9 9
      .github/workflows/nightly.yml
  3. 2 1
      core/time/time.odin
  4. BIN
      glfw3.dll
  5. 3 1
      src/build_settings.cpp
  6. 10 1
      src/checker.cpp
  7. 4 1
      src/linker.cpp
  8. 2 1
      src/main.cpp

+ 14 - 14
.github/workflows/ci.yml

@@ -8,7 +8,11 @@ jobs:
     steps:
       - uses: actions/checkout@v1
       - name: Download LLVM
-        run: sudo apt-get install llvm-11 clang-11
+        run: |
+          wget https://apt.llvm.org/llvm.sh
+          chmod +x llvm.sh
+          sudo ./llvm.sh 17
+          echo "/usr/lib/llvm-17/bin" >> $GITHUB_PATH
       - name: build odin
         run: ./build_odin.sh release
       - name: Odin version
@@ -63,10 +67,8 @@ jobs:
       - uses: actions/checkout@v1
       - name: Download LLVM, and setup PATH
         run: |
-          brew install llvm@13
-          echo "/usr/local/opt/llvm@13/bin" >> $GITHUB_PATH
-          TMP_PATH=$(xcrun --show-sdk-path)/user/include
-          echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
+          brew install llvm@17
+          echo "/usr/local/opt/llvm@17/bin" >> $GITHUB_PATH
       - name: build odin
         run: ./build_odin.sh release
       - name: Odin version
@@ -104,10 +106,8 @@ jobs:
       - uses: actions/checkout@v1
       - name: Download LLVM and setup PATH
         run: |
-          brew install llvm@13
-          echo "/opt/homebrew/opt/llvm@13/bin" >> $GITHUB_PATH
-          TMP_PATH=$(xcrun --show-sdk-path)/user/include
-          echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
+          brew install llvm@17
+          echo "/opt/homebrew/opt/llvm@17/bin" >> $GITHUB_PATH
       - name: build odin
         run: ./build_odin.sh release
       - name: Odin version
@@ -128,11 +128,11 @@ jobs:
       - name: Odin check examples/all
         run: ./odin check examples/all -strict-style
         timeout-minutes: 10
-      # - name: Core library tests
-      #   run: |
-      #     cd tests/core
-      #     make
-      #   timeout-minutes: 10
+      - name: Core library tests
+        run: |
+          cd tests/core
+          make
+        timeout-minutes: 10
       - name: Odin internals tests
         run: |
           cd tests/internal

+ 9 - 9
.github/workflows/nightly.yml

@@ -47,7 +47,11 @@ jobs:
     steps:
       - uses: actions/checkout@v1
       - name: (Linux) Download LLVM
-        run: sudo apt-get install llvm-11 clang-11
+        run: |
+          wget https://apt.llvm.org/llvm.sh
+          chmod +x llvm.sh
+          sudo ./llvm.sh 17
+          echo "/usr/lib/llvm-17/bin" >> $GITHUB_PATH
       - name: build odin
         run: make nightly
       - name: Odin run
@@ -78,10 +82,8 @@ jobs:
       - uses: actions/checkout@v1
       - name: Download LLVM and setup PATH
         run: |
-          brew install llvm@13 dylibbundler
-          echo "/usr/local/opt/llvm@13/bin" >> $GITHUB_PATH
-          TMP_PATH=$(xcrun --show-sdk-path)/user/include
-          echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
+          brew install llvm@17 dylibbundler
+          echo "/usr/local/opt/llvm@17/bin" >> $GITHUB_PATH
       - name: build odin
         # These -L makes the linker prioritize system libraries over LLVM libraries, this is mainly to
         # not link with libunwind bundled with LLVM but link with libunwind on the system.
@@ -114,10 +116,8 @@ jobs:
       - uses: actions/checkout@v1
       - name: Download LLVM and setup PATH
         run: |
-          brew install llvm@13 dylibbundler
-          echo "/opt/homebrew/opt/llvm@13/bin" >> $GITHUB_PATH
-          TMP_PATH=$(xcrun --show-sdk-path)/user/include
-          echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
+          brew install llvm@17 dylibbundler
+          echo "/opt/homebrew/opt/llvm@17/bin" >> $GITHUB_PATH
       - name: build odin
         # These -L makes the linker prioritize system libraries over LLVM libraries, this is mainly to
         # not link with libunwind bundled with LLVM but link with libunwind on the system.

+ 2 - 1
core/time/time.odin

@@ -238,8 +238,9 @@ time_add :: proc "contextless" (t: Time, d: Duration) -> Time {
 //
 // Accuracy seems to be pretty good out of the box on Linux, to within around 4µs worst case.
 // On Windows it depends but is comparable with regular sleep in the worst case.
-// To get the same kind of accuracy as on Linux, have your program call `win32.time_begin_period(1)` to
+// To get the same kind of accuracy as on Linux, have your program call `windows.timeBeginPeriod(1)` to
 // tell Windows to use a more accurate timer for your process.
+// Additionally your program should call `windows.timeEndPeriod(1)` once you're done with `accurate_sleep`. 
 accurate_sleep :: proc "contextless" (d: Duration) {
 	to_sleep, estimate, mean, m2, count: Duration
 

BIN
glfw3.dll


+ 3 - 1
src/build_settings.cpp

@@ -436,7 +436,9 @@ struct BuildContext {
 	BlockingMutex target_features_mutex;
 	StringSet target_features_set;
 	String target_features_string;
+
 	String minimum_os_version_string;
+	bool   minimum_os_version_string_given;
 };
 
 gb_global BuildContext build_context = {0};
@@ -1419,7 +1421,7 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
 
 	bc->metrics = *metrics;
 	if (metrics->os == TargetOs_darwin) {
-		if (bc->minimum_os_version_string.len == 0) {
+		if (!bc->minimum_os_version_string_given) {
 			bc->minimum_os_version_string = str_lit("11.0.0");
 		}
 

+ 10 - 1
src/checker.cpp

@@ -1115,7 +1115,16 @@ gb_internal void init_universal(void) {
 
 	add_global_constant("ODIN_COMPILE_TIMESTAMP", t_untyped_integer, exact_value_i64(odin_compile_timestamp()));
 
-	add_global_bool_constant("__ODIN_LLVM_F16_SUPPORTED", lb_use_new_pass_system() && !is_arch_wasm());
+	{
+		bool f16_supported = lb_use_new_pass_system();
+		if (is_arch_wasm()) {
+			f16_supported = false;
+		} else if (build_context.metrics.os == TargetOs_darwin && build_context.metrics.arch == TargetArch_amd64) {
+			// NOTE(laytan): See #3222 for my ramblings on this.
+			f16_supported = false;
+		}
+		add_global_bool_constant("__ODIN_LLVM_F16_SUPPORTED", f16_supported);
+	}
 
 	{
 		GlobalEnumValue values[3] = {

+ 4 - 1
src/linker.cpp

@@ -502,9 +502,12 @@ gb_internal i32 linker_stage(LinkerData *gen) {
 					platform_lib_str = gb_string_appendc(platform_lib_str, "-L/opt/local/lib ");
 				}
 
-				if (build_context.minimum_os_version_string.len) {
+				// Only specify this flag if the user has given a minimum version to target.
+				// This will cause warnings to show up for mismatched libraries.
+				if (build_context.minimum_os_version_string_given) {
 					link_settings = gb_string_append_fmt(link_settings, "-mmacosx-version-min=%.*s ", LIT(build_context.minimum_os_version_string));
 				}
+
 				// This points the linker to where the entry point is
 				link_settings = gb_string_appendc(link_settings, "-e _main ");
 			}

+ 2 - 1
src/main.cpp

@@ -1066,6 +1066,7 @@ gb_internal bool parse_build_flags(Array<String> args) {
 						case BuildFlag_MinimumOSVersion: {
 							GB_ASSERT(value.kind == ExactValue_String);
 							build_context.minimum_os_version_string = value.value_string;
+							build_context.minimum_os_version_string_given = true;
 							break;
 						}
 						case BuildFlag_RelocMode: {
@@ -1926,7 +1927,7 @@ gb_internal void print_show_help(String const arg0, String const &command) {
 		print_usage_line(1, "-minimum-os-version:<string>");
 		print_usage_line(2, "Sets the minimum OS version targeted by the application.");
 		print_usage_line(2, "Default: -minimum-os-version:11.0.0");
-		print_usage_line(2, "(Only used when target is Darwin.)");
+		print_usage_line(2, "Only used when target is Darwin, if given, linking mismatched versions will emit a warning.");
 		print_usage_line(0, "");
 
 		print_usage_line(1, "-extra-linker-flags:<string>");