Browse Source

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

gingerBill 5 years ago
parent
commit
999d1a022d

+ 1 - 1
.github/ISSUE_TEMPLATE/bug_report.md

@@ -12,7 +12,7 @@ assignees: ''
 Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
 Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
 
 
 * Operating System:
 * Operating System:
-* Odin version/Commit:
+* Please paste `odin version` output:
 
 
 ## Expected Behavior
 ## Expected Behavior
 
 

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

@@ -44,7 +44,7 @@ jobs:
         shell: cmd
         shell: cmd
         run: |
         run: |
           call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
           call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
-          ./ci/build_ci.bat
+          ./build.bat 1
       - name: Odin run
       - name: Odin run
         shell: cmd
         shell: cmd
         run: |
         run: |

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

@@ -22,7 +22,7 @@ jobs:
         shell: cmd
         shell: cmd
         run: |
         run: |
           call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
           call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
-          ./ci/build_ci.bat
+          ./build.bat 1 1
       - name: Odin run
       - name: Odin run
         shell: cmd
         shell: cmd
         run: |
         run: |

+ 5 - 1
Makefile

@@ -1,6 +1,7 @@
+GIT_SHA=$(shell git rev-parse --short HEAD)
 DISABLED_WARNINGS=-Wno-switch -Wno-pointer-sign -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare -Wno-macro-redefined
 DISABLED_WARNINGS=-Wno-switch -Wno-pointer-sign -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare -Wno-macro-redefined
 LDFLAGS=-pthread -ldl -lm -lstdc++
 LDFLAGS=-pthread -ldl -lm -lstdc++
-CFLAGS=-std=c++11
+CFLAGS=-std=c++11 -DGIT_SHA=\"$(GIT_SHA)\"
 CC=clang
 CC=clang
 
 
 OS=$(shell uname)
 OS=$(shell uname)
@@ -20,5 +21,8 @@ debug:
 release:
 release:
 	$(CC) src/main.cpp $(DISABLED_WARNINGS) $(CFLAGS) -O3 -march=native $(LDFLAGS) -o odin
 	$(CC) src/main.cpp $(DISABLED_WARNINGS) $(CFLAGS) -O3 -march=native $(LDFLAGS) -o odin
 
 
+nightly:
+	$(CC) src/main.cpp $(DISABLED_WARNINGS) $(CFLAGS) -DNIGHTLY -O3 -march=native $(LDFLAGS) -o odin
+
 
 
 
 

+ 15 - 7
build.bat

@@ -12,9 +12,19 @@ if "%1" == "1" (
 	set release_mode=0
 	set release_mode=0
 )
 )
 
 
+:: Normal = 0, CI Nightly = 1
+if "%2" == "1" (
+    set nightly=1
+) else (
+    set nightly=0
+)
+
 set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF
 set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF
-set compiler_defines= -DLLVM_BACKEND_SUPPORT
+set compiler_defines= -DLLVM_BACKEND_SUPPORT 
 
 
+for /f %%i in ('git rev-parse --short HEAD') do set GIT_SHA=%%i
+if %ERRORLEVEL% equ 0 set compiler_defines=%compiler_defines% -DGIT_SHA=\"%GIT_SHA%\"
+if %nightly% equ 1 set compiler_defines=%compiler_defines% -DNIGHTLY
 
 
 if %release_mode% EQU 0 ( rem Debug
 if %release_mode% EQU 0 ( rem Debug
 	set compiler_flags=%compiler_flags% -Od -MDd -Z7
 	set compiler_flags=%compiler_flags% -Od -MDd -Z7
@@ -49,12 +59,10 @@ set linker_settings=%libs% %linker_flags%
 del *.pdb > NUL 2> NUL
 del *.pdb > NUL 2> NUL
 del *.ilk > NUL 2> NUL
 del *.ilk > NUL 2> NUL
 
 
-cl %compiler_settings% "src\main.cpp" ^
-	/link %linker_settings% -OUT:%exe_name% ^
-	&& odin run examples/demo/demo.odin
-if %errorlevel% neq 0 (
-	goto end_of_build
-)
+cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name%
+
+if %errorlevel% neq 0 goto end_of_build
+if %release_mode% EQU 0 odin run examples/demo/demo.odin
 
 
 del *.obj > NUL 2> NUL
 del *.obj > NUL 2> NUL
 
 

+ 0 - 31
ci/build_ci.bat

@@ -1,31 +0,0 @@
-@echo off
-
-:: Make sure this is a decent name and not generic
-set exe_name=odin.exe
-
-set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF -O2 -MT -Z7
-set compiler_defines= -DLLVM_BACKEND_SUPPORT -DNO_ARRAY_BOUNDS_CHECK
-
-set compiler_warnings= ^
-    -W4 -WX ^
-    -wd4100 -wd4101 -wd4127 -wd4189 ^
-    -wd4201 -wd4204 ^
-    -wd4456 -wd4457 -wd4480 ^
-    -wd4512
-
-set compiler_includes=
-set libs= ^
-    kernel32.lib ^
-    bin\llvm\windows\LLVM-C.lib
-
-set linker_flags= -incremental:no -opt:ref -subsystem:console -debug
-
-set compiler_settings=%compiler_includes% %compiler_flags% %compiler_warnings% %compiler_defines%
-set linker_settings=%libs% %linker_flags%
-
-del *.pdb > NUL 2> NUL
-del *.ilk > NUL 2> NUL
-
-cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name%
-    
-:end_of_build

+ 1 - 1
core/container/ring.odin

@@ -2,7 +2,7 @@ package container
 
 
 
 
 Ring :: struct(T: typeid) {
 Ring :: struct(T: typeid) {
-	next, prev: ^Ring,
+	next, prev: ^Ring(T),
 	value: T,
 	value: T,
 }
 }
 
 

+ 11 - 1
src/main.cpp

@@ -1684,7 +1684,17 @@ int main(int arg_count, char const **arg_ptr) {
 		return 1;
 		return 1;
 		#endif
 		#endif
 	} else if (command == "version") {
 	} else if (command == "version") {
-		gb_printf("%.*s version %.*s\n", LIT(args[0]), LIT(ODIN_VERSION));
+		gb_printf("%.*s version %.*s", LIT(args[0]), LIT(ODIN_VERSION));
+		
+		#ifdef NIGHTLY
+		gb_printf("-nightly");
+		#endif
+
+		#ifdef GIT_SHA
+		gb_printf("-%s", GIT_SHA);
+		#endif
+		
+		gb_printf("\n");
 		return 0;
 		return 0;
 	} else {
 	} else {
 		usage(args[0]);
 		usage(args[0]);