]> Savannah Git Hosting - gnulib.git/commitdiff
manywarnings: more nuance about optimization
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 5 Jun 2023 20:16:22 +0000 (13:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 5 Jun 2023 20:16:38 +0000 (13:16 -0700)
* doc/manywarnings.texi (manywarnings): Suggest compiling with the
optimization flags commonly used, as opposed to -O2 and -O0
specificially.  -ggdb shouldn’t affect warnings so don’t mention it.

ChangeLog
doc/manywarnings.texi

index b761ca3a8e3bc929115e23be4876dede344f5ac0..d8f04f737db6dbdb0f1370a852885e5e0fba29ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-06-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+       manywarnings: more nuance about optimization
+       * doc/manywarnings.texi (manywarnings): Suggest compiling with the
+       optimization flags commonly used, as opposed to -O2 and -O0
+       specificially.  -ggdb shouldn’t affect warnings so don’t mention it.
+
 2023-06-05  Bruno Haible  <bruno@clisp.org>
 
        posix_spawn-internal: Fix a warning (regression 2022-11-20).
index 19b58f8e47bfd571f963ebec0991aa701d5ff19c..33506dccef15a82c84e7b2ed5fe93407270f180b 100644 (file)
@@ -66,18 +66,23 @@ This will save you time, because some warning options produce many false
 alarms with older versions of GCC (such as @code{-Wstrict-overflow} or
 @code{-Wunsafe-loop-optimizations}).
 @item
-Compile the package with an empty @code{nw} value, that is, with all
-possible warnings enabled.
-Do this once with optimizations (@code{CPPFLAGS=-O2}) and once with no
-optimizations (@code{CPPFLAGS=-O0} or @code{CPPFLAGS=-ggdb}).
-The exercise with optimizations will catch more bugs, because the
-compiler does a better static analysis of the program when optimizing.
+Consider the platforms commonly used when enabling GCC warnings.
+This includes not only target architectures and operating systems, but also
+optimization options, which can greatly affect the warnings generated.
+Makefiles generated by @code{configure} default to @option{-O2} optimization.
+If you also commonly build with @option{-O0} or other optimization options,
+you can compile again with those options.
+Using more optimizations catches more bugs, because the compiler does
+a better static analysis of the program when optimizing more.
 Also, some warning options that diagnose suboptimal code generation,
 such as @code{-Winline}, are not effective when not optimizing.
-On the other hand, it's frequent to build the package without
-optimizations, for debugging purposes, and you don't want to see
+On the other hand, if it's frequent to build the package with warnings but
+without optimizations, for debugging purposes, then you don't want to see
 undesired warnings in these phases of development either.
 @item
+Compile the package with an empty @code{nw} value, that is, with all
+possible warnings enabled.
+@item
 Then you will go through the list of warnings.
 Since there are likely many warnings, the first time, it's a good idea
 to sort them by warning option first: