This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Wed, Mar 09, 2005 at 08:06:57PM +0100, Jakub Jelinek wrote: > This patch: > a) fixes getwd, pread and pread64 that were broken before > b) starts using extern inline wrappers instead of macros for those checking > routines that have no GCC builtins. Although programs using say > somestruct->read (buf, 1, 2, 3); > without #undef read or using (somestruct->read) (buf, 1, 2, 3); > are broken, there are simply too many of them. > The wrappers for routines that have checking builtins in GCC > (like memcpy, strcpy or e.g. printf) should stay as is, so that warnings > about them are reported on the place where the bug occurs instead of > always in say bits/string3.h. > c) improves test coverage of these functions > Tested with GCC 4.0-RH with: > -#if _FORTIFY_SOURCE > 0 && __GNUC_PREREQ (4, 1) && __OPTIMIZE__ > 0 > +#if _FORTIFY_SOURCE > 0 && (__GNUC_PREREQ (4, 1) || (defined __GNUC_RH_RELEASE__ && __GNUC_PREREQ (4, 0))) && __OPTIMIZE__ > 0 > so that tst-chk{2,3} actually test something. Roland asked off-line if I could use __typeof for the __*_alias prototypes. Unfortunately, it seems I can't. With extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes, size_t __buflen) __wur; extern __typeof (read) __read_alias __asm__ ("read") __wur; extern __always_inline __wur ssize_t read (int __fd, void *__buf, size_t __nbytes) { if (__bos0 (__buf) != (size_t) -1 && (!__builtin_constant_p (__nbytes) || __nbytes > __bos0 (__buf))) return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf)); return __read_alias (__fd, __buf, __nbytes); } All GCCs I have tried (3.2.3-RH, 3.3.4-RH, 3.4.3-RH, 4.0 branch) treat __typeof (read) as a "call" and thus this triggers a warning in all those compilers: /usr/include/unistd.h:312: warning: 'read' declared inline after being called /usr/include/unistd.h:312: warning: previous declaration of 'read' was here So I'll just post an __always_inline patch on top of this one. Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |