public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: preprocessor/8880: __WCHAR_TYPE__ macro incorrectly set to "long int" with -fshort-wchar
@ 2002-12-11 13:16 Neil Booth
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Booth @ 2002-12-11 13:16 UTC (permalink / raw)
  To: neil; +Cc: gcc-prs

The following reply was made to PR preprocessor/8880; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.co.uk>
To: cheinan@primus.com
Cc: gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Subject: Re: preprocessor/8880: __WCHAR_TYPE__ macro incorrectly set to "long int" with -fshort-wchar
Date: Wed, 11 Dec 2002 21:13:15 +0000

 Please confirm this patch fixes it (a kludge around the kludge that is
 predefined macros before 3.3).
 
 Neil.
 
 	PR preprocessor/8880
 	* gcc.c (cpp_unique_options): Handle -fshort-wchar later so it
 	overrides any target CPU specs.
 
 Index: gcc.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
 retrieving revision 1.296.2.12.4.4
 diff -u -p -r1.296.2.12.4.4 gcc.c
 --- gcc.c	14 Oct 2002 21:55:26 -0000	1.296.2.12.4.4
 +++ gcc.c	11 Dec 2002 21:11:52 -0000
 @@ -688,10 +688,10 @@ static const char *cpp_unique_options =
   %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
   %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
   %{fno-inline|O0|!O*:-D__NO_INLINE__} %{ffast-math:-D__FAST_MATH__}\
 - %{fshort-wchar:-U__WCHAR_TYPE__ -D__WCHAR_TYPE__=short\\ unsigned\\ int}\
   %{ffreestanding:-D__STDC_HOSTED__=0} %{fno-hosted:-D__STDC_HOSTED__=0}\
   %{!ffreestanding:%{!fno-hosted:-D__STDC_HOSTED__=1}} %{remap}\
   %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i\
 + %{fshort-wchar:-U__WCHAR_TYPE__ -D__WCHAR_TYPE__=short\\ unsigned\\ int}\
   %{E|M|MM:%W{o*}}";
  
  /* This contains cpp options which are common with cc1_options and are passed


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: preprocessor/8880: __WCHAR_TYPE__ macro incorrectly set to "long int" with -fshort-wchar
@ 2003-01-01 16:24 neil
  0 siblings, 0 replies; 5+ messages in thread
From: neil @ 2003-01-01 16:24 UTC (permalink / raw)
  To: cheinan, gcc-bugs, gcc-prs, neil

Synopsis: __WCHAR_TYPE__ macro incorrectly set to "long int" with -fshort-wchar

State-Changed-From-To: analyzed->closed
State-Changed-By: neil
State-Changed-When: Wed Jan  1 08:24:43 2003
State-Changed-Why:
    No feedback; I'm assuming the patch fixes it and I've checked it in.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8880


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: preprocessor/8880: __WCHAR_TYPE__ macro incorrectly set to "long int" with -fshort-wchar
@ 2002-12-11 13:11 neil
  0 siblings, 0 replies; 5+ messages in thread
From: neil @ 2002-12-11 13:11 UTC (permalink / raw)
  To: cheinan, gcc-bugs, gcc-prs, neil, nobody

Synopsis: __WCHAR_TYPE__ macro incorrectly set to "long int" with -fshort-wchar

Responsible-Changed-From-To: unassigned->neil
Responsible-Changed-By: neil
Responsible-Changed-When: Wed Dec 11 13:11:40 2002
Responsible-Changed-Why:
    Mine.
State-Changed-From-To: open->analyzed
State-Changed-By: neil
State-Changed-When: Wed Dec 11 13:11:40 2002
State-Changed-Why:
    Patch in progress.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8880


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: preprocessor/8880: __WCHAR_TYPE__ macro incorrectly set to "long int" with -fshort-wchar
@ 2002-12-09 16:26 Neil Booth
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Booth @ 2002-12-09 16:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/8880; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.co.uk>
To: cheinan@primus.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/8880: __WCHAR_TYPE__ macro incorrectly set to "long int" with -fshort-wchar
Date: Tue, 10 Dec 2002 00:19:37 +0000

 cheinan@primus.com wrote:-
 
 > The __WCHAR_TYPE__ macro is not set correctly when the -fshort-wchar command line option is specified.  In gcc 3.0.3 the macro would be defined to "unsigned short," but in 3.2.1 it remains set to "long int."  The wchar_t type itself is correct.
 > 
 > The compiler also emits the diagnostic:
 > <command line>:1:1: warning: "__WCHAR_TYPE__" redefined
 > <command line>:1:1: warning: this is the location of the previous definition
 > >How-To-Repeat:
 > liza:~/test> cat empty.cpp
 > int main()
 > {
 >         return 0;
 > }
 
 Would you please confirm this issue does not arise in CVS gcc (pre-3.3)?
 
 Neil.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* preprocessor/8880: __WCHAR_TYPE__ macro incorrectly set to "long int" with -fshort-wchar
@ 2002-12-09 12:26 cheinan
  0 siblings, 0 replies; 5+ messages in thread
From: cheinan @ 2002-12-09 12:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8880
>Category:       preprocessor
>Synopsis:       __WCHAR_TYPE__ macro incorrectly set to "long int" with -fshort-wchar
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 09 12:26:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Cheinan Marks
>Release:        gcc version 3.2.1
>Organization:
>Environment:
Sun Solaris 8 Sparc
liza:~/test> g++ -v
Reading specs from /opt/exp/full/lib/gcc-lib/sparc-sun-solaris2.8/3.2.1/specs
Configured with: ../gcc-3.2.1/configure --prefix=/opt/exp/full --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls --enable-languages=c,c++
Thread model: posix
gcc version 3.2.1
>Description:
The __WCHAR_TYPE__ macro is not set correctly when the -fshort-wchar command line option is specified.  In gcc 3.0.3 the macro would be defined to "unsigned short," but in 3.2.1 it remains set to "long int."  The wchar_t type itself is correct.

The compiler also emits the diagnostic:
<command line>:1:1: warning: "__WCHAR_TYPE__" redefined
<command line>:1:1: warning: this is the location of the previous definition
>How-To-Repeat:
liza:~/test> cat empty.cpp
int main()
{
        return 0;
}
liza:~/test> g++ -E -dM -fshort-wchar empty.cpp
<command line>:1:1: warning: "__WCHAR_TYPE__" redefined
<command line>:1:1: warning: this is the location of the previous definition
#define __EXTENSIONS__ 1
#define __HAVE_BUILTIN_SETJMP__ 1
#define _XOPEN_SOURCE 500
#define __sparc 1
#define sun 1
#define __unix__ 1
#define unix 1
#define __SIZE_TYPE__ unsigned int
#define __GNUC_PATCHLEVEL__ 1
#define sparc 1
#define __unix 1
#define __PRAGMA_REDEFINE_EXTNAME 1
#define __USER_LABEL_PREFIX__ 
#define __STDC_HOSTED__ 1
#define _LARGEFILE64_SOURCE 1
#define __EXCEPTIONS 1
#define __GXX_WEAK__ 1
#define __WCHAR_TYPE__ long int
#define _LARGEFILE_SOURCE 1
#define __WINT_TYPE__ long int
#define __GNUC__ 3
#define __sun__ 1
#define __SVR4 1
#define __GCC_NEW_VARARGS__ 1
#define __cplusplus 1
#define __DEPRECATED 1
#define __svr4__ 1
#define __GNUG__ 3
#define __sparc__ 1
#define __GXX_ABI_VERSION 102
#define __GNUC_MINOR__ 2
#define __PTRDIFF_TYPE__ int
#define __sun 1
#define __REGISTER_PREFIX__ 
#define __NO_INLINE__ 1
#define __VERSION__ "3.2.1"

Alternative illustration:
> cat wcharmacro.cpp
#include <iostream>

int main()
{
        std::cout << "sizeof(__WCHAR_TYPE__) = " << sizeof(__WCHAR_TYPE__) << std::endl;
        std::cout << "sizeof(wchar_t) = " << sizeof(wchar_t) << std::endl;

        return 0;
}

> g++ wcharmacro.cpp -fshort-wchar -owcm -Wl,-R/opt/exp/full/lib
<command line>:1:1: warning: "__WCHAR_TYPE__" redefined
<command line>:1:1: warning: this is the location of the previous definition
> ./wcm
sizeof(__WCHAR_TYPE__) = 4
sizeof(wchar_t) = 2
>Fix:
Workaround:  Add a -D__WCHAR_TYPE__=whatever after the -fshort-wchar on the command line.

Better fix:  Add a macro that defines to a string that tells whether the -fshort-wchar is present.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-01-01 16:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-11 13:16 preprocessor/8880: __WCHAR_TYPE__ macro incorrectly set to "long int" with -fshort-wchar Neil Booth
  -- strict thread matches above, loose matches on Subject: below --
2003-01-01 16:24 neil
2002-12-11 13:11 neil
2002-12-09 16:26 Neil Booth
2002-12-09 12:26 cheinan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).