Bug 439693 - <wchar.h > leaves __need_wint_t defined
<wchar.h > leaves __need_wint_t defined
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
8
All Linux
low Severity low
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-30 11:15 EDT by Jonathan Wakely
Modified: 2008-04-02 04:19 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-04-02 04:19:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jonathan Wakely 2008-03-30 11:15:45 EDT
Description of problem:

On Fedora 8 this program fails to compile using the Sun Studio Express C++
compiler for GNU/Linux:

#include <stdio.h>
#include <iostream>
int main() { }

See this forum topic for more information:
http://forum.java.sun.com/thread.jspa?messageID=10036641#10036641

Version-Release number of selected component (if applicable):

glibc-2.7-2.x86_64
glibc-2.7-2.i686

How reproducible:

Always

Steps to Reproduce:

Compile the example code above with sunCC on Fedora8
  
Actual results:

$ sunCC -V
sunCC: Sun Ceres C++ 5.9 Linux_i386 2008/01/28
$ sunCC bug.cc
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/iosfwd", line 74: Error: mbstate_t
is not defined.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/iosfwd", line 75: Error: mbstate_t
is not defined.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/traits", line 191: Error: ","
expected instead of "state_type".
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/traits", line 194: Error: Use
";" to terminate declarations.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/traits", line 261: Error: ","
expected instead of "get_state".
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/traits", line 265: Error: Use
";" to terminate declarations.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/traits", line 299: Error: ","
expected instead of "state_type".
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/traits", line 302: Error: Use
";" to terminate declarations.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/traits", line 410: Error: ","
expected instead of "get_state".
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/traits", line 414: Error: Use
";" to terminate declarations.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/rwlocale", line 125: Error:
mbstate_t is not defined.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/rwlocale", line 125: Error:
Template parameter std::stateT requires a type argument.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/rwlocale", line 130: Error:
mbstate_t is not defined.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/rwlocale", line 130: Error:
Template parameter std::stateT requires a type argument.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/codecvt", line 55: Error:
mbstate_t is not defined.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/codecvt", line 55: Error:
Template parameter std::stateT requires a type argument.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/codecvt", line 61: Error: ","
expected instead of "state_type".
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/codecvt", line 63: Error: Use
";" to terminate declarations.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/codecvt", line 138: Error:
mbstate_t is not defined.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/codecvt", line 138: Error:
Template parameter std::stateT requires a type argument.
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/codecvt", line 144: Error: ","
expected instead of "state_type".
"/opt/sun/sunstudioceres/prod/include/CC/Cstd/rw/codecvt", line 146: Error: Use
";" to terminate declarations.
22 Error(s) detected.


Expected results:

The program should compile.

Additional info:

As I explained in the forum topic referenced above, the cause is that glibc's
wchar.h defines __need_wint_t assuming it will be undefined by stddef.h - but if
the compiler is not GCC then it stays defined and when <wchar.h> is included
again, _WCHAR_H never gets set.

wchar.h already accommodates compilers that don't define wint_t in <stddef.h> by
defining it:

# undef __need_wint_t
# define __need_wint_t
# include <stddef.h>

/* We try to get wint_t from <stddef.h>, but not all GCC versions define it
   there.  So define it ourselves if it remains undefined.  */
# ifndef _WINT_T
/* Integral type unchanged by default argument promotions that can
   hold any value corresponding to members of the extended character
   set, as well as at least one value that does not correspond to any
   member of the extended character set.  */
#  define _WINT_T
typedef unsigned int wint_t;

It seems to me that __need_wint_t should get #undef'd in that case, since it's
no longer needed.
Comment 1 Jakub Jelinek 2008-04-02 04:19:35 EDT
That's bug on the Sun studio stddef.h side.  The (numerous __need_*) macros are
part of the Linux APIs, so if their stddef.h doesn't use them and undef them, it
has been ported incorrectly.

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