2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-03-21 10:20:29 +08:00

Index: ChangeLog

2004-01-15  Geoffrey Keating  <geoffk@apple.com>

	PR pch/13361
	* c-typeck.c (constructor_asmspec): Delete.
	(struct initializer_stack): Delete field 'asmspec'.
	(start_init): Delete saving of asmspec.
	(finish_init): Don't update constructor_asmspec.
	* dwarf2out.c (rtl_for_decl_location): Duplicate string from tree.
	* stmt.c (expand_asm): Duplicate strings from tree.
	(expand_asm_operands): Likewise.
	* tree.c (tree_size): Update computation of size of STRING_CST.
	(make_node): Don't make STRING_CST nodes.
	(build_string): Allocate string with tree node.
	* tree.def (STRING_CST): Update comment.
	* tree.h (TREE_STRING_POINTER): Adjust for change to STRING_CST.
	(tree_string): Place contents of string in tree node.
	* config/sh/sh.c (sh_handle_sp_switch_attribute): Duplicate string
	from tree.

Index: cp/ChangeLog
2004-01-15  Geoffrey Keating  <geoffk@apple.com>

	PR pch/13361
	* cp/lex.c (handle_pragma_interface): Duplicate string from tree.
	(handle_pragma_implementation): Likewise.

Index: testsuite/ChangeLog
2004-01-15  Geoffrey Keating  <geoffk@apple.com>

	PR pch/13361
	* testsuite/g++.dg/pch/wchar-1.C: New.
	* testsuite/g++.dg/pch/wchar-1.Hs: New.

From-SVN: r75961
This commit is contained in:
Geoffrey Keating 2004-01-16 07:20:38 +00:00 committed by Geoffrey Keating
parent b0fadda7ec
commit a6dd409400
13 changed files with 74 additions and 35 deletions

@ -1,5 +1,22 @@
2004-01-15 Geoffrey Keating <geoffk@apple.com>
PR pch/13361
* c-typeck.c (constructor_asmspec): Delete.
(struct initializer_stack): Delete field 'asmspec'.
(start_init): Delete saving of asmspec.
(finish_init): Don't update constructor_asmspec.
* dwarf2out.c (rtl_for_decl_location): Duplicate string from tree.
* stmt.c (expand_asm): Duplicate strings from tree.
(expand_asm_operands): Likewise.
* tree.c (tree_size): Update computation of size of STRING_CST.
(make_node): Don't make STRING_CST nodes.
(build_string): Allocate string with tree node.
* tree.def (STRING_CST): Update comment.
* tree.h (TREE_STRING_POINTER): Adjust for change to STRING_CST.
(tree_string): Place contents of string in tree node.
* config/sh/sh.c (sh_handle_sp_switch_attribute): Duplicate string
from tree.
* config/rs6000/rs6000.c (rs6000_va_arg): No need to special-case
altivec operands.

