+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).
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: