This is a discussion on Re: Default GCC behaviour on OpenBSD vs Linux within the mailing.openbsd.tech forums, part of the OpenBSD category; --> The warnings printed by the linker are very handy, and it's not a local customization either.. it's just not ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| The warnings printed by the linker are very handy, and it's not a local customization either.. it's just not very widely utilized. /usr/include/`uname -m`/cdefs.h determines if GCC is being used and defines __warn_references as follows: #define __warn_references(sym,msg) \ __asm__(".section .gnu.warning." __STRING(sym) \ " ; .ascii \"" msg "\" ; .text") #endif Then, in strcpy.c for instance, the C preprocessor first checks to see if APIWARN is defined, and if it is, the function is marked as unsafe. #if defined(APIWARN) __warn_references(strcpy, "warning: strcpy() is almost always misused, please use strlcpy()"); #endif Personally, I think it's a brilliant idea.. but this reminds me, several files don't define that... /usr/src/lib/libc/stdio/gets.c /usr/src/lib/libc/stdio/mktemp.c /usr/src/lib/libc/stdio/tempnam.c /usr/src/lib/libc/stdio/tmpnam.c /usr/src/lib/libc/compat-43/getwd.c /usr/src/lib/libcompat/4.3/setruid.c /usr/src/lib/libcompat/4.3/setrgid.c I'm not sure if that was the intent of the developers, or if it was an oversight.. regardless I'll send patches if anyone wants them. Be well. 8) |
| ||||
| On 6/24/08, Brynet <brynet@gmail.com> wrote: > Personally, I think it's a brilliant idea.. but this reminds me, > several files don't define that... > > /usr/src/lib/libc/stdio/gets.c > /usr/src/lib/libc/stdio/mktemp.c Some warnings are not optional. |