Message ID | 5440EC13.3030700@debian.org |
---|---|
State | New |
Headers | show |
ping now that C11 mode is the default, can we avoid the warning? On 10/17/2014 12:14 PM, Matthias Klose wrote: > Building libssp in C11 mode shows a warning for 64bit configurations, > > ../../../src/libssp/gets-chk.c:62:12: warning: return makes pointer from integer > without a cast [-Wint-conversion] > > Currently working around by adding a prototype in gets-chk.c, conditionally > defined by the inverted condition found in glibc's stdio.h. > > Is there a better approach? > > Matthias >
On 01/22/15 08:45, Matthias Klose wrote: > ping > > now that C11 mode is the default, can we avoid the warning? Ick. Part of me wants to say drop the gets intercepting and just issue some kind of error for C11 mode. Part of me wants to ignore the issue and accept the warning. Part of me wants to look at the two paths where we call gets and punt them somehow. But in the end, adding the prototype is probably best, though I'm sure some lame-o system will have a ever-so-slightly different prototype that will cause a build failure. Part of me would like to just punt until gcc-6 when fallout would be lighter. But ISTM that without a proper prototype in place, we could get wrong code here on 64 bit platforms. So, I guess go forward with the prototype. We may have to adjust the guard further if other platforms fail to build. jeff
--- libssp/gets-chk.c +++ libssp/gets-chk.c @@ -51,6 +51,11 @@ # include <string.h> #endif +#if !(!defined __USE_ISOC11 \ + || (defined __cplusplus && __cplusplus <= 201103L)) +extern char *gets (char *); +#endif + extern void __chk_fail (void) __attribute__((__noreturn__)); char *