Skip to content

clang/LLVM for Windows (clang-cl) conformance errors #733

@walbourn

Description

@walbourn

Trying to build this library using clang/LLVM for Windows 15.0.1 fails with the following fatal errors due to conformance:

First, the code assumes it's safe to convert a const char[] array to a void*. It would work as const void*.

D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\zre_msg.c(1932,5): error: no matching function for call to 'zlist_append'
    zlist_append (hello_groups, "Name: Brutus");
    ^~~~~~~~~~~~
D:\vcpkg\installed\x64-clangcl-dynamic\include/zlist.h(74,5): note: candidate function not viable: no known conversion from 'const char[13]' to 'void *' for 2nd argument
    zlist_append (zlist_t *self, void *item);
    ^
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\zre_msg.c(1933,5): error: no matching function for call to 'zlist_append'
    zlist_append (hello_groups, "Age: 43");
    ^~~~~~~~~~~~
D:\vcpkg\installed\x64-clangcl-dynamic\include/zlist.h(74,5): note: candidate function not viable: no known conversion from 'const char[8]' to 'void *' for 2nd argument
    zlist_append (zlist_t *self, void *item);
    ^
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\zre_msg.c(1938,5): error: no matching function for call to 'zhash_insert'
    zhash_insert (hello_headers, "Name", "Brutus");
    ^~~~~~~~~~~~
D:\vcpkg\installed\x64-clangcl-dynamic\include/zhash.h(48,5): note: candidate function not viable: no known conversion from 'const char[7]' to 'void *' for 3rd argument
    zhash_insert (zhash_t *self, const char *key, void *item);
    ^
D:\vcpkg\installed\x64-clangcl-dynamic\include/zactor.h(34,5): note: candidate function not viable: no known conversion from 'const char[4]' to 'void *' for 2nd argument
    zactor_new (zactor_fn task, void *args);

Second, it doesn't respect that string literals are read-only:

D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_local.c(128,36): warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
            if (s_node_recv (node, "WHISPER", "R:WHISPER"))
                                   ^
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_local.c(128,47): warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
            if (s_node_recv (node, "WHISPER", "R:WHISPER"))
                                              ^
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_local.c(133,32): warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
        if (s_node_recv (node, "WHISPER", "R:WHISPER"))
                               ^
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_local.c(133,43): warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
        if (s_node_recv (node, "WHISPER", "R:WHISPER"))
                                          ^
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_local.c(150,36): warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
            if (s_node_recv (node, "SHOUT", "R:SHOUT"))
                                   ^
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_local.c(150,45): warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
            if (s_node_recv (node, "SHOUT", "R:SHOUT"))
                                            ^
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_local.c(155,32): warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
        if (s_node_recv (node, "SHOUT", "R:SHOUT"))
                               ^
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_local.c(155,41): warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
        if (s_node_recv (node, "SHOUT", "R:SHOUT"))
                                        ^
[7/25] D:\vcpkg\installed\x64-clangcl-dynamic\tools\llvm\clang-cl.exe   -TP  -ID:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src -ID:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\include -ID:\vcpkg\buildtrees\zyre\x64-clangcl-dynamic-dbg -imsvcD:\vcpkg\installed\x64-clangcl-dynamic\include /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc  -m64 /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\perf_remote.dir\src\perf_remote.c.obj /FdCMakeFiles\perf_remote.dir\ -c -- D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_remote.c
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_remote.c(49,30): warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
            sending_cookie = "R:HELLO";
                             ^
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_remote.c(63,34): warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
                sending_cookie = "R:WHISPER";
                                 ^
D:\vcpkg\buildtrees\zyre\src\32d83c5294-8833c9e2fa.clean\src\perf_remote.c(83,34): warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
                sending_cookie = "R:SHOUT";

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions