Bug 185667 - wchar.h has function declaration using "long long" type which doesn't allow to use c89 mode
wchar.h has function declaration using "long long" type which doesn't allow t...
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2006-03-16 14:58 EST by Anton Youdkevitch
Modified: 2007-11-30 17:11 EST (History)
2 users (show)

See Also:
Fixed In Version: 2.4-5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-03-29 11:51:10 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Anton Youdkevitch 2006-03-16 14:58:16 EST
Description of problem:

wchar.h include file has two function declared as returning "long long" which is
not allowed in c89 mode.
These function are supposed to be internal and are prepended with __extension__
macro. However, this macro expands to nothing for non-gnu compilers rendering
this declaration illegal.
All such functions should be guarded by "#if defined __GNUC__" which is true for
all the function except these two. Apparently, these two function have to be
guarded by #ifdef's in the same way.

Version-Release number of selected component (if applicable):
glibc 2.3, 2.4

How reproducible:

Steps to Reproduce:
1. Get SunStudio C compiler
2. Run it in c89 mode to compile any source file that includes wchar.h Just
one-liner "#include <wchar.h>" will do.

Actual results:
Compiler complains about illegal type for c89 mode

Expected results:
Should compile OK

Additional info:

]$]$ uname -srvmpo
Linux 2.6.5-7.139-smp #1 SMP Fri Jan 14 15:41:33 UTC 2005 i686 i686 GNU/Linux

]$ cat z.c
#include <wchar.h>

]$ c89 -c -V z.c
cc: Sun C 5.8
acomp: Sun C 5.8
"/usr/include/wchar.h", line 507: long long not allowed in Xc mode
"/usr/include/wchar.h", line 507: invalid type combination
"/usr/include/wchar.h", line 514: long long not allowed in Xc mode
"/usr/include/wchar.h", line 514: invalid type combination
c89: acomp failed for z.c

]$ cat -n /usr/include/wchar.h | sed -n '500,525p'
500  extern unsigned long int __wcstoul_internal (__const wchar_t *__restrict __npt,
501                                               wchar_t **__restrict __endptr,
502                                               int __base, int __group) __THROW;
503  # define __wcstoul_internal_defined     1
504  #endif
505  #ifndef __wcstoll_internal_defined
506  __extension__
507  extern long long int __wcstoll_internal (__const wchar_t *__restrict __nptr,
508                                           wchar_t **__restrict __endptr,
509                                           int __base, int __group) __THROW;
510  # define __wcstoll_internal_defined     1
511  #endif
512  #ifndef __wcstoull_internal_defined
513  __extension__
514  extern unsigned long long int __wcstoull_internal (__const wchar_t *
515                                                     __restrict __nptr,
516                                                     wchar_t **
517                                                     __restrict __endptr,
518                                                     int __base,
519                                                     int __group) __THROW;
520  # define __wcstoull_internal_defined    1
521  #endif
524  #if defined __OPTIMIZE__ && __GNUC__ >= 2
525  /* Define inline functions which call the internal entry points.  */
Comment 2 Roland McGrath 2006-03-16 17:08:52 EST
I changed those particular cases upstream, since it is trivial and harmless to
avoid those decls when they will not be used anyway.  But there are plenty of
other uses of __extension__ like that, which we will not be changing.  Perhaps
none other arises when using C89 without _GNU_SOURCE.  Supporting non-GCC
compilers is of no interest to glibc and changes to make them work will in
general not be made when they perturb anything.  
Comment 3 Jakub Jelinek 2006-03-29 11:51:10 EST
Should be fixed in rawhide glibc-2.4-5.

Note You need to log in before you can comment on or make changes to this bug.