Skip to content

meson: Improve handling of compiler arguments

Simon McVittie requested to merge smcv/dbus:compiler-args into master
  • meson: Set up functionally necessary compiler arguments separately

    We have to set up feature-flag options like _GNU_SOURCE before we do compiler checks like cc.has_header_symbol, otherwise we'll miss symbols that are guarded by a feature-flag test, like environ in Linux unistd.h.

    However, we don't want to pass flags for extra compiler warnings when doing these checks, because that can cause false negatives: in particular, Meson's check programs nearly always trigger -Wunused. So the warnings need to be in a separate list.

  • meson: Build with -fno-strict-aliasing if supported

    We know that dbus is not fully strict-aliasing-compliant. In Autotools we got this from AX_COMPILER_FLAGS_CFLAGS.

  • meson: Build with -fno-common if supported

    This turns off a poorly-supported feature of older compilers. Even when using an older compiler, we want to behave more strictly.

    The Autotools build already did this.

  • meson: Comment why we disable certain compiler warnings

    This knowledge shouldn't be lost when we delete the Autotools build system.

  • meson: Pass project-wide compile arguments to has_header_symbol, etc.

    Otherwise, we'll miss symbols that only appear when _GNU_SOURCE is defined, like environ in Linux unistd.h.

  • meson: Enable more compiler warnings

    This provides parity with what we did in Autotools (most of it via AX_COMPILER_FLAGS_CFLAGS).

Merge request reports