This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add macros for diagnostic control, use them in locale/weightwc.h


Joseph Myers wrote:
it's established glibc practice not to add initializations that
would change generated code to silence warnings.

Sure, and that's what the IF_LINT macro calls do in coreutils, Emacs, etc.: they don't alter the code used in production. In practice this leads to code that is definitely easier to maintain and arguably more resistant against faults than the DIAG_IGNORE approach being proposed.

that doesn't appear to help for the case this patch relates to; the
uninitialized object '*((void *)&str+4)' is outside the bounds of "UCHAR
str[1]"

If GCC is griping about (say) some component of the array xyz not being initialized, then in the worst case one can pacify it by initializing the array in its declaration, e.g., 'int xyz[100] IF_LINT (= {0});'. Of course if GCC is griping only about xyz[2], one can tighten this by initializing just xyz[2], which is preferable. In my experience, it's rare to need to do anything so drastic as to initialize an entire array, as GCC warning bugs generally have to do with local scalars.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]