Bug 22786

Summary: g++ -fshort-wchar gives warning for every file
Product: [Retired] Red Hat Linux Reporter: David Baron <dbaron>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: bryner
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: 2000-12-28 12:09:35 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:

Description David Baron 2000-12-23 20:46:51 UTC
Using the -fshort-wchar option with g++ (but not gcc) gives the following
warning for every file compiled:

<command line>: warning: "__WCHAR_TYPE__" redefined

Steps to reproduce:
 * create a file called test.cpp containing "int main() { return 0; }"
 * `g++ -fshort-wchar -o test test.cpp`

This seems like the -fshort-wchar option is being tranlated to a -D option
at 2 different points (perhaps g++ and gcc), which leads to 2
-D__WCHAR_TYPE__ options, or something like that.

It would be nice to see this fixed, since we're using this for Mozilla when
the option is available.  I haven't tested this on the gcc trunk.

Comment 1 David Baron 2000-12-23 21:02:39 UTC
It turns out I may not have been looking closely enough.  bryner pointed out to
me that this warning shows up for gcc as well.  My memory of trying it on my RH
7.0 system (which I don't have access to now) was the reverse, but maybe I
didn't test what I thought I did.

Comment 2 Jakub Jelinek 2000-12-28 12:09:32 UTC
This was fixed by
2000-09-04  Craig Newell  <CraigN>

        * gcc.c: Undefine "__WCHAR_TYPE__" before redefining it.
in CVS gcc, gcc-c++-2.96-70 will include this fix.