Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 88154 - GCC header file <stdio.h> fails to properly define snprintf()
Summary: GCC header file <stdio.h> fails to properly define snprintf()
Status: VERIFIED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Please assign to toolchain
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-06 06:04 UTC by Tom Fredrik Blenning Klaussen
Modified: 2005-07-22 11:41 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Testcase to demonstrate problem (snprintf_test.c,136 bytes, text/plain)
2005-04-06 06:05 UTC, Tom Fredrik Blenning Klaussen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Fredrik Blenning Klaussen 2005-04-06 06:04:05 UTC
This is probably an upstream problem, but I'm not sure. Anyway, I'm reporting it here.

snprintf should be defined in <stdio.h> or at least that's what the man page claims.



Reproducible: Always
Steps to Reproduce:
If you try to compile the attached program, with 
"i686-pc-linux-gnu-gcc-3.3.5 -Wall -ansi snprintf_test.c"
you will see a warning.


Actual Results:  
snprintf_test.c: In function `main':
snprintf_test.c:6: warning: implicit declaration of function `snprintf'



Portage 2.0.51.19 (default-linux/x86/2004.3, gcc-3.3.5, glibc-2.3.4.20041102-r1,
                                                                               
                                               
 2.6.10 i686)
=================================================================
System uname: 2.6.10 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.16
Python:              dev-lang/python-2.3.4-r1 [2.3.4 (#1, Mar  2 2005, 14:52:06)
                                                                               
                                               
]
ccache version 2.3 [enabled]
dev-lang/python:     2.3.4-r1
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.4
sys-devel/binutils:  2.15.92.0.2-r7
sys-devel/libtool:   1.5.10-r4
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium3 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share
                                                                               
                                               
/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/shar
                                                                               
                                               
e/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/sh
                                                                               
                                               
are/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/tex
                                                                               
                                               
mf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium3 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="http://mirror.gentoo.no/ http://ftp.du.se/pub/os/gentoo http://d
                                                                               
                                               
s.thn.htu.se/linux/gentoo http://mirror.pudas.net/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X aalib alsa apm arts avi bash-completion berkdb bitmap-fonts crypt cup
                                                                               
                                               
s curl emboss encode esd fam flac font-server foomaticdb fortran gdbm gif gnome
                                                                               
                                                
gpm gtk gtk2 imagemagick imlib ipv6 java jpeg kde libg++ libwww mad mikmod motif
                                                                               
                                               
 mp3 mpeg ncurses nls oggvorbis opengl oss pam pdflib perl png python qt quickti
                                                                               
                                               
me readline samba sdl slang spell ssl svga tcltk tcpd tiff truetype truetype-fon
                                                                               
                                               
ts type1-fonts xml2 xmms xv zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS
Comment 1 Tom Fredrik Blenning Klaussen 2005-04-06 06:05:04 UTC
Created attachment 55459 [details]
Testcase to demonstrate problem
Comment 2 Roland Bär 2005-04-06 07:35:50 UTC
When compiling with "-ansi" switch (ISO C90), then the prototype for snprintf is #ifdef'd out, cause (excerp of man snprintf):
       The fprintf, printf, sprintf, vprintf, vfprintf, and vsprintf functions
       conform  to  ANSI X3.159-1989 (``ANSI C'') and ISO/IEC 9899:1999 (``ISO
       C99'').  The  snprintf  and  vsnprintf  functions  conform  to  ISO/IEC
       9899:1999.
So if you really want "-ansi" to force ISO C90  standard for some (portability?) reasons, then don't use snprintf...
Comment 3 Tom Fredrik Blenning Klaussen 2005-04-06 09:36:57 UTC
That certainly seems to explain things. Sorry, marking this as invalid
Comment 4 Tom Fredrik Blenning Klaussen 2005-07-22 11:41:05 UTC
Closing this bug