1@echo off & setlocal enableextensions enabledelayedexpansion
2::
3:: tg.bat - compile & run tests (GNUC).
4::
5
6:: if no std is given, use c++11
7
8set std=%1
9set args=%2 %3 %4 %5 %6 %7 %8 %9
10if "%1" == "" set std=c++11
11
12call :CompilerVersion version
13echo g++ %version%: %std% %args%
14
15REM set FLAG=-Wsign-conversion
16REM set FLAG=-Wshadow
17set EXTRAFLAGS=%FLAG% -Wundef -Wpedantic -Wconversion -Wctor-dtor-privacy -Wnon-virtual-dtor -Wcast-align -Woverloaded-virtual -Wold-style-cast
18
19g++ -std=%std% -O2 %EXTRAFLAGS% -Wall -Wextra -Wno-unused-parameter -fno-elide-constructors -o gsl-lite.t.exe -I../include/gsl -Dgsl_FEATURE_EXPERIMENTAL_RETURN_GUARD -Dgsl_CONFIG_CONTRACT_VIOLATION_THROWS gsl-lite.t.cpp assert.t.cpp at.t.cpp byte.t.cpp issue.t.cpp not_null.t.cpp owner.t.cpp span.t.cpp string_span.t.cpp util.t.cpp && gsl-lite.t.exe
20
21endlocal & goto :EOF
22
23:: subroutines:
24
25:CompilerVersion  version
26echo off & setlocal enableextensions
27set tmpprogram=_getcompilerversion.tmp
28set tmpsource=%tmpprogram%.c
29
30echo #include ^<stdio.h^>     > %tmpsource%
31echo int main(){printf("%%d.%%d.%%d\n",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);} >> %tmpsource%
32
33g++ -o %tmpprogram% %tmpsource% >nul
34for /f %%x in ('%tmpprogram%') do set version=%%x
35del %tmpprogram%.* >nul
36endlocal & set %1=%version%& goto :EOF
37