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: Always 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 522 523 524 #if defined __OPTIMIZE__ && __GNUC__ >= 2 525 /* Define inline functions which call the internal entry points. */
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.
Should be fixed in rawhide glibc-2.4-5.