1998-09-06 17:36:06 +02:00
|
|
|
/* Handle exceptions for GNU compiler for the Java(TM) language.
|
java-gimplify.c: Change copyright header to refer to version 3 of the GNU General Public...
* java-gimplify.c: Change copyright header to refer to version 3 of the GNU
General Public License and to point readers at the COPYING3 file and the
FSF's license web page.
* typeck.c, lang-specs.h, mangle_name.c, jcf-dump.c, class.c, decl.c,
config-lang.in, jcf-parse.c, constants.c, Make-lang.in, resource.c, except.c,
builtins.c, jvspec.c, java-tree.def, javaop.def, jcf-path.c, verify-glue.c,
jcf-depend.c, lang.opt, jcf-reader.c, mangle.c, zextract.c, jcf-io.c, jcf.h,
zipfile.h, verify.h, java-except.h, win32-host.c, expr.c, jvgenmain.c,
parse.h, lang.c, java-tree.h, javaop.h, boehm.c: Likewise.
From-SVN: r127098
2007-07-31 18:19:49 +02:00
|
|
|
Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005,
|
2009-09-14 21:18:58 +02:00
|
|
|
2007, 2008, 2009 Free Software Foundation, Inc.
|
1998-09-06 17:36:06 +02:00
|
|
|
|
Make-lang.in, [...]: Replace "GNU CC" with "GCC" in the copyright header.
* Make-lang.in, boehm.c, buffer.c,
buffer.h, builtins.c, class.c,
config-lang.in, constants.c,
convert.h, decl.c, except.c,
expr.c, java-except.h,
java-tree.h, javaop.def,
jcf-parse.c, jcf-write.c,
jv-scan.c, jvgenmain.c,
jvspec.c, keyword.gperf,
keyword.h, lang-options.h,
lang-specs.h, lang.c, lex.c,
lex.h, mangle.c, mangle_name.c,
parse-scan.y, parse.h, parse.y,
typeck.c, verify.c, xref.c,
xref.h: Replace "GNU CC" with
"GCC" in the copyright header.
* check-init.c, gjavah.c, javaop.h,
jcf-depend.c, jcf-dump.c, jcf-io.c,
jcf-path.c, jcf-reader.c, jcf.h,
zextract.c, zipfile.h: These files are
"part of GCC". Also say "GCC" not "GNU CC".
From-SVN: r60747
2003-01-01 16:10:03 +01:00
|
|
|
This file is part of GCC.
|
1998-09-06 17:36:06 +02:00
|
|
|
|
Make-lang.in, [...]: Replace "GNU CC" with "GCC" in the copyright header.
* Make-lang.in, boehm.c, buffer.c,
buffer.h, builtins.c, class.c,
config-lang.in, constants.c,
convert.h, decl.c, except.c,
expr.c, java-except.h,
java-tree.h, javaop.def,
jcf-parse.c, jcf-write.c,
jv-scan.c, jvgenmain.c,
jvspec.c, keyword.gperf,
keyword.h, lang-options.h,
lang-specs.h, lang.c, lex.c,
lex.h, mangle.c, mangle_name.c,
parse-scan.y, parse.h, parse.y,
typeck.c, verify.c, xref.c,
xref.h: Replace "GNU CC" with
"GCC" in the copyright header.
* check-init.c, gjavah.c, javaop.h,
jcf-depend.c, jcf-dump.c, jcf-io.c,
jcf-path.c, jcf-reader.c, jcf.h,
zextract.c, zipfile.h: These files are
"part of GCC". Also say "GCC" not "GNU CC".
From-SVN: r60747
2003-01-01 16:10:03 +01:00
|
|
|
GCC is free software; you can redistribute it and/or modify
|
1998-09-06 17:36:06 +02:00
|
|
|
it under the terms of the GNU General Public License as published by
|
java-gimplify.c: Change copyright header to refer to version 3 of the GNU General Public...
* java-gimplify.c: Change copyright header to refer to version 3 of the GNU
General Public License and to point readers at the COPYING3 file and the
FSF's license web page.
* typeck.c, lang-specs.h, mangle_name.c, jcf-dump.c, class.c, decl.c,
config-lang.in, jcf-parse.c, constants.c, Make-lang.in, resource.c, except.c,
builtins.c, jvspec.c, java-tree.def, javaop.def, jcf-path.c, verify-glue.c,
jcf-depend.c, lang.opt, jcf-reader.c, mangle.c, zextract.c, jcf-io.c, jcf.h,
zipfile.h, verify.h, java-except.h, win32-host.c, expr.c, jvgenmain.c,
parse.h, lang.c, java-tree.h, javaop.h, boehm.c: Likewise.
From-SVN: r127098
2007-07-31 18:19:49 +02:00
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
1998-09-06 17:36:06 +02:00
|
|
|
any later version.
|
|
|
|
|
Make-lang.in, [...]: Replace "GNU CC" with "GCC" in the copyright header.
* Make-lang.in, boehm.c, buffer.c,
buffer.h, builtins.c, class.c,
config-lang.in, constants.c,
convert.h, decl.c, except.c,
expr.c, java-except.h,
java-tree.h, javaop.def,
jcf-parse.c, jcf-write.c,
jv-scan.c, jvgenmain.c,
jvspec.c, keyword.gperf,
keyword.h, lang-options.h,
lang-specs.h, lang.c, lex.c,
lex.h, mangle.c, mangle_name.c,
parse-scan.y, parse.h, parse.y,
typeck.c, verify.c, xref.c,
xref.h: Replace "GNU CC" with
"GCC" in the copyright header.
* check-init.c, gjavah.c, javaop.h,
jcf-depend.c, jcf-dump.c, jcf-io.c,
jcf-path.c, jcf-reader.c, jcf.h,
zextract.c, zipfile.h: These files are
"part of GCC". Also say "GCC" not "GNU CC".
From-SVN: r60747
2003-01-01 16:10:03 +01:00
|
|
|
GCC is distributed in the hope that it will be useful,
|
1998-09-06 17:36:06 +02:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
java-gimplify.c: Change copyright header to refer to version 3 of the GNU General Public...
* java-gimplify.c: Change copyright header to refer to version 3 of the GNU
General Public License and to point readers at the COPYING3 file and the
FSF's license web page.
* typeck.c, lang-specs.h, mangle_name.c, jcf-dump.c, class.c, decl.c,
config-lang.in, jcf-parse.c, constants.c, Make-lang.in, resource.c, except.c,
builtins.c, jvspec.c, java-tree.def, javaop.def, jcf-path.c, verify-glue.c,
jcf-depend.c, lang.opt, jcf-reader.c, mangle.c, zextract.c, jcf-io.c, jcf.h,
zipfile.h, verify.h, java-except.h, win32-host.c, expr.c, jvgenmain.c,
parse.h, lang.c, java-tree.h, javaop.h, boehm.c: Likewise.
From-SVN: r127098
2007-07-31 18:19:49 +02:00
|
|
|
along with GCC; see the file COPYING3. If not see
|
|
|
|
<http://www.gnu.org/licenses/>.
|
1998-09-06 17:36:06 +02:00
|
|
|
|
|
|
|
Java and all Java-based marks are trademarks or registered trademarks
|
|
|
|
of Sun Microsystems, Inc. in the United States and other countries.
|
|
|
|
The Free Software Foundation is independent of Sun Microsystems, Inc. */
|
|
|
|
|
|
|
|
#include "config.h"
|
1998-09-14 11:42:24 +02:00
|
|
|
#include "system.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
#include "coretypes.h"
|
1998-09-06 17:36:06 +02:00
|
|
|
#include "tree.h"
|
|
|
|
#include "java-tree.h"
|
|
|
|
#include "javaop.h"
|
|
|
|
#include "java-opcodes.h"
|
|
|
|
#include "jcf.h"
|
java-gimplify.c: Do not include tm.h, toplev.h.
* java-gimplify.c: Do not include tm.h, toplev.h.
* typeck.c: Do not include tm.h.
* mangle_name.c: Do not include tm.h.
* jcf-dump.c: Do not include tm.h, ggc.h.
* class.c: Do not include rtl.h, tm_p.h, target.h, except.h, cgraph.h.
* decl.c: Do not include tm.h, rtl.h, function.h, expr.h, except.h,
and timevar.h.
* jcf-parse.c: Do not include tm.h and tm_p.h.
* resource.c: Do not include tm.h, rtl.h, flags.h, obstack.h,
target.h, and expr.h.
* except.c: Do not include tm.h, rtl.h, function.h.
* builtins.c: Do not include convert.h. Explain why RTL headers
have to be included here.
* verify-glue.c: Do not include tm.h.
* jcf-depend.c: Do not include tm.h.
* jcf-reader.c: Include ggc.h.
* jcf-io.c: Do not include tm.h, toplev.h.
* expr.c: Do not include tm.h, rtl.h, expr.h, except.h, tm_p.h,
gimple.h.
* lang.c: Do not include rtl.h, expr.h.
* Make-lang.in: Update dependencies.
From-SVN: r159764
2010-05-23 19:48:41 +02:00
|
|
|
#include "except.h" /* for doing_eh. */
|
1998-09-06 17:36:06 +02:00
|
|
|
#include "java-except.h"
|
1998-09-14 11:42:24 +02:00
|
|
|
#include "toplev.h"
|
2009-09-14 21:18:58 +02:00
|
|
|
#include "tree-iterator.h"
|
|
|
|
|
1998-09-06 17:36:06 +02:00
|
|
|
|
2003-01-10 00:16:56 +01:00
|
|
|
static void expand_start_java_handler (struct eh_range *);
|
|
|
|
static struct eh_range *find_handler_in_range (int, struct eh_range *,
|
|
|
|
struct eh_range *);
|
|
|
|
static void check_start_handlers (struct eh_range *, int);
|
|
|
|
static void free_eh_ranges (struct eh_range *range);
|
Makefile.in (jcf-dump.o): Depend on $(CONFIG_H) $(srcdir)/../system.h and $(JAVA_TREE_H).
* Makefile.in (jcf-dump.o): Depend on $(CONFIG_H)
$(srcdir)/../system.h and $(JAVA_TREE_H).
(jcf-io.o): Depend on $(JAVA_TREE_H).
(mangle.o): Likewise.
* check-init.c (check_cond_init): Add static prototype.
* class.c (build_java_method_type, hashUtf8String,
make_field_value, get_dispatch_vector, get_dispatch_table,
append_gpp_mangled_type, mangle_static_field): Likewise.
(strLengthUtf8): Hide unused definition.
(hashUtf8String): Const-ify.
(make_field_value): Un-ANSI-fy.
* constants.c: Move inclusion of jcf.h above java-tree.h.
(set_constant_entry, find_class_or_string_constant,
find_name_and_type_constant, get_tag_node,
build_constant_data_ref): Add static prototype.
* decl.c (push_jvm_slot, builtin_function,
lookup_name_current_level): Likewise.
(builtin_function): Const-ify.
* except.c (expand_start_java_handler, expand_end_java_handler):
Add static prototype.
* expr.c (flush_quick_stack, push_value, pop_value,
java_stack_swap, java_stack_dup, build_java_athrow,
build_java_jsr, build_java_ret, expand_java_multianewarray,
expand_java_arraystore, expand_java_arrayload,
expand_java_array_length, build_java_monitor, expand_java_pushc,
expand_java_return, expand_java_NEW, expand_java_INSTANCEOF,
expand_java_CHECKCAST, expand_iinc, expand_java_binop, note_label,
expand_compare, expand_test, expand_cond, expand_java_goto,
expand_java_call, expand_java_ret, pop_arguments, expand_invoke,
expand_java_field_op, java_push_constant_from_pool): Likewise.
(decode_newarray_type, expand_iinc): Un-ANSI-fy.
(build_java_arraynull_check): Mark parameters `node' and `type'
with ATTRIBUTE_UNUSED.
(note_label): Likewise for parameter `current_pc'.
(expand_java_call, expand_java_ret): Hide unused definition.
* java-tree.h (make_class, build_constants_constructor,
java_set_exception_lang_code, pop_labeled_block, emit_handlers,
init_outgoing_cpool, register_class, emit_register_classes,
java_layout_seen_class_methods): Prototype.
(unicode_mangling_length): Const-ify.
(append_gpp_mangled_name, append_gpp_mangled_classtype,
emit_unicode_mangled_name, format_int, format_uint,
jcf_trim_old_input, jcf_print_utf8, jcf_print_char,
jcf_print_utf8_replace, open_class): Prototype.
* jcf-dump.c: Include "config.h", not <config.h>. Don't include
<stdio.h>. Include tree.h/java-tree.h.
(utf8_equal_string usage, process_class): Add static prototype.
(open_class): Don't prototype this here.
(utf8_equal_string): Match arguments to format specifiers.
(HANDLE_CODE_ATTRIBUTE, BRANCH, JSR, RET, LOOKUP_SWITCH,
TABLE_SWITCH, disassemble_method): Likewise.
* jcf-io.c: Include tree.h/java-tree.h.
(open_class, find_classfile, jcf_print_utf8,
jcf_print_utf8_replace): Const-ify.
* jcf-parse.c (parse_zip_file_entries, process_zip_dir,
parse_class_file): Add static prototype.
(find_in_current_zip): Match definition to existing static
prototype.
* jcf-write.c: Include jcf.h before tree.h/java-tree.h.
(alloc_chunk, append_chunk, append_chunk_copy, gen_jcf_label,
finish_jcf_block, define_jcf_label, get_jcf_label_here,
put_linenumber, localvar_alloc, localvar_free, get_access_flags,
write_chunks, adjust_typed_op, generate_bytecode_conditional,
generate_bytecode_return, perform_relocations, init_jcf_state,
init_jcf_method, release_jcf_state, generate_classfile):
Add static prototype.
(emit_unop): Mark parameter `type' with ATTRIBUTE_UNUSED.
(make_class_file_name): Const-ify.
* jcf.h (find_classfile): Const-ify.
* jv-scan.c (reset_report): Remove prototype.
* jvgenmain.c: Include jcf.h/tree.h/java-tree.h.
(error): Rewrite to allow varargs.
* lang.c (lang_f_options): Const-ify.
* lex.c (java_parse_escape_sequence): Add static prototype.
(java_allocate_new_line): Match definition to existing static
prototype.
* mangle.c Include tree.h/java-tree.h.
(unicode_mangling_length, emit_unicode_mangled_name,
append_gpp_mangled_name, append_gpp_mangled_classtype): Const-ify.
* parse.h (jdep_code): Remove trailing comma in enumeration.
(java_get_line_col): Move prototype outside of !JC1_LITE test.
(reset_report): Add prototype.
* verify.c (push_pending_label, merge_types): Add static
prototypes.
* zipfile.h (opendir_in_zip, open_in_zip): Prototype.
From-SVN: r25878
1999-03-21 07:09:25 +01:00
|
|
|
|
1998-09-06 17:36:06 +02:00
|
|
|
struct eh_range *current_method_handlers;
|
|
|
|
|
|
|
|
struct eh_range *current_try_block = NULL;
|
|
|
|
|
|
|
|
/* These variables are used to speed up find_handler. */
|
|
|
|
|
|
|
|
static int cache_range_start, cache_range_end;
|
|
|
|
static struct eh_range *cache_range;
|
|
|
|
static struct eh_range *cache_next_child;
|
|
|
|
|
|
|
|
/* A dummy range that represents the entire method. */
|
|
|
|
|
|
|
|
struct eh_range whole_range;
|
|
|
|
|
2005-04-19 11:52:21 +02:00
|
|
|
/* Check the invariants of the structure we're using to contain
|
|
|
|
exception regions. Either returns true or fails an assertion
|
|
|
|
check. */
|
|
|
|
|
|
|
|
bool
|
|
|
|
sanity_check_exception_range (struct eh_range *range)
|
|
|
|
{
|
|
|
|
struct eh_range *ptr = range->first_child;
|
|
|
|
for (; ptr; ptr = ptr->next_sibling)
|
|
|
|
{
|
|
|
|
gcc_assert (ptr->outer == range
|
|
|
|
&& ptr->end_pc > ptr->start_pc);
|
|
|
|
if (ptr->next_sibling)
|
|
|
|
gcc_assert (ptr->next_sibling->start_pc >= ptr->end_pc);
|
|
|
|
gcc_assert (ptr->start_pc >= ptr->outer->start_pc
|
|
|
|
&& ptr->end_pc <= ptr->outer->end_pc);
|
|
|
|
(void) sanity_check_exception_range (ptr);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-02-09 15:08:44 +01:00
|
|
|
#if defined(DEBUG_JAVA_BINDING_LEVELS)
|
2002-09-05 15:24:41 +02:00
|
|
|
extern int is_class_level;
|
|
|
|
extern int current_pc;
|
2005-04-19 11:52:21 +02:00
|
|
|
extern int binding_depth;
|
|
|
|
extern void indent (void);
|
|
|
|
static void
|
|
|
|
print_ranges (struct eh_range *range)
|
|
|
|
{
|
|
|
|
if (! range)
|
|
|
|
return;
|
|
|
|
|
|
|
|
struct eh_range *child = range->first_child;
|
|
|
|
|
|
|
|
indent ();
|
|
|
|
fprintf (stderr, "handler pc %d --> %d ", range->start_pc, range->end_pc);
|
|
|
|
|
|
|
|
tree handler = range->handlers;
|
|
|
|
for ( ; handler != NULL_TREE; handler = TREE_CHAIN (handler))
|
|
|
|
{
|
|
|
|
tree type = TREE_PURPOSE (handler);
|
|
|
|
if (type == NULL)
|
|
|
|
type = throwable_type_node;
|
|
|
|
fprintf (stderr, " type=%s ", IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
|
|
|
|
}
|
|
|
|
fprintf (stderr, "\n");
|
|
|
|
|
|
|
|
int saved = binding_depth;
|
|
|
|
binding_depth++;
|
|
|
|
print_ranges (child);
|
|
|
|
binding_depth = saved;
|
2000-02-09 15:08:44 +01:00
|
|
|
|
2005-04-19 11:52:21 +02:00
|
|
|
print_ranges (range->next_sibling);
|
|
|
|
}
|
2000-02-09 15:08:44 +01:00
|
|
|
#endif
|
|
|
|
|
1998-09-06 17:36:06 +02:00
|
|
|
/* Search for the most specific eh_range containing PC.
|
|
|
|
Assume PC is within RANGE.
|
|
|
|
CHILD is a list of children of RANGE such that any
|
|
|
|
previous children have end_pc values that are too low. */
|
|
|
|
|
|
|
|
static struct eh_range *
|
2003-01-12 03:14:56 +01:00
|
|
|
find_handler_in_range (int pc, struct eh_range *range, struct eh_range *child)
|
1998-09-06 17:36:06 +02:00
|
|
|
{
|
|
|
|
for (; child != NULL; child = child->next_sibling)
|
|
|
|
{
|
|
|
|
if (pc < child->start_pc)
|
|
|
|
break;
|
1999-06-21 11:18:50 +02:00
|
|
|
if (pc < child->end_pc)
|
1998-09-06 17:36:06 +02:00
|
|
|
return find_handler_in_range (pc, child, child->first_child);
|
|
|
|
}
|
|
|
|
cache_range = range;
|
|
|
|
cache_range_start = pc;
|
|
|
|
cache_next_child = child;
|
|
|
|
cache_range_end = child == NULL ? range->end_pc : child->start_pc;
|
|
|
|
return range;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find the inner-most handler that contains PC. */
|
|
|
|
|
|
|
|
struct eh_range *
|
2003-01-12 03:14:56 +01:00
|
|
|
find_handler (int pc)
|
1998-09-06 17:36:06 +02:00
|
|
|
{
|
|
|
|
struct eh_range *h;
|
|
|
|
if (pc >= cache_range_start)
|
|
|
|
{
|
|
|
|
h = cache_range;
|
|
|
|
if (pc < cache_range_end)
|
|
|
|
return h;
|
|
|
|
while (pc >= h->end_pc)
|
|
|
|
{
|
|
|
|
cache_next_child = h->next_sibling;
|
|
|
|
h = h->outer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
h = &whole_range;
|
|
|
|
cache_next_child = h->first_child;
|
|
|
|
}
|
|
|
|
return find_handler_in_range (pc, h, cache_next_child);
|
|
|
|
}
|
|
|
|
|
2000-10-13 08:26:46 +02:00
|
|
|
static void
|
2003-01-12 03:14:56 +01:00
|
|
|
free_eh_ranges (struct eh_range *range)
|
2000-10-13 08:26:46 +02:00
|
|
|
{
|
|
|
|
while (range)
|
|
|
|
{
|
|
|
|
struct eh_range *next = range->next_sibling;
|
|
|
|
free_eh_ranges (range->first_child);
|
2000-10-18 00:48:59 +02:00
|
|
|
if (range != &whole_range)
|
|
|
|
free (range);
|
2000-10-13 08:26:46 +02:00
|
|
|
range = next;
|
|
|
|
}
|
|
|
|
}
|
1999-05-18 17:03:26 +02:00
|
|
|
|
1998-09-06 17:36:06 +02:00
|
|
|
/* Called to re-initialize the exception machinery for a new method. */
|
|
|
|
|
|
|
|
void
|
2003-01-12 03:14:56 +01:00
|
|
|
method_init_exceptions (void)
|
1998-09-06 17:36:06 +02:00
|
|
|
{
|
2000-10-13 08:26:46 +02:00
|
|
|
free_eh_ranges (&whole_range);
|
1998-09-06 17:36:06 +02:00
|
|
|
whole_range.start_pc = 0;
|
|
|
|
whole_range.end_pc = DECL_CODE_LENGTH (current_function_decl) + 1;
|
|
|
|
whole_range.outer = NULL;
|
|
|
|
whole_range.first_child = NULL;
|
|
|
|
whole_range.next_sibling = NULL;
|
|
|
|
cache_range_start = 0xFFFFFF;
|
|
|
|
}
|
|
|
|
|
2005-04-19 11:52:21 +02:00
|
|
|
/* Split an exception range into two at PC. The sub-ranges that
|
|
|
|
belong to the range are split and distributed between the two new
|
|
|
|
ranges. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
split_range (struct eh_range *range, int pc)
|
|
|
|
{
|
|
|
|
struct eh_range *ptr;
|
|
|
|
struct eh_range **first_child, **second_child;
|
|
|
|
struct eh_range *h;
|
|
|
|
|
|
|
|
/* First, split all the sub-ranges. */
|
|
|
|
for (ptr = range->first_child; ptr; ptr = ptr->next_sibling)
|
|
|
|
{
|
|
|
|
if (pc > ptr->start_pc
|
|
|
|
&& pc < ptr->end_pc)
|
|
|
|
{
|
|
|
|
split_range (ptr, pc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create a new range. */
|
2006-01-31 20:56:55 +01:00
|
|
|
h = XNEW (struct eh_range);
|
2005-04-19 11:52:21 +02:00
|
|
|
|
|
|
|
h->start_pc = pc;
|
|
|
|
h->end_pc = range->end_pc;
|
|
|
|
h->next_sibling = range->next_sibling;
|
|
|
|
range->next_sibling = h;
|
|
|
|
range->end_pc = pc;
|
|
|
|
h->handlers = build_tree_list (TREE_PURPOSE (range->handlers),
|
|
|
|
TREE_VALUE (range->handlers));
|
|
|
|
h->next_sibling = NULL;
|
|
|
|
h->expanded = 0;
|
|
|
|
h->stmt = NULL;
|
|
|
|
h->outer = range->outer;
|
|
|
|
h->first_child = NULL;
|
|
|
|
|
|
|
|
ptr = range->first_child;
|
|
|
|
first_child = &range->first_child;
|
|
|
|
second_child = &h->first_child;
|
|
|
|
|
2005-04-19 17:45:28 +02:00
|
|
|
/* Distribute the sub-ranges between the two new ranges. */
|
2005-04-19 11:52:21 +02:00
|
|
|
for (ptr = range->first_child; ptr; ptr = ptr->next_sibling)
|
|
|
|
{
|
|
|
|
if (ptr->start_pc < pc)
|
|
|
|
{
|
|
|
|
*first_child = ptr;
|
|
|
|
ptr->outer = range;
|
|
|
|
first_child = &ptr->next_sibling;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*second_child = ptr;
|
|
|
|
ptr->outer = h;
|
|
|
|
second_child = &ptr->next_sibling;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*first_child = NULL;
|
|
|
|
*second_child = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Add an exception range.
|
|
|
|
|
|
|
|
There are some missed optimization opportunities here. For
|
|
|
|
example, some bytecode obfuscators generate seemingly
|
|
|
|
nonoverlapping exception ranges which, when coalesced, do in fact
|
|
|
|
nest correctly. We could merge these, but we'd have to fix up all
|
|
|
|
the enclosed regions first and perhaps create a new range anyway if
|
|
|
|
it overlapped existing ranges.
|
1999-05-18 17:03:26 +02:00
|
|
|
|
2005-04-19 11:52:21 +02:00
|
|
|
Also, we don't attempt to detect the case where two previously
|
|
|
|
added disjoint ranges could be coalesced by a new range. */
|
1999-05-18 17:03:26 +02:00
|
|
|
|
2005-04-19 11:52:21 +02:00
|
|
|
void
|
2003-01-12 03:14:56 +01:00
|
|
|
add_handler (int start_pc, int end_pc, tree handler, tree type)
|
1998-09-06 17:36:06 +02:00
|
|
|
{
|
2005-04-19 11:52:21 +02:00
|
|
|
struct eh_range *ptr, *h;
|
|
|
|
struct eh_range **first_child, **prev;
|
1999-05-18 17:03:26 +02:00
|
|
|
|
2005-04-19 11:52:21 +02:00
|
|
|
/* First, split all the existing ranges that we need to enclose. */
|
1999-05-18 17:03:26 +02:00
|
|
|
for (ptr = whole_range.first_child; ptr; ptr = ptr->next_sibling)
|
|
|
|
{
|
2005-04-19 11:52:21 +02:00
|
|
|
if (start_pc > ptr->start_pc
|
|
|
|
&& start_pc < ptr->end_pc)
|
|
|
|
{
|
|
|
|
split_range (ptr, start_pc);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (end_pc > ptr->start_pc
|
|
|
|
&& end_pc < ptr->end_pc)
|
1999-05-18 17:03:26 +02:00
|
|
|
{
|
2005-04-19 11:52:21 +02:00
|
|
|
split_range (ptr, end_pc);
|
1999-05-18 17:03:26 +02:00
|
|
|
}
|
2005-04-19 11:52:21 +02:00
|
|
|
|
|
|
|
if (ptr->start_pc >= end_pc)
|
|
|
|
break;
|
1999-05-18 17:03:26 +02:00
|
|
|
}
|
|
|
|
|
2005-04-19 11:52:21 +02:00
|
|
|
/* Create the new range. */
|
2006-01-31 20:56:55 +01:00
|
|
|
h = XNEW (struct eh_range);
|
2005-04-19 11:52:21 +02:00
|
|
|
first_child = &h->first_child;
|
|
|
|
|
1999-05-18 17:03:26 +02:00
|
|
|
h->start_pc = start_pc;
|
|
|
|
h->end_pc = end_pc;
|
|
|
|
h->first_child = NULL;
|
2005-04-19 11:52:21 +02:00
|
|
|
h->outer = NULL_EH_RANGE;
|
1999-05-18 17:03:26 +02:00
|
|
|
h->handlers = build_tree_list (type, handler);
|
|
|
|
h->next_sibling = NULL;
|
2000-02-09 15:08:44 +01:00
|
|
|
h->expanded = 0;
|
2004-05-13 08:41:07 +02:00
|
|
|
h->stmt = NULL;
|
1999-05-18 17:03:26 +02:00
|
|
|
|
2005-04-19 11:52:21 +02:00
|
|
|
/* Find every range at the top level that will be a sub-range of the
|
|
|
|
range we're inserting and make it so. */
|
|
|
|
{
|
|
|
|
struct eh_range **prev = &whole_range.first_child;
|
|
|
|
for (ptr = *prev; ptr;)
|
|
|
|
{
|
|
|
|
struct eh_range *next = ptr->next_sibling;
|
|
|
|
|
|
|
|
if (ptr->start_pc >= end_pc)
|
|
|
|
break;
|
1998-09-06 17:36:06 +02:00
|
|
|
|
2005-04-19 11:52:21 +02:00
|
|
|
if (ptr->start_pc < start_pc)
|
|
|
|
{
|
|
|
|
prev = &ptr->next_sibling;
|
|
|
|
}
|
|
|
|
else if (ptr->start_pc >= start_pc
|
|
|
|
&& ptr->start_pc < end_pc)
|
|
|
|
{
|
|
|
|
*prev = next;
|
|
|
|
*first_child = ptr;
|
|
|
|
first_child = &ptr->next_sibling;
|
|
|
|
ptr->outer = h;
|
|
|
|
ptr->next_sibling = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ptr = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find the right place to insert the new range. */
|
|
|
|
prev = &whole_range.first_child;
|
|
|
|
for (ptr = *prev; ptr; prev = &ptr->next_sibling, ptr = ptr->next_sibling)
|
|
|
|
{
|
|
|
|
gcc_assert (ptr->outer == NULL_EH_RANGE);
|
|
|
|
if (ptr->start_pc >= start_pc)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* And insert it there. */
|
|
|
|
*prev = h;
|
|
|
|
if (ptr)
|
|
|
|
{
|
|
|
|
h->next_sibling = ptr;
|
|
|
|
h->outer = ptr->outer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-09-06 17:36:06 +02:00
|
|
|
/* if there are any handlers for this range, issue start of region */
|
Makefile.in (jcf-dump.o): Depend on $(CONFIG_H) $(srcdir)/../system.h and $(JAVA_TREE_H).
* Makefile.in (jcf-dump.o): Depend on $(CONFIG_H)
$(srcdir)/../system.h and $(JAVA_TREE_H).
(jcf-io.o): Depend on $(JAVA_TREE_H).
(mangle.o): Likewise.
* check-init.c (check_cond_init): Add static prototype.
* class.c (build_java_method_type, hashUtf8String,
make_field_value, get_dispatch_vector, get_dispatch_table,
append_gpp_mangled_type, mangle_static_field): Likewise.
(strLengthUtf8): Hide unused definition.
(hashUtf8String): Const-ify.
(make_field_value): Un-ANSI-fy.
* constants.c: Move inclusion of jcf.h above java-tree.h.
(set_constant_entry, find_class_or_string_constant,
find_name_and_type_constant, get_tag_node,
build_constant_data_ref): Add static prototype.
* decl.c (push_jvm_slot, builtin_function,
lookup_name_current_level): Likewise.
(builtin_function): Const-ify.
* except.c (expand_start_java_handler, expand_end_java_handler):
Add static prototype.
* expr.c (flush_quick_stack, push_value, pop_value,
java_stack_swap, java_stack_dup, build_java_athrow,
build_java_jsr, build_java_ret, expand_java_multianewarray,
expand_java_arraystore, expand_java_arrayload,
expand_java_array_length, build_java_monitor, expand_java_pushc,
expand_java_return, expand_java_NEW, expand_java_INSTANCEOF,
expand_java_CHECKCAST, expand_iinc, expand_java_binop, note_label,
expand_compare, expand_test, expand_cond, expand_java_goto,
expand_java_call, expand_java_ret, pop_arguments, expand_invoke,
expand_java_field_op, java_push_constant_from_pool): Likewise.
(decode_newarray_type, expand_iinc): Un-ANSI-fy.
(build_java_arraynull_check): Mark parameters `node' and `type'
with ATTRIBUTE_UNUSED.
(note_label): Likewise for parameter `current_pc'.
(expand_java_call, expand_java_ret): Hide unused definition.
* java-tree.h (make_class, build_constants_constructor,
java_set_exception_lang_code, pop_labeled_block, emit_handlers,
init_outgoing_cpool, register_class, emit_register_classes,
java_layout_seen_class_methods): Prototype.
(unicode_mangling_length): Const-ify.
(append_gpp_mangled_name, append_gpp_mangled_classtype,
emit_unicode_mangled_name, format_int, format_uint,
jcf_trim_old_input, jcf_print_utf8, jcf_print_char,
jcf_print_utf8_replace, open_class): Prototype.
* jcf-dump.c: Include "config.h", not <config.h>. Don't include
<stdio.h>. Include tree.h/java-tree.h.
(utf8_equal_string usage, process_class): Add static prototype.
(open_class): Don't prototype this here.
(utf8_equal_string): Match arguments to format specifiers.
(HANDLE_CODE_ATTRIBUTE, BRANCH, JSR, RET, LOOKUP_SWITCH,
TABLE_SWITCH, disassemble_method): Likewise.
* jcf-io.c: Include tree.h/java-tree.h.
(open_class, find_classfile, jcf_print_utf8,
jcf_print_utf8_replace): Const-ify.
* jcf-parse.c (parse_zip_file_entries, process_zip_dir,
parse_class_file): Add static prototype.
(find_in_current_zip): Match definition to existing static
prototype.
* jcf-write.c: Include jcf.h before tree.h/java-tree.h.
(alloc_chunk, append_chunk, append_chunk_copy, gen_jcf_label,
finish_jcf_block, define_jcf_label, get_jcf_label_here,
put_linenumber, localvar_alloc, localvar_free, get_access_flags,
write_chunks, adjust_typed_op, generate_bytecode_conditional,
generate_bytecode_return, perform_relocations, init_jcf_state,
init_jcf_method, release_jcf_state, generate_classfile):
Add static prototype.
(emit_unop): Mark parameter `type' with ATTRIBUTE_UNUSED.
(make_class_file_name): Const-ify.
* jcf.h (find_classfile): Const-ify.
* jv-scan.c (reset_report): Remove prototype.
* jvgenmain.c: Include jcf.h/tree.h/java-tree.h.
(error): Rewrite to allow varargs.
* lang.c (lang_f_options): Const-ify.
* lex.c (java_parse_escape_sequence): Add static prototype.
(java_allocate_new_line): Match definition to existing static
prototype.
* mangle.c Include tree.h/java-tree.h.
(unicode_mangling_length, emit_unicode_mangled_name,
append_gpp_mangled_name, append_gpp_mangled_classtype): Const-ify.
* parse.h (jdep_code): Remove trailing comma in enumeration.
(java_get_line_col): Move prototype outside of !JC1_LITE test.
(reset_report): Add prototype.
* verify.c (push_pending_label, merge_types): Add static
prototypes.
* zipfile.h (opendir_in_zip, open_in_zip): Prototype.
From-SVN: r25878
1999-03-21 07:09:25 +01:00
|
|
|
static void
|
2003-01-12 03:14:56 +01:00
|
|
|
expand_start_java_handler (struct eh_range *range)
|
1998-09-06 17:36:06 +02:00
|
|
|
{
|
2000-02-09 15:08:44 +01:00
|
|
|
#if defined(DEBUG_JAVA_BINDING_LEVELS)
|
|
|
|
indent ();
|
|
|
|
fprintf (stderr, "expand start handler pc %d --> %d\n",
|
|
|
|
current_pc, range->end_pc);
|
|
|
|
#endif /* defined(DEBUG_JAVA_BINDING_LEVELS) */
|
2004-06-29 18:18:46 +02:00
|
|
|
pushlevel (0);
|
|
|
|
register_exception_range (range, range->start_pc, range->end_pc);
|
2000-02-09 15:08:44 +01:00
|
|
|
range->expanded = 1;
|
1998-09-06 17:36:06 +02:00
|
|
|
}
|
|
|
|
|
1998-10-12 14:43:53 +02:00
|
|
|
tree
|
2003-01-12 03:14:56 +01:00
|
|
|
prepare_eh_table_type (tree type)
|
1998-10-12 14:43:53 +02:00
|
|
|
{
|
|
|
|
tree exp;
|
re PR java/12755 (Binary Compatibility: Resolving static methods and classes is not thread safe)
2004-01-09 Andrew Haley <aph@redhat.com>
PR java/12755:
* parse.y (java_fix_constructors): Set output_class.
(java_reorder_fields): Likewise.
(java_layout_classes): Likewise.
(java_expand_classes): Generate indirect dispatch tables.
(java_expand_classes): Set output_class.
(java_finish_classes): Likewise.
* lang.c (java_init): Turn on always_initialize_class_p if we're
using indirect dis[atch.
(java_decl_ok_for_sibcall): Use output_class, not current_class.
(java_get_callee_fndecl): Use class local atable.
* jcf-parse.c
(always_initialize_class_p): Decl moved to java-tree.h.
(HANDLE_CLASS_INFO): Set output_class.
(read_class): Likewise.
(parse_class_file): Call gen_indirect_dispatch_tables.
(parse_zip_file_entries): Set output_class.
(java_parse_file): Set output_class. Don't emit symbol tables.
* java-tree.h (output_class): New.
Remove global declarations for otable, atable, and ctable.
(always_initialize_class_p): moved here from decl.c.
(DECL_OWNER): New.
(TYPE_ATABLE_METHODS, TYPE_ATABLE_SYMS_DECL, TYPE_ATABLE_DECL,
TYPE_OTABLE_METHODS, TYPE_OTABLE_SYMS_DECL, TYPE_OTABLE_DECL,
TYPE_CTABLE_DECL, TYPE_CATCH_CLASSES): New.
(struct lang_type): Add otable_methods, otable_decl,
otable_syms_decl, atable_methods, atable_decl, atable_syms_decl,
ctable_decl, catch_classes, type_to_runtime_map.
* expr.c (build_field_ref): Make otable, atable, and ctable class
local rather than global.
(build_known_method_ref): Likewise.
(build_invokeinterface): Likewise.
(java_expand_expr): Pass runtime type (rather than actual type) to
expand_start_catch.
* except.c (prepare_eh_table_type): Create TYPE_TO_RUNTIME_MAP for
this class. Look up each class in that map to delete duplicates.
(expand_end_java_handler): Pass runtime type (rather than actual
type) to expand_start_catch.
* decl.c: (always_initialize_class_p): Decl moved to java-tree.h.
(do_nothing): New.
(java_init_decl_processing): Rearrange things. Remove global
declarations of otable, atable, and ctable.
(java_init_decl_processing): Make lang_eh_runtime_type do_nothing.
(java_expand_body): Set output_class.
* constants.c (build_constant_data_ref): Use output_class, not
current_class.
(alloc_name_constant): Likewise.
* class.c (gen_indirect_dispatch_tables): New.
(build_class_ref): Generate hard reference to superclass, even if
using indirect dispatch.
(build_static_field_ref): Use class local atable.
(make_class_data): Generate hard reference to superclass, even if
using indirect dispatch.
Generate symbolic references to interfaces when using indirect
dispatch.
(make_class_data): Emit otable, atable, and ctable.
Make otable, atable, and ctable class local rather than global.
(emit_catch_table): Make otable, atable, and ctable class local
rather than global.
From-SVN: r75590
2004-01-09 18:08:44 +01:00
|
|
|
tree *slot;
|
2003-11-20 04:34:59 +01:00
|
|
|
const char *name;
|
|
|
|
char *buf;
|
|
|
|
tree decl;
|
|
|
|
tree utf8_ref;
|
1998-10-12 14:43:53 +02:00
|
|
|
|
2003-10-24 11:29:43 +02:00
|
|
|
/* The "type" (match_info) in a (Java) exception table is a pointer to:
|
1998-10-12 14:43:53 +02:00
|
|
|
* a) NULL - meaning match any type in a try-finally.
|
2003-10-24 11:29:43 +02:00
|
|
|
* b) a pointer to a pointer to a class.
|
|
|
|
* c) a pointer to a pointer to a utf8_ref. The pointer is
|
|
|
|
* rewritten to point to the appropriate class. */
|
1998-10-12 14:43:53 +02:00
|
|
|
|
|
|
|
if (type == NULL_TREE)
|
re PR java/12755 (Binary Compatibility: Resolving static methods and classes is not thread safe)
2004-01-09 Andrew Haley <aph@redhat.com>
PR java/12755:
* parse.y (java_fix_constructors): Set output_class.
(java_reorder_fields): Likewise.
(java_layout_classes): Likewise.
(java_expand_classes): Generate indirect dispatch tables.
(java_expand_classes): Set output_class.
(java_finish_classes): Likewise.
* lang.c (java_init): Turn on always_initialize_class_p if we're
using indirect dis[atch.
(java_decl_ok_for_sibcall): Use output_class, not current_class.
(java_get_callee_fndecl): Use class local atable.
* jcf-parse.c
(always_initialize_class_p): Decl moved to java-tree.h.
(HANDLE_CLASS_INFO): Set output_class.
(read_class): Likewise.
(parse_class_file): Call gen_indirect_dispatch_tables.
(parse_zip_file_entries): Set output_class.
(java_parse_file): Set output_class. Don't emit symbol tables.
* java-tree.h (output_class): New.
Remove global declarations for otable, atable, and ctable.
(always_initialize_class_p): moved here from decl.c.
(DECL_OWNER): New.
(TYPE_ATABLE_METHODS, TYPE_ATABLE_SYMS_DECL, TYPE_ATABLE_DECL,
TYPE_OTABLE_METHODS, TYPE_OTABLE_SYMS_DECL, TYPE_OTABLE_DECL,
TYPE_CTABLE_DECL, TYPE_CATCH_CLASSES): New.
(struct lang_type): Add otable_methods, otable_decl,
otable_syms_decl, atable_methods, atable_decl, atable_syms_decl,
ctable_decl, catch_classes, type_to_runtime_map.
* expr.c (build_field_ref): Make otable, atable, and ctable class
local rather than global.
(build_known_method_ref): Likewise.
(build_invokeinterface): Likewise.
(java_expand_expr): Pass runtime type (rather than actual type) to
expand_start_catch.
* except.c (prepare_eh_table_type): Create TYPE_TO_RUNTIME_MAP for
this class. Look up each class in that map to delete duplicates.
(expand_end_java_handler): Pass runtime type (rather than actual
type) to expand_start_catch.
* decl.c: (always_initialize_class_p): Decl moved to java-tree.h.
(do_nothing): New.
(java_init_decl_processing): Rearrange things. Remove global
declarations of otable, atable, and ctable.
(java_init_decl_processing): Make lang_eh_runtime_type do_nothing.
(java_expand_body): Set output_class.
* constants.c (build_constant_data_ref): Use output_class, not
current_class.
(alloc_name_constant): Likewise.
* class.c (gen_indirect_dispatch_tables): New.
(build_class_ref): Generate hard reference to superclass, even if
using indirect dispatch.
(build_static_field_ref): Use class local atable.
(make_class_data): Generate hard reference to superclass, even if
using indirect dispatch.
Generate symbolic references to interfaces when using indirect
dispatch.
(make_class_data): Emit otable, atable, and ctable.
Make otable, atable, and ctable class local rather than global.
(emit_catch_table): Make otable, atable, and ctable class local
rather than global.
From-SVN: r75590
2004-01-09 18:08:44 +01:00
|
|
|
return NULL_TREE;
|
|
|
|
|
|
|
|
if (TYPE_TO_RUNTIME_MAP (output_class) == NULL)
|
|
|
|
TYPE_TO_RUNTIME_MAP (output_class) = java_treetreehash_create (10, 1);
|
|
|
|
|
|
|
|
slot = java_treetreehash_new (TYPE_TO_RUNTIME_MAP (output_class), type);
|
|
|
|
if (*slot != NULL)
|
|
|
|
return TREE_VALUE (*slot);
|
|
|
|
|
|
|
|
if (is_compiled_class (type) && !flag_indirect_dispatch)
|
2003-10-24 11:29:43 +02:00
|
|
|
{
|
2003-11-20 04:34:59 +01:00
|
|
|
name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
|
collect2.c (main, [...]): Fix for -Wc++-compat.
* collect2.c (main, add_to_list): Fix for -Wc++-compat.
* gcc.c (translate_options, init_spec, store_arg, read_specs,
add_to_obstack, file_at_path, find_a_file, execute,
add_preprocessor_option, add_assembler_option, add_linker_option,
process_command, insert_wrapper, do_option_spec, do_self_spec,
spec_path, do_spec_1, is_directory, main, used_arg,
getenv_spec_function): Likewise.
* tlink.c (symbol_hash_lookup, file_hash_lookup,
demangled_hash_lookup, symbol_push, file_push, frob_extension):
Likewise.
java:
* class.c (ident_subst, mangled_classname, unmangle_classname,
gen_indirect_dispatch_tables, add_method_1,
build_fieldref_cache_entry, make_local_function_alias,
layout_class, java_treetreehash_find, java_treetreehash_new,
split_qualified_name): Fix for -Wc++-compat.
* constants.c (set_constant_entry, cpool_for_class): Likewise.
* decl.c (make_binding_level, java_dup_lang_specific_decl,
start_java_method): Likewise.
* except.c (prepare_eh_table_type): Likewise.
* expr.c (type_assertion_hash, note_instructions): Likewise.
* java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC,
MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise.
* jcf-io.c (jcf_filbuf_from_stdio, opendir_in_zip, find_class):
Likewise.
* jcf-parse.c (reverse, java_read_sourcefilenames,
annotation_grow, rewrite_reflection_indexes, java_parse_file,
process_zip_dir): Likewise.
* jcf-path.c (add_entry, add_path, jcf_path_init,
jcf_path_extdirs_arg): Likewise.
* jcf-reader.c (jcf_parse_constant_pool): Likewise.
* jvgenmain.c (do_mangle_classname): Likewise.
* lang.c (put_decl_string): Likewise.
* verify-impl.c (make_state_copy, make_state, add_new_state):
Likewise.
objc:
* objc-act.c (setup_string_decl, objc_build_string_object,
hash_interface, eq_interface, objc_begin_try_stmt,
encode_method_prototype, build_ivar_list_initializer,
objc_build_encode_expr): Fix for -Wc++-compat.
From-SVN: r136980
2008-06-20 05:46:09 +02:00
|
|
|
buf = (char *) alloca (strlen (name) + 5);
|
2003-11-20 04:34:59 +01:00
|
|
|
sprintf (buf, "%s_ref", name);
|
java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt.
gcc/java/
* java-gimplify.c (java_gimplify_block): New argument to
build_empty_stmt.
* expr.c (force_evaluation_order): Same.
* typeck.c: Add location to build_decl or PUSH_FIELD calls.
* class.c: Same.
* decl.c: Same.
* jcf-parse.c: Same.
* constants.c: Same.
* resource.c: Same.
* except.c: Same.
* builtins.c: Same.
* expr.c: Same.
* java-tree.h (PUSH_FIELD): Add location field.
gcc/objc/
* objc-act.c (finish_var_decl): Pass location to finish_decl.
(objc_get_parm_info): Same.
(get_super_receiver): Same.
* objc-act.c (objc_build_component_ref): Pass location to
build_compound_ref.
(build_module_initializer_routine): Pass location to
c_end_compound_stmt.
(objc_generate_static_init_call): Pass location to build_stmt.
(build_typed_selector_reference): New location argument.
(build_selector_reference): Same.
(objc_substitute_decl): Pass location to build_array_ref.
(next_sjlj_build_try_catch_finally): Pass location to build_stmt.
(objc_begin_catch_clause): Same.
(objc_finish_try_stmt): Same.
(objc_finish_catch_clause): Pass location to c_end_compound_stmt.
(objc_build_throw_stmt): New argument.
(generate_shared_structures): Pass location to build_c_cast.
(objc_build_message_expr): Use local location.
(objc_finish_message_expr): Use input_location.
(build_objc_method_call): New argument.
(objc_build_selector_expr): Same.
(get_super_receiver): Pass location to build_c_cast,
build_modify_expr, build_compound_expr.
* objc-act.c: Add location to all calls to start_struct, build_decl,
finish_struct.
gcc/
* tree-pretty-print.c (dump_generic_node): Dump column numbers.
* gimple-pretty-print.c (dump_gimple_stmt): Same.
* gimplify.c (gimplify_modify_expr): Set location for GIMPLE_ASSIGNs
created.
* c-parser.c (c_parser_binary_expression): Use current column while
building binary operations.
* common.opt (fshow-column): Enable by default.
* tree-vrp.c (check_array_ref): Use warning_at.
(check_array_bounds): Use location from call back if expr has no
location.
* tree.h: Add location argument to maybe_fold_*.
* tree-ssa-ccp.c (ccp_fold): Pass location to maybe_fold_*.
(maybe_fold_offset_to_array_ref): Add location argument and use it.
(maybe_fold_offset_to_component_ref): Same.
(maybe_fold_offset_to_reference): Same.
(maybe_fold_offset_to_address): Same.
(maybe_fold_stmt_indirect): Same.
(maybe_fold_stmt_addition): Same.
(fold_stmt_r): Pass location to maybe_fold_*.
(fold_gimple_assign): Same.
* c-tree.h: Add location argument to finish_decl,
default_function_array_conversion, store_init_value.
* c-decl.c (define_label): Use error_at.
(c_make_fname_decl): Pass location to finish_decl.
(finish_decl): New location argument.
(build_compound_literal): Pass location to store_init_value.
(grokdeclarator): Pass location to finish_decl.
(grokfield): Same.
* c-typeck.c (array_to_pointer_conversion): New location argument.
(function_to_pointer_conversion): Same.
(default_function_array_conversion): Same.
(parser_build_unary_op): Pass location to overflow_warning.
(parser_build_binary_op): Same. Use warning_at.
(build_unary_op): Pass location to array_to_pointer_conversion.
(build_c_cast): Pass location to digest_init.
(build_modify_expr): New location argument.
(convert_for_assignment): Same.
(store_init_value): Same.
(digest_init): Same.
(output_init_element): Pass location to digest_init and
array_to_pointer_conversion.
(c_finish_return): Pass location to convert_for_assignment.
* gimplify.c (gimplify_conversion): Pass location to
maybe_fold_offset_to_address.
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Pass location
to maybe_fold_stmt_addition.
* c-omp.c (c_finish_omp_atomic): Pass new location to
build_modify_expr.
(c_finish_omp_for): Same.
* c-common.c (overflow_warning): New argument.
* c-common.h: New argument to build_modify_expr, overflow_warning.
* c-parser.c (c_parser_declaration_or_fndef): Pass location to
finish_decl.
(c_parser_initializer): Pass location to
default_function_array_conversion.
(c_parser_initelt): Same.
(c_parser_initval): Same.
(c_parser_asm_operands): Same.
(c_parser_expr_no_commas): Same. Pass location to build_modify_expr.
(c_parser_conditional_expression): Same.
(c_parser_binary_expression): Add location info to stack. Use it.
(c_parser_unary_expression): Pass location to
default_function_array_conversion, parser_build_unary_op,
build_indirect_ref, c_parser_postfix_expression_after_primary.
(c_parser_postfix_expression_after_primary): New location argument.
Use it.
(c_parser_expression_conv): Pass location to
default_function_array_conversion.
(c_parser_expr_list): Same.
(c_parser_omp_atomic): Same.
(c_parser_omp_for_loop): Same.
* c-tree.h: (struct c_declarator): Add comment to id_loc.
(build_array_declarator): New argument.
* c-decl.c (build_array_declarator): Add location argument.
(grokdeclarator): Set id_loc for cdk_array.
* c-parser.c (c_parser_direct_declarator_inner): Pass location to
build_array_declarator.
* tree.c (build_omp_clause): Add location argument.
* tree.h (OMP_CLAUSE_HAS_LOCATION): New macro.
(OMP_CLAUSE_LOCATION): New macro.
(struct tree_omp_clause): Add location field.
(build_omp_clause): Add argument.
* testsuite/gcc.dg/gomp/for-1.c: Fix column.
* cp/pt.c (tsubst_omp_for_iterator): Pass location to
build_omp_clause.
* cp/parser.c (cp_parser_omp_var_list_no_open): Same.
(cp_parser_omp_clause_collapse): Same.
(cp_parser_omp_clause_default): Same.
(cp_parser_omp_clause_if): Same.
(cp_parser_omp_clause_nowait): Same.
(cp_parser_omp_clause_num_threads): Same.
(cp_parser_omp_clause_ordered): Same.
(cp_parser_omp_clause_schedule): Same.
(cp_parser_omp_clause_untied): Same.
(cp_parser_omp_for_loop): Same.
(cp_parser_omp_parallel): Pass location to c_split_parallel_clauses.
* c-tree.h (c_start_case): Add location argument.
(c_process_expr_stmt): Same.
(c_finish_goto_*): Same.
* tree-parloops.c (initialize_reductions): Pass location to
build_omp_clause.
(create_parallel_loop): Same.
* fortran/trans-openmp.c (gfc_trans_omp_variable_list): Same.
(gfc_trans_omp_reduction_list): Same.
(gfc_trans_omp_clauses): Same.
(gfc_trans_omp_do): Same.
* c-typeck.c (c_finish_goto_label): Same.
(c_finish_goto_ptr): New location argument.
(c_start_case): Same.
(emit_side_effect_warnings): Same.
(c_process_expr_stmt): Same.
(c_finish_stmt_expr): Same.
(c_finish_omp_clauses): Use error_at instead of error.
* gimplify.c (gimplify_adjust_omp_clauses_1): Pass location to
build_omp_clause.
* c-omp.c (c_split_parallel_clauses): New location argument.
* tree-nested.c (convert_nonlocal_reference_stmt): Pass location
to build_omp_clause.
(convert_local_reference_stmt): Same.
(convert_gimple_call): Same.
* c-common.h (c_split_parallel_clauses): New argument.
* c-parser.c (c_parser_statement_after_labels): Pass location to
c_finish_goto_label.
(c_parser_switch_statement): Pass location to c_start_case.
(c_parser_for_statement): Pass location to c_finish_expr_stmt,
and c_process_expr_stmt.
(c_parser_omp_variable_list): Add location argument.
(c_parser_omp_clause_collapse): Pass location to
build_omp_clause.
(c_parser_omp_clause_default): Same.
(c_parser_omp_clause_if): Same.
(c_parser_omp_clause_num_threads): Same.
(-c_parser_omp_clause_ordered): Same.
(c_parser_omp_clause_reduction): Pass location to
c_parser_omp_variable_list.
(c_parser_omp_clause_schedule): Pass location to build_omp_clause.
(c_parser_omp_clause_untied): Same.
(c_parser_omp_for_loop): Pass location to c_process_expr_stmt.
(c_parser_omp_parallel): Pass location to
c_split_parallel_clauses.
* c-tree.h (check_for_loop_decls, undeclared_variable,
build_component_ref, build_array_ref, build_external_ref,
c_expr_sizeof_expr, c_expr_sizeof_type, parser_build_unary_op,
build_conditional_expr, build_compound_expr, c_cast_expr,
build_c_cast, build_asm_expr, c_end_compound_stmt, c_finish_stmt_expr,
c_finish_return, c_finish_omp_parallel, c_finish_omp_task): New
argument.
* c-semantics.c (build_stmt): Same.
(build_case_label): Same.
* c-decl.c (c_finish_incomplete_decl): Pass location on down.
(undeclared_variable): New argument.
(make_label): Same.
(lookup_label): Pass location on down.
(define_label): Same.
(finish_decl): Same.
(build_compound_literal): Same.
(finish_struct): Same.
(finish_function): Do not set location here.
(check_for_loop_decls): New argument.
* tree.c (save_expr): Set location.
(build_empty_stmt): New argument.
* tree.h (build_empty_stmt): New argument to build_empty_stmt.
(CAN_HAVE_LOCATION_P): Make sure we have a non empty node.
* builtins.c (gimplify_va_arg_expr): Use locations.
(expand_builtin_sync_operation): Same.
* c-typeck.c (build_component_ref): New argument.
(build_array_ref): Same.
(build_external_ref): Same.
(c_expr_sizeof_expr): Same.
(c_expr_sizeof_type): Same.
(parser_build_unary_op): Same.
(build_conditional_expr): Same.
(build_compound_expr): Pass location on down.
(build_compound_expr): New argument.
(build_c_cast): Same.
(c_cast_expr): Same.
(build_asm_expr): Same.
(c_finish_return): Same.
(c_process_expr_stmt): Pass location on down.
(c_finish_stmt_expr): New argument.
(push_clenaup): Same.
(c_finish_omp_parallel): Same.
(c_finish_omp_task): Same.
* gimplify.c (gimplify_call_expr): Pass location on down.
* c-omp.c (c_finish_omp_master): New argument.
(c_finish_omp_critical): Same.
(c_finish_omp_ordered): Same.
(c_finish_omp_barrier): Same.
(-c_finish_omp_taskwait): Same.
(c_finish_omp_atomic): Same.
(c_finish_omp_flush): Same.
* tree-inline.c (copy_tree_body_r): Pass location on down.
(inline_forbidden_p): Remove use of input_location.
* c-gimplify.c (c_build_bind_expr): New argument.
* c-common.c (c_common_truthvalue_conversion): Pass location on down.
(c_sizeof_or_alignof_type): New argument.
(c_alignof_expr): Same.
(build_va_arg): Same.
(c_add_case_label): Same.
* c-common.h (c_sizeof_or_alignof_type, c_alignof_expr,
c_sizeof, c_alignof, build_va_arg, build_stmt, build_case_label,
c_build_bind_expr, objc_build_selector_expr, objc_build_throw_stmt,
c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered,
c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush,
c_finish_omp_taskwait, c_finish_omp_for, c_split_parallel_clauses):
New argument.
* stub-objc.c (objc_build_selector_expr): Same.
(objc_build_throw_stmt): Same.
* c-parser.c (c_parser_declaration_or_fndef): Pass location on down.
(c_parser_initelt): Same.
(c_parser_compound_statement): Same.
(c_parser_compound_statement_nostart): Same.
(c_parser_label): Same.
(c_parser_statement_after_labels): Same.
(c_parser_if_body): Same.
(c_parser_else_body): Same.
(c_parser_if_statement): Same.
(c_parser_switch_statement): Same.
(c_parser_while_statement): Same.
(c_parser_do_statement): Same.
(c_parser_for_statement): Same.
(c_parser_asm_statement): Same.
(c_parser_conditional_expression): Same.
(c_parser_binary_expression): Same.
(c_parser_cast_expression): Same.
(c_parser_unary_expression): Same.
(c_parser_sizeof_expression): Same.
(c_parser_alignof_expression): Same.
(c_parser_postfix_expression): Same.
(c_parser_expression): Same.
(c_parser_objc_receiver): Same.
(c_parser_omp_variable_list): Same.
(c_parser_omp_structured_block): Same.
(c_parser_omp_atomic): New argument.
(c_parser_omp_barrier): Same.
(c_parser_omp_critical): Same.
(c_parser_omp_flush): Pass location on down.
(c_parser_omp_for_loop): New argument.
(c_parser_omp_for): Same.
(c_parser_omp_master): Same.
(c_parser_omp_ordered): Same.
(c_parser_omp_sections_scope): Same.
(c_parser_omp_sections): Same.
(c_parser_omp_parallel): Same.
(c_parser_omp_single): Same.
(c_parser_omp_task): Same.
(c_parser_omp_taskwait): Pass location on down.
(c_parser_omp_construct): Same.
(c_parser_omp_threadprivate): Same.
* dwarf2asm.c, targhooks.c, optabs.c, tree.c, tree.h, target.h,
builtins.c, omp-low.c, cgraphunit.c, tree-call-cdce.c,
tree-ssa-alias.c, gimple-low.c, c-tree.h, expr.c, tree-parloops.c,
c-decl.c, tree-eh.c, langhooks.c, function.c, stor-layout.c,
c-typeck.c, gimplify.c, c-pragma.c, expmed.c, except.c, coverage.c,
emit-rtl.c, cfgexpand.c, tree-mudflap.c, varasm.c, tree-nested.c,
rtl.h, tree-inline.c, tree-profile.c, c-common.c, c-common.h,
tree-switch-conversion.c, tree-cfg.c, ipa-struct-reorg.c, c-parser.c,
config/i386/i386.c, stmt.c:
Add location argument to the following function definitions and/or
function calls: build_decl, objcp_start_struct, objcp_finish_struct,
start_struct, finish_struct, PUSH_FIELD, create_artificial_label,
cp_make_fname_decl, pushtag, implicitly_declare, c_make_fname_decl,
build_compound_literal, parser_xref_tag, resolve_overloaded_builtin,
do_case, c_finish_bc_stmt, build_compound_literal,
build_function_call.
* c-decl.c (build_compound_literal): Add location argument.
Make all diagnostic calls use location.
(start_struct): Same.
(finish_struct): Same.
(start_enum): Same.
(build_enumerator): Same.
(start_function): Same.
(grokdeclarator): Make all diagnostic calls use location.
(store_parm_decls_oldstyle): Same.
* c-typeck.c (build_function_call): Add location argument.
Make all diagnostic calls use location.
(do_case): Same.
(c_finish_bc_stmt): Same.
* tree-nested.c (get_trampoline_type): Add argument.
Pass location to build_decl.
(lookup_tramp_for_decl): Pass location to get_trampoline_type.
* rtl.h (RTL_LOCATION): New.
* c-common.c (c_add_case_label): Add location argument.
Make all diagnostic calls use location.
* c-common.h: Add location argument to make_fname_decl, do_case,
c_add_case_label, build_function_call, resolve_overloaded_builtin.
* c-parser.c (c_parser_enum_specifier): Rename ident_loc to enum_loc.
Set it appropriately for every case. Pass enum_loc to start_enum
call. Pass value_loc first to build_enumerator. Pass enum_loc to
parser_xref_tag.
(c_parser_struct_or_union_specifier): Save location. Use it for
start_struct, finish_struct, and parser_xref_tag.
gcc/testsuite/
* gcc.dg/old-style-prom-3.c: Add column info.
* gcc.dg/overflow-warn-1.c
* gcc.dg/gomp/pr27415.c
* gcc.dg/gomp/for-1.c: Same.
* gcc.dg/enum-compat-1.c: Same.
* gcc.dg/c99-tag-3.c: Same.
* gcc.dg/Wredundant-decls-2.c: Same.
* gcc.dg/func-ptr-conv-1.c: Same.
* gcc.dg/asm-wide-1.c: Same.
* gcc.dg/nofixed-point-2.c: Same.
* gcc.dg/cpp/line3.c: Same.
* gcc.dg/array-10.c: Same.
* gcc.dg/c99-vla-jump-1.c: Same.
* gcc.dg/pr20368-1.c: Same.
* gcc.dg/Wshadow-3.c: Same.
* gcc.dg/c90-const-expr-8.c: Same.
* gcc.dg/label-decl-2.c: Same.
* gcc.dg/dremf-type-compat-2.c: Same.
* gcc.dg/c90-const-expr-5.c: Same.
* gcc.dg/builtins-30.c: Same.
* gcc.dg/Warray-bounds.c: Same.
* gcc.dg/Wcxx-compat-2.c: Same.
* gcc.dg/tree-ssa/col-1.c: Same.
* gcc.dg/old-style-prom-2.c: Same.
* gcc.dg/cast-function-1.c: Same.
* gcc.dg/pr15698-1.c: Same.
* gcc.dg/dremf-type-compat-3.c: Same.
* gcc.dg/vla-8.c: Same.
* gcc.dg/gomp/pr27415.c: Move firstprivate diagnostics to correct
line.
* gcc.dg/label-decl-2.c: Move label diagnostic to correct line.
* gcc.dg/old-style-prom-3.c: Check for error on the correct line.
* gcc.dg/enum-compat-1.c: Same.
* gcc.dg/dremf-type-compat-2.c: Same.
* gcc.dg/old-style-prom-2.c: Same.
* gcc.dg/pr15698-1.c: Same.
* gcc.dg/pr20368-1.c: Same.
* gcc.dg/dremf-type-compat-3.c: Same.
* gcc.dg/builtins-30.c: Same. Test for columns.
gcc/objcp/
* objcp-decl.h (c_end_compound_stmt): New argument.
* objcp-decl.c (objcp_start_struct): Add argument.
(objcp_finish_struct): Same.
gcc/cp/
* typeck.c (cp_build_binary_op): Pass location to overflow_warning.
(build_modify_expr): New arg.
* semantics.c (finish_unary_op_expr): Pass location to
overflow_warning.
(handle_omp_for_class_iterator): Pass location to build_modify_expr.
* typeck.c (cxx_sizeof_or_alignof_type): Pass location to
c_sizeof_or_alignof_type.
(build_array_ref): New argument.
(build_compound_expr): Same.
(build_const_cast): Same.
(build_ptrmemfunc): Pass location to build_c_cast.
* init.c (avoid_placement_new_aliasing): Pass location to
build_stmt.
(build_vec_delete_1): Pass location to cp_build_modify_expr,
build_compound_expr.
* class.c (build_vtbl_ref_1): Pass location to build_array_ref.
* decl.c (poplevel): Pass location to c_build_bind_expr.
(finish_case_label): Pass location to build_case_label.
(finish_constructor_body): Same.
(finish_destructor_body): Pass location to build_stmt.
(cxx_maybe_build_cleanup): Same, but to build_compound_expr.
* call.c (build_new_op): Pass location to build_array_ref.
(build_x_va_arg): Pass location to build_va_arg.
* except.c (expand_end_catch_block): Pass location to
build_stmt.
* cp-tree.h (build_array_ref): New argument.
(build_compound_expr): Same.
(build_c_cast): Same.
* cp-gimplify.c (gimplify_if_stmt): Pass location on down.
(gimplify_switch_stmt): Same.
* typeck2.c (split_nonconstant_init_1): Same.
* pt.c (tsubst_copy): Same.
* semantics.c (add_decl_expr): Same.
(do_poplevel): Same.
(push_cleanup): Same.
(finish_goto_stmt): Same.
(finish_expr_stmt): Same.
(begin_if_stmt): Same.
(begin_while_stmt): Same.
(begin_do_stmt): Same.
(finish_return_stmt): Same.
(begin_for_stmt): Same.
(finish_break_stmt): Same.
(finish_continue_stmt): Same.
(begin_switch_stmt): Same.
(begin_try_block): Same.
(begin_handler): Same.
(finish_asm_stmt): Same.
(finish_label_stmt): Same.
(finish_stmt_expr_expr): Same.
(finalize_nrv_r): Same.
(finish_omp_atomic): Same.
* name-lookup.c (do_using_directive): Same.
* decl2.c (grok_array_decl): Same.
* parser.c (cp_parser_cast_expression): Same.
(cp_parser_selection_statement): Same.
(cp_parser_implicitly_scoped_statement): Same.
(cp_parser_objc_selector_expression): Same.
(cp_parser_objc_synchronized_statement): Same.
(cp_parser_objc_throw_statement): Same.
(cp_parser_omp_critical): Same.
(cp_parser_omp_master): Same.
* typeck.c (build_function_call): Add location argument.
* init.c: Add location argument to all build_decl calls.
* class.c: Same.
* method.c: Same.
* rtti.c: Same.
* tree.c: Same.
* pt.c: Same.
* semantics.c: Same.
* lex.c: Same.
* decl2.c: Same.
* cp-gimplify.c: Same.
* decl.c: Same.
(cp_make_fname_decl): Add location argument. Pass location ot
build_decl.
(finish_case_label): Same.
* cp-tree.h (finish_case_label): Add location argument.
* parser.c (cp_parser_label_for_labeled_statement): Pass location to
finish_case_label.
gcc/fortran/
* trans-array.c (gfc_trans_allocate_array_storage): Pass
location on down.
(gfc_trans_array_constructor_value): Same.
(gfc_trans_scalarized_loop_end): Same.
(gfc_conv_ss_startstride): Same.
(gfc_trans_g77_array): Same.
(gfc_trans_dummy_array_bias): Same.
(gfc_conv_array_parameter): Same.
(structure_alloc_comps): Same.
* trans-expr.c (gfc_conv_function_call): Same.
(fill_with_spaces): Same.
(gfc_trans_string_copy): Same.
(gfc_trans_scalar_assign): Same.
* trans-stmt.c (gfc_trans_goto): Same.
(gfc_trans_if_1): Same.
(gfc_trans_simple_do): Same.
(gfc_trans_do): Same.
(gfc_trans_do_while): Same.
(gfc_trans_logical_select): Same.
(gfc_trans_select): Same.
(gfc_trans_forall_loop): Same.
(gfc_trans_nested_forall_loop): Same.
(generate_loop_for_temp_to_lhs): Same.
(generate_loop_for_rhs_to_temp): Same.
(gfc_trans_forall_1): Same.
(gfc_trans_where_assign): Same.
(gfc_trans_where_3): Same.
(gfc_trans_allocate): Same.
* trans.c (gfc_finish_block): Same.
(gfc_trans_runtime_check): Same.
(gfc_call_malloc): Same.
(gfc_allocate_with_status): Same.
(gfc_call_free): Same.
(gfc_deallocate_with_status): Same.
(gfc_call_realloc): Same.
(gfc_trans_code): Same.
* trans-decl.c (gfc_init_default_dt): Same.
(gfc_generate_constructors): Same.
* trans-io.c (gfc_trans_io_runtime_check): Same.
* trans-intrinsic.c (gfc_conv_intrinsic_ctime): Same.
(gfc_conv_intrinsic_fdate): Same.
(gfc_conv_intrinsic_ttynam): Same.
(gfc_conv_intrinsic_minmax): Same.
(gfc_conv_intrinsic_minmax_char): Same.
(gfc_conv_intrinsic_anyall): Same.
(gfc_conv_intrinsic_count): Same.
(gfc_conv_intrinsic_arith): Same.
(gfc_conv_intrinsic_minmaxloc): Same.
(gfc_conv_intrinsic_minmaxval): Same.
(gfc_conv_intrinsic_rrspacing): Same.
(gfc_conv_intrinsic_array_transfer): Same.
(gfc_conv_intrinsic_trim): Same.
(gfc_conv_intrinsic_repeat): Same.
From-SVN: r148442
2009-06-13 00:06:47 +02:00
|
|
|
decl = build_decl (input_location,
|
|
|
|
VAR_DECL, get_identifier (buf), ptr_type_node);
|
2003-10-24 11:29:43 +02:00
|
|
|
TREE_STATIC (decl) = 1;
|
|
|
|
DECL_ARTIFICIAL (decl) = 1;
|
|
|
|
DECL_IGNORED_P (decl) = 1;
|
|
|
|
TREE_READONLY (decl) = 1;
|
|
|
|
TREE_THIS_VOLATILE (decl) = 0;
|
|
|
|
DECL_INITIAL (decl) = build_class_ref (type);
|
|
|
|
layout_decl (decl, 0);
|
|
|
|
pushdecl (decl);
|
2004-05-13 08:41:07 +02:00
|
|
|
exp = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (decl)), decl);
|
2003-10-24 11:29:43 +02:00
|
|
|
}
|
1998-10-12 14:43:53 +02:00
|
|
|
else
|
2003-08-20 19:27:56 +02:00
|
|
|
{
|
2003-11-20 04:34:59 +01:00
|
|
|
utf8_ref = build_utf8_ref (DECL_NAME (TYPE_NAME (type)));
|
|
|
|
name = IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (utf8_ref, 0)));
|
collect2.c (main, [...]): Fix for -Wc++-compat.
* collect2.c (main, add_to_list): Fix for -Wc++-compat.
* gcc.c (translate_options, init_spec, store_arg, read_specs,
add_to_obstack, file_at_path, find_a_file, execute,
add_preprocessor_option, add_assembler_option, add_linker_option,
process_command, insert_wrapper, do_option_spec, do_self_spec,
spec_path, do_spec_1, is_directory, main, used_arg,
getenv_spec_function): Likewise.
* tlink.c (symbol_hash_lookup, file_hash_lookup,
demangled_hash_lookup, symbol_push, file_push, frob_extension):
Likewise.
java:
* class.c (ident_subst, mangled_classname, unmangle_classname,
gen_indirect_dispatch_tables, add_method_1,
build_fieldref_cache_entry, make_local_function_alias,
layout_class, java_treetreehash_find, java_treetreehash_new,
split_qualified_name): Fix for -Wc++-compat.
* constants.c (set_constant_entry, cpool_for_class): Likewise.
* decl.c (make_binding_level, java_dup_lang_specific_decl,
start_java_method): Likewise.
* except.c (prepare_eh_table_type): Likewise.
* expr.c (type_assertion_hash, note_instructions): Likewise.
* java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC,
MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise.
* jcf-io.c (jcf_filbuf_from_stdio, opendir_in_zip, find_class):
Likewise.
* jcf-parse.c (reverse, java_read_sourcefilenames,
annotation_grow, rewrite_reflection_indexes, java_parse_file,
process_zip_dir): Likewise.
* jcf-path.c (add_entry, add_path, jcf_path_init,
jcf_path_extdirs_arg): Likewise.
* jcf-reader.c (jcf_parse_constant_pool): Likewise.
* jvgenmain.c (do_mangle_classname): Likewise.
* lang.c (put_decl_string): Likewise.
* verify-impl.c (make_state_copy, make_state, add_new_state):
Likewise.
objc:
* objc-act.c (setup_string_decl, objc_build_string_object,
hash_interface, eq_interface, objc_begin_try_stmt,
encode_method_prototype, build_ivar_list_initializer,
objc_build_encode_expr): Fix for -Wc++-compat.
From-SVN: r136980
2008-06-20 05:46:09 +02:00
|
|
|
buf = (char *) alloca (strlen (name) + 5);
|
2003-11-20 04:34:59 +01:00
|
|
|
sprintf (buf, "%s_ref", name);
|
java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt.
gcc/java/
* java-gimplify.c (java_gimplify_block): New argument to
build_empty_stmt.
* expr.c (force_evaluation_order): Same.
* typeck.c: Add location to build_decl or PUSH_FIELD calls.
* class.c: Same.
* decl.c: Same.
* jcf-parse.c: Same.
* constants.c: Same.
* resource.c: Same.
* except.c: Same.
* builtins.c: Same.
* expr.c: Same.
* java-tree.h (PUSH_FIELD): Add location field.
gcc/objc/
* objc-act.c (finish_var_decl): Pass location to finish_decl.
(objc_get_parm_info): Same.
(get_super_receiver): Same.
* objc-act.c (objc_build_component_ref): Pass location to
build_compound_ref.
(build_module_initializer_routine): Pass location to
c_end_compound_stmt.
(objc_generate_static_init_call): Pass location to build_stmt.
(build_typed_selector_reference): New location argument.
(build_selector_reference): Same.
(objc_substitute_decl): Pass location to build_array_ref.
(next_sjlj_build_try_catch_finally): Pass location to build_stmt.
(objc_begin_catch_clause): Same.
(objc_finish_try_stmt): Same.
(objc_finish_catch_clause): Pass location to c_end_compound_stmt.
(objc_build_throw_stmt): New argument.
(generate_shared_structures): Pass location to build_c_cast.
(objc_build_message_expr): Use local location.
(objc_finish_message_expr): Use input_location.
(build_objc_method_call): New argument.
(objc_build_selector_expr): Same.
(get_super_receiver): Pass location to build_c_cast,
build_modify_expr, build_compound_expr.
* objc-act.c: Add location to all calls to start_struct, build_decl,
finish_struct.
gcc/
* tree-pretty-print.c (dump_generic_node): Dump column numbers.
* gimple-pretty-print.c (dump_gimple_stmt): Same.
* gimplify.c (gimplify_modify_expr): Set location for GIMPLE_ASSIGNs
created.
* c-parser.c (c_parser_binary_expression): Use current column while
building binary operations.
* common.opt (fshow-column): Enable by default.
* tree-vrp.c (check_array_ref): Use warning_at.
(check_array_bounds): Use location from call back if expr has no
location.
* tree.h: Add location argument to maybe_fold_*.
* tree-ssa-ccp.c (ccp_fold): Pass location to maybe_fold_*.
(maybe_fold_offset_to_array_ref): Add location argument and use it.
(maybe_fold_offset_to_component_ref): Same.
(maybe_fold_offset_to_reference): Same.
(maybe_fold_offset_to_address): Same.
(maybe_fold_stmt_indirect): Same.
(maybe_fold_stmt_addition): Same.
(fold_stmt_r): Pass location to maybe_fold_*.
(fold_gimple_assign): Same.
* c-tree.h: Add location argument to finish_decl,
default_function_array_conversion, store_init_value.
* c-decl.c (define_label): Use error_at.
(c_make_fname_decl): Pass location to finish_decl.
(finish_decl): New location argument.
(build_compound_literal): Pass location to store_init_value.
(grokdeclarator): Pass location to finish_decl.
(grokfield): Same.
* c-typeck.c (array_to_pointer_conversion): New location argument.
(function_to_pointer_conversion): Same.
(default_function_array_conversion): Same.
(parser_build_unary_op): Pass location to overflow_warning.
(parser_build_binary_op): Same. Use warning_at.
(build_unary_op): Pass location to array_to_pointer_conversion.
(build_c_cast): Pass location to digest_init.
(build_modify_expr): New location argument.
(convert_for_assignment): Same.
(store_init_value): Same.
(digest_init): Same.
(output_init_element): Pass location to digest_init and
array_to_pointer_conversion.
(c_finish_return): Pass location to convert_for_assignment.
* gimplify.c (gimplify_conversion): Pass location to
maybe_fold_offset_to_address.
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Pass location
to maybe_fold_stmt_addition.
* c-omp.c (c_finish_omp_atomic): Pass new location to
build_modify_expr.
(c_finish_omp_for): Same.
* c-common.c (overflow_warning): New argument.
* c-common.h: New argument to build_modify_expr, overflow_warning.
* c-parser.c (c_parser_declaration_or_fndef): Pass location to
finish_decl.
(c_parser_initializer): Pass location to
default_function_array_conversion.
(c_parser_initelt): Same.
(c_parser_initval): Same.
(c_parser_asm_operands): Same.
(c_parser_expr_no_commas): Same. Pass location to build_modify_expr.
(c_parser_conditional_expression): Same.
(c_parser_binary_expression): Add location info to stack. Use it.
(c_parser_unary_expression): Pass location to
default_function_array_conversion, parser_build_unary_op,
build_indirect_ref, c_parser_postfix_expression_after_primary.
(c_parser_postfix_expression_after_primary): New location argument.
Use it.
(c_parser_expression_conv): Pass location to
default_function_array_conversion.
(c_parser_expr_list): Same.
(c_parser_omp_atomic): Same.
(c_parser_omp_for_loop): Same.
* c-tree.h: (struct c_declarator): Add comment to id_loc.
(build_array_declarator): New argument.
* c-decl.c (build_array_declarator): Add location argument.
(grokdeclarator): Set id_loc for cdk_array.
* c-parser.c (c_parser_direct_declarator_inner): Pass location to
build_array_declarator.
* tree.c (build_omp_clause): Add location argument.
* tree.h (OMP_CLAUSE_HAS_LOCATION): New macro.
(OMP_CLAUSE_LOCATION): New macro.
(struct tree_omp_clause): Add location field.
(build_omp_clause): Add argument.
* testsuite/gcc.dg/gomp/for-1.c: Fix column.
* cp/pt.c (tsubst_omp_for_iterator): Pass location to
build_omp_clause.
* cp/parser.c (cp_parser_omp_var_list_no_open): Same.
(cp_parser_omp_clause_collapse): Same.
(cp_parser_omp_clause_default): Same.
(cp_parser_omp_clause_if): Same.
(cp_parser_omp_clause_nowait): Same.
(cp_parser_omp_clause_num_threads): Same.
(cp_parser_omp_clause_ordered): Same.
(cp_parser_omp_clause_schedule): Same.
(cp_parser_omp_clause_untied): Same.
(cp_parser_omp_for_loop): Same.
(cp_parser_omp_parallel): Pass location to c_split_parallel_clauses.
* c-tree.h (c_start_case): Add location argument.
(c_process_expr_stmt): Same.
(c_finish_goto_*): Same.
* tree-parloops.c (initialize_reductions): Pass location to
build_omp_clause.
(create_parallel_loop): Same.
* fortran/trans-openmp.c (gfc_trans_omp_variable_list): Same.
(gfc_trans_omp_reduction_list): Same.
(gfc_trans_omp_clauses): Same.
(gfc_trans_omp_do): Same.
* c-typeck.c (c_finish_goto_label): Same.
(c_finish_goto_ptr): New location argument.
(c_start_case): Same.
(emit_side_effect_warnings): Same.
(c_process_expr_stmt): Same.
(c_finish_stmt_expr): Same.
(c_finish_omp_clauses): Use error_at instead of error.
* gimplify.c (gimplify_adjust_omp_clauses_1): Pass location to
build_omp_clause.
* c-omp.c (c_split_parallel_clauses): New location argument.
* tree-nested.c (convert_nonlocal_reference_stmt): Pass location
to build_omp_clause.
(convert_local_reference_stmt): Same.
(convert_gimple_call): Same.
* c-common.h (c_split_parallel_clauses): New argument.
* c-parser.c (c_parser_statement_after_labels): Pass location to
c_finish_goto_label.
(c_parser_switch_statement): Pass location to c_start_case.
(c_parser_for_statement): Pass location to c_finish_expr_stmt,
and c_process_expr_stmt.
(c_parser_omp_variable_list): Add location argument.
(c_parser_omp_clause_collapse): Pass location to
build_omp_clause.
(c_parser_omp_clause_default): Same.
(c_parser_omp_clause_if): Same.
(c_parser_omp_clause_num_threads): Same.
(-c_parser_omp_clause_ordered): Same.
(c_parser_omp_clause_reduction): Pass location to
c_parser_omp_variable_list.
(c_parser_omp_clause_schedule): Pass location to build_omp_clause.
(c_parser_omp_clause_untied): Same.
(c_parser_omp_for_loop): Pass location to c_process_expr_stmt.
(c_parser_omp_parallel): Pass location to
c_split_parallel_clauses.
* c-tree.h (check_for_loop_decls, undeclared_variable,
build_component_ref, build_array_ref, build_external_ref,
c_expr_sizeof_expr, c_expr_sizeof_type, parser_build_unary_op,
build_conditional_expr, build_compound_expr, c_cast_expr,
build_c_cast, build_asm_expr, c_end_compound_stmt, c_finish_stmt_expr,
c_finish_return, c_finish_omp_parallel, c_finish_omp_task): New
argument.
* c-semantics.c (build_stmt): Same.
(build_case_label): Same.
* c-decl.c (c_finish_incomplete_decl): Pass location on down.
(undeclared_variable): New argument.
(make_label): Same.
(lookup_label): Pass location on down.
(define_label): Same.
(finish_decl): Same.
(build_compound_literal): Same.
(finish_struct): Same.
(finish_function): Do not set location here.
(check_for_loop_decls): New argument.
* tree.c (save_expr): Set location.
(build_empty_stmt): New argument.
* tree.h (build_empty_stmt): New argument to build_empty_stmt.
(CAN_HAVE_LOCATION_P): Make sure we have a non empty node.
* builtins.c (gimplify_va_arg_expr): Use locations.
(expand_builtin_sync_operation): Same.
* c-typeck.c (build_component_ref): New argument.
(build_array_ref): Same.
(build_external_ref): Same.
(c_expr_sizeof_expr): Same.
(c_expr_sizeof_type): Same.
(parser_build_unary_op): Same.
(build_conditional_expr): Same.
(build_compound_expr): Pass location on down.
(build_compound_expr): New argument.
(build_c_cast): Same.
(c_cast_expr): Same.
(build_asm_expr): Same.
(c_finish_return): Same.
(c_process_expr_stmt): Pass location on down.
(c_finish_stmt_expr): New argument.
(push_clenaup): Same.
(c_finish_omp_parallel): Same.
(c_finish_omp_task): Same.
* gimplify.c (gimplify_call_expr): Pass location on down.
* c-omp.c (c_finish_omp_master): New argument.
(c_finish_omp_critical): Same.
(c_finish_omp_ordered): Same.
(c_finish_omp_barrier): Same.
(-c_finish_omp_taskwait): Same.
(c_finish_omp_atomic): Same.
(c_finish_omp_flush): Same.
* tree-inline.c (copy_tree_body_r): Pass location on down.
(inline_forbidden_p): Remove use of input_location.
* c-gimplify.c (c_build_bind_expr): New argument.
* c-common.c (c_common_truthvalue_conversion): Pass location on down.
(c_sizeof_or_alignof_type): New argument.
(c_alignof_expr): Same.
(build_va_arg): Same.
(c_add_case_label): Same.
* c-common.h (c_sizeof_or_alignof_type, c_alignof_expr,
c_sizeof, c_alignof, build_va_arg, build_stmt, build_case_label,
c_build_bind_expr, objc_build_selector_expr, objc_build_throw_stmt,
c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered,
c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush,
c_finish_omp_taskwait, c_finish_omp_for, c_split_parallel_clauses):
New argument.
* stub-objc.c (objc_build_selector_expr): Same.
(objc_build_throw_stmt): Same.
* c-parser.c (c_parser_declaration_or_fndef): Pass location on down.
(c_parser_initelt): Same.
(c_parser_compound_statement): Same.
(c_parser_compound_statement_nostart): Same.
(c_parser_label): Same.
(c_parser_statement_after_labels): Same.
(c_parser_if_body): Same.
(c_parser_else_body): Same.
(c_parser_if_statement): Same.
(c_parser_switch_statement): Same.
(c_parser_while_statement): Same.
(c_parser_do_statement): Same.
(c_parser_for_statement): Same.
(c_parser_asm_statement): Same.
(c_parser_conditional_expression): Same.
(c_parser_binary_expression): Same.
(c_parser_cast_expression): Same.
(c_parser_unary_expression): Same.
(c_parser_sizeof_expression): Same.
(c_parser_alignof_expression): Same.
(c_parser_postfix_expression): Same.
(c_parser_expression): Same.
(c_parser_objc_receiver): Same.
(c_parser_omp_variable_list): Same.
(c_parser_omp_structured_block): Same.
(c_parser_omp_atomic): New argument.
(c_parser_omp_barrier): Same.
(c_parser_omp_critical): Same.
(c_parser_omp_flush): Pass location on down.
(c_parser_omp_for_loop): New argument.
(c_parser_omp_for): Same.
(c_parser_omp_master): Same.
(c_parser_omp_ordered): Same.
(c_parser_omp_sections_scope): Same.
(c_parser_omp_sections): Same.
(c_parser_omp_parallel): Same.
(c_parser_omp_single): Same.
(c_parser_omp_task): Same.
(c_parser_omp_taskwait): Pass location on down.
(c_parser_omp_construct): Same.
(c_parser_omp_threadprivate): Same.
* dwarf2asm.c, targhooks.c, optabs.c, tree.c, tree.h, target.h,
builtins.c, omp-low.c, cgraphunit.c, tree-call-cdce.c,
tree-ssa-alias.c, gimple-low.c, c-tree.h, expr.c, tree-parloops.c,
c-decl.c, tree-eh.c, langhooks.c, function.c, stor-layout.c,
c-typeck.c, gimplify.c, c-pragma.c, expmed.c, except.c, coverage.c,
emit-rtl.c, cfgexpand.c, tree-mudflap.c, varasm.c, tree-nested.c,
rtl.h, tree-inline.c, tree-profile.c, c-common.c, c-common.h,
tree-switch-conversion.c, tree-cfg.c, ipa-struct-reorg.c, c-parser.c,
config/i386/i386.c, stmt.c:
Add location argument to the following function definitions and/or
function calls: build_decl, objcp_start_struct, objcp_finish_struct,
start_struct, finish_struct, PUSH_FIELD, create_artificial_label,
cp_make_fname_decl, pushtag, implicitly_declare, c_make_fname_decl,
build_compound_literal, parser_xref_tag, resolve_overloaded_builtin,
do_case, c_finish_bc_stmt, build_compound_literal,
build_function_call.
* c-decl.c (build_compound_literal): Add location argument.
Make all diagnostic calls use location.
(start_struct): Same.
(finish_struct): Same.
(start_enum): Same.
(build_enumerator): Same.
(start_function): Same.
(grokdeclarator): Make all diagnostic calls use location.
(store_parm_decls_oldstyle): Same.
* c-typeck.c (build_function_call): Add location argument.
Make all diagnostic calls use location.
(do_case): Same.
(c_finish_bc_stmt): Same.
* tree-nested.c (get_trampoline_type): Add argument.
Pass location to build_decl.
(lookup_tramp_for_decl): Pass location to get_trampoline_type.
* rtl.h (RTL_LOCATION): New.
* c-common.c (c_add_case_label): Add location argument.
Make all diagnostic calls use location.
* c-common.h: Add location argument to make_fname_decl, do_case,
c_add_case_label, build_function_call, resolve_overloaded_builtin.
* c-parser.c (c_parser_enum_specifier): Rename ident_loc to enum_loc.
Set it appropriately for every case. Pass enum_loc to start_enum
call. Pass value_loc first to build_enumerator. Pass enum_loc to
parser_xref_tag.
(c_parser_struct_or_union_specifier): Save location. Use it for
start_struct, finish_struct, and parser_xref_tag.
gcc/testsuite/
* gcc.dg/old-style-prom-3.c: Add column info.
* gcc.dg/overflow-warn-1.c
* gcc.dg/gomp/pr27415.c
* gcc.dg/gomp/for-1.c: Same.
* gcc.dg/enum-compat-1.c: Same.
* gcc.dg/c99-tag-3.c: Same.
* gcc.dg/Wredundant-decls-2.c: Same.
* gcc.dg/func-ptr-conv-1.c: Same.
* gcc.dg/asm-wide-1.c: Same.
* gcc.dg/nofixed-point-2.c: Same.
* gcc.dg/cpp/line3.c: Same.
* gcc.dg/array-10.c: Same.
* gcc.dg/c99-vla-jump-1.c: Same.
* gcc.dg/pr20368-1.c: Same.
* gcc.dg/Wshadow-3.c: Same.
* gcc.dg/c90-const-expr-8.c: Same.
* gcc.dg/label-decl-2.c: Same.
* gcc.dg/dremf-type-compat-2.c: Same.
* gcc.dg/c90-const-expr-5.c: Same.
* gcc.dg/builtins-30.c: Same.
* gcc.dg/Warray-bounds.c: Same.
* gcc.dg/Wcxx-compat-2.c: Same.
* gcc.dg/tree-ssa/col-1.c: Same.
* gcc.dg/old-style-prom-2.c: Same.
* gcc.dg/cast-function-1.c: Same.
* gcc.dg/pr15698-1.c: Same.
* gcc.dg/dremf-type-compat-3.c: Same.
* gcc.dg/vla-8.c: Same.
* gcc.dg/gomp/pr27415.c: Move firstprivate diagnostics to correct
line.
* gcc.dg/label-decl-2.c: Move label diagnostic to correct line.
* gcc.dg/old-style-prom-3.c: Check for error on the correct line.
* gcc.dg/enum-compat-1.c: Same.
* gcc.dg/dremf-type-compat-2.c: Same.
* gcc.dg/old-style-prom-2.c: Same.
* gcc.dg/pr15698-1.c: Same.
* gcc.dg/pr20368-1.c: Same.
* gcc.dg/dremf-type-compat-3.c: Same.
* gcc.dg/builtins-30.c: Same. Test for columns.
gcc/objcp/
* objcp-decl.h (c_end_compound_stmt): New argument.
* objcp-decl.c (objcp_start_struct): Add argument.
(objcp_finish_struct): Same.
gcc/cp/
* typeck.c (cp_build_binary_op): Pass location to overflow_warning.
(build_modify_expr): New arg.
* semantics.c (finish_unary_op_expr): Pass location to
overflow_warning.
(handle_omp_for_class_iterator): Pass location to build_modify_expr.
* typeck.c (cxx_sizeof_or_alignof_type): Pass location to
c_sizeof_or_alignof_type.
(build_array_ref): New argument.
(build_compound_expr): Same.
(build_const_cast): Same.
(build_ptrmemfunc): Pass location to build_c_cast.
* init.c (avoid_placement_new_aliasing): Pass location to
build_stmt.
(build_vec_delete_1): Pass location to cp_build_modify_expr,
build_compound_expr.
* class.c (build_vtbl_ref_1): Pass location to build_array_ref.
* decl.c (poplevel): Pass location to c_build_bind_expr.
(finish_case_label): Pass location to build_case_label.
(finish_constructor_body): Same.
(finish_destructor_body): Pass location to build_stmt.
(cxx_maybe_build_cleanup): Same, but to build_compound_expr.
* call.c (build_new_op): Pass location to build_array_ref.
(build_x_va_arg): Pass location to build_va_arg.
* except.c (expand_end_catch_block): Pass location to
build_stmt.
* cp-tree.h (build_array_ref): New argument.
(build_compound_expr): Same.
(build_c_cast): Same.
* cp-gimplify.c (gimplify_if_stmt): Pass location on down.
(gimplify_switch_stmt): Same.
* typeck2.c (split_nonconstant_init_1): Same.
* pt.c (tsubst_copy): Same.
* semantics.c (add_decl_expr): Same.
(do_poplevel): Same.
(push_cleanup): Same.
(finish_goto_stmt): Same.
(finish_expr_stmt): Same.
(begin_if_stmt): Same.
(begin_while_stmt): Same.
(begin_do_stmt): Same.
(finish_return_stmt): Same.
(begin_for_stmt): Same.
(finish_break_stmt): Same.
(finish_continue_stmt): Same.
(begin_switch_stmt): Same.
(begin_try_block): Same.
(begin_handler): Same.
(finish_asm_stmt): Same.
(finish_label_stmt): Same.
(finish_stmt_expr_expr): Same.
(finalize_nrv_r): Same.
(finish_omp_atomic): Same.
* name-lookup.c (do_using_directive): Same.
* decl2.c (grok_array_decl): Same.
* parser.c (cp_parser_cast_expression): Same.
(cp_parser_selection_statement): Same.
(cp_parser_implicitly_scoped_statement): Same.
(cp_parser_objc_selector_expression): Same.
(cp_parser_objc_synchronized_statement): Same.
(cp_parser_objc_throw_statement): Same.
(cp_parser_omp_critical): Same.
(cp_parser_omp_master): Same.
* typeck.c (build_function_call): Add location argument.
* init.c: Add location argument to all build_decl calls.
* class.c: Same.
* method.c: Same.
* rtti.c: Same.
* tree.c: Same.
* pt.c: Same.
* semantics.c: Same.
* lex.c: Same.
* decl2.c: Same.
* cp-gimplify.c: Same.
* decl.c: Same.
(cp_make_fname_decl): Add location argument. Pass location ot
build_decl.
(finish_case_label): Same.
* cp-tree.h (finish_case_label): Add location argument.
* parser.c (cp_parser_label_for_labeled_statement): Pass location to
finish_case_label.
gcc/fortran/
* trans-array.c (gfc_trans_allocate_array_storage): Pass
location on down.
(gfc_trans_array_constructor_value): Same.
(gfc_trans_scalarized_loop_end): Same.
(gfc_conv_ss_startstride): Same.
(gfc_trans_g77_array): Same.
(gfc_trans_dummy_array_bias): Same.
(gfc_conv_array_parameter): Same.
(structure_alloc_comps): Same.
* trans-expr.c (gfc_conv_function_call): Same.
(fill_with_spaces): Same.
(gfc_trans_string_copy): Same.
(gfc_trans_scalar_assign): Same.
* trans-stmt.c (gfc_trans_goto): Same.
(gfc_trans_if_1): Same.
(gfc_trans_simple_do): Same.
(gfc_trans_do): Same.
(gfc_trans_do_while): Same.
(gfc_trans_logical_select): Same.
(gfc_trans_select): Same.
(gfc_trans_forall_loop): Same.
(gfc_trans_nested_forall_loop): Same.
(generate_loop_for_temp_to_lhs): Same.
(generate_loop_for_rhs_to_temp): Same.
(gfc_trans_forall_1): Same.
(gfc_trans_where_assign): Same.
(gfc_trans_where_3): Same.
(gfc_trans_allocate): Same.
* trans.c (gfc_finish_block): Same.
(gfc_trans_runtime_check): Same.
(gfc_call_malloc): Same.
(gfc_allocate_with_status): Same.
(gfc_call_free): Same.
(gfc_deallocate_with_status): Same.
(gfc_call_realloc): Same.
(gfc_trans_code): Same.
* trans-decl.c (gfc_init_default_dt): Same.
(gfc_generate_constructors): Same.
* trans-io.c (gfc_trans_io_runtime_check): Same.
* trans-intrinsic.c (gfc_conv_intrinsic_ctime): Same.
(gfc_conv_intrinsic_fdate): Same.
(gfc_conv_intrinsic_ttynam): Same.
(gfc_conv_intrinsic_minmax): Same.
(gfc_conv_intrinsic_minmax_char): Same.
(gfc_conv_intrinsic_anyall): Same.
(gfc_conv_intrinsic_count): Same.
(gfc_conv_intrinsic_arith): Same.
(gfc_conv_intrinsic_minmaxloc): Same.
(gfc_conv_intrinsic_minmaxval): Same.
(gfc_conv_intrinsic_rrspacing): Same.
(gfc_conv_intrinsic_array_transfer): Same.
(gfc_conv_intrinsic_trim): Same.
(gfc_conv_intrinsic_repeat): Same.
From-SVN: r148442
2009-06-13 00:06:47 +02:00
|
|
|
decl = build_decl (input_location,
|
|
|
|
VAR_DECL, get_identifier (buf), utf8const_ptr_type);
|
2003-08-20 19:27:56 +02:00
|
|
|
TREE_STATIC (decl) = 1;
|
|
|
|
DECL_ARTIFICIAL (decl) = 1;
|
|
|
|
DECL_IGNORED_P (decl) = 1;
|
|
|
|
TREE_READONLY (decl) = 1;
|
|
|
|
TREE_THIS_VOLATILE (decl) = 0;
|
|
|
|
layout_decl (decl, 0);
|
|
|
|
pushdecl (decl);
|
2003-10-24 11:29:43 +02:00
|
|
|
exp = build1 (ADDR_EXPR, build_pointer_type (utf8const_ptr_type), decl);
|
re PR java/12755 (Binary Compatibility: Resolving static methods and classes is not thread safe)
2004-01-09 Andrew Haley <aph@redhat.com>
PR java/12755:
* parse.y (java_fix_constructors): Set output_class.
(java_reorder_fields): Likewise.
(java_layout_classes): Likewise.
(java_expand_classes): Generate indirect dispatch tables.
(java_expand_classes): Set output_class.
(java_finish_classes): Likewise.
* lang.c (java_init): Turn on always_initialize_class_p if we're
using indirect dis[atch.
(java_decl_ok_for_sibcall): Use output_class, not current_class.
(java_get_callee_fndecl): Use class local atable.
* jcf-parse.c
(always_initialize_class_p): Decl moved to java-tree.h.
(HANDLE_CLASS_INFO): Set output_class.
(read_class): Likewise.
(parse_class_file): Call gen_indirect_dispatch_tables.
(parse_zip_file_entries): Set output_class.
(java_parse_file): Set output_class. Don't emit symbol tables.
* java-tree.h (output_class): New.
Remove global declarations for otable, atable, and ctable.
(always_initialize_class_p): moved here from decl.c.
(DECL_OWNER): New.
(TYPE_ATABLE_METHODS, TYPE_ATABLE_SYMS_DECL, TYPE_ATABLE_DECL,
TYPE_OTABLE_METHODS, TYPE_OTABLE_SYMS_DECL, TYPE_OTABLE_DECL,
TYPE_CTABLE_DECL, TYPE_CATCH_CLASSES): New.
(struct lang_type): Add otable_methods, otable_decl,
otable_syms_decl, atable_methods, atable_decl, atable_syms_decl,
ctable_decl, catch_classes, type_to_runtime_map.
* expr.c (build_field_ref): Make otable, atable, and ctable class
local rather than global.
(build_known_method_ref): Likewise.
(build_invokeinterface): Likewise.
(java_expand_expr): Pass runtime type (rather than actual type) to
expand_start_catch.
* except.c (prepare_eh_table_type): Create TYPE_TO_RUNTIME_MAP for
this class. Look up each class in that map to delete duplicates.
(expand_end_java_handler): Pass runtime type (rather than actual
type) to expand_start_catch.
* decl.c: (always_initialize_class_p): Decl moved to java-tree.h.
(do_nothing): New.
(java_init_decl_processing): Rearrange things. Remove global
declarations of otable, atable, and ctable.
(java_init_decl_processing): Make lang_eh_runtime_type do_nothing.
(java_expand_body): Set output_class.
* constants.c (build_constant_data_ref): Use output_class, not
current_class.
(alloc_name_constant): Likewise.
* class.c (gen_indirect_dispatch_tables): New.
(build_class_ref): Generate hard reference to superclass, even if
using indirect dispatch.
(build_static_field_ref): Use class local atable.
(make_class_data): Generate hard reference to superclass, even if
using indirect dispatch.
Generate symbolic references to interfaces when using indirect
dispatch.
(make_class_data): Emit otable, atable, and ctable.
Make otable, atable, and ctable class local rather than global.
(emit_catch_table): Make otable, atable, and ctable class local
rather than global.
From-SVN: r75590
2004-01-09 18:08:44 +01:00
|
|
|
TYPE_CATCH_CLASSES (output_class) =
|
|
|
|
tree_cons (NULL, make_catch_class_record (exp, utf8_ref),
|
|
|
|
TYPE_CATCH_CLASSES (output_class));
|
2003-08-20 19:27:56 +02:00
|
|
|
}
|
re PR java/12755 (Binary Compatibility: Resolving static methods and classes is not thread safe)
2004-01-09 Andrew Haley <aph@redhat.com>
PR java/12755:
* parse.y (java_fix_constructors): Set output_class.
(java_reorder_fields): Likewise.
(java_layout_classes): Likewise.
(java_expand_classes): Generate indirect dispatch tables.
(java_expand_classes): Set output_class.
(java_finish_classes): Likewise.
* lang.c (java_init): Turn on always_initialize_class_p if we're
using indirect dis[atch.
(java_decl_ok_for_sibcall): Use output_class, not current_class.
(java_get_callee_fndecl): Use class local atable.
* jcf-parse.c
(always_initialize_class_p): Decl moved to java-tree.h.
(HANDLE_CLASS_INFO): Set output_class.
(read_class): Likewise.
(parse_class_file): Call gen_indirect_dispatch_tables.
(parse_zip_file_entries): Set output_class.
(java_parse_file): Set output_class. Don't emit symbol tables.
* java-tree.h (output_class): New.
Remove global declarations for otable, atable, and ctable.
(always_initialize_class_p): moved here from decl.c.
(DECL_OWNER): New.
(TYPE_ATABLE_METHODS, TYPE_ATABLE_SYMS_DECL, TYPE_ATABLE_DECL,
TYPE_OTABLE_METHODS, TYPE_OTABLE_SYMS_DECL, TYPE_OTABLE_DECL,
TYPE_CTABLE_DECL, TYPE_CATCH_CLASSES): New.
(struct lang_type): Add otable_methods, otable_decl,
otable_syms_decl, atable_methods, atable_decl, atable_syms_decl,
ctable_decl, catch_classes, type_to_runtime_map.
* expr.c (build_field_ref): Make otable, atable, and ctable class
local rather than global.
(build_known_method_ref): Likewise.
(build_invokeinterface): Likewise.
(java_expand_expr): Pass runtime type (rather than actual type) to
expand_start_catch.
* except.c (prepare_eh_table_type): Create TYPE_TO_RUNTIME_MAP for
this class. Look up each class in that map to delete duplicates.
(expand_end_java_handler): Pass runtime type (rather than actual
type) to expand_start_catch.
* decl.c: (always_initialize_class_p): Decl moved to java-tree.h.
(do_nothing): New.
(java_init_decl_processing): Rearrange things. Remove global
declarations of otable, atable, and ctable.
(java_init_decl_processing): Make lang_eh_runtime_type do_nothing.
(java_expand_body): Set output_class.
* constants.c (build_constant_data_ref): Use output_class, not
current_class.
(alloc_name_constant): Likewise.
* class.c (gen_indirect_dispatch_tables): New.
(build_class_ref): Generate hard reference to superclass, even if
using indirect dispatch.
(build_static_field_ref): Use class local atable.
(make_class_data): Generate hard reference to superclass, even if
using indirect dispatch.
Generate symbolic references to interfaces when using indirect
dispatch.
(make_class_data): Emit otable, atable, and ctable.
Make otable, atable, and ctable class local rather than global.
(emit_catch_table): Make otable, atable, and ctable class local
rather than global.
From-SVN: r75590
2004-01-09 18:08:44 +01:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
exp = convert (ptr_type_node, exp);
|
|
|
|
|
re PR java/12755 (Binary Compatibility: Resolving static methods and classes is not thread safe)
2004-01-09 Andrew Haley <aph@redhat.com>
PR java/12755:
* parse.y (java_fix_constructors): Set output_class.
(java_reorder_fields): Likewise.
(java_layout_classes): Likewise.
(java_expand_classes): Generate indirect dispatch tables.
(java_expand_classes): Set output_class.
(java_finish_classes): Likewise.
* lang.c (java_init): Turn on always_initialize_class_p if we're
using indirect dis[atch.
(java_decl_ok_for_sibcall): Use output_class, not current_class.
(java_get_callee_fndecl): Use class local atable.
* jcf-parse.c
(always_initialize_class_p): Decl moved to java-tree.h.
(HANDLE_CLASS_INFO): Set output_class.
(read_class): Likewise.
(parse_class_file): Call gen_indirect_dispatch_tables.
(parse_zip_file_entries): Set output_class.
(java_parse_file): Set output_class. Don't emit symbol tables.
* java-tree.h (output_class): New.
Remove global declarations for otable, atable, and ctable.
(always_initialize_class_p): moved here from decl.c.
(DECL_OWNER): New.
(TYPE_ATABLE_METHODS, TYPE_ATABLE_SYMS_DECL, TYPE_ATABLE_DECL,
TYPE_OTABLE_METHODS, TYPE_OTABLE_SYMS_DECL, TYPE_OTABLE_DECL,
TYPE_CTABLE_DECL, TYPE_CATCH_CLASSES): New.
(struct lang_type): Add otable_methods, otable_decl,
otable_syms_decl, atable_methods, atable_decl, atable_syms_decl,
ctable_decl, catch_classes, type_to_runtime_map.
* expr.c (build_field_ref): Make otable, atable, and ctable class
local rather than global.
(build_known_method_ref): Likewise.
(build_invokeinterface): Likewise.
(java_expand_expr): Pass runtime type (rather than actual type) to
expand_start_catch.
* except.c (prepare_eh_table_type): Create TYPE_TO_RUNTIME_MAP for
this class. Look up each class in that map to delete duplicates.
(expand_end_java_handler): Pass runtime type (rather than actual
type) to expand_start_catch.
* decl.c: (always_initialize_class_p): Decl moved to java-tree.h.
(do_nothing): New.
(java_init_decl_processing): Rearrange things. Remove global
declarations of otable, atable, and ctable.
(java_init_decl_processing): Make lang_eh_runtime_type do_nothing.
(java_expand_body): Set output_class.
* constants.c (build_constant_data_ref): Use output_class, not
current_class.
(alloc_name_constant): Likewise.
* class.c (gen_indirect_dispatch_tables): New.
(build_class_ref): Generate hard reference to superclass, even if
using indirect dispatch.
(build_static_field_ref): Use class local atable.
(make_class_data): Generate hard reference to superclass, even if
using indirect dispatch.
Generate symbolic references to interfaces when using indirect
dispatch.
(make_class_data): Emit otable, atable, and ctable.
Make otable, atable, and ctable class local rather than global.
(emit_catch_table): Make otable, atable, and ctable class local
rather than global.
From-SVN: r75590
2004-01-09 18:08:44 +01:00
|
|
|
*slot = tree_cons (type, exp, NULL_TREE);
|
|
|
|
|
1998-10-12 14:43:53 +02:00
|
|
|
return exp;
|
|
|
|
}
|
|
|
|
|
re PR java/12755 (Binary Compatibility: Resolving static methods and classes is not thread safe)
2004-01-09 Andrew Haley <aph@redhat.com>
PR java/12755:
* parse.y (java_fix_constructors): Set output_class.
(java_reorder_fields): Likewise.
(java_layout_classes): Likewise.
(java_expand_classes): Generate indirect dispatch tables.
(java_expand_classes): Set output_class.
(java_finish_classes): Likewise.
* lang.c (java_init): Turn on always_initialize_class_p if we're
using indirect dis[atch.
(java_decl_ok_for_sibcall): Use output_class, not current_class.
(java_get_callee_fndecl): Use class local atable.
* jcf-parse.c
(always_initialize_class_p): Decl moved to java-tree.h.
(HANDLE_CLASS_INFO): Set output_class.
(read_class): Likewise.
(parse_class_file): Call gen_indirect_dispatch_tables.
(parse_zip_file_entries): Set output_class.
(java_parse_file): Set output_class. Don't emit symbol tables.
* java-tree.h (output_class): New.
Remove global declarations for otable, atable, and ctable.
(always_initialize_class_p): moved here from decl.c.
(DECL_OWNER): New.
(TYPE_ATABLE_METHODS, TYPE_ATABLE_SYMS_DECL, TYPE_ATABLE_DECL,
TYPE_OTABLE_METHODS, TYPE_OTABLE_SYMS_DECL, TYPE_OTABLE_DECL,
TYPE_CTABLE_DECL, TYPE_CATCH_CLASSES): New.
(struct lang_type): Add otable_methods, otable_decl,
otable_syms_decl, atable_methods, atable_decl, atable_syms_decl,
ctable_decl, catch_classes, type_to_runtime_map.
* expr.c (build_field_ref): Make otable, atable, and ctable class
local rather than global.
(build_known_method_ref): Likewise.
(build_invokeinterface): Likewise.
(java_expand_expr): Pass runtime type (rather than actual type) to
expand_start_catch.
* except.c (prepare_eh_table_type): Create TYPE_TO_RUNTIME_MAP for
this class. Look up each class in that map to delete duplicates.
(expand_end_java_handler): Pass runtime type (rather than actual
type) to expand_start_catch.
* decl.c: (always_initialize_class_p): Decl moved to java-tree.h.
(do_nothing): New.
(java_init_decl_processing): Rearrange things. Remove global
declarations of otable, atable, and ctable.
(java_init_decl_processing): Make lang_eh_runtime_type do_nothing.
(java_expand_body): Set output_class.
* constants.c (build_constant_data_ref): Use output_class, not
current_class.
(alloc_name_constant): Likewise.
* class.c (gen_indirect_dispatch_tables): New.
(build_class_ref): Generate hard reference to superclass, even if
using indirect dispatch.
(build_static_field_ref): Use class local atable.
(make_class_data): Generate hard reference to superclass, even if
using indirect dispatch.
Generate symbolic references to interfaces when using indirect
dispatch.
(make_class_data): Emit otable, atable, and ctable.
Make otable, atable, and ctable class local rather than global.
(emit_catch_table): Make otable, atable, and ctable class local
rather than global.
From-SVN: r75590
2004-01-09 18:08:44 +01:00
|
|
|
static int
|
|
|
|
expand_catch_class (void **entry, void *x ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry;
|
2004-05-13 08:41:07 +02:00
|
|
|
tree addr = TREE_VALUE ((tree)ite->value);
|
|
|
|
tree decl;
|
|
|
|
STRIP_NOPS (addr);
|
|
|
|
decl = TREE_OPERAND (addr, 0);
|
2004-08-05 07:52:01 +02:00
|
|
|
rest_of_decl_compilation (decl, global_bindings_p (), 0);
|
re PR java/12755 (Binary Compatibility: Resolving static methods and classes is not thread safe)
2004-01-09 Andrew Haley <aph@redhat.com>
PR java/12755:
* parse.y (java_fix_constructors): Set output_class.
(java_reorder_fields): Likewise.
(java_layout_classes): Likewise.
(java_expand_classes): Generate indirect dispatch tables.
(java_expand_classes): Set output_class.
(java_finish_classes): Likewise.
* lang.c (java_init): Turn on always_initialize_class_p if we're
using indirect dis[atch.
(java_decl_ok_for_sibcall): Use output_class, not current_class.
(java_get_callee_fndecl): Use class local atable.
* jcf-parse.c
(always_initialize_class_p): Decl moved to java-tree.h.
(HANDLE_CLASS_INFO): Set output_class.
(read_class): Likewise.
(parse_class_file): Call gen_indirect_dispatch_tables.
(parse_zip_file_entries): Set output_class.
(java_parse_file): Set output_class. Don't emit symbol tables.
* java-tree.h (output_class): New.
Remove global declarations for otable, atable, and ctable.
(always_initialize_class_p): moved here from decl.c.
(DECL_OWNER): New.
(TYPE_ATABLE_METHODS, TYPE_ATABLE_SYMS_DECL, TYPE_ATABLE_DECL,
TYPE_OTABLE_METHODS, TYPE_OTABLE_SYMS_DECL, TYPE_OTABLE_DECL,
TYPE_CTABLE_DECL, TYPE_CATCH_CLASSES): New.
(struct lang_type): Add otable_methods, otable_decl,
otable_syms_decl, atable_methods, atable_decl, atable_syms_decl,
ctable_decl, catch_classes, type_to_runtime_map.
* expr.c (build_field_ref): Make otable, atable, and ctable class
local rather than global.
(build_known_method_ref): Likewise.
(build_invokeinterface): Likewise.
(java_expand_expr): Pass runtime type (rather than actual type) to
expand_start_catch.
* except.c (prepare_eh_table_type): Create TYPE_TO_RUNTIME_MAP for
this class. Look up each class in that map to delete duplicates.
(expand_end_java_handler): Pass runtime type (rather than actual
type) to expand_start_catch.
* decl.c: (always_initialize_class_p): Decl moved to java-tree.h.
(do_nothing): New.
(java_init_decl_processing): Rearrange things. Remove global
declarations of otable, atable, and ctable.
(java_init_decl_processing): Make lang_eh_runtime_type do_nothing.
(java_expand_body): Set output_class.
* constants.c (build_constant_data_ref): Use output_class, not
current_class.
(alloc_name_constant): Likewise.
* class.c (gen_indirect_dispatch_tables): New.
(build_class_ref): Generate hard reference to superclass, even if
using indirect dispatch.
(build_static_field_ref): Use class local atable.
(make_class_data): Generate hard reference to superclass, even if
using indirect dispatch.
Generate symbolic references to interfaces when using indirect
dispatch.
(make_class_data): Emit otable, atable, and ctable.
Make otable, atable, and ctable class local rather than global.
(emit_catch_table): Make otable, atable, and ctable class local
rather than global.
From-SVN: r75590
2004-01-09 18:08:44 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For every class in the TYPE_TO_RUNTIME_MAP, expand the
|
|
|
|
corresponding object that is used by the runtime type matcher. */
|
|
|
|
|
|
|
|
void
|
|
|
|
java_expand_catch_classes (tree this_class)
|
|
|
|
{
|
|
|
|
if (TYPE_TO_RUNTIME_MAP (this_class))
|
|
|
|
htab_traverse
|
|
|
|
(TYPE_TO_RUNTIME_MAP (this_class),
|
|
|
|
expand_catch_class, NULL);
|
|
|
|
}
|
2001-03-28 13:04:51 +02:00
|
|
|
|
2009-09-14 21:18:58 +02:00
|
|
|
/* Build and push the variable that will hold the exception object
|
|
|
|
within this function. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
build_exception_object_var (void)
|
|
|
|
{
|
|
|
|
tree decl = DECL_FUNCTION_EXC_OBJ (current_function_decl);
|
|
|
|
if (decl == NULL)
|
|
|
|
{
|
|
|
|
decl = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
|
|
|
|
VAR_DECL, get_identifier ("#exc_obj"), ptr_type_node);
|
|
|
|
DECL_IGNORED_P (decl) = 1;
|
|
|
|
DECL_ARTIFICIAL (decl) = 1;
|
|
|
|
|
|
|
|
DECL_FUNCTION_EXC_OBJ (current_function_decl) = decl;
|
|
|
|
pushdecl_function_level (decl);
|
|
|
|
}
|
|
|
|
return decl;
|
|
|
|
}
|
|
|
|
|
2001-03-28 13:04:51 +02:00
|
|
|
/* Build a reference to the jthrowable object being carried in the
|
|
|
|
exception header. */
|
|
|
|
|
|
|
|
tree
|
2003-01-12 03:14:56 +01:00
|
|
|
build_exception_object_ref (tree type)
|
2001-03-28 13:04:51 +02:00
|
|
|
{
|
|
|
|
tree obj;
|
|
|
|
|
|
|
|
/* Java only passes object via pointer and doesn't require adjusting.
|
|
|
|
The java object is immediately before the generic exception header. */
|
2009-09-14 21:18:58 +02:00
|
|
|
obj = build_exception_object_var ();
|
|
|
|
obj = fold_convert (build_pointer_type (type), obj);
|
[multiple changes]
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
Zdenek Dvorak <dvorakz@suse.cz>
Richard Guenther <rguenther@suse.de>
Kaz Kojima <kkojima@gcc.gnu.org>
* tree-vrp.c (compare_values_warnv): Convert val2 to
the type of val1.
(extract_range_from_assert): Create
POINTER_PLUS_EXPR for pointer types.
(extract_range_from_binary_expr): Handle
only POINTER_PLUS_EXPR, MIN_EXPR, and MAX_EXPR
for pointer types.
* doc/c-tree.texi (POINTER_PLUS_EXPR): Document.
* tree-ssa-loop-niter.c (split_to_var_and_offset): Handle
POINTER_PLUS_EXPR as PLUS_EXPR.
(number_of_iterations_lt_to_ne):
For pointer types, use sizetype when
creating MINUS_EXPR/PLUS_EXPRs.
(assert_loop_rolls_lt): For pointer types, use sizetype when
creating MINUS_EXPR/PLUS_EXPRs.
(number_of_iterations_le): Likewise.
(expand_simple_operations): POINTER_PLUS_EXPR are simple also.
(derive_constant_upper_bound): Handle POINTER_PLUS_EXPR just
like PLUS_EXPR and MINUS_EXPR.
* tree-pretty-print.c (dump_generic_node): Handle
POINTER_PLUS_EXPR.
(op_prio): Likewise.
(op_symbol_1): Likewise.
* optabs.c (optab_for_tree_code): Likewise.
* tree-ssa-loop-manip.c (create_iv): Handle pointer base
specially.
* tree-tailcall.c (process_assignment): Mention
POINTER_PLUS_EXPR in a TODO comment.
* tree.c (build2_stat): Assert when trying to use PLUS_EXPR or
MINUS_EXPR with a pointer. Also assert for POINTER_PLUS_EXPR
not used with a pointer and an integer type.
* tree-scalar-evolution.c (add_to_evolution_1): Convert the
increment using chrec_convert_rhs instead of chrec_convert.
(follow_ssa_edge_in_rhs): Handle POINTER_PLUS_EXPR like
PLUS_EXPR except for the right hand side's type will be
sizetype.
(interpret_rhs_modify_stmt): Handle POINTER_PLUS_EXPR.
(fold_used_pointer_cast): Kill.
(pointer_offset_p): Kill.
(fold_used_pointer): Kill.
(pointer_used_p): Kill.
(analyze_scalar_evolution_1 <case GIMPLE_MODIFY_STMT>): Don't
call fold_used_pointer.
(instantiate_parameters_1): Convert the increment
using chrec_convert_rhs instead of chrec_convert.
Handle POINTER_PLUS_EXPR as PLUS_EXPR.
* builtins.c (get_pointer_alignment): Handle POINTER_PLUS_EXPR
instead of PLUS_EXPR.
(expand_builtin_strcat): Create a POINTER_PLUS_EXPR instead of
PLUS_EXPR for pointers.
(std_gimplify_va_arg_expr): Likewise.
(fold_builtin_memory_op): Likewise.
(fold_builtin_strstr): Likewise.
(fold_builtin_strchr): Likewise.
(fold_builtin_strrchr): Likewise.
(fold_builtin_strpbrk): Likewise.
(expand_builtin_memory_chk): Likewise.
(fold_builtin_memory_chk): Likewise.
(std_expand_builtin_va_start): Use
sizetype for the call to make_tree and then convert
to the pointer type.
(fold_builtin_memchr): Use POINTER_PLUS_EXPR
instead of PLUS_EXPR for adding to a pointer.
(std_gimplify_va_arg_expr): Use fold_build2 for
the creating of POINTER_PLUS_EXPR. For the BIT_AND_EXPR, cast
the operands to sizetype first and then cast the BIT_AND_EXPR
back to the pointer type.
* fold-const.c (build_range_check): Handle pointer types
specially.
(extract_array_ref): Look for POINTER_PLUS_EXPR instead
of PLUS_EXPR's. Make sure the offset is converted to
sizetype.
(try_move_mult_to_index): Strip the NOPs from the offset.
Remove code argument and replace all uses with PLUS_EXPR.
(fold_to_nonsharp_ineq_using_bound): Handle pointer types
specially. Don't use a pointer type for MINUS_EXPR.
(fold_unary): Handle for (T1)(X op Y),
only p+ as that is the only as that can be handled for
binary operators now.
(fold_binary <case POINTER_PLUS_EXPR>): Add folding of
POINTER_PLUS_EXPR.
<case PLUS_EXPR>: Add folding of PTR+INT into
PTR p+ INT.
Don't call try_move_mult_to_index.
<case MINUS_EXPR>: Fold (PTR0 p+ A) - (PTR1 p+ B)
into (PTR0 - PTR1) + (A - B). Fold (PTR0 p+ A) - PTR1 into
(PTR0 - PTR1) + A iff (PTR0 - PTR1) simplifies.
Don't call try_move_mult_to_index.
(tree_expr_nonnegative_warnv_p): Handle POINTER_PLUS_EXPR.
(tree_expr_nonzero_p): Likewise.
(fold_indirect_ref_1): Look at POINTER_PLUS_EXPR instead
of PLUS_EXPR for the complex expression folding.
* tree-chrec.c (chrec_fold_plus_poly_poly): If the
first chrec is a pointer type, then the second should
be sizetype and not the first's type.
For POINTER_PLUS_EXPR, use a different right hand side type.
Handle POINTER_PLUS_EXPR like PLUS_EXPR.
(chrec_fold_plus_1): For POINTER_PLUS_EXPR, use a
different right hand side type.
Handle POINTER_PLUS_EXPR like PLUS_EXPR.
(chrec_fold_plus): For pointer types, use POINTER_PLUS_EXPR
instead of PLUS_EXPR.
When either operand is zero, convert the other operand.
(chrec_apply): Use chrec_convert_rhs
on the argument x instead of chrec_convert.
(reset_evolution_in_loop): For pointer types, the new_evol
should be sizetype.
(convert_affine_scev): For POINTER_PLUS_EXPR, use a
different right hand side type.
Handle POINTER_PLUS_EXPR like PLUS_EXPR.
(chrec_convert_rhs): New function.
(chrec_convert_aggressive): For POINTER_PLUS_EXPR, use a
different right hand side type.
Handle POINTER_PLUS_EXPR like PLUS_EXPR.
* tree-chrec.h (chrec_convert_rhs): New prototype.
(build_polynomial_chrec): For pointer types, the right hand
* tree-ssa-ccp.c (maybe_fold_stmt_indirect): Look for
POINTER_PLUS_EXPR instead of PLUS_EXPR's.
Remove subtraction case as it is always addition now.
Make sure the offset is converted to sizetype.
(fold_stmt_r): Don't handle PLUS_EXPR/MINUS_EXPR specially.
Handle POINTER_PLUS_EXPR like PLUS_EXPR was handled before.
* tree-ssa-loop-ivopts.c (determine_base_object): Abort for
PLUS_EXPR in pointer type.
Handle POINTER_PLUS_EXPR.
(tree_to_aff_combination): Likewise.
(force_expr_to_var_cost): Likewise.
(force_expr_to_var_cost): Likewise. Create a POINTER_PLUS_EXPR
instead of PLUS_EXPR for pointers.
* c-format.c (check_format_arg): Handle POINTER_PLUS_EXPR
instead of PLUS_EXPR of pointer types.
* tree-stdarg.c (va_list_counter_bump): Handle POINTER_PLUS_EXPR
as PLUS_EXPR.
(check_va_list_escapes): Likewise.
(check_all_va_list_escapes): Likewise.
* dwarf2out.c (loc_descriptor_from_tree_1):
Handle POINT_PLUS_EXPR as a PLUS_EXPR.
* expr.c (expand_expr_real_1): Handle POINTER_PLUS_EXPR.
(string_constant): Likewise.
* tree-ssa-address.c (tree_mem_ref_addr): When adding
the offset to the base, use POINTER_PLUS_EXPR.
(add_to_parts): Convert the index to sizetype.
(create_mem_ref): Create A POINTER_PLUS_EXPR for the one case.
* matrix-reorg.c (collect_data_for_malloc_call): Stmt
will now only be either INDIRECT_REF and POINTER_PLUS_EXPR.
Offset only holds something for PLUS_EXPR.
(ssa_accessed_in_tree): Handle POINTER_PLUS_EXPR just as
a PLUS_EXPR.
(analyze_transpose): POINTER_PLUS_EXPR will only show up now
and not PLUS_EXPR.
(analyze_accesses_for_modify_stmt): Likewise.
Remove comment about the type being integral type as it is
wrong now.
(can_calculate_expr_before_stmt): Handle POINTER_PLUS_EXPR as
PLUS_EXPR.
(transform_access_sites): POINTER_PLUS_EXPR will only show up now
and not PLUS_EXPR.
Correct the type which the artimentic is done in (is now
sizetype).
Reindent one loop.
* tree-data-ref.c (split_constant_offset): Handle
POINTER_PLUS_EXPR
* tree-affine.c (tree_to_aff_combination): Likewise.
* c-typeck.c (build_unary_op): For pointers create the increment
as a sizetype. Create a POINTER_PLUS_EXPR instead of PLUS_EXPR
for pointers.
* gimplify.c (gimplify_self_mod_expr): Create a
POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers.
(gimplify_omp_atomic_fetch_op): Handle POINTER_PLUS_EXPR.
* tree.def (POINTER_PLUS_EXPR): New tree code.
* tree-predcom.c (ref_at_iteration): If we have a pointer
type do the multiplication in sizetype.
* tree-mudflap.c (mf_xform_derefs_1): Create a
POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers.
* tree-ssa-forwprop.c
(forward_propagate_addr_into_variable_array_index):
Don't expect there to be a cast for the index as that
does not exist anymore.
(forward_propagate_addr_expr_1): Check for POINTER_PLUS_EXPR
instead of PLUS_EXPR.
Don't check for the first operand of the POINTER_PLUS_EXPR
was the index as it cannot be.
Call forward_propagate_addr_into_variable_array_index with
the SSA_NAME instead of the statement.
* varasm.c (const_hash_1): Handle POINTER_PLUS_EXPR.
(compare_constant): Likewise.
(copy_constant): Likewise.
(compute_reloc_for_constant): Likewise.
(output_addressed_constants): Likewise.
(initializer_constant_valid_p): Likewise.
* tree-ssa.c (tree_ssa_useless_type_conversion_1):
Convert the MIN/MAX of the inner type to the outer
type before comparing them.
* tree-ssa-loop-prefetch.c (idx_analyze_ref): Handle
POINTER_PLUS_EXPR instead of PLUS_EXPR.
(issue_prefetch_ref): Create a POINTER_PLUS_EXPR instead
of PLUS_EXPR for pointers.
* tree-inline.c (estimate_num_insns_1): Handle
POINTER_PLUS_EXPR.
* tree-vect-transform.c (vect_create_addr_base_for_vector_ref):
Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers.
(bump_vector_ptr): Create a POINTER_PLUS_EXPR
instead of PLUS_EXPR for the pointer increment statement.
(vect_update_ivs_after_vectorizer): For pointer types, create
POINTER_PLUS_EXPR instead of PLUS_EXPR and also create
MULT_EXPR in sizetype.
(vect_gen_niters_for_prolog_loop): Add a cast when creating
byte_misalign.
* tree-object-size.c (plus_expr_object_size): Handle
POINTER_PLUS_EXPR instead of PLUS_EXPR. Removing all the extra
code which is trying to figure out which side is a pointer and
is the index.
(check_for_plus_in_loops_1): Likewise.
(check_for_plus_in_loops): Likewise.
* c-common.c (pointer_int_sum): Create a
POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers.
* tree-ssa-structalias.c (handle_ptr_arith): Handle
only POINTER_PLUS_EXPR. Removing all the extra
code which is trying to figure out which side is a pointer and
is the index.
* tree-cfg.c (verify_expr): Add extra checking for pointers and
PLUS_EXPR and MINUS_EXPR.
Also add checking to make sure the operands of POINTER_PLUS_EXPR
are correct.
* config/frv/frv.c (frv_expand_builtin_va_start): Use sizetype
with make_tree, instead of a pointer type.
* config/s390/s390.c (s390_va_start): Use POINTER_PLUS_EXPR
for pointers instead of PLUS_EXPR.
(s390_gimplify_va_arg): Likewise.
* config/spu/spu.c (spu_va_start): Create POINTER_PLUS_EXPR
instead of PLUS_EXPR when doing addition on pointer
types. Use sizetype for the second operand.
(spu_gimplify_va_arg_expr): Likewise.
* config/sparc/sparc.c (sparc_gimplify_va_arg): Use
POINTER_PLUS_EXPR instead of PLUS_EXPR when the operand was
a pointer. Don't create a BIT_AND_EXPR for pointer types.
* config/i386/i386.c (ix86_va_start): Use POINTER_PLUS_EXPR
for the pointer addition and also use size_int/sizetype
for the offset.
(ix86_gimplify_va_arg): Likewise.
Perform BIT_AND_EXPR on sizetype arguments.
* config/sh/sh.c (sh_va_start): Call make_tree with sizetype
and convert its result to a pointer type. Use POINTER_PLUS_EXPR
for the pointer additions and also use size_int for the offsets.
(sh_gimplify_va_arg_expr): Use POINTER_PLUS_EXPR for the pointer
additions and also use size_int for the offsets. Perform
BIT_AND_EXPR on sizetype arguments.
* config/ia64/ia64.c (ia64_gimplify_va_arg): Use
POINTER_PLUS_EXPR for pointers and create the
BIT_AND_EXPR in sizetype.
* config/rs6000/rs6000.c (rs6000_va_start): Use POINTER_PLUS_EXPR
instead of PLUS_EXPR for pointer addition.
(rs6000_va_start): Likewise.
Also use sizetype for the offset.
* config/pa/pa.c (reloc_needed): Handle POINTER_PLUS_EXPR
as PLUS_EXPR/MINUS_EXPR.
(hppa_gimplify_va_arg_expr): Don't create MINUS_EXPR or
PLUS_EXPR for pointers, instead use POINTER_PLUS_EXPR.
Don't use BIT_AND_EXPR on a pointer type, convert the
expression to sizetype first.
* config/mips/mips.c (mips_va_start): Use POINTER_PLUS_EXPR
for pointers.
(mips_gimplify_va_arg_expr): Likewise.
Don't create BIT_AND_EXPR in a pointer type.
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
* trans-intrinsic.c (gfc_conv_intrinsic_repeat): Use
POINTER_PLUS_EXPR instead of PLUS_EXPR for pointer addition.
* trans-expr.c (gfc_trans_string_copy): Create
POINTER_PLUS_EXPR instead of a PLUS_EXPR
for pointer types.
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
* typeck.c (build_binary_op): For templates build the
expression in pieces to avoid the assert in build2_stat.
(get_member_function_from_ptrfunc):
Change over to using POINTER_PLUS_EXPR and convert
the second operand to sizetype.
* typeck2.c (build_m_component_ref): Likewise.
* init.c (expand_virtual_init): Create a POINTER_PLUS_EXPR
instead of PLUS_EXPR for pointers.
(build_new_1): Likewise.
(build_vec_delete_1): Likewise.
(build_vec_delete): Likewise.
* class.c (build_base_path): Likewise.
(build_base_path): Likewise.
(convert_to_base_statically): Likewise.
(fixed_type_or_null): Handle POINTER_PLUS_EXPR.
(get_vtbl_decl_for_binfo): Handle POINTER_PLUS_EXPR
instead of PLUS_EXPR.
(dfs_accumulate_vtbl_inits): Create a POINTER_PLUS_EXPR
instead of PLUS_EXPR for pointers.
* call.c (build_special_member_call): Likewise.
* rtti.c (build_headof): Likewise.
Use sizetype instead of ptrdiff_type_node.
(tinfo_base_init): Create a POINTER_PLUS_EXPR
instead of PLUS_EXPR for pointers.
* except.c (expand_start_catch_block): Do a
NEGATIVE and then a POINTER_PLUS_EXPR instead
of a MINUS_EXPR.
* cp-gimplify.c (cxx_omp_clause_apply_fn): Convert
PLUS_EXPR on pointer types over to use
POINTER_PLUS_EXPR and remove the conversion
to the pointer types.
* method.c (thunk_adjust): Use POINTER_PLUS_EXPR for
adding to a pointer type. Use size_int instead of
ssize_int. Convert the index to sizetype before
adding it to the pointer.
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
* trans.c (Attribute_to_gnu): When subtracting an
offset from a pointer, use POINTER_PLUS_EXPR with
NEGATE_EXPR instead of MINUS_EXPR.
(gnat_to_gnu): Likewise.
* utils.c (convert): When converting between
thin pointers, use POINTER_PLUS_EXPR and sizetype
for the offset.
* utils2.c (known_alignment): POINTER_PLUS_EXPR
have the same semantics as PLUS_EXPR for alignment.
(build_binary_op): Add support for the semantics of
POINTER_PLUS_EXPR's operands.
When adding an offset to a pointer, use POINTER_PLUS_EXPR.
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
* class.c (make_class_data): Build the index in sizetype.
Use POINTER_PLUS_EXPR instead of PLUS_EXPR when
adding to a pointer type.
(build_symbol_entry): Likewise.
* expr.c (build_java_arrayaccess): Likewise.
(build_field_ref): Likewise.
(build_known_method_ref): Likewise.
(build_invokevirtual): Likewise.
* except.c (build_exception_object_ref): Do a
NEGATIVE and then a POINTER_PLUS_EXPR instead
of a MINUS_EXPR.
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/32225
* gcc.c-torture/compile/20070605-1.c: New test.
* gcc.c-torture/compile/20070603-1.c: New testcase.
* gcc.c-torture/compile/20070603-2.c: New testcase.
* gcc.c-torture/compile/20070531-1.c: New test.
PR tree-opt/32167
* gcc.c-torture/compile/20070531-2.c: New test.
PR tree-opt/32144
* gcc.c-torture/compile/20070529-1.c: New test.
PR tree-opt/32145
* gcc.c-torture/compile/20070529-2.c: New test.
PR tree-opt/32015
* gcc.c-torture/compile/20070520-1.c: New test.
* g++.dg/ext/java-1.C: New test.
* gcc.dg/vect/vect-106.c: We are now able to vectorize two
loops instead of one. Remove the "can't determine dependence"
check.
* gcc.dg/tree-ssa/20030815-1.c: Remove testcase which is no longer
needed as the cast is gone in the first place.
* gcc.dg/max-1.c: Change local variable a to be a global one.
* gcc.dg/tree-ssa/ssa-pre-8.c: Update testcase since we don't
have a cast which is PREd.
From-SVN: r125755
2007-06-16 07:42:36 +02:00
|
|
|
obj = build2 (POINTER_PLUS_EXPR, TREE_TYPE (obj), obj,
|
|
|
|
fold_build1 (NEGATE_EXPR, sizetype,
|
|
|
|
TYPE_SIZE_UNIT (TREE_TYPE (obj))));
|
2001-03-28 13:04:51 +02:00
|
|
|
obj = build1 (INDIRECT_REF, type, obj);
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2006-05-28 20:07:29 +02:00
|
|
|
/* If there are any handlers for this range, issue end of range,
|
1998-09-06 17:36:06 +02:00
|
|
|
and then all handler blocks */
|
2004-06-29 18:18:46 +02:00
|
|
|
void
|
2003-01-12 03:14:56 +01:00
|
|
|
expand_end_java_handler (struct eh_range *range)
|
2000-02-09 15:08:44 +01:00
|
|
|
{
|
1998-09-06 17:36:06 +02:00
|
|
|
tree handler = range->handlers;
|
2009-09-14 21:18:58 +02:00
|
|
|
if (handler)
|
1998-09-06 17:36:06 +02:00
|
|
|
{
|
2009-09-14 21:18:58 +02:00
|
|
|
tree exc_obj = build_exception_object_var ();
|
|
|
|
tree catches = make_node (STATEMENT_LIST);
|
|
|
|
tree_stmt_iterator catches_i = tsi_last (catches);
|
|
|
|
tree *body;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2009-09-14 21:18:58 +02:00
|
|
|
for (; handler; handler = TREE_CHAIN (handler))
|
|
|
|
{
|
|
|
|
tree type, eh_type, x;
|
|
|
|
tree stmts = make_node (STATEMENT_LIST);
|
|
|
|
tree_stmt_iterator stmts_i = tsi_last (stmts);
|
|
|
|
|
|
|
|
type = TREE_PURPOSE (handler);
|
|
|
|
if (type == NULL)
|
|
|
|
type = throwable_type_node;
|
|
|
|
eh_type = prepare_eh_table_type (type);
|
|
|
|
|
|
|
|
x = build_call_expr (built_in_decls[BUILT_IN_EH_POINTER],
|
|
|
|
1, integer_zero_node);
|
|
|
|
x = build2 (MODIFY_EXPR, void_type_node, exc_obj, x);
|
|
|
|
tsi_link_after (&stmts_i, x, TSI_CONTINUE_LINKING);
|
|
|
|
|
|
|
|
x = build1 (GOTO_EXPR, void_type_node, TREE_VALUE (handler));
|
|
|
|
tsi_link_after (&stmts_i, x, TSI_CONTINUE_LINKING);
|
|
|
|
|
|
|
|
x = build2 (CATCH_EXPR, void_type_node, eh_type, stmts);
|
|
|
|
tsi_link_after (&catches_i, x, TSI_CONTINUE_LINKING);
|
|
|
|
|
|
|
|
/* Throwable can match anything in Java, and therefore
|
|
|
|
any subsequent handlers are unreachable. */
|
|
|
|
/* ??? If we're assured of no foreign language exceptions,
|
|
|
|
we'd be better off using NULL as the exception type
|
|
|
|
for the catch. */
|
|
|
|
if (type == throwable_type_node)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
body = get_stmts ();
|
|
|
|
*body = build2 (TRY_CATCH_EXPR, void_type_node, *body, catches);
|
1998-09-06 17:36:06 +02:00
|
|
|
}
|
2009-09-14 21:18:58 +02:00
|
|
|
|
2000-02-09 15:08:44 +01:00
|
|
|
#if defined(DEBUG_JAVA_BINDING_LEVELS)
|
|
|
|
indent ();
|
|
|
|
fprintf (stderr, "expand end handler pc %d <-- %d\n",
|
|
|
|
current_pc, range->start_pc);
|
|
|
|
#endif /* defined(DEBUG_JAVA_BINDING_LEVELS) */
|
1998-09-06 17:36:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Recursive helper routine for maybe_start_handlers. */
|
|
|
|
|
|
|
|
static void
|
2003-01-12 03:14:56 +01:00
|
|
|
check_start_handlers (struct eh_range *range, int pc)
|
1998-09-06 17:36:06 +02:00
|
|
|
{
|
|
|
|
if (range != NULL_EH_RANGE && range->start_pc == pc)
|
|
|
|
{
|
|
|
|
check_start_handlers (range->outer, pc);
|
2000-02-09 15:08:44 +01:00
|
|
|
if (!range->expanded)
|
|
|
|
expand_start_java_handler (range);
|
1998-09-06 17:36:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-09 15:08:44 +01:00
|
|
|
static struct eh_range *current_range;
|
|
|
|
|
|
|
|
/* Emit any start-of-try-range starting at start_pc and ending after
|
|
|
|
end_pc. */
|
1998-09-06 17:36:06 +02:00
|
|
|
|
|
|
|
void
|
2003-01-12 03:14:56 +01:00
|
|
|
maybe_start_try (int start_pc, int end_pc)
|
1998-09-06 17:36:06 +02:00
|
|
|
{
|
2000-02-09 15:08:44 +01:00
|
|
|
struct eh_range *range;
|
1998-09-06 17:36:06 +02:00
|
|
|
if (! doing_eh (1))
|
|
|
|
return;
|
|
|
|
|
2000-02-09 15:08:44 +01:00
|
|
|
range = find_handler (start_pc);
|
|
|
|
while (range != NULL_EH_RANGE && range->start_pc == start_pc
|
|
|
|
&& range->end_pc < end_pc)
|
|
|
|
range = range->outer;
|
|
|
|
|
|
|
|
current_range = range;
|
2000-02-10 20:10:07 +01:00
|
|
|
check_start_handlers (range, start_pc);
|
1998-09-06 17:36:06 +02:00
|
|
|
}
|
|
|
|
|