tc-noexcept.bat 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. @echo off & setlocal enableextensions enabledelayedexpansion
  2. ::
  3. :: tc.bat - compile & run tests (clang).
  4. ::
  5. set unit=expected
  6. :: if no std is given, use c++14
  7. set std=%1
  8. if "%std%"=="" set std=c++14
  9. set clang=clang
  10. call :CompilerVersion version
  11. echo %clang% %version%: %std%
  12. set UCAP=%unit%
  13. call :toupper UCAP
  14. set unit_select=-D%unit%_CONFIG_SELECT_%UCAP%=%unit%_%UCAP%_DEFAULT
  15. ::set unit_select=-D%unit%_CONFIG_SELECT_%UCAP%=%unit%_%UCAP%_NONSTD
  16. ::set unit_select=-D%unit%_CONFIG_SELECT_%UCAP%=%unit%_%UCAP%_STD
  17. set unit_config=
  18. rem -flto / -fwhole-program
  19. set optflags=-O2 -fno-exceptions
  20. set warnflags=-Wall -Wextra -Wpedantic -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-missing-noreturn -Wno-documentation-unknown-command -Wno-documentation-deprecated-sync -Wno-documentation -Wno-weak-vtables -Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-exit-time-destructors -Wno-global-constructors
  21. "%clang%" -m32 -std=%std% %optflags% %warnflags% %unit_select% %unit_config% -Dlest_FEATURE_AUTO_REGISTER=1 -fms-compatibility-version=19.00 -isystem "%VCInstallDir%include" -isystem "%WindowsSdkDir_71A%include" -I../include -I. -o %unit%-main.t.exe %unit%-noexcept.t.cpp && %unit%-noexcept.t.exe
  22. endlocal & goto :EOF
  23. :: subroutines:
  24. :CompilerVersion version
  25. echo off & setlocal enableextensions
  26. set tmpprogram=_getcompilerversion.tmp
  27. set tmpsource=%tmpprogram%.c
  28. echo #include ^<stdio.h^> > %tmpsource%
  29. echo int main(){printf("%%d.%%d.%%d\n",__clang_major__,__clang_minor__,__clang_patchlevel__);} >> %tmpsource%
  30. "%clang%" -m32 -o %tmpprogram% %tmpsource% >nul
  31. for /f %%x in ('%tmpprogram%') do set version=%%x
  32. del %tmpprogram%.* >nul
  33. endlocal & set %1=%version%& goto :EOF
  34. :: toupper; makes use of the fact that string
  35. :: replacement (via SET) is not case sensitive
  36. :toupper
  37. for %%L IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO SET %1=!%1:%%L=%%L!
  38. goto :EOF