+1998-10-23 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * parse.y (condition): Convert VAR_DECL from reference to indirect
+ reference.
+
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* method.c (hack_identifier): Just return a member function.
+1998-10-18 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl2.c (validate_nonmember_using_decl): Fix using-directives of
+ std if std is ignored.
+
1998-10-14 Jason Merrill <jason@yorick.cygnus.com>
* spew.c (yylex): Clear looking_for_typename if we got
* tinfo.cc: Add #pragma implementation.
(operator==): Move from inc/typeinfo and tinfo2.cc.
+1998-10-05 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * method.c (build_decl_overload_real): Clear
+ numeric_output_need_bar after __.
+
+1998-10-04 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (cp_finish_decl): Make statics in extern inlines and
+ templates common, if possible and the target doesn't support weak
+ symbols.
+
+1998-10-03 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (merge_functions): Remove duplicates.
+
+ * typeck.c (build_conditional_expr): Only fold if ifexp is an
+ INTEGER_CST.
+
Fri Oct 2 02:07:26 1998 Mumit Khan <khan@xraylith.wisc.edu>
* parse.y (nomods_initdcl0): Set up the parser stack correctly.
if (was_temp)
end_temporary_allocation ();
- /* Extern inline function static data has external linkage.
- Instead of trying to deal with that, we disable inlining of
- such functions. The ASM_WRITTEN check is to avoid hitting this
- for __FUNCTION__. */
+ /* Static data in a function with comdat linkage also has comdat
+ linkage. */
if (TREE_CODE (decl) == VAR_DECL
&& TREE_STATIC (decl)
+ /* Don't mess with __FUNCTION__. */
&& ! TREE_ASM_WRITTEN (decl)
&& current_function_decl
&& DECL_CONTEXT (decl) == current_function_decl
- && DECL_THIS_INLINE (current_function_decl)
+ && (DECL_THIS_INLINE (current_function_decl)
+ || DECL_TEMPLATE_INSTANTIATION (current_function_decl))
&& TREE_PUBLIC (current_function_decl))
{
+ /* Rather than try to get this right with inlining, we suppress
+ inlining of such functions. */
current_function_cannot_inline
= "function with static variable cannot be inline";
+
+ /* If flag_weak, we don't need to mess with this, as we can just
+ make the function weak, and let it refer to its unique local
+ copy. This works because we don't allow the function to be
+ inlined. */
+ if (! flag_weak)
+ {
+ if (DECL_INTERFACE_KNOWN (current_function_decl))
+ {
+ TREE_PUBLIC (decl) = 1;
+ DECL_EXTERNAL (decl) = DECL_EXTERNAL (current_function_decl);
+ }
+ else if (DECL_INITIAL (decl) == NULL_TREE
+ || DECL_INITIAL (decl) == error_mark_node)
+ {
+ TREE_PUBLIC (decl) = 1;
+ DECL_COMMON (decl) = 1;
+ }
+ /* else we lose. We can only do this if we can use common,
+ which we can't if it has been initialized. */
+
+ if (TREE_PUBLIC (decl))
+ DECL_ASSEMBLER_NAME (decl)
+ = build_static_name (current_function_decl, DECL_NAME (decl));
+ else if (! DECL_ARTIFICIAL (decl))
+ {
+ cp_warning_at ("sorry: semantics of inline function static data `%#D' are wrong (you'll wind up with multiple copies)", decl);
+ cp_warning_at (" you can work around this by removing the initializer"), decl;
+ }
+ }
}
else if (TREE_CODE (decl) == VAR_DECL
add_using_namespace (TREE_PURPOSE (t), used, 1);
}
-/* Combines two sets of overloaded functions into an OVERLOAD chain.
- The first list becomes the tail of the result. */
+/* Combines two sets of overloaded functions into an OVERLOAD chain, removing
+ duplicates. The first list becomes the tail of the result.
+
+ The algorithm is O(n^2). */
static tree
merge_functions (s1, s2)
tree s1;
tree s2;
{
- if (TREE_CODE (s2) == OVERLOAD)
- while (s2)
- {
- s1 = build_overload (OVL_FUNCTION (s2), s1);
- s2 = OVL_CHAIN (s2);
- }
- else
- s1 = build_overload (s2, s1);
+ for (; s2; s2 = OVL_NEXT (s2))
+ {
+ tree fn = OVL_CURRENT (s2);
+ if (! ovl_member (fn, s1))
+ s1 = build_overload (fn, s1);
+ }
return s1;
}
{
if (TREE_CODE (decl) == SCOPE_REF
&& TREE_OPERAND (decl, 0) == std_node)
- return NULL_TREE;
- if (TREE_CODE (decl) == SCOPE_REF)
+ {
+ *scope = global_namespace;
+ *name = TREE_OPERAND (decl, 1);
+ }
+ else if (TREE_CODE (decl) == SCOPE_REF)
{
*scope = TREE_OPERAND (decl, 0);
*name = TREE_OPERAND (decl, 1);
and figure out its name without any extra encoding. */
OB_PUTC2 ('_', '_');
+ numeric_output_need_bar = 0;
if (tparms)
{
{
cp_finish_decl (yyvsp[-1].ttype, yyvsp[0].ttype, yyvsp[-3].ttype, 1, LOOKUP_ONLYCONVERTING);
resume_momentary (yyvsp[-2].itype);
- yyval.ttype = yyvsp[-1].ttype;
+ yyval.ttype = convert_from_reference (yyvsp[-1].ttype);
if (TREE_CODE (TREE_TYPE (yyval.ttype)) == ARRAY_TYPE)
cp_error ("definition of array `%#D' in condition", yyval.ttype);
;
{
cp_finish_decl ($<ttype>6, $7, $4, 1, LOOKUP_ONLYCONVERTING);
resume_momentary ($<itype>5);
- $$ = $<ttype>6;
+ $$ = convert_from_reference ($<ttype>6);
if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
cp_error ("definition of array `%#D' in condition", $$);
}
op2 = convert_for_initialization
(NULL_TREE, result_type, op2, LOOKUP_NORMAL, "converting", NULL_TREE, 0);
- if (TREE_CONSTANT (ifexp))
+ if (TREE_CODE (ifexp) == INTEGER_CST)
return integer_zerop (ifexp) ? op2 : op1;
return convert_from_reference