clang issues -Wformat-nonliteral when `vsnprintf` is passed the format
string from its caller. This is generally not useful. Fortunately, the
warning can be suppressed by annotating the function as format(printf).
Presumably, this is because clang now trusts that the caller would have
been warned for a bad format string.
Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/369>
Fixes: dc79bb8e4a ("Remove hack for bypassing buddy time restriction")
clang rightly warns for `if (!var&1)`, which parses as `if (!(var &
1))`, which is probably not what the original author intended.
Unfortunately, the author never commented what *was* intended. The
author might have meant to reject any row with an even length (`if
(!(var & 1))`, but that seems strange in this context. Remove the `&
1`, which retains the sense of what the code has always done.
clang warns for taking the address of unaligned data, but not for taking
a reference to it. It should warn for both. The data should be fixed
not to be unaligned, but for now, this change will quiet the warning.
OS X clang warns when a variable is captured but not used. Linux gcc
does not. Remove the unused variable.
Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/368>
Fixes: 7da64d3782 ("Add new autoselect-while-firing mode: "when firing stops"")
Packed structures cannot be passed by reference, may fail on
alignment-strict architectures, and are bad for performance even on
alignment-tolerant architectures. Using them for anything other than an
abstract layout declaration is a mistake. Remove
__attribute__((packed)).
OpenBSD 6 uses `openbsd6` as its sys.platform. Strip trailing numbers,
then remove the hack for converting `linux2` into `linux`. This should
prevent compatibility problems when OpenBSD 7 is used.
Commit 265af2b9e5 added an extra test for whether the header could be
preprocessed, but reused the string shown when an empty test program is
compiled. This can confuse users since the same message is shown twice.
Differentiate the messages.
Fixes: 265af2b9e5 ("Extend SConf diagnostics for failed system headers")
Many predicate functions only need to return zero/nonzero, and the
callers do not care about the particular value of nonzero. Use this to
eliminate loads of explicit `1`, instead returning a nonzero value
generated by the test.
gcc-5 rejects `constexpr bool DefiningMarkerMessage() const` because
`d_marker_state` is not literal. Later versions of gcc accept this, but
the `constexpr` is not useful here since one term is a runtime variable.
Remove `constexpr`.
Also, modify the definition of `marker_message_text_t` and
`d_marker_state` to encourage the compiler to initialize `MarkerState`
at compile time instead of load time.
Fixes: 49a4ac1c0e ("Move more marker state to d_marker_state")
gcc-4.9 warns (and due to -Werror, errors) for `png_time pt{}` because
the members are not explicitly initialized. This code is compiled, but
never run, so the explicit initialization is unnecessary. Later
versions of gcc accept both versions of this code without complaint.
Fixes: 131c1b9f4d ("Add support for PNG screenshots")
User roncli reports[1] an original game bug that prevents boss
teleportation from operating correctly if the program is not restarted
between each campaign. This is another case of a global variable being
used improperly. Reset the relevant variables when the boss is
initialized.
[1] https://github.com/dxx-rebirth/dxx-rebirth/issues/366#issuecomment-373199624
`build_colormap_good` only took `used` to clear it. Only one caller
needed it cleared. Move the clear into that caller. Remove the
parameter from all calls.