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: sparc: fix for missing include file


David Miller wrote:
strncat.c: In function âstrncatâ:
strncat.c:76:6: error: âcâ may be used uninitialized in this function [-Werror=uninitialized]

This is the generic C strncat.c in string/strncat.c, and actually the
compiler is right here in that when 'n' is zero 'c' will in fact be
tested without being initialized to anything.

That's amusing, since the code works regardless of whether 'c' is initialized properly, assuming that using an uninitialized value doesn't trap or have similarly bad behavior. So this looks like another candidate for adding pragmas to suppress the diagnostic. In Gnulib we'd say 'char c IF_LINT (= 0);'.


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