Date: Wed, 21 Aug 2002 22:02:27 -0700 (PDT) From: Archie Cobbs <archie@dellroad.org> To: freebsd-stable@freebsd.org Subject: stdio.h patch Message-ID: <200208220502.g7M52Rh09296@arch20m.dellroad.org>
next in thread | raw e-mail | index | archive | help
Hi, Does anyone object to the patch below? It fixes this warning when compiling with -Wnested-externs and -D_THREAD_SAFE (am I the only one who ever does that??) /usr/include/stdio.h: In function `__getc_locked': /usr/include/stdio.h:418: warning: nested extern declaration of `__isthreaded' /usr/include/stdio.h: In function `__putc_locked': /usr/include/stdio.h:430: warning: nested extern declaration of `__isthreaded' The fix is to declare '__isthreaded' at the top level. My understanding of things is that this should be OK because the name begins with two underscores (but I could be wrong about that). Also, it removes a bunch of backslash contiunations that are not needed. FYI, this is not an issue in -current. Thanks, -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com Index: stdio.h =================================================================== RCS file: /home/ncvs/src/include/stdio.h,v retrieving revision 1.24.2.2 diff -u -r1.24.2.2 stdio.h --- stdio.h 5 Dec 2001 20:48:07 -0000 1.24.2.2 +++ stdio.h 22 Aug 2002 05:01:24 -0000 @@ -415,29 +415,28 @@ #else #define _FLOCKFILE(x) flockfile(x) #endif -static __inline int \ -__getc_locked(FILE *_fp) \ -{ \ - extern int __isthreaded; \ - int _ret; \ - if (__isthreaded) \ - _FLOCKFILE(_fp); \ - _ret = getc_unlocked(_fp); \ - if (__isthreaded) \ - funlockfile(_fp); \ - return (_ret); \ +extern int __isthreaded; +static __inline int +__getc_locked(FILE *_fp) +{ + int _ret; + if (__isthreaded) + _FLOCKFILE(_fp); + _ret = getc_unlocked(_fp); + if (__isthreaded) + funlockfile(_fp); + return (_ret); } -static __inline int \ -__putc_locked(int _x, FILE *_fp) \ -{ \ - extern int __isthreaded; \ - int _ret; \ - if (__isthreaded) \ - _FLOCKFILE(_fp); \ - _ret = putc_unlocked(_x, _fp); \ - if (__isthreaded) \ - funlockfile(_fp); \ - return (_ret); \ +static __inline int +__putc_locked(int _x, FILE *_fp) +{ + int _ret; + if (__isthreaded) + _FLOCKFILE(_fp); + _ret = putc_unlocked(_x, _fp); + if (__isthreaded) + funlockfile(_fp); + return (_ret); } #define getc(fp) __getc_locked(fp) #define putc(x, fp) __putc_locked(x, fp) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208220502.g7M52Rh09296>