[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_*/AM_* macros for options

From: Paul Eggert
Subject: Re: AC_*/AM_* macros for options
Date: Tue, 29 Oct 2013 21:00:05 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

David A. Wheeler wrote:
> AC_PROG_CC_WARNINGS([low])  # off, low, medium, high; default medium
> and in gcc "medium" might map to "-Wall".

I'm afraid in practice things are not quite that simple.
The set of warning flags that are useful varies from project;
it's not a simple dial that one can turn from 1 to 10.

For example, GCC does something like the following,
if you configure --with-gcc-warnings:

  * Enable all GCC warning flags that the current
    compiler (whatever it is) supports.

  * But disable -Wtautological-constant-out-of-range-compare,
    -Wpointer-sign, -Wformat-extra-args, -Wunused-command-line-argument,
    -Wunused-value if using clang.

  * And disable -Wwrite-strings if using the Lucid or
    Motif toolkits (since those old interfaces generate
    too many warnings otherwise).  And disable -Werror
    while you're at it (ditto).

  * Disable the following warnings on all platforms:
    -Wsystem-headers, -Woverlength-strings, -Wlogical-op,
    -Wformat-nonliteral, -Wvla, -Wnested-externs,
    -Wswitch-default, -Winline, -Wjump-misses-init,
    -Wstrict-overflow, -Wsync-nand, -Wunsafe-loop-optimizations,
    -Wbad-function-cast, -Wshadow, -Wstack-protector,
    -Wsuggest-attribute=pure, -Wmissing-field-initializers,
    -Wsign-compare, -Wtype-limits, -Wunused-parameter.

  * And if compiling the gnulib part of Emacs,
    disable -Wunused-macros as well.

  * Compile with _FORTIFY_SOURCE = 2 if optimizing, as
    this enables some further compile-time warnings.

  * Disable -pie, as -pie breaks Emacs's funky way
    of saving its state.

The set of warnings options that other tools use is
neither a superset nor a subset of the options that
Emacs uses; there are simply too many knobs to turn.

If you're interested in pursuing this, I suggest that
you look at the for Emacs, grep, coreutils,
diffutils, and tar, and look for some of the variations.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]