public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/40376]  New: GCC defines UNICODE instead of _UNICODE for -municode
@ 2009-06-08  4:27 nightstrike at gmail dot com
  2009-06-08  7:51 ` [Bug preprocessor/40376] " ktietz at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: nightstrike at gmail dot com @ 2009-06-08  4:27 UTC (permalink / raw)
  To: gcc-bugs

The new option -municode incorrectly defines UNICODE.  Instead, it should
define _UNICODE.  Jon_Y provided the following suggestion for a fix:

Index: gcc/config/i386/mingw-w64.h
===================================================================
--- gcc/config/i386/mingw-w64.h (revision 148266)
+++ gcc/config/i386/mingw-w64.h (working copy)
@@ -24,7 +24,7 @@

 #undef CPP_SPEC
 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} \
-  %{municode:-DUNICODE}"
+  %{municode:-D_UNICODE}"

 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \


-- 
           Summary: GCC defines UNICODE instead of _UNICODE for -municode
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nightstrike at gmail dot com
GCC target triplet: *-w64-mingw*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40376


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

* [Bug preprocessor/40376] GCC defines UNICODE instead of _UNICODE for -municode
  2009-06-08  4:27 [Bug preprocessor/40376] New: GCC defines UNICODE instead of _UNICODE for -municode nightstrike at gmail dot com
@ 2009-06-08  7:51 ` ktietz at gcc dot gnu dot org
  2009-06-08  8:31 ` ktietz at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-06-08  7:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ktietz at gcc dot gnu dot org  2009-06-08 07:51 -------
Hi,

to define UNICODE is absolutely correct. The define _UNICODE is fiction (but I
agree it is in use). We can discuss about to define _UNICODE, too. But the
UNICODE defines is for the w64 runtime the proper thing to define here.

Cheers,
Kai


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40376


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

* [Bug preprocessor/40376] GCC defines UNICODE instead of _UNICODE for -municode
  2009-06-08  4:27 [Bug preprocessor/40376] New: GCC defines UNICODE instead of _UNICODE for -municode nightstrike at gmail dot com
  2009-06-08  7:51 ` [Bug preprocessor/40376] " ktietz at gcc dot gnu dot org
@ 2009-06-08  8:31 ` ktietz at gcc dot gnu dot org
  2009-06-08  9:09 ` ktietz at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-06-08  8:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ktietz at gcc dot gnu dot org  2009-06-08 08:31 -------
Ok, it is no fiction, but a issue for tchar.h in CRT headers. See
http://blogs.msdn.com/oldnewthing/archive/2004/02/12/71851.aspx

so, we define UNICODE for PSDK, but _UNICODE is user defined AFAIU. But
possibly we could add the _UNICODE define for CRT's sake, too.

Kai


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40376


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

* [Bug preprocessor/40376] GCC defines UNICODE instead of _UNICODE for -municode
  2009-06-08  4:27 [Bug preprocessor/40376] New: GCC defines UNICODE instead of _UNICODE for -municode nightstrike at gmail dot com
  2009-06-08  7:51 ` [Bug preprocessor/40376] " ktietz at gcc dot gnu dot org
  2009-06-08  8:31 ` ktietz at gcc dot gnu dot org
@ 2009-06-08  9:09 ` ktietz at gcc dot gnu dot org
  2009-06-08  9:40 ` joseph at codesourcery dot com
  2009-06-09  6:52 ` ktietz at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-06-08  9:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ktietz at gcc dot gnu dot org  2009-06-08 09:09 -------
As further research has shown, is the definition of _UNICODE a thing the user
has to take care. The _UNICODE define is used in tchar.h and documentation for
this can be found on msdn.


-- 

ktietz at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40376


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

* [Bug preprocessor/40376] GCC defines UNICODE instead of _UNICODE for -municode
  2009-06-08  4:27 [Bug preprocessor/40376] New: GCC defines UNICODE instead of _UNICODE for -municode nightstrike at gmail dot com
                   ` (2 preceding siblings ...)
  2009-06-08  9:09 ` ktietz at gcc dot gnu dot org
@ 2009-06-08  9:40 ` joseph at codesourcery dot com
  2009-06-09  6:52 ` ktietz at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: joseph at codesourcery dot com @ 2009-06-08  9:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from joseph at codesourcery dot com  2009-06-08 09:40 -------
Subject: Re:  GCC defines UNICODE instead of _UNICODE
 for -municode

On Mon, 8 Jun 2009, ktietz at gcc dot gnu dot org wrote:

> to define UNICODE is absolutely correct. The define _UNICODE is fiction (but I

UNICODE is in the user's namespace; it should not be predefined if 
flag_iso (if you have to use specs rather than hooks, you need 
%{!ansi:%{!std=i*:%{!std=c*:-DUNICODE}}} to detect the various conformance 
options).  We should not add to the instances of bug 545 that are still 
present.  If the MinGW headers use a macro in the user's namespace as a 
feature test macro of some sort, they are buggy and should be fixed (with 
fixincludes if necessary for existing installations).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40376


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

* [Bug preprocessor/40376] GCC defines UNICODE instead of _UNICODE for -municode
  2009-06-08  4:27 [Bug preprocessor/40376] New: GCC defines UNICODE instead of _UNICODE for -municode nightstrike at gmail dot com
                   ` (3 preceding siblings ...)
  2009-06-08  9:40 ` joseph at codesourcery dot com
@ 2009-06-09  6:52 ` ktietz at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-06-09  6:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from ktietz at gcc dot gnu dot org  2009-06-09 06:52 -------
(In reply to comment #4)
> Subject: Re:  GCC defines UNICODE instead of _UNICODE
>  for -municode
> 
> UNICODE is in the user's namespace; it should not be predefined if 
> flag_iso (if you have to use specs rather than hooks, you need 
> %{!ansi:%{!std=i*:%{!std=c*:-DUNICODE}}} to detect the various conformance 
> options).  We should not add to the instances of bug 545 that are still 
> present.  If the MinGW headers use a macro in the user's namespace as a 
> feature test macro of some sort, they are buggy and should be fixed (with 
> fixincludes if necessary for existing installations).
> 

It is right that _UNICODE and UNICODE are in user name space defined and are
controlling which API (wide/or ascii) has to be used.
UNICODE is used in windows headers itself (see msdn for documentation).
_UNICODE is used in CRT (and inspecial in tchar.h header) only. (This is also
documented in msdn).
I agree, that these two different macro names are a bit annoying, but for sure
they are platform specific stuff and are for sure absolutely unrelated to ISO.
Therefore to introduce a relationship to ISO defines is contradictive and
wrong. Those macros are controling behaviour of runtime. By the windows
specific switch -municode the windows runtime is controlled.

Cheers,
Kai


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40376


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

end of thread, other threads:[~2009-06-09  6:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-08  4:27 [Bug preprocessor/40376] New: GCC defines UNICODE instead of _UNICODE for -municode nightstrike at gmail dot com
2009-06-08  7:51 ` [Bug preprocessor/40376] " ktietz at gcc dot gnu dot org
2009-06-08  8:31 ` ktietz at gcc dot gnu dot org
2009-06-08  9:09 ` ktietz at gcc dot gnu dot org
2009-06-08  9:40 ` joseph at codesourcery dot com
2009-06-09  6:52 ` ktietz at gcc dot gnu dot org

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).