md5, sha1, sha256, sha512: add gl_SET_CRYPTO_CHECK_DEFAULT
[gnulib.git] / doc / manywarnings.texi
1 @node manywarnings
2 @section manywarnings
3
4 The @code{manywarnings} module allows you to enable as many GCC warnings as
5 possible for your package. The purpose is to protect against introducing new
6 code that triggers warnings that weren't already triggered by the existing code
7 base.
8
9 An example use of the module is as follows:
10
11 @smallexample
12 gl_MANYWARN_ALL_GCC([warnings])
13 # Set up the list of the pointless, undesired warnings.
14 nw=
15 nw="$nw -Wsystem-headers"       # Don't let system headers trigger warnings
16 nw="$nw -Wundef"                # All compiler preprocessors support #if UNDEF
17 nw="$nw -Wtraditional"          # All compilers nowadays support ANSI C
18 nw="$nw -Wconversion"           # These warnings usually don't point to mistakes.
19 nw="$nw -Wsign-conversion"      # Likewise.
20 # Enable all GCC warnings not in this list.
21 gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw])
22 for w in $warnings; do
23   gl_WARN_ADD([$w])
24 done
25 @end smallexample
26
27 This module is meant to be used by developers who are not very experienced
28 regarding the various GCC warning options. In the beginning you will set the
29 list of undesired warnings (@samp{nw} in the example above) to empty, and
30 compile the package with all possible warnings enabled. The GCC option
31 @code{-fdiagnostics-show-option}, available in GCC 4.1 or newer, helps
32 understanding which warnings originated from which option. Then you will
33 go through the list of warnings. You will likely deactivate warnings that
34 occur often and don't point to mistakes in the code, by adding them to the
35 @samp{nw} variable, then reconfiguring and recompiling. When warnings point
36 to real mistakes and bugs in the code, you will of course not disable
37 them.
38
39 There are also many GCC warning options which usually don't point to mistakes
40 in the code; these warnings enforce a certain programming style. It is a
41 project management decision whether you want your code to follow any of these
42 styles. Note that some of these programming styles are conflicting. You
43 cannot have them all; you have to choose among them.
44
45 When a new version of GCC is released, you can add the new warning options
46 that it introduces into the @code{gl_MANYWARN_ALL_GCC} macro (and submit your
47 modification to the Gnulib maintainers :-)), and enjoy the benefits of the
48 new warnings, while adding the undesired ones to the @samp{nw} variable.