Skip to content

Diagnostics

unhappy-ending edited this page Jun 9, 2024 · 5 revisions

Diagnostics are important for finding misbehaving code or unruly user settings that break things. Package testing can only go so far, some packages pass tests fine but can still have segmentation faults or failing to be linked against from being compiled incorrectly. These diagnostic flags should be added after you've already defined your CFLAGS, CXXFLAGS, and LDFLAGS. The reason diagnostic flags are manually duplicated in CXXFLAGS instead of carrying them over from CFLAGS is because -Werror=implicit-function-declaration shouldn't be used when compiling C++ code.

CFLAGS

-fdiagnostics-color=always

-frecord-gcc-switches

-Werror=format-security

-Werror=implicit-function-declaration

-Werror=incompatible-library-redeclaration

-Werror=strict-aliasing

CXXFLAGS

-fdiagnostics-color=always

-frecord-gcc-switches

-Werror=format-security

-Werror=odr

-Werror=strict-aliasing

LDFLAGS

-Wl,--defsym=gentoo_check_ldflags=0

FEATURES

qa-unresolved-soname-deps