@ -4304,9 +4304,6 @@ static int require_constant_elements;
such as (struct foo) {...}. */
static tree constructor_decl;
/* start_init saves the ASMSPEC arg here for really_start_incremental_init. */
static const char *constructor_asmspec;
/* Nonzero if this is an initializer for a top-level decl. */
static int constructor_top_level;
@ -4378,7 +4375,6 @@ struct initializer_stack
{
struct initializer_stack *next;
tree decl;
const char *asmspec;
struct constructor_stack *constructor_stack;
struct constructor_range_stack *constructor_range_stack;
tree elements;
@ -4395,17 +4391,12 @@ struct initializer_stack *initializer_stack;
/* Prepare to parse and output the initializer for variable DECL. */
void
start_init (tree decl, tree asmspec_tree, int top_level)
start_init (tree decl, tree asmspec_tree ATTRIBUTE_UNUSED, int top_level)
{
const char *locus;
struct initializer_stack *p = xmalloc (sizeof (struct initializer_stack));
const char *asmspec = 0;
if (asmspec_tree)
asmspec = TREE_STRING_POINTER (asmspec_tree);
p->decl = constructor_decl;
p->asmspec = constructor_asmspec;
p->require_constant_value = require_constant_value;
p->require_constant_elements = require_constant_elements;
p->constructor_stack = constructor_stack;
@ -4419,7 +4410,6 @@ start_init (tree decl, tree asmspec_tree, int top_level)
initializer_stack = p;
constructor_decl = decl;
constructor_asmspec = asmspec;
constructor_designated = 0;
constructor_top_level = top_level;
@ -4476,7 +4466,6 @@ finish_init (void)
free (spelling_base);
constructor_decl = p->decl;
constructor_asmspec = p->asmspec;
require_constant_value = p->require_constant_value;
require_constant_elements = p->require_constant_elements;
constructor_stack = p->constructor_stack;

@ -6774,8 +6774,8 @@ sh_handle_sp_switch_attribute (tree *node, tree name, tree args,
}
else
{
sp_switch = gen_rtx_SYMBOL_REF (VOIDmode,
TREE_STRING_POINTER (TREE_VALUE (args)));
char *s = ggc_strdup (TREE_STRING_POINTER (TREE_VALUE (args)));
sp_switch = gen_rtx_SYMBOL_REF (VOIDmode, s);
}
return NULL_TREE;

@ -1,3 +1,9 @@
2004-01-15 Geoffrey Keating <geoffk@apple.com>
PR pch/13361
* cp/lex.c (handle_pragma_interface): Duplicate string from tree.
(handle_pragma_implementation): Likewise.
2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/9259

@ -1,6 +1,6 @@
/* Separate lexical analyzer for GNU C++.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
@ -535,7 +535,7 @@ handle_pragma_interface (cpp_reader* dfile ATTRIBUTE_UNUSED )
else if (fname == 0)
main_filename = lbasename (input_filename);
else
main_filename = TREE_STRING_POINTER (fname);
main_filename = ggc_strdup (TREE_STRING_POINTER (fname));
finfo = get_fileinfo (input_filename);
@ -585,7 +585,7 @@ handle_pragma_implementation (cpp_reader* dfile ATTRIBUTE_UNUSED )
}
else
{
main_filename = TREE_STRING_POINTER (fname);
main_filename = ggc_strdup (TREE_STRING_POINTER (fname));
if (cpp_included (parse_in, main_filename))
warning ("#pragma implementation for %s appears after file is included",
main_filename);

@ -9398,7 +9398,8 @@ rtl_for_decl_location (tree decl)
TREE_STRING_LENGTH (init) - 1) == 0
&& ((size_t) TREE_STRING_LENGTH (init)
== strlen (TREE_STRING_POINTER (init)) + 1))
rtl = gen_rtx_CONST_STRING (VOIDmode, TREE_STRING_POINTER (init));
rtl = gen_rtx_CONST_STRING (VOIDmode,
ggc_strdup (TREE_STRING_POINTER (init)));
}
/* If the initializer is something that we know will expand into an
immediate RTL constant, expand it now. Expanding anything else

@ -1,6 +1,6 @@
/* Expands front end tree to back end RTL for GCC
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@ -1106,7 +1106,8 @@ expand_asm (tree string, int vol)
if (TREE_CODE (string) == ADDR_EXPR)
string = TREE_OPERAND (string, 0);
body = gen_rtx_ASM_INPUT (VOIDmode, TREE_STRING_POINTER (string));
body = gen_rtx_ASM_INPUT (VOIDmode,
ggc_strdup (TREE_STRING_POINTER (string)));
MEM_VOLATILE_P (body) = vol;
@ -1668,7 +1669,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
body = gen_rtx_ASM_OPERANDS ((noutputs == 0 ? VOIDmode
: GET_MODE (output_rtx[0])),
TREE_STRING_POINTER (string),
ggc_strdup (TREE_STRING_POINTER (string)),
empty_string, 0, argvec, constraintvec,
locus.file, locus.line);
@ -1749,7 +1750,8 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
ASM_OPERANDS_INPUT (body, i) = op;
ASM_OPERANDS_INPUT_CONSTRAINT_EXP (body, i)
= gen_rtx_ASM_INPUT (TYPE_MODE (type), constraints[i + noutputs]);
= gen_rtx_ASM_INPUT (TYPE_MODE (type),
ggc_strdup (constraints[i + noutputs]));
if (decl_conflicts_with_clobbers_p (val, clobbered_regs))
clobber_conflict_found = 1;
@ -1790,7 +1792,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
if (noutputs == 1 && nclobbers == 0)
{
ASM_OPERANDS_OUTPUT_CONSTRAINT (body) = constraints[0];
ASM_OPERANDS_OUTPUT_CONSTRAINT (body) = ggc_strdup (constraints[0]);
emit_insn (gen_rtx_SET (VOIDmode, output_rtx[0], body));
}
@ -1818,8 +1820,9 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
output_rtx[i],
gen_rtx_ASM_OPERANDS
(GET_MODE (output_rtx[i]),
TREE_STRING_POINTER (string),
constraints[i], i, argvec, constraintvec,
ggc_strdup (TREE_STRING_POINTER (string)),
ggc_strdup (constraints[i]),
i, argvec, constraintvec,
locus.file, locus.line));
MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i))) = vol;

@ -1,3 +1,9 @@
2004-01-15 Geoffrey Keating <geoffk@apple.com>
PR pch/13361
* testsuite/g++.dg/pch/wchar-1.C: New.
* testsuite/g++.dg/pch/wchar-1.Hs: New.
2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/9259

@ -0,0 +1 @@
#include "wchar-1.H"

@ -0,0 +1,2 @@
#include <stddef.h>
const wchar_t test_var[] = L"wide string";

@ -1,6 +1,6 @@
/* Language-independent node constructors for parse phase of GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@ -168,7 +168,8 @@ tree_size (tree node)
case REAL_CST: return sizeof (struct tree_real_cst);
case COMPLEX_CST: return sizeof (struct tree_complex);
case VECTOR_CST: return sizeof (struct tree_vector);
case STRING_CST: return sizeof (struct tree_string);
case STRING_CST:
return sizeof (struct tree_string) + TREE_STRING_LENGTH (node);
default:
return (*lang_hooks.tree_size) (code);
}
@ -212,8 +213,8 @@ make_node (enum tree_code code)
struct tree_common ttmp;
/* We can't allocate a TREE_VEC without knowing how many elements
it will have. */
if (code == TREE_VEC)
it will have; likewise a STRING_CST without knowing the length. */
if (code == TREE_VEC || code == STRING_CST)
abort ();
TREE_SET_CODE ((tree)&ttmp, code);
@ -525,10 +526,23 @@ build_real_from_int_cst (tree type, tree i)
tree
build_string (int len, const char *str)
{
tree s = make_node (STRING_CST);
tree s;
size_t length;
length = len + sizeof (struct tree_string);
#ifdef GATHER_STATISTICS
tree_node_counts[(int) c_kind]++;
tree_node_sizes[(int) c_kind] += length;
#endif
s = ggc_alloc_tree (length);
memset (s, 0, sizeof (struct tree_common));
TREE_SET_CODE (s, STRING_CST);
TREE_STRING_LENGTH (s) = len;
TREE_STRING_POINTER (s) = ggc_alloc_string (str, len);
memcpy ((char *) TREE_STRING_POINTER (s), str, len);
((char *) TREE_STRING_POINTER (s))[len] = '\0';
return s;
}

@ -1,6 +1,6 @@
/* This file contains the definitions and documentation for the
tree codes used in GCC.
Copyright (C) 1987, 1988, 1993, 1995, 1997, 1998, 2000, 2001
Copyright (C) 1987, 1988, 1993, 1995, 1997, 1998, 2000, 2001, 2004
Free Software Foundation, Inc.
This file is part of GCC.
@ -274,7 +274,7 @@ DEFTREECODE (COMPLEX_CST, "complex_cst", 'c', 0)
/* Contents are in TREE_VECTOR_CST_ELTS field. */
DEFTREECODE (VECTOR_CST, "vector_cst", 'c', 0)
/* Contents are TREE_STRING_LENGTH and TREE_STRING_POINTER fields. */
/* Contents are TREE_STRING_LENGTH and the actual contents of the string. */
DEFTREECODE (STRING_CST, "string_cst", 'c', 0)
/* Declarations. All references to names are represented as ..._DECL

@ -700,13 +700,13 @@ struct tree_real_cst GTY(())
/* In a STRING_CST */
#define TREE_STRING_LENGTH(NODE) (STRING_CST_CHECK (NODE)->string.length)
#define TREE_STRING_POINTER(NODE) (STRING_CST_CHECK (NODE)->string.pointer)
#define TREE_STRING_POINTER(NODE) (STRING_CST_CHECK (NODE)->string.str)
struct tree_string GTY(())
{
struct tree_common common;
int length;
const char *pointer;
const char str[1];
};
/* In a COMPLEX_CST node. */