Subject: standards/16997: #define vfscanf __svfscanf considered harmful
To: None <gnats-bugs@gnats.netbsd.org>
From: None <thorpej@shagadelic.org>
List: netbsd-bugs
Date: 05/23/2002 22:59:36
>Number: 16997
>Category: standards
>Synopsis: #define vfscanf __svfscanf considered harmful
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: standards-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu May 23 23:00:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Jason R Thorpe
>Release: NetBSD 1.5ZC
>Organization:
Wasabi Systems, Inc.
>Environment:
System: NetBSD yeah-baby.shagadelic.org 1.5ZC NetBSD 1.5ZC (YEAH-BABY-XP) #8: Sat May 4 15:32:58 PDT 2002 thorpej@yeah-baby.shagadelic.org:/u1/netbsd/src/sys/arch/i386/compile/YEAH-BABY-XP i386
Architecture: i386
Machine: i386
>Description:
NetBSD's <stdio.h> has the following block of code:
/*
* This is a #define because the function is used internally and
* (unlike vfscanf) the name __svfscanf is guaranteed not to collide
* with a user function when _ANSI_SOURCE or _POSIX_SOURCE is defined.
*/
#define vfscanf __svfscanf
This presents a problem when building recent versions of
GCC (3.1 or later). What happens is that GCC builds a
table of built-in attributes to automatically apply to
certain functions. vfscanf is one if these functions (being
in ISO C99).
The file that builds this table also happens to have included
<stdio.h> at some point (either directly or indirectly through
another header file).
Because of the #define above, the built-in attribute table
ends up applying a scanf format attribute to "__svfscanf"
rather than "vfscanf". This results in testsuite failures:
FAIL: gcc.dg/format/c99-scanf-3.c vfscanf (test for warnings, line 21)
FAIL: gcc.dg/format/c99-scanf-3.c vfscanf (test for warnings, line 21)
FAIL: gcc.dg/format/ext-6.c vfscanf (test for warnings, line 42)
FAIL: gcc.dg/format/ext-6.c vfscanf (test for warnings, line 42)
>How-To-Repeat:
See above.
>Fix:
Not entirely clear. I suspect this is really a GCC problem
(and I plan on bringing this up with them, as well), but I
wanted to make a record of it here, as well.
>Release-Note:
>Audit-Trail:
>Unformatted: