Subject: bin/19775: printf(3) documents the z format option for size_t, gcc complains
To: None <gnats-bugs@gnats.netbsd.org>
From: Andrew Brown <atatat@atatdot.net>
List: netbsd-bugs
Date: 01/11/2003 00:12:16
>Number: 19775
>Category: bin
>Synopsis: printf(3) documents the z format option for size_t, gcc complains
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 10 21:13:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: TheMan
>Release: 1.6K (current as of 20021220)
>Organization:
none
>Environment:
System: NetBSD this 1.6K NetBSD 1.6K (THAT) #147: Fri Jan 10 18:49:06 EST 2003 andrew@this:/usr/src/sys/arch/i386/compile/THAT i386
>Description:
the printf(3) man page describes the z modifier for integer
types that are size_t and ssize_t. try to use them and gcc
warns you that it has no idea what they are.
>How-To-Repeat:
% cat > size_t.c << EOF
#include <sys/types.h>
main() {
size_t s = 437;
printf("%zu\n", s);
}
EOF
% cc -Wformat size_t.c
size_t.c: In function `main':
size_t.c:2: warning: unknown conversion type character `z' in format
%
>Fix:
tweak gcc (src/gnu/dist/toolchain/gcc/c-common.c, around line
1635) to shut up about it? import a new gcc?
>Release-Note:
>Audit-Trail:
>Unformatted: