This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: PATCH: PR target/53539: Different __WCHAR_TYPE__/wchar_t for gcc -m32 on Linux/i386 and Linux/x86-64


On Thu, May 31, 2012 at 6:50 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, May 31, 2012 at 06:35:19AM -0700, H.J. Lu wrote:
>> This patch makes __WCHAR_TYPE__/wchar_t the same for gcc -m32 on
>> Linux/i386 and Linux/x86-64. ?OK for trunk?
>
> That looks wrong. ?For Linux/i386, the 32-bit only compiler should be
> the standard, rather than x86_64 -m32 if they differ.
> So, IMHO you should keep gnu-user.h as is, and just use
> #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
> in gcc/config/i386/x86-64.h.
>

You are right on Linux/i386.  But we should change config/i386/gnu-user64.h,
not x86-64.h since most of other i386 OSes use int for wchar.  Also we should
check TARGET_LP64 to keep x32 as close to i386 as possible.  OK for
trunk and 4.7?

Thanks.


-- 
H.J.
----
2012-05-31  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/53539
	* config/i386/gnu-user64.h (WCHAR_TYPE): Use "int" only for
	TARGET_LP64.

diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
index 0e66d26..2941332 100644
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -91,3 +91,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If n
ot, see
 #define TARGET_THREAD_SPLIT_STACK_OFFSET \
   (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
 #endif
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int")


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