This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bug compiling libstdc++ under solaris


> Another interesting data point is that my patch did not include anything
> that would trigger a call to getwchar. Perhaps I am misunderstanding your
> question. Is this just something else that came up when trying to get
> the wchar_t support working rather than a problem with the patch I sent?
> In any case I am not sure where the call to getwchar is coming from.

In std/straits.h it includes
	#include <cwctype>
	#include <cwchar>
The first does
	#include <wctype.h>
which from Solaris does
	#include <widec.h>
in which it creates the macros:
	#define	getwchar()	getwc(stdin)
	#define	putwchar(x)	putwc((x), stdout)

Then when <cwchar> brings in <wchar.h>, it barfs on the forward decl of

	extern wint_t getwchar(void);

Hmm, ISO C Amendment 1 apparently sez that getwchar "has the same effect as
fgetwc(stdin)".

I'm not sure what other systems might be susceptible to this.  One route to
fix it might be having gcc's ficincludes script tweak this to only define that 
macro if !defined(__cplusplus) or somesuch.

Another (real hack) way of doing it is to explicitly #undef getwchar after the 
first #include, but that feels wrong.

Whatcha think?

B

-- 
Brendan Kehoe                                               brendan@cygnus.com
Cygnus Solutions, Sunnyvale, CA                                +1 408 542 9600

Web page: http://www.zen.org/~brendan/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]