Bug 89142

Summary: SRPMS: extra definition of vsnprintf in config.h conflicts with system one causeing compile-time error with more strict than gcc compiler
Product: [Retired] Red Hat Linux Reporter: Sysoltsev Slawa <vyatcheslav.sysoltsev>
Component: kofficeAssignee: Than Ngo <than>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-06-26 12:33:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch for configure.in.in that add check for vsnprintf presence in system none

Description Sysoltsev Slawa 2003-04-18 09:43:32 UTC
Description of problem:
Trying to build koffice from RH8.0 with Intel compiler I got such an error:

/bin/sh ../../libtool --silent --mode=compile --tag=CXX g++ -DHAVE_CONFIG_H -I. -
I. -I../.. -I../../lib/store -I../../lib/store -I../../lib/kwmf -I../../lib/kwmf -I/usr/include/kde -
I/usr/lib/qt3-gcc3.2/include -I/usr/X11R6/include   -DQT_THREAD_SUPPORT  -
D_REENTRANT  -Wnon-virtual-dtor -Wno-long-long -Wbad-function-cast -Wundef -
Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -
D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -
D_GNU_SOURCE -O2 -march=i386 -mcpu=i686 -DNO_DEBUG -DNDEBUG -fno-
check-new -fno-exceptions -fno-check-new -DQT_CLEAN_NAMESPACE -
DQT_NO_ASCII_CAST -DQT_NO_COMPAT -DKDE_NO_COMPAT   -c -o 
koApplication.lo `test -f koApplication.cc || echo './'`koApplication.cc
/usr/include/stdio.h(321): error: exception specification is incompatible with that of 
previous function "snprintf" (declared at line 181 of "../../config.h")
       __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
       ^

/usr/include/stdio.h(325): error: exception specification is incompatible with that of 
previous function "vsnprintf" (declared at line 177 of "../../config.h")
       __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
       ^

As you see problem here in conflicting two definitions of vsnprintf; one is in system 
header stdio.h, second is in config.h, generated in configuration stage. Looking 
into config.h I found that vsnprintf prototype is guarded by #if:
#if !defined(HAVE_VSNPRINTF) || defined(hpux) || defined(__osf__)

It's quite competently that it is guarded by HAVE_VSNPRINTF, but there is no 
something about HAVE_VSNPRINTF in config.h previously! It seems you simply 
forgot to test for presence of vsnprintf in configuration, that's why extra vsnprintf 
declaration mistakenly ALWAYS included. I did the patch for configure.in.in that 
add test for vsnprintf, with it declaration of vsnprintf becomes active only when 
there is no such in system headers.

GNU gcc doesn't expose this bug because it treats such functions as vsnprintf, 
snprintf (but not fprintf, sprintf, etc) somehow specially and they can be redeclared 
in difference with others.


Version-Release number of selected component (if applicable):
koffice-1.2-0.rc1.4

How reproducible:
always

Steps to Reproduce:
1. I'm afraid this is not reproducible with gcc because of special treating for 
vsnprintf, snprintf; you could try to reproduce problem using Intel compiler or other 
third-party compiler, for this just try to build koffice from sources on system that 
have vsnprintf.
    
Actual results:
Compilation error

Expected results:
Succesfully built package

Additional info:

Comment 1 Sysoltsev Slawa 2003-04-18 09:44:49 UTC
Created attachment 91186 [details]
Patch for configure.in.in that add check for vsnprintf presence in system

Comment 2 Than Ngo 2003-06-26 12:33:26 UTC
it's fixed in 1.2.1-12. thanks for your patch file