You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the latest MSVC (Community) update munit fails to compile when the C standard version is set to C11. With C99 it works fine. C11 used to work fine before the update.
CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)
project(MUNIT-TEST VERSION 1.0.0
LANGUAGES C)
set(CMAKE_C_STANDARD 11) # HERE
set(CMAKE_C_EXTENSIONS OFF)
add_executable(munit-test munit.c main.c)
D:\projects\munit-test\build>cmake -A x64 ..
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 6.1.7601.
-- The C compiler identification is MSVC 19.28.29334.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/projects/munit-test/build
cmake --build . --config Release:
Microsoft (R) Build Engine версии 16.8.2+25e4d540b для .NET Framework
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.
munit.c
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\winbase.h(9461,5): warning C5105: macro expansion producing 'defined' has undefined behavior [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(403,81): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(403,81): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(465,118): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(465,118): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(474,139): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(480,83): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(480,83): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(152,38): error C2054: expected '(' to follow '_Thread_local' [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(152,64): error C2085: 'munit_error_jmp_buf_valid': not in formal parameter list [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(152,64): error C2143: syntax error: missing ';' before '=' [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(153,35): error C2054: expected '(' to follow '_Thread_local' [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(153,54): error C2085: 'munit_error_jmp_buf': not in formal parameter list [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(169,111): error C2085: 'munit_logf_exv': not in formal parameter list [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(169,111): error C2143: syntax error: missing ';' before '{' [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(204,17): warning C4013: 'munit_logf_exv' undefined; assuming extern returning int [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(223,34): error C2065: 'munit_error_jmp_buf_valid': undeclared identifier [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(224,34): error C2065: 'munit_error_jmp_buf': undeclared identifier [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(224,34): warning C4047: 'function': '_JBTYPE *' differs in levels of indirection from 'int' [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(224,15): warning C4024: 'longjmp': different types for formal and actual parameter 1 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(239,32): error C2065: 'munit_error_jmp_buf_valid': undeclared identifier [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(240,32): error C2065: 'munit_error_jmp_buf': undeclared identifier [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(240,32): warning C4047: 'function': '_JBTYPE *' differs in levels of indirection from 'int' [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(240,13): warning C4024: 'longjmp': different types for formal and actual parameter 1 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(939,103): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(939,103): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(956,74): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(956,74): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(1077,97): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(1077,97): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(1430,9): error C2065: 'munit_error_jmp_buf': undeclared identifier [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(1430,9): warning C4047: 'function': '_JBTYPE *' differs in levels of indirection from 'int' [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(1430,9): warning C4024: '_setjmp': different types for formal and actual parameter 1 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(1434,33): error C2065: 'munit_error_jmp_buf_valid': undeclared identifier [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(1700,72): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(1700,72): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(1836,79): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(1836,79): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(2053,72): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.c(2053,72): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
main.c
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\winbase.h(9461,5): warning C5105: macro expansion producing 'defined' has undefined behavior [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(403,81): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(403,81): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(465,118): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(465,118): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(474,139): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(480,83): error C2057: expected constant expression [D:\projects\munit-test\build\munit-test.vcxproj]
D:\projects\munit-test\munit.h(480,83): error C2466: cannot allocate an array of constant size 0 [D:\projects\munit-test\build\munit-test.vcxproj]
Generating Code...
The text was updated successfully, but these errors were encountered:
Hi! Thanks for the great library!
With the latest MSVC (Community) update munit fails to compile when the
C
standard version is set toC11
. WithC99
it works fine.C11
used to work fine before the update.CMakeLists.txt:
main.c:
cmake -A x64 ..
:cmake --build . --config Release
:The text was updated successfully, but these errors were encountered: