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]

PATCH: Change wchar_t size on ARM Symbian OS


It turns out that our Symbian OS specification was incorrect; wchar_t
should be a 2-byte type by default, not a 4-byte type.  I also added a
test that -fno-short-wchar works correctly on Symbian OS.

I also cleaned up the Symbian OS specs so that we avoid passing
duplicate command-line options to the compiler.  Paul pointed out that
this was confusing and error-prone.  Eventually, this stuff will
proabably move out of specs, but exactly how is still being discussed.

Tested by runnning a subset of the tests on arm-none-symbian-elf.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2004-08-06  Mark Mitchell  <mark@codesourcery.com>

	* config/arm/symbian.h (CC1_SPEC): Avoid passing duplicate options
	to the compiler.  Use -fshort-wchar by default.

2004-08-06  Mark Mitchell  <mark@codesourcery.com>

	* gcc.dg/symbian4.c: Expect a 2-byte wchar_t, not a 4-byte
	wchar_t.
	* gcc.dg/symbian5.c: Test -fno-short-wchar.

Index: config/arm/symbian.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/symbian.h,v
retrieving revision 1.3
diff -c -5 -p -r1.3 symbian.h
*** config/arm/symbian.h	6 Aug 2004 07:54:19 -0000	1.3
--- config/arm/symbian.h	6 Aug 2004 17:47:59 -0000
***************
*** 32,43 ****
     and (b) that would prevent users from explicitly overriding the
     default with -fbuiltin, which may sometimes be useful.
  
     Make all symbols hidden by default.  Symbian OS expects that all
     exported symbols will be explicitly marked with
!    "__declspec(dllexport)".  */
! #define CC1_SPEC "-fno-builtin -fvisibility=hidden -fno-short-enums"
  #define CC1PLUS_SPEC CC1_SPEC
  
  /* Symbian OS does not use crt0.o, unlike the generic unknown-elf
     configuration.  */
  #undef STARTFILE_SPEC
--- 32,53 ----
     and (b) that would prevent users from explicitly overriding the
     default with -fbuiltin, which may sometimes be useful.
  
     Make all symbols hidden by default.  Symbian OS expects that all
     exported symbols will be explicitly marked with
!    "__declspec(dllexport)".  
! 
!    Enumeration types use 4 bytes, even if the enumerals are small,
!    unless explicitly overridden.
! 
!    The wchar_t type is a 2-byte type, unless explicitly
!    overridden.  */
! #define CC1_SPEC						\
!   "%{!fbuiltin:%{!fno-builtin:-fno-builtin}} "			\
!   "%{!fvisibility=*:-fvisibility=hidden} "			\
!   "%{!fshort-enums:%{!fno-short-enums:-fno-short-enums}} "	\
!   "%{!fshort-wchar:%{!fno-short-wchar:-fshort-wchar}} "
  #define CC1PLUS_SPEC CC1_SPEC
  
  /* Symbian OS does not use crt0.o, unlike the generic unknown-elf
     configuration.  */
  #undef STARTFILE_SPEC
Index: testsuite/gcc.dg/symbian4.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/symbian4.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 symbian4.c
*** testsuite/gcc.dg/symbian4.c	6 Aug 2004 07:54:18 -0000	1.1
--- testsuite/gcc.dg/symbian4.c	6 Aug 2004 17:48:02 -0000
***************
*** 1,5 ****
  /* { dg-do compile { target arm*-*-symbianelf* } } */
! /* Check that wchar_t is a 4-byte type.  */
  
  extern int i[sizeof (L'a')];
! int i[4];
--- 1,5 ----
  /* { dg-do compile { target arm*-*-symbianelf* } } */
! /* Check that wchar_t is a 2-byte type.  */
  
  extern int i[sizeof (L'a')];
! int i[2];
Index: testsuite/gcc.dg/symbian5.c
===================================================================
RCS file: testsuite/gcc.dg/symbian5.c
diff -N testsuite/gcc.dg/symbian5.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/symbian5.c	6 Aug 2004 17:48:02 -0000
***************
*** 0 ****
--- 1,8 ----
+ /* { dg-do compile { target arm*-*-symbianelf* } } */
+ /* { dg-options "-fno-short-wchar" } */
+ /* Check that wchar_t is a 4-byte type when -fno-short-wchar is
+    used.  */
+ 
+ extern int i[sizeof (L'a')];
+ int i[4];
+ 


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