• MacOS compiles

    From Janne Johansson@2:221/6 to Tommi Koivula on Wednesday, December 13, 2017 14:34:00

    If we are at "warnings at compile time", MacOS clang thinks this about
    current binkd sources:

    Making depends...
    Compiling ftnq.c...
    ftnq.c:181:16: warning: comparison of array 'fn->pwd' equal to a null
    pointer is always false [-Wtautological-pointer-compare]
    fn->pwd == NULL || strcmp(fn->pwd, "-") == 0)
    ~~~~^~~ ~~~~
    ftnq.c:319:33: warning: comparison of array 'node->pwd' equal to a null
    pointer is always false [-Wtautological-pointer-compare]
    if (node == NULL || node->pwd == NULL || strcmp(node->pwd, "-") == 0)
    ~~~~~~^~~ ~~~~
    2 warnings generated.
    Compiling protocol.c...
    protocol.c:1262:17: warning: address of array 'pn->pwd' will always
    evaluate to 'true' [-Wpointer-bool-conversion]
    if (pn->pwd && strcmp(pn->pwd, "-") && state->to == 0)
    ~~~~^~~ ~~
    protocol.c:1405:21: warning: address of array 'pn->pwd' will always
    evaluate to 'true' [-Wpointer-bool-conversion]
    if (pn && pn->pwd && strcmp(pn->pwd, "-") && state->to == 0)
    ~~ ~~~~^~~
    protocol.c:1419:17: warning: address of array 'pn->pwd' will always
    evaluate to 'true' [-Wpointer-bool-conversion]
    if (pn->pwd && strcmp(pn->pwd, "-"))
    ~~~~^~~ ~~
    protocol.c:1432:17: warning: address of array 'pn->pwd' will always
    evaluate to 'true' [-Wpointer-bool-conversion]
    if (pn->pwd && strcmp(pn->pwd, "-"))
    ~~~~^~~ ~~
    4 warnings generated.
    Compiling ftnnode.c...
    ftnnode.c:150:18: warning: address of array 'pn->pwd' will always
    evaluate to 'true' [-Wpointer-bool-conversion]
    && (!pn->pwd || strcmp(pn->pwd, "-") == 0)
    ~~~~~^~~
    1 warning generated.
    Compiling unix/daemonize.c...
    unix/daemonize.c:33:5: warning: 'daemon' is deprecated: first deprecated
    in macOS 10.5 - Use posix_spawn APIs instead. [-Wdeprecated-declarations]
    if (daemon(nochdir, 0) == -1)
    ^
    /usr/include/stdlib.h:293:6: note: 'daemon' has been explicitly marked deprecated here
    int daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0, "Us...
    ^
    1 warning generated.

    It does produce an runnable executable,
    $ ./binkd -v
    Binkd 1.1a-96 (Dec 13 2017 13:27:11/Darwin)
    $ cc -v
    Apple LLVM version 9.0.0 (clang-900.0.39.2)
    Target: x86_64-apple-darwin17.3.0
    ....

    but some of the warnings might point out logic that really isn't doing
    what was expected, like the inverted pointers.

    ---
    * Origin: *** nntp://fidonews.mine.nu *** Finland *** (2:221/6.0)