summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2006-08-26 21:37:21 +0000
committerkan <kan@FreeBSD.org>2006-08-26 21:37:21 +0000
commitd2e7ac2a73d6bcff5e0c32bced4f407ce06175a0 (patch)
tree36bfe9866a842f09652778d17edc7168f0d238df /contrib
parent76c8a9b91c6a52b70109327bfd45d4d3fa8e659f (diff)
downloadFreeBSD-src-d2e7ac2a73d6bcff5e0c32bced4f407ce06175a0.zip
FreeBSD-src-d2e7ac2a73d6bcff5e0c32bced4f407ce06175a0.tar.gz
Resolve conflicts after GCC 3.4.6 20060825 import.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/gcc/builtins.c37
-rw-r--r--contrib/gcc/c-common.c12
-rw-r--r--contrib/gcc/c-common.h2
-rw-r--r--contrib/gcc/c-decl.c77
-rw-r--r--contrib/gcc/config/alpha/alpha.c23
-rw-r--r--contrib/gcc/config/i386/i386.c3
-rw-r--r--contrib/gcc/config/i386/i386.md16
-rw-r--r--contrib/gcc/config/x-linux4
-rwxr-xr-xcontrib/gcc/configure39
-rw-r--r--contrib/gcc/cp/decl.c154
-rw-r--r--contrib/gcc/cppinit.c6
-rw-r--r--contrib/gcc/f/g77spec.c4
-rw-r--r--contrib/gcc/gcc.c4
-rw-r--r--contrib/gcc/toplev.c6
-rw-r--r--contrib/gcc/version.c2
15 files changed, 260 insertions, 129 deletions
diff --git a/contrib/gcc/builtins.c b/contrib/gcc/builtins.c
index a3e069e..2931684 100644
--- a/contrib/gcc/builtins.c
+++ b/contrib/gcc/builtins.c
@@ -4329,14 +4329,15 @@ static rtx
expand_builtin_fputs (tree arglist, rtx target, bool unlocked)
{
tree len, fn;
- tree fn_fputc = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTC_UNLOCKED]
+ /* If we're using an unlocked function, assume the other unlocked
+ functions exist explicitly. */
+ tree const fn_fputc = unlocked ? built_in_decls[BUILT_IN_FPUTC_UNLOCKED]
: implicit_built_in_decls[BUILT_IN_FPUTC];
- tree fn_fwrite = unlocked ? implicit_built_in_decls[BUILT_IN_FWRITE_UNLOCKED]
+ tree const fn_fwrite = unlocked ? built_in_decls[BUILT_IN_FWRITE_UNLOCKED]
: implicit_built_in_decls[BUILT_IN_FWRITE];
- /* If the return value is used, or the replacement _DECL isn't
- initialized, don't do the transformation. */
- if (target != const0_rtx || !fn_fputc || !fn_fwrite)
+ /* If the return value is used, don't do the transformation. */
+ if (target != const0_rtx)
return 0;
/* Verify the arguments in the original call. */
@@ -4397,6 +4398,11 @@ expand_builtin_fputs (tree arglist, rtx target, bool unlocked)
abort ();
}
+ /* If the replacement _DECL isn't initialized, don't do the
+ transformation. */
+ if (!fn)
+ return 0;
+
return expand_expr (build_function_call_expr (fn, arglist),
const0_rtx, VOIDmode, EXPAND_NORMAL);
}
@@ -4651,11 +4657,12 @@ static rtx
expand_builtin_printf (tree arglist, rtx target, enum machine_mode mode,
bool unlocked)
{
- tree fn_putchar = unlocked
- ? implicit_built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED]
- : implicit_built_in_decls[BUILT_IN_PUTCHAR];
- tree fn_puts = unlocked ? implicit_built_in_decls[BUILT_IN_PUTS_UNLOCKED]
- : implicit_built_in_decls[BUILT_IN_PUTS];
+ /* If we're using an unlocked function, assume the other unlocked
+ functions exist explicitly. */
+ tree const fn_putchar = unlocked ? built_in_decls[BUILT_IN_PUTCHAR_UNLOCKED]
+ : implicit_built_in_decls[BUILT_IN_PUTCHAR];
+ tree const fn_puts = unlocked ? built_in_decls[BUILT_IN_PUTS_UNLOCKED]
+ : implicit_built_in_decls[BUILT_IN_PUTS];
const char *fmt_str;
tree fn, fmt, arg;
@@ -4754,10 +4761,12 @@ static rtx
expand_builtin_fprintf (tree arglist, rtx target, enum machine_mode mode,
bool unlocked)
{
- tree fn_fputc = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTC_UNLOCKED]
- : implicit_built_in_decls[BUILT_IN_FPUTC];
- tree fn_fputs = unlocked ? implicit_built_in_decls[BUILT_IN_FPUTS_UNLOCKED]
- : implicit_built_in_decls[BUILT_IN_FPUTS];
+ /* If we're using an unlocked function, assume the other unlocked
+ functions exist explicitly. */
+ tree const fn_fputc = unlocked ? built_in_decls[BUILT_IN_FPUTC_UNLOCKED]
+ : implicit_built_in_decls[BUILT_IN_FPUTC];
+ tree const fn_fputs = unlocked ? built_in_decls[BUILT_IN_FPUTS_UNLOCKED]
+ : implicit_built_in_decls[BUILT_IN_FPUTS];
const char *fmt_str;
tree fn, fmt, fp, arg;
diff --git a/contrib/gcc/c-common.c b/contrib/gcc/c-common.c
index 50516f4..7305b3c6 100644
--- a/contrib/gcc/c-common.c
+++ b/contrib/gcc/c-common.c
@@ -1281,6 +1281,18 @@ constant_fits_type_p (tree c, tree type)
return !TREE_OVERFLOW (c);
}
+/* Nonzero if vector types T1 and T2 can be converted to each other
+ without an explicit cast. */
+int
+vector_types_convertible_p (tree t1, tree t2)
+{
+ return targetm.vector_opaque_p (t1)
+ || targetm.vector_opaque_p (t2)
+ || (tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2))
+ && INTEGRAL_TYPE_P (TREE_TYPE (t1))
+ == INTEGRAL_TYPE_P (TREE_TYPE (t2)));
+}
+
/* Convert EXPR to TYPE, warning about conversion problems with constants.
Invoke this function on every expression that is converted implicitly,
i.e. because of language rules and not because of an explicit cast. */
diff --git a/contrib/gcc/c-common.h b/contrib/gcc/c-common.h
index bd8be8b..3466bff 100644
--- a/contrib/gcc/c-common.h
+++ b/contrib/gcc/c-common.h
@@ -1268,6 +1268,8 @@ extern tree finish_label_address_expr (tree);
different implementations. Used in c-common.c. */
extern tree lookup_label (tree);
+extern int vector_types_convertible_p (tree t1, tree t2);
+
extern rtx c_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
extern int c_safe_from_p (rtx, tree);
diff --git a/contrib/gcc/c-decl.c b/contrib/gcc/c-decl.c
index 26431d0..af6d668 100644
--- a/contrib/gcc/c-decl.c
+++ b/contrib/gcc/c-decl.c
@@ -957,6 +957,15 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
return false;
}
+ /* Enumerators have no linkage, so may only be declared once in a
+ given scope. */
+ if (TREE_CODE (olddecl) == CONST_DECL)
+ {
+ error ("%Jredeclaration of enumerator `%D'", newdecl, newdecl);
+ locate_old_decl (olddecl, error);
+ return false;
+ }
+
if (!comptypes (oldtype, newtype, COMPARE_STRICT))
{
if (TREE_CODE (olddecl) == FUNCTION_DECL
@@ -2956,12 +2965,21 @@ void
push_parm_decl (tree parm)
{
tree decl;
+ int old_dont_save_pending_sizes_p = 0;
/* Don't attempt to expand sizes while parsing this decl.
(We can get here with i_s_e 1 somehow from Objective-C.) */
int save_immediate_size_expand = immediate_size_expand;
immediate_size_expand = 0;
+ /* If this is a nested function, we do want to keep SAVE_EXPRs for
+ the argument sizes, regardless of the parent's setting. */
+ if (cfun)
+ {
+ old_dont_save_pending_sizes_p = cfun->x_dont_save_pending_sizes_p;
+ cfun->x_dont_save_pending_sizes_p = 0;
+ }
+
decl = grokdeclarator (TREE_VALUE (TREE_PURPOSE (parm)),
TREE_PURPOSE (TREE_PURPOSE (parm)),
PARM, 0, NULL);
@@ -2971,6 +2989,8 @@ push_parm_decl (tree parm)
finish_decl (decl, NULL_TREE, NULL_TREE);
+ if (cfun)
+ cfun->x_dont_save_pending_sizes_p = old_dont_save_pending_sizes_p;
immediate_size_expand = save_immediate_size_expand;
}
@@ -4784,13 +4804,22 @@ start_struct (enum tree_code code, tree name)
ref = lookup_tag (code, name, 1);
if (ref && TREE_CODE (ref) == code)
{
- if (TYPE_FIELDS (ref))
+ if (TYPE_SIZE (ref))
{
if (code == UNION_TYPE)
error ("redefinition of `union %s'", IDENTIFIER_POINTER (name));
else
error ("redefinition of `struct %s'", IDENTIFIER_POINTER (name));
}
+ else if (C_TYPE_BEING_DEFINED (ref))
+ {
+ if (code == UNION_TYPE)
+ error ("nested redefinition of `union %s'",
+ IDENTIFIER_POINTER (name));
+ else
+ error ("nested redefinition of `struct %s'",
+ IDENTIFIER_POINTER (name));
+ }
}
else
{
@@ -5005,11 +5034,6 @@ finish_struct (tree t, tree fieldlist, tree attributes)
if (C_DECL_VARIABLE_SIZE (x))
C_TYPE_VARIABLE_SIZE (t) = 1;
- /* Detect invalid nested redefinition. */
- if (TREE_TYPE (x) == t)
- error ("nested redefinition of `%s'",
- IDENTIFIER_POINTER (TYPE_NAME (t)));
-
if (DECL_INITIAL (x))
{
unsigned HOST_WIDE_INT width = tree_low_cst (DECL_INITIAL (x), 1);
@@ -5131,6 +5155,9 @@ finish_struct (tree t, tree fieldlist, tree attributes)
TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (t);
TYPE_ALIGN (x) = TYPE_ALIGN (t);
TYPE_USER_ALIGN (x) = TYPE_USER_ALIGN (t);
+ C_TYPE_FIELDS_READONLY (x) = C_TYPE_FIELDS_READONLY (t);
+ C_TYPE_FIELDS_VOLATILE (x) = C_TYPE_FIELDS_VOLATILE (t);
+ C_TYPE_VARIABLE_SIZE (x) = C_TYPE_VARIABLE_SIZE (t);
}
/* If this was supposed to be a transparent union, but we can't
@@ -5204,6 +5231,9 @@ start_enum (tree name)
pushtag (name, enumtype);
}
+ if (C_TYPE_BEING_DEFINED (enumtype))
+ error ("nested redefinition of `enum %s'", IDENTIFIER_POINTER (name));
+
C_TYPE_BEING_DEFINED (enumtype) = 1;
if (TYPE_VALUES (enumtype) != 0)
@@ -5976,9 +6006,6 @@ store_parm_decls (void)
{
tree fndecl = current_function_decl;
- /* The function containing FNDECL, if any. */
- tree context = decl_function_context (fndecl);
-
/* True if this definition is written with a prototype. */
bool prototype = (current_function_parms
&& TREE_CODE (current_function_parms) != TREE_LIST);
@@ -6003,20 +6030,9 @@ store_parm_decls (void)
/* Begin the statement tree for this function. */
begin_stmt_tree (&DECL_SAVED_TREE (fndecl));
- /* If this is a nested function, save away the sizes of any
- variable-size types so that we can expand them when generating
- RTL. */
- if (context)
- {
- tree t;
-
- DECL_LANG_SPECIFIC (fndecl)->pending_sizes
- = nreverse (get_pending_sizes ());
- for (t = DECL_LANG_SPECIFIC (fndecl)->pending_sizes;
- t;
- t = TREE_CHAIN (t))
- SAVE_EXPR_CONTEXT (TREE_VALUE (t)) = context;
- }
+ /* Save away the sizes of any variable-size types so that we can
+ expand them when generating RTL. */
+ DECL_LANG_SPECIFIC (fndecl)->pending_sizes = get_pending_sizes ();
/* This function is being processed in whole-function mode. */
cfun->x_whole_function_mode_p = 1;
@@ -6167,15 +6183,12 @@ static void
c_expand_body_1 (tree fndecl, int nested_p)
{
if (nested_p)
- {
- /* Make sure that we will evaluate variable-sized types involved
- in our function's type. */
- expand_pending_sizes (DECL_LANG_SPECIFIC (fndecl)->pending_sizes);
-
- /* Squirrel away our current state. */
- push_function_context ();
- }
+ /* Squirrel away our current state. */
+ push_function_context ();
+ /* Make sure that we will evaluate variable-sized types involved
+ in our function's type. */
+ put_pending_sizes (DECL_LANG_SPECIFIC (fndecl)->pending_sizes);
tree_rest_of_compilation (fndecl, nested_p);
if (nested_p)
@@ -6396,7 +6409,7 @@ c_begin_compound_stmt (void)
tree stmt;
/* Create the COMPOUND_STMT. */
- stmt = add_stmt (build_stmt (COMPOUND_STMT, NULL_TREE));
+ stmt = add_stmt (build_stmt (COMPOUND_STMT, error_mark_node));
return stmt;
}
diff --git a/contrib/gcc/config/alpha/alpha.c b/contrib/gcc/config/alpha/alpha.c
index fbaeabe..f9aef99 100644
--- a/contrib/gcc/config/alpha/alpha.c
+++ b/contrib/gcc/config/alpha/alpha.c
@@ -5469,6 +5469,21 @@ print_operand (FILE *file, rtx x, int code)
}
break;
+ case 'j':
+ {
+ const char *lituse;
+
+#ifdef HAVE_AS_JSRDIRECT_RELOCS
+ lituse = "lituse_jsrdirect";
+#else
+ lituse = "lituse_jsr";
+#endif
+
+ if (INTVAL (x) == 0)
+ abort ();
+ fprintf (file, "\t\t!%s!%d", lituse, (int) INTVAL (x));
+ }
+ break;
case 'r':
/* If this operand is the constant zero, write it as "$31". */
if (GET_CODE (x) == REG)
@@ -8814,7 +8829,7 @@ alpha_align_insns (unsigned int max_align,
unsigned int align;
/* OFS is the offset of the current insn in the insn group. */
int ofs;
- int prev_in_use, in_use, len;
+ int prev_in_use, in_use, len, ldgp;
rtx i, next;
/* Let shorten branches care for assigning alignments to code labels. */
@@ -8832,6 +8847,8 @@ alpha_align_insns (unsigned int max_align,
if (GET_CODE (i) == NOTE)
i = next_nonnote_insn (i);
+ ldgp = alpha_function_needs_gp ? 8 : 0;
+
while (i)
{
next = (*next_group) (i, &in_use, &len);
@@ -8888,6 +8905,10 @@ alpha_align_insns (unsigned int max_align,
}
}
+ /* We may not insert padding inside the initial ldgp sequence. */
+ else if (ldgp > 0)
+ ldgp -= len;
+
/* If the group won't fit in the same INT16 as the previous,
we need to add padding to keep the group together. Rather
than simply leaving the insn filling to the assembler, we
diff --git a/contrib/gcc/config/i386/i386.c b/contrib/gcc/config/i386/i386.c
index d0040fb..0360ff1 100644
--- a/contrib/gcc/config/i386/i386.c
+++ b/contrib/gcc/config/i386/i386.c
@@ -4903,7 +4903,7 @@ output_set_got (rtx dest)
if (!flag_pic || TARGET_DEEP_BRANCH_PREDICTION)
output_asm_insn ("add{l}\t{%1, %0|%0, %1}", xops);
else if (!TARGET_MACHO)
- output_asm_insn ("add{l}\t{%1+[.-%a2], %0|%0, %a1+(.-%a2)}", xops);
+ output_asm_insn ("add{l}\t{%1+[.-%a2], %0|%0, %1+(.-%a2)}", xops);
return "";
}
@@ -13961,6 +13961,7 @@ ix86_expand_unop_builtin (enum insn_code icode, tree arglist,
if (! target
|| GET_MODE (target) != tmode
+ || (do_load && GET_CODE (target) == MEM)
|| ! (*insn_data[icode].operand[0].predicate) (target, tmode))
target = gen_reg_rtx (tmode);
if (do_load)
diff --git a/contrib/gcc/config/i386/i386.md b/contrib/gcc/config/i386/i386.md
index 93d9dcd..0fbe00b 100644
--- a/contrib/gcc/config/i386/i386.md
+++ b/contrib/gcc/config/i386/i386.md
@@ -1850,7 +1850,8 @@
(define_split
[(set (match_operand:DI 0 "push_operand" "")
(match_operand:DI 1 "immediate_operand" ""))]
- "TARGET_64BIT && (flow2_completed || (reload_completed && !flag_peephole2))
+ "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
+ ? flow2_completed : reload_completed)
&& !symbolic_operand (operands[1], DImode)
&& !x86_64_immediate_operand (operands[1], DImode)"
[(set (match_dup 0) (match_dup 1))
@@ -2105,7 +2106,8 @@
(define_split
[(set (match_operand:DI 0 "memory_operand" "")
(match_operand:DI 1 "immediate_operand" ""))]
- "TARGET_64BIT && (flow2_completed || (reload_completed && !flag_peephole2))
+ "TARGET_64BIT && ((optimize > 0 && flag_peephole2)
+ ? flow2_completed : reload_completed)
&& !symbolic_operand (operands[1], DImode)
&& !x86_64_immediate_operand (operands[1], DImode)"
[(set (match_dup 2) (match_dup 3))
@@ -2172,11 +2174,10 @@
(match_operand:SF 1 "memory_operand" ""))]
"reload_completed
&& GET_CODE (operands[1]) == MEM
- && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
+ && constant_pool_reference_p (operands[1])"
[(set (match_dup 0)
(match_dup 1))]
- "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
+ "operands[1] = avoid_constant_pool_reference (operands[1]);")
;; %%% Kill this when call knows how to work this out.
@@ -2889,11 +2890,10 @@
&& GET_CODE (operands[1]) == MEM
&& (GET_MODE (operands[0]) == XFmode
|| GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode)
- && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
+ && constant_pool_reference_p (operands[1])"
[(set (match_dup 0) (match_dup 1))]
{
- rtx c = get_pool_constant (XEXP (operands[1], 0));
+ rtx c = avoid_constant_pool_reference (operands[1]);
rtx r = operands[0];
if (GET_CODE (r) == SUBREG)
diff --git a/contrib/gcc/config/x-linux b/contrib/gcc/config/x-linux
new file mode 100644
index 0000000..d14586b
--- /dev/null
+++ b/contrib/gcc/config/x-linux
@@ -0,0 +1,4 @@
+host-linux.o : $(srcdir)/config/host-linux.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h hosthooks.h hosthooks-def.h
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+ $(srcdir)/config/host-linux.c
diff --git a/contrib/gcc/configure b/contrib/gcc/configure
index bd8a927..91f9326 100755
--- a/contrib/gcc/configure
+++ b/contrib/gcc/configure
@@ -11091,6 +11091,45 @@ cat >>confdefs.h <<\_ACEOF
_ACEOF
fi
+ echo "$as_me:$LINENO: checking assembler for jsrdirect relocation support" >&5
+echo $ECHO_N "checking assembler for jsrdirect relocation support... $ECHO_C" >&6
+if test "${gcc_cv_as_alpha_jsrdirect_relocs+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gcc_cv_as_alpha_jsrdirect_relocs=no
+ if test $in_tree_gas = yes; then
+ if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 16 \) \* 1000 + 90`
+ then gcc_cv_as_alpha_jsrdirect_relocs=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ echo ' .set nomacro
+ .text
+ ldq $27, a($29) !literal!1
+ jsr $26, ($27), a !lituse_jsrdirect!1' > conftest.s
+ if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+ then
+ gcc_cv_as_alpha_jsrdirect_relocs=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_as_alpha_jsrdirect_relocs" >&5
+echo "${ECHO_T}$gcc_cv_as_alpha_jsrdirect_relocs" >&6
+if test $gcc_cv_as_alpha_jsrdirect_relocs = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_AS_JSRDIRECT_RELOCS 1
+_ACEOF
+
+fi
;;
cris-*-*)
diff --git a/contrib/gcc/cp/decl.c b/contrib/gcc/cp/decl.c
index 6c7cece..451993e 100644
--- a/contrib/gcc/cp/decl.c
+++ b/contrib/gcc/cp/decl.c
@@ -1380,10 +1380,7 @@ duplicate_decls (tree newdecl, tree olddecl)
else
return NULL_TREE;
}
-
- /* Already complained about this, so don't do so again. */
- else if (current_class_type == NULL_TREE
- || IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (newdecl)) != current_class_type)
+ else
{
error ("conflicting declaration '%#D'", newdecl);
cp_error_at ("'%D' has a previous declaration as `%#D'",
@@ -2647,16 +2644,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain)
return error_mark_node;
}
my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 20030802);
-
- if (TREE_CODE (context) == NAMESPACE_DECL)
- {
- /* We can get here from typename_sub0 in the explicit_template_type
- expansion. Just fail. */
- if (complain & tf_error)
- error ("no class template named `%#T' in `%#T'",
- name, context);
- return error_mark_node;
- }
+ my_friendly_assert (TYPE_P (context), 20050905);
if (!dependent_type_p (context)
|| currently_open_class (context))
@@ -4919,6 +4907,16 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags)
"initialized", decl);
init = NULL_TREE;
}
+ if (DECL_EXTERNAL (decl) && init)
+ {
+ /* The static data member cannot be initialized by a
+ non-constant when being declared. */
+ error ("`%D' cannot be initialized by a non-constant expression"
+ " when being declared", decl);
+ DECL_INITIALIZED_IN_CLASS_P (decl) = 0;
+ init = NULL_TREE;
+ }
+
/* Handle:
[dcl.init]
@@ -5718,7 +5716,7 @@ grokfndecl (tree ctype,
}
if (IDENTIFIER_OPNAME_P (DECL_NAME (decl)))
- grok_op_properties (decl, friendp, /*complain=*/true);
+ grok_op_properties (decl, /*complain=*/true);
if (ctype && decl_function_context (decl))
DECL_NO_STATIC_CHAIN (decl) = 1;
@@ -5893,6 +5891,7 @@ grokvardecl (tree type,
tree scope)
{
tree decl;
+ tree explicit_scope;
RID_BIT_TYPE specbits;
my_friendly_assert (!name || TREE_CODE (name) == IDENTIFIER_NODE,
@@ -5900,7 +5899,9 @@ grokvardecl (tree type,
specbits = *specbits_in;
- /* Compute the scope in which to place the variable. */
+ /* Compute the scope in which to place the variable, but remember
+ whether or not that scope was explicitly specified by the user. */
+ explicit_scope = scope;
if (!scope)
{
/* An explicit "extern" specifier indicates a namespace-scope
@@ -5929,8 +5930,8 @@ grokvardecl (tree type,
else
decl = build_decl (VAR_DECL, name, type);
- if (scope && TREE_CODE (scope) == NAMESPACE_DECL)
- set_decl_namespace (decl, scope, 0);
+ if (explicit_scope && TREE_CODE (explicit_scope) == NAMESPACE_DECL)
+ set_decl_namespace (decl, explicit_scope, 0);
else
DECL_CONTEXT (decl) = scope;
@@ -7187,8 +7188,8 @@ grokdeclarator (tree declarator,
if (virtualp && staticp == 2)
{
- error ("member `%D' cannot be declared both virtual and static",
- dname);
+ error ("member `%D' cannot be declared both virtual and static", dname);
+ RIDBIT_RESET (RID_STATIC, specbits);
staticp = 0;
}
friendp = RIDBIT_SETP (RID_FRIEND, specbits);
@@ -9004,7 +9005,7 @@ unary_op_p (enum tree_code code)
errors are issued for invalid declarations. */
bool
-grok_op_properties (tree decl, int friendp, bool complain)
+grok_op_properties (tree decl, bool complain)
{
tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl));
tree argtype;
@@ -9012,20 +9013,24 @@ grok_op_properties (tree decl, int friendp, bool complain)
tree name = DECL_NAME (decl);
enum tree_code operator_code;
int arity;
+ bool ellipsis_p;
bool ok;
+ tree class_type;
/* Assume that the declaration is valid. */
ok = true;
- /* Count the number of arguments. */
+ /* Count the number of arguments. and check for ellipsis */
for (argtype = argtypes, arity = 0;
argtype && argtype != void_list_node;
argtype = TREE_CHAIN (argtype))
++arity;
+ ellipsis_p = !argtype;
- if (current_class_type == NULL_TREE)
- friendp = 1;
-
+ class_type = DECL_CONTEXT (decl);
+ if (class_type && !CLASS_TYPE_P (class_type))
+ class_type = NULL_TREE;
+
if (DECL_CONV_FN_P (decl))
operator_code = TYPE_EXPR;
else
@@ -9053,30 +9058,28 @@ grok_op_properties (tree decl, int friendp, bool complain)
my_friendly_assert (operator_code != LAST_CPLUS_TREE_CODE, 20000526);
SET_OVERLOADED_OPERATOR_CODE (decl, operator_code);
- if (! friendp)
- {
- switch (operator_code)
- {
- case NEW_EXPR:
- TYPE_HAS_NEW_OPERATOR (current_class_type) = 1;
- break;
+ if (class_type)
+ switch (operator_code)
+ {
+ case NEW_EXPR:
+ TYPE_HAS_NEW_OPERATOR (class_type) = 1;
+ break;
- case DELETE_EXPR:
- TYPE_GETS_DELETE (current_class_type) |= 1;
- break;
+ case DELETE_EXPR:
+ TYPE_GETS_DELETE (class_type) |= 1;
+ break;
- case VEC_NEW_EXPR:
- TYPE_HAS_ARRAY_NEW_OPERATOR (current_class_type) = 1;
- break;
+ case VEC_NEW_EXPR:
+ TYPE_HAS_ARRAY_NEW_OPERATOR (class_type) = 1;
+ break;
- case VEC_DELETE_EXPR:
- TYPE_GETS_DELETE (current_class_type) |= 2;
- break;
+ case VEC_DELETE_EXPR:
+ TYPE_GETS_DELETE (class_type) |= 2;
+ break;
- default:
- break;
- }
- }
+ default:
+ break;
+ }
if (operator_code == NEW_EXPR || operator_code == VEC_NEW_EXPR)
TREE_TYPE (decl) = coerce_new_type (TREE_TYPE (decl));
@@ -9130,37 +9133,46 @@ grok_op_properties (tree decl, int friendp, bool complain)
if (operator_code == CALL_EXPR)
return ok;
- if (IDENTIFIER_TYPENAME_P (name) && ! DECL_TEMPLATE_INFO (decl))
+ /* Warn about conversion operators that will never be used. */
+ if (IDENTIFIER_TYPENAME_P (name)
+ && ! DECL_TEMPLATE_INFO (decl)
+ && warn_conversion
+ /* Warn only declaring the function; there is no need to
+ warn again about out-of-class definitions. */
+ && class_type == current_class_type)
{
tree t = TREE_TYPE (name);
- if (! friendp)
+ int ref = (TREE_CODE (t) == REFERENCE_TYPE);
+ const char *what = 0;
+
+ if (ref)
+ t = TYPE_MAIN_VARIANT (TREE_TYPE (t));
+
+ if (TREE_CODE (t) == VOID_TYPE)
+ what = "void";
+ else if (class_type)
{
- int ref = (TREE_CODE (t) == REFERENCE_TYPE);
- const char *what = 0;
-
- if (ref)
- t = TYPE_MAIN_VARIANT (TREE_TYPE (t));
-
- if (TREE_CODE (t) == VOID_TYPE)
- what = "void";
- else if (t == current_class_type)
+ if (t == class_type)
what = "the same type";
/* Don't force t to be complete here. */
else if (IS_AGGR_TYPE (t)
&& COMPLETE_TYPE_P (t)
- && DERIVED_FROM_P (t, current_class_type))
+ && DERIVED_FROM_P (t, class_type))
what = "a base class";
-
- if (what && warn_conversion)
- warning ("conversion to %s%s will never use a type conversion operator",
- ref ? "a reference to " : "", what);
}
+
+ if (what)
+ warning ("conversion to %s%s will never use a type conversion operator",
+ ref ? "a reference to " : "", what);
}
+
if (operator_code == COND_EXPR)
{
/* 13.4.0.3 */
error ("ISO C++ prohibits overloading operator ?:");
}
+ else if (ellipsis_p)
+ error ("`%D' must not have variable number of arguments", decl);
else if (ambi_op_p (operator_code))
{
if (arity == 1)
@@ -9325,9 +9337,11 @@ tag_name (enum tag_types code)
case class_type:
return "class";
case union_type:
- return "union ";
+ return "union";
case enum_type:
return "enum";
+ case typename_type:
+ return "typename";
default:
abort ();
}
@@ -9365,7 +9379,8 @@ check_elaborated_type_specifier (enum tag_types tag_code,
In other words, the only legitimate declaration to use in the
elaborated type specifier is the implicit typedef created when
the type is declared. */
- if (!DECL_IMPLICIT_TYPEDEF_P (decl))
+ if (!DECL_IMPLICIT_TYPEDEF_P (decl)
+ && tag_code != typename_type)
{
error ("using typedef-name `%D' after `%s'", decl, tag_name (tag_code));
return IS_AGGR_TYPE (type) ? type : error_mark_node;
@@ -9379,7 +9394,8 @@ check_elaborated_type_specifier (enum tag_types tag_code,
}
else if (TREE_CODE (type) != RECORD_TYPE
&& TREE_CODE (type) != UNION_TYPE
- && tag_code != enum_type)
+ && tag_code != enum_type
+ && tag_code != typename_type)
{
error ("`%T' referred to as `%s'", type, tag_name (tag_code));
return error_mark_node;
@@ -10301,7 +10317,11 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
class scope, current_class_type will be NULL_TREE until set above
by push_nested_class.) */
if (processing_template_decl)
- decl1 = push_template_decl (decl1);
+ {
+ tree newdecl1 = push_template_decl (decl1);
+ if (newdecl1 != error_mark_node)
+ decl1 = newdecl1;
+ }
/* We are now in the scope of the function being defined. */
current_function_decl = decl1;
@@ -10315,6 +10335,8 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
must be complete when you define the function. */
if (! processing_template_decl)
check_function_type (decl1, current_function_parms);
+ /* Make sure no default arg is missing. */
+ check_default_args (decl1);
/* Build the return declaration for the function. */
restype = TREE_TYPE (fntype);
@@ -10378,8 +10400,6 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
/* We need to set the DECL_CONTEXT. */
if (!DECL_CONTEXT (decl1) && DECL_TEMPLATE_INFO (decl1))
DECL_CONTEXT (decl1) = DECL_CONTEXT (DECL_TI_TEMPLATE (decl1));
- /* And make sure we have enough default args. */
- check_default_args (decl1);
}
fntype = TREE_TYPE (decl1);
}
diff --git a/contrib/gcc/cppinit.c b/contrib/gcc/cppinit.c
index 6ea1ca2..a713cea 100644
--- a/contrib/gcc/cppinit.c
+++ b/contrib/gcc/cppinit.c
@@ -468,7 +468,7 @@ cpp_read_main_file (cpp_reader *pfile, const char *fname)
}
pfile->main_file
- = _cpp_find_file (pfile, fname, &pfile->no_search_path, false);
+ = _cpp_find_file (pfile, fname, &pfile->no_search_path, false, 0);
if (_cpp_find_failed (pfile->main_file))
return NULL;
@@ -479,6 +479,8 @@ cpp_read_main_file (cpp_reader *pfile, const char *fname)
if (CPP_OPTION (pfile, preprocessed))
{
read_original_filename (pfile);
+ if (!pfile->map)
+ return NULL;
fname = pfile->map->to_file;
}
return fname;
@@ -498,8 +500,10 @@ read_original_filename (cpp_reader *pfile)
token = _cpp_lex_direct (pfile);
if (token->type == CPP_HASH)
{
+ pfile->state.in_directive = 1;
token1 = _cpp_lex_direct (pfile);
_cpp_backup_tokens (pfile, 1);
+ pfile->state.in_directive = 0;
/* If it's a #line directive, handle it. */
if (token1->type == CPP_NUMBER)
diff --git a/contrib/gcc/f/g77spec.c b/contrib/gcc/f/g77spec.c
index 10b7d1f..449f299 100644
--- a/contrib/gcc/f/g77spec.c
+++ b/contrib/gcc/f/g77spec.c
@@ -1,5 +1,5 @@
/* Specific flags and argument handling of the Fortran front-end.
- Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
This file is part of GCC.
@@ -370,7 +370,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
case OPTION_version:
printf ("GNU Fortran (GCC) %s\n", version_string);
- printf ("Copyright %s 2004 Free Software Foundation, Inc.\n",
+ printf ("Copyright %s 2006 Free Software Foundation, Inc.\n",
_("(C)"));
printf ("\n");
printf (_("\
diff --git a/contrib/gcc/gcc.c b/contrib/gcc/gcc.c
index bc83fa9..2800d91 100644
--- a/contrib/gcc/gcc.c
+++ b/contrib/gcc/gcc.c
@@ -1,6 +1,8 @@
/* Compiler driver program that can handle many languages.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+ Inc.
This file is part of GCC.
@@ -3406,7 +3408,7 @@ process_command (int argc, const char **argv)
{
/* translate_options () has turned --version into -fversion. */
printf (_("%s (GCC) %s\n"), programname, version_string);
- printf ("Copyright %s 2004 Free Software Foundation, Inc.\n",
+ printf ("Copyright %s 2006 Free Software Foundation, Inc.\n",
_("(C)"));
fputs (_("This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"),
diff --git a/contrib/gcc/toplev.c b/contrib/gcc/toplev.c
index acb44f6..da20354 100644
--- a/contrib/gcc/toplev.c
+++ b/contrib/gcc/toplev.c
@@ -4277,6 +4277,10 @@ general_init (const char *argv0)
static void
process_options (void)
{
+ /* Just in case lang_hooks.post_options ends up calling a debug_hook.
+ This can happen with incorrect pre-processed input. */
+ debug_hooks = &do_nothing_debug_hooks;
+
/* Allow the front end to perform consistency checks and do further
initialization based on the command line options. This hook also
sets the original filename if appropriate (e.g. foo.i -> foo.c)
@@ -4406,7 +4410,7 @@ process_options (void)
/* Now we know write_symbols, set up the debug hooks based on it.
By default we do nothing for debug output. */
if (write_symbols == NO_DEBUG)
- debug_hooks = &do_nothing_debug_hooks;
+ ;
#if defined(DBX_DEBUGGING_INFO)
else if (write_symbols == DBX_DEBUG)
debug_hooks = &dbx_debug_hooks;
diff --git a/contrib/gcc/version.c b/contrib/gcc/version.c
index 00f84e6..229cf62 100644
--- a/contrib/gcc/version.c
+++ b/contrib/gcc/version.c
@@ -6,7 +6,7 @@
please modify this string to indicate that, e.g. by putting your
organization's name in parentheses at the end of the string. */
-const char version_string[] = "3.4.4 [FreeBSD] 20050518";
+const char version_string[] = "3.4.6 [FreeBSD] 20060825";
/* This is the location of the online document giving instructions for
reporting bugs. If you distribute a modified version of GCC,
OpenPOWER on IntegriCloud