In binds/c/lib.cpp, we have the following definitions:
/*
* These symbols may not have been compiled into the library (if
* `--embed-kprint` was not passed), and so we need to give them a weak default
* definition. If the embed flag was passed, the value of these symbols will be
* given by the embedded data.
*/
char kore_definition_syntax __attribute__((weak)) = -1;
char kore_definition_macros __attribute__((weak)) = -1;
Note that there's no indication of whether these are signed or unsigned.
These comparisons with -1 of course work only with signed chars, but on Linux aarch64 and Darwin arm64 platforms the default type of char is unsigned for clang (and perhaps the ABI). This produces (fortunately) an
error due to the -Wall.
There appear to be no warnings we can turn on that will indicate that such non-portable code is being used. (We get a tautological-constant-out-of-range-compare only when compiling on aarch64/arm64 platforms.)
It looks as if this type is one we define internally, so perhaps this document might provide some guidance on a better type to choose?
(BTW, this makes the program uncompilable on Apple Silicon CPUs for both MacOS and Linux.)
In
binds/c/lib.cpp
, we have the following definitions:Note that there's no indication of whether these are signed or unsigned.
However, later in the file we have:
These comparisons with -1 of course work only with signed chars, but on Linux
aarch64
and Darwinarm64
platforms the default type ofchar
is unsigned for clang (and perhaps the ABI). This produces (fortunately) an error due to the-Wall
.There appear to be no warnings we can turn on that will indicate that such non-portable code is being used. (We get a
tautological-constant-out-of-range-compare
only when compiling onaarch64
/arm64
platforms.)It looks as if this type is one we define internally, so perhaps this document might provide some guidance on a better type to choose?
(BTW, this makes the program uncompilable on Apple Silicon CPUs for both MacOS and Linux.)