[PATCH] Fix -Os related -Werror failures.

Paul Eggert eggert@cs.ucla.edu
Fri Oct 28 20:10:00 GMT 2016


On 10/28/2016 01:12 AM, Arnd Bergmann wrote:
> I found that most often when gcc is confused about whether a variable is uninitialized or not, the source code tends to be confusing to a human reader as well and rewriting it differently results in better readability and better object code while avoiding the warning.

I'm afraid my experience has not been so good. Maybe 1/3 of the time rewriting is better, but otherwise rewriting doesn't help or even confuses the code. When that happens with -Wmaybe-uninitialized, in Emacs we typically use C declarations like this:

       ptrdiff_t offset2 UNINIT; /* The UNINIT works around GCC bug 
78081.  */

where UNINIT is defined something like this:

   #ifdef GCC_LINT
   # define UNINIT = {0,}
   #else
   # define UNINIT /* empty */
   #endif

and configuring with --enable-gcc-warnings compiles with something like 
'gcc -Wall -Werror -DGCC_LINT'.



More information about the Libc-alpha mailing list