Commit 5096c664 by Jason Merrill Committed by Jason Merrill

lex.c: Get WCHAR_TYPE_SIZE from wchar_type_node.

	* lex.c: Get WCHAR_TYPE_SIZE from wchar_type_node.
	* lang-specs.h: If -fshort-wchar, override __WCHAR_TYPE__.
	* decl2.c (lang_f_options): Add -fshort-wchar.
	* cp-tree.h: Declare flag_short_wchar.
	* decl.c (init_decl_processing): If -fshort-wchar, use 'short unsigned
	int' for wchar_t.

From-SVN: r29639
parent 12a39b12
1999-09-23 Jason Merrill <jason@yorick.cygnus.com>
* lex.c: Get WCHAR_TYPE_SIZE from wchar_type_node.
* lang-specs.h: If -fshort-wchar, override __WCHAR_TYPE__.
* decl2.c (lang_f_options): Add -fshort-wchar.
* cp-tree.h: Declare flag_short_wchar.
* decl.c (init_decl_processing): If -fshort-wchar, use 'short unsigned
int' for wchar_t.
1999-09-23 Martin v. Lwis <loewis@informatik.hu-berlin.de> 1999-09-23 Martin v. Lwis <loewis@informatik.hu-berlin.de>
* ir.texi: Fix formatting errors and typos. * ir.texi: Fix formatting errors and typos.
......
...@@ -930,6 +930,10 @@ extern int name_mangling_version; ...@@ -930,6 +930,10 @@ extern int name_mangling_version;
/* Nonzero means that guiding declarations are allowed. */ /* Nonzero means that guiding declarations are allowed. */
extern int flag_guiding_decls; extern int flag_guiding_decls;
/* Nonzero if wchar_t should be `unsigned short' instead of whatever it
would normally be, for use with WINE. */
extern int flag_short_wchar;
/* Nonzero if squashed mangling is to be performed. /* Nonzero if squashed mangling is to be performed.
This uses the B and K codes to reference previously seen class types This uses the B and K codes to reference previously seen class types
and class qualifiers. */ and class qualifiers. */
......
...@@ -6247,8 +6247,10 @@ init_decl_processing () ...@@ -6247,8 +6247,10 @@ init_decl_processing ()
TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node; TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node;
/* This is special for C++ so functions can be overloaded. */ /* This is special for C++ so functions can be overloaded. */
wchar_type_node wchar_type_node = get_identifier (flag_short_wchar
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WCHAR_TYPE))); ? "short unsigned int"
: WCHAR_TYPE);
wchar_type_node = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (wchar_type_node));
wchar_type_size = TYPE_PRECISION (wchar_type_node); wchar_type_size = TYPE_PRECISION (wchar_type_node);
signed_wchar_type_node = make_signed_type (wchar_type_size); signed_wchar_type_node = make_signed_type (wchar_type_size);
unsigned_wchar_type_node = make_unsigned_type (wchar_type_size); unsigned_wchar_type_node = make_unsigned_type (wchar_type_size);
......
...@@ -456,6 +456,10 @@ int name_mangling_version = 2; ...@@ -456,6 +456,10 @@ int name_mangling_version = 2;
/* Nonzero means that guiding declarations are allowed. */ /* Nonzero means that guiding declarations are allowed. */
int flag_guiding_decls; int flag_guiding_decls;
/* Nonzero if wchar_t should be `unsigned short' instead of whatever it
would normally be, for use with WINE. */
int flag_short_wchar;
/* Nonzero if squashed mangling is to be performed. /* Nonzero if squashed mangling is to be performed.
This uses the B and K codes to reference previously seen class types This uses the B and K codes to reference previously seen class types
and class qualifiers. */ and class qualifiers. */
...@@ -491,6 +495,7 @@ lang_f_options[] = ...@@ -491,6 +495,7 @@ lang_f_options[] =
{"unsigned-bitfields", &flag_signed_bitfields, 0}, {"unsigned-bitfields", &flag_signed_bitfields, 0},
{"short-enums", &flag_short_enums, 1}, {"short-enums", &flag_short_enums, 1},
{"short-double", &flag_short_double, 1}, {"short-double", &flag_short_double, 1},
{"short-wchar", &flag_short_wchar, 1},
{"cond-mismatch", &flag_cond_mismatch, 1}, {"cond-mismatch", &flag_cond_mismatch, 1},
{"asm", &flag_no_asm, 0}, {"asm", &flag_no_asm, 0},
{"builtin", &flag_no_builtin, 0}, {"builtin", &flag_no_builtin, 0},
......
...@@ -39,6 +39,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -39,6 +39,7 @@ Boston, MA 02111-1307, USA. */
%{!fno-exceptions:-D__EXCEPTIONS}\ %{!fno-exceptions:-D__EXCEPTIONS}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
%{ffast-math:-D__FAST_MATH__}\ %{ffast-math:-D__FAST_MATH__}\
%{fshort-wchar:-D__WCHAR_TYPE__=short\\ unsigned\\ int}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}\ %i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}\
%{!E:%{!M:%{!MM:cc1plus %i %1 %2\ %{!E:%{!M:%{!MM:cc1plus %i %1 %2\
...@@ -50,6 +51,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -50,6 +51,7 @@ Boston, MA 02111-1307, USA. */
%{!fno-exceptions:-D__EXCEPTIONS}\ %{!fno-exceptions:-D__EXCEPTIONS}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
%{ffast-math:-D__FAST_MATH__}\ %{ffast-math:-D__FAST_MATH__}\
%{fshort-wchar:-D__WCHAR_TYPE__=short\\ unsigned\\ int}\
%{trigraphs}\ %{trigraphs}\
%{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\ %{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\
%{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\ %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\
...@@ -71,6 +73,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -71,6 +73,7 @@ Boston, MA 02111-1307, USA. */
%{!fno-exceptions:-D__EXCEPTIONS}\ %{!fno-exceptions:-D__EXCEPTIONS}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
%{ffast-math:-D__FAST_MATH__}\ %{ffast-math:-D__FAST_MATH__}\
%{fshort-wchar:-D__WCHAR_TYPE__=short\\ unsigned\\ int}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.ii}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", %i %{!M:%{!MM:%{!E:%{!pipe:%g.ii}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
"%{!M:%{!MM:%{!E:cc1plus %{!pipe:%g.ii} %1 %2\ "%{!M:%{!MM:%{!E:cc1plus %{!pipe:%g.ii} %1 %2\
......
...@@ -348,13 +348,8 @@ int interface_unknown; /* whether or not we know this class ...@@ -348,13 +348,8 @@ int interface_unknown; /* whether or not we know this class
/* lexical analyzer */ /* lexical analyzer */
#ifndef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#ifdef INT_TYPE_SIZE #define WCHAR_TYPE_SIZE TYPE_PRECISION (wchar_type_node)
#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
#else
#define WCHAR_TYPE_SIZE BITS_PER_WORD
#endif
#endif
/* Number of bytes in a wide character. */ /* Number of bytes in a wide character. */
#define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT) #define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment