Skip to content

Compilation with vcc or clang (msvc) on Windows fails by using nimRawSetjmp #19957

@rockcavera

Description

@rockcavera

This error only happens with clang msvc compiler. In the clang gnu compiler this does not happen. The default LLVM installer for Windows is msvc.

Example

# test.nim
echo "test"

Current Output

nim c --cc:clang test
Hint: used config file 'D:\Nim\config\nim.cfg' [Conf]
Hint: used config file 'D:\Nim\config\config.nims' [Conf]
.........................................................
CC: D:/Nim/lib/system/ansi_c.nim
CC: D:/Nim/lib/std/private/digitsutils.nim
CC: D:/Nim/lib/system/dollars.nim
CC: D:/Nim/lib/std/syncio.nim
CC: D:/Nim/lib/system.nim
CC: test.nim
C:\Users\josep\nimcache\test_d\@mD@c@sNim@slib@ssystem@sansi_c.nim.c:27:25: error: too many arguments to function call,
      expected single argument '_Buf', have 2 arguments
        result = _setjmp(jmpb, NIM_NIL);
                 ~~~~~~~       ^~~~~~~
D:\Nim\lib\nimbase.h:350:19: note: expanded from macro 'NIM_NIL'
#  define NIM_NIL ((void*)0) /* C's NULL is fucked up in some C compilers, so
                  ^~~~~~~~~~
1 error generated.
Error: execution of an external compiler program 'D:\compilers\LLVM64\bin\clang.exe -c -w -ferror-limit=3   -ID:\Nim\lib -IC:\Users\josep\Desktop -o C:\Users\josep\nimcache\test_d\@mD@c@sNim@slib@ssystem@sansi_c.nim.c.o C:\Users\josep\nimcache\test_d\@mD@c@sNim@slib@ssystem@sansi_c.nim.c' failed with exit code: 1



C:\Users\josep\Desktop>C:\Users\josep\nimcache\test_d\@mD@c@sNim@slib@ssystem.nim.c:4448:93: error: too many arguments to function call,
      expected single argument '_Buf', have 2 arguments
                TM__Q5wkpxktOdTGvlSRo9bzt9aw_26.status = _setjmp(TM__Q5wkpxktOdTGvlSRo9bzt9aw_26.context, 0);
                                                         ~~~~~~~                                          ^
1 error generated.

Expected Output

Compile without error.

Additional Information

nim -v
Nim Compiler Version 1.7.1 [Windows: amd64]
Compiled at 2022-07-01
Copyright (c) 2006-2022 by Andreas Rumpf

git hash: ce4078acd40bb27de5d05832f486dbc95918a3c9
active boot switches: -d:release

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions