Commit Graph

18 Commits

Author SHA1 Message Date
Peter Keresztes Schmidt e8adf5d331 Build: Enable std::vector ASAN annotation in libstdc++
By defining _GLIBCXX_SANITIZE_VECTOR when ASAN is enabled `std::vector` operations
will be annotated so ASAN can detect invalid accesses.

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html
2021-05-29 19:55:17 +02:00
Peter Keresztes Schmidt 8379ab70be Build: Disable Wstringop-truncation in GCC ASAN builds
These two options don't work well together and lead to false positives.

Follow-up on e5cac38521
2021-05-28 00:08:46 +02:00
Peter Keresztes Schmidt e232b5d1a7 Build: Disable Wmissing-field-initializers on older GCC versions
GCC 5.1 corrected the behaviour in regard that the C++11 initialisation behaviour is respected.
2021-05-24 01:15:00 +02:00
Peter Keresztes Schmidt c8f2a813e3 Build: Enable VLA warnings
VLAs (variable-length arrays) are a C99 feature and were never standardised for C++.
There are better alternatives in C++ (mainly std::vector). Enable the warnings
so no new ones can be introduced.
2021-05-17 22:12:04 +02:00
Peter Keresztes Schmidt bf08502b9c Build: Add CMake option to enable Werror
With -DENABLE_WERROR the -Werror flag will be passed to the compiler failing the build if a warning is emitted.
2021-05-01 00:07:12 +02:00
Isaac Connor 03b8a98bae xenial has cmake 3.5.1. VERSION_LESS_EQUAL was introduced in 3.7. So lets use VERSION_LESS,11 instead 2021-04-19 17:06:54 -04:00
Peter Keresztes Schmidt 0676f71cd6 Build/GCC: Suppress -Wclobbered warnings on older compilers
There were a high number of false positives with old compilers. Suppress these warnings on them.
2021-04-12 08:58:57 +02:00
Peter Keresztes Schmidt b93d5556b2 Build: Re-enable Wtype-limits on GCC 2021-04-12 00:25:04 +02:00
Peter Keresztes Schmidt e8565b0704 Build: Enable implicit fallthrough warnings on clang 2021-04-11 23:39:35 +02:00
Peter Keresztes Schmidt 0ab6b04fa1 build: Enable Woverloaded-virtual on GCC 2021-04-11 01:28:23 +02:00
Andrew Bauer 663c7f51f5 don't set -Wconditionally-supported on older gcc 2021-04-07 10:01:46 -05:00
Peter Keresztes Schmidt d1bbfdaf6b Build: Enable -Wconditionally-supported on GCC
We want to have warnings if we use some implementation-specific features of GCC
to be able to keep compatibility with clang.
2021-03-18 20:02:23 +01:00
Peter Keresztes Schmidt 0796a2262e Utils: Replace stringtf with a type-safe version that can't overflow 2021-03-06 00:12:18 +01:00
Peter Keresztes Schmidt 6e2f8bfedb build: Enable Wextra with some exceptions
-Wno-cast-function-type:
Signal handler code relies on this.

-Wno-type-limits:
Some of the color space conversion code in zm_image throws this warning. To not break anything let's ignore this warning for the time being.

Note that clang enables -Woverloaded-virtual with -Wextra. To not flood the GCC build log with warnings let's not enable this at the moment.
This will be done in a second step, when the currently throwing code will be cleaned up.
2021-02-27 02:08:14 +01:00
Peter Keresztes Schmidt 4c07bf5aae Build: Add ThreadSanitizer (TSan) support
Enable it by setting -DTSAN=1
This setting is mutually exclusive with -DASAN
2021-02-11 00:38:31 +01:00
Peter Keresztes Schmidt 424e6e14f6 Build: Add -DASAN option to build with AddressSanitizer support
Use this option only for debugging purposes.
2021-02-08 23:13:31 +01:00
Peter Keresztes Schmidt 825ca07561 Build: Use zm-* interfaces to set cxx standard and warning flags 2021-02-08 23:08:22 +01:00
Peter Keresztes Schmidt 407ea70991 Build: Add support for compiler detection
Using this system we can separate settings for different compilers nicely.
2021-02-08 23:08:22 +01:00