Canonicalize whitespace.
From-SVN: r100965
This commit is contained in:
parent
cbcabe5bed
commit
0cbd750645
@ -6378,7 +6378,7 @@
|
||||
(cp_parser_direct_declarator): Likewise.
|
||||
* pt.c (tsubst): Likewise.
|
||||
(tsubst_copy, tsubst_copy_and_build): Likewise; also add new operand
|
||||
for COMPONENT_REF.
|
||||
for COMPONENT_REF.
|
||||
* semantics.c (finish_non_static_data_member): Add new operand
|
||||
for COMPONENT_REF.
|
||||
* typeck.c (build_class_member_access_expr): Likewise.
|
||||
|
@ -454,8 +454,8 @@
|
||||
Greg McGary <gkm@gnu.org>
|
||||
|
||||
* decl.c (duplicate_decls): Merge
|
||||
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT,
|
||||
DECL_NO_CHECK_MEMORY_USAGE, DECL_NO_LIMIT_STACK.
|
||||
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT,
|
||||
DECL_NO_CHECK_MEMORY_USAGE, DECL_NO_LIMIT_STACK.
|
||||
|
||||
1999-12-02 Mike Stump <mrs@wrs.com>
|
||||
|
||||
@ -860,7 +860,7 @@ Thu Nov 11 12:42:11 MST 1999 Diego Novillo <dnovillo@cygnus.com>
|
||||
* pt.c (tsubst_enum): Adjust according to build_enumerator changes.
|
||||
|
||||
Wed Nov 10 12:43:21 1999 Philippe De Muyter <phdm@macqel.be>
|
||||
Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* cp-tree.h: Test `GCC_VERSION', not `HAVE_GCC_VERSION'.
|
||||
|
||||
@ -2183,8 +2183,8 @@ Sun Sep 12 23:29:07 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* g++spec.c: Include gcc.h.
|
||||
(lang_specific_driver): Constify a char*. Call xcalloc, not
|
||||
xmalloc/bzero. All calls to the function pointer parameter now
|
||||
explicitly call `fatal'.
|
||||
xmalloc/bzero. All calls to the function pointer parameter now
|
||||
explicitly call `fatal'.
|
||||
|
||||
1999-09-12 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
@ -4791,7 +4791,7 @@ Wed Jul 7 01:26:47 1999 Alexandre Oliva <oliva@dcc.unicamp.br>
|
||||
(pt.c): Or CP_TYPE_QUALS for an ERROR_MARK.
|
||||
(typeck.c): Or TYPE_MAIN_VARIANT for a type.
|
||||
|
||||
* pt.c (for_each_template_parm): Rework to match documentation.
|
||||
* pt.c (for_each_template_parm): Rework to match documentation.
|
||||
Don't be fooled by a COMPONENT_REF with no TREE_TYPE.
|
||||
|
||||
1999-05-20 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
@ -85,12 +85,12 @@
|
||||
2003-12-22 Andrew Pinski <pinskia@physics.uc.edu>
|
||||
|
||||
PR c++/5050
|
||||
* tree.c (cp_start_inlining): Remove.
|
||||
(cp_end_inlining): Remove.
|
||||
* cp-lang.c (LANG_HOOKS_TREE_INLINING_START_INLINING): Do not define.
|
||||
(LANG_HOOKS_TREE_INLINING_END_INLINING): Do not define.
|
||||
* cp-tree.h (cp_start_inlining): Do not declare.
|
||||
(cp_end_inlining): Do not declare.
|
||||
* tree.c (cp_start_inlining): Remove.
|
||||
(cp_end_inlining): Remove.
|
||||
* cp-lang.c (LANG_HOOKS_TREE_INLINING_START_INLINING): Do not define.
|
||||
(LANG_HOOKS_TREE_INLINING_END_INLINING): Do not define.
|
||||
* cp-tree.h (cp_start_inlining): Do not declare.
|
||||
(cp_end_inlining): Do not declare.
|
||||
|
||||
2003-12-22 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
@ -304,7 +304,7 @@
|
||||
* decl.c (xref_basetypes): Check java class inheritance.
|
||||
* decl2.c (check_java_method): Skip artificial params.
|
||||
|
||||
PR c++/13241
|
||||
PR c++/13241
|
||||
C++ ABI change. Mangling of symbols in expressions.
|
||||
* mangle.c (write_mangled_name): Add top_level flag. Rework for
|
||||
nested and unnested mangling. Deal with abi version 1 and version
|
||||
@ -514,8 +514,8 @@
|
||||
2003-12-02 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* name-lookup.h (struct cp_binding_level): Use ENUM_BITFIELD.
|
||||
* parser.c (struct cp_token): Likewise.
|
||||
(struct cp_parser_token_tree_map_node): Likewise.
|
||||
* parser.c (struct cp_token): Likewise.
|
||||
(struct cp_parser_token_tree_map_node): Likewise.
|
||||
* lex.c (struct resword): Move const after ENUM_BITFIELD.
|
||||
|
||||
2003-11-30 Mark Mitchell <mark@codesourcery.com>
|
||||
@ -630,11 +630,11 @@
|
||||
|
||||
2003-11-14 Giovanni Bajo <giovannibajo@libero.it>
|
||||
|
||||
PR c++/2294
|
||||
* name-lookup.c (push_overloaded_decl): Always construct an OVERLOAD
|
||||
unless the declaration is a built-in.
|
||||
(set_namespace_binding): While binding OVERLOADs with only one
|
||||
declaration, we still need to call supplement_binding.
|
||||
PR c++/2294
|
||||
* name-lookup.c (push_overloaded_decl): Always construct an OVERLOAD
|
||||
unless the declaration is a built-in.
|
||||
(set_namespace_binding): While binding OVERLOADs with only one
|
||||
declaration, we still need to call supplement_binding.
|
||||
|
||||
2003-11-14 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
@ -647,9 +647,9 @@
|
||||
|
||||
2003-11-14 Giovanni Bajo <giovannibajo@libero.it>
|
||||
|
||||
PR c++/2094
|
||||
* pt.c (unify): Add support for PTRMEM_CST and
|
||||
FIELD_DECL unification.
|
||||
PR c++/2094
|
||||
* pt.c (unify): Add support for PTRMEM_CST and
|
||||
FIELD_DECL unification.
|
||||
|
||||
2003-11-13 Richard Earnshaw <rearnsha@arm.com>
|
||||
|
||||
@ -801,7 +801,7 @@
|
||||
2003-10-21 Robert Bowdidge <bowdidge@apple.com>
|
||||
|
||||
* decl.c (cp_finish_decl): Remove clause intended for asm directives
|
||||
in struct or class fields: this code is never executed.
|
||||
in struct or class fields: this code is never executed.
|
||||
|
||||
2003-10-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
@ -1194,7 +1194,7 @@
|
||||
2003-09-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
* cp-tree.h, name-lookup.h, decl.c, decl2.c: Remove reference to
|
||||
macros BINDING_SCOPE, BINDING_VALUE and BINDING_TYPE.
|
||||
macros BINDING_SCOPE, BINDING_VALUE and BINDING_TYPE.
|
||||
|
||||
2003-09-26 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
@ -1344,7 +1344,7 @@
|
||||
2003-09-17 Richard Henderson <rth@redhat.com>
|
||||
|
||||
PR c++/12316
|
||||
* semantics.c (expand_or_defer_fn): Inc/dec function_depth.
|
||||
* semantics.c (expand_or_defer_fn): Inc/dec function_depth.
|
||||
|
||||
2003-09-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
|
@ -4631,7 +4631,7 @@
|
||||
(cp_parser_direct_declarator): Likewise.
|
||||
* pt.c (tsubst): Likewise.
|
||||
(tsubst_copy, tsubst_copy_and_build): Likewise; also add new operand
|
||||
for COMPONENT_REF.
|
||||
for COMPONENT_REF.
|
||||
* semantics.c (finish_non_static_data_member): Add new operand
|
||||
for COMPONENT_REF.
|
||||
* typeck.c (build_class_member_access_expr): Likewise.
|
||||
|
@ -261,8 +261,8 @@
|
||||
|
||||
2003-09-03 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* decl.c (finish_function): Fix misapplied patch. Don't
|
||||
free_after_parsing or free_after_compilation. For real this time.
|
||||
* decl.c (finish_function): Fix misapplied patch. Don't
|
||||
free_after_parsing or free_after_compilation. For real this time.
|
||||
|
||||
2003-08-22 Jason Merrill <jason@redhat.com>
|
||||
|
||||
@ -314,7 +314,7 @@
|
||||
|
||||
2003-06-05 Frank Ch. Eigler <fche@redhat.com>
|
||||
|
||||
* cp-mudflap.c (mx_flag): Remove. Update callers to use mf_mark.
|
||||
* cp-mudflap.c (mx_flag): Remove. Update callers to use mf_mark.
|
||||
|
||||
2003-05-24 Diego Novillo <dnovillo@redhat.com>
|
||||
|
||||
|
@ -164,7 +164,7 @@ c++.install-common: installdirs
|
||||
$(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
|
||||
rm -f $(DESTDIR)$(gcc_tooldir)/bin/c++$(exeext); \
|
||||
( cd $(DESTDIR)$(gcc_tooldir)/bin && \
|
||||
$(LN) g++$(exeext) c++$(exeext) ); \
|
||||
$(LN) g++$(exeext) c++$(exeext) ); \
|
||||
else true; fi; \
|
||||
else \
|
||||
rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
|
||||
|
16
gcc/cp/NEWS
16
gcc/cp/NEWS
@ -250,7 +250,7 @@
|
||||
but not all, the compiler will tell you where you need to add
|
||||
'typename'. For more information, see
|
||||
|
||||
http://www.cygnus.com/misc/wp/dec96pub/template.html#temp.res
|
||||
http://www.cygnus.com/misc/wp/dec96pub/template.html#temp.res
|
||||
|
||||
+ Guiding declarations are no longer supported. Function declarations,
|
||||
including friend declarations, do not refer to template instantiations.
|
||||
@ -269,7 +269,7 @@
|
||||
+ Explicit instantiation of template constructors and destructors is
|
||||
now supported. For instance:
|
||||
|
||||
template A<int>::A(const A&);
|
||||
template A<int>::A(const A&);
|
||||
|
||||
Still not supported:
|
||||
|
||||
@ -324,9 +324,9 @@
|
||||
signatures are overridden) as it did before.
|
||||
|
||||
+ -Wall no longer implies -W. The new warning flag, -Wsign-compare,
|
||||
included in -Wall, warns about dangerous comparisons of signed and
|
||||
unsigned values. Only the flag is new; it was previously part of
|
||||
-W.
|
||||
included in -Wall, warns about dangerous comparisons of signed and
|
||||
unsigned values. Only the flag is new; it was previously part of
|
||||
-W.
|
||||
|
||||
+ The new flag, -fno-weak, disables the use of weak symbols.
|
||||
|
||||
@ -377,12 +377,12 @@
|
||||
supported. For instance:
|
||||
|
||||
struct A {
|
||||
struct B;
|
||||
B* bp;
|
||||
struct B;
|
||||
B* bp;
|
||||
};
|
||||
|
||||
struct A::B {
|
||||
int member;
|
||||
int member;
|
||||
};
|
||||
|
||||
* On the HPPA, some classes that do not define a copy constructor
|
||||
|
182
gcc/cp/call.c
182
gcc/cp/call.c
@ -134,11 +134,11 @@ static tree build_java_interface_fn_ref (tree, tree);
|
||||
#define convert_like_with_context(CONV, EXPR, FN, ARGNO) \
|
||||
convert_like_real ((CONV), (EXPR), (FN), (ARGNO), 0, \
|
||||
/*issue_conversion_warnings=*/true, \
|
||||
/*c_cast_p=*/false)
|
||||
/*c_cast_p=*/false)
|
||||
static tree convert_like_real (conversion *, tree, tree, int, int, bool,
|
||||
bool);
|
||||
static void op_error (enum tree_code, enum tree_code, tree, tree,
|
||||
tree, const char *);
|
||||
tree, const char *);
|
||||
static tree build_object_call (tree, tree);
|
||||
static tree resolve_args (tree);
|
||||
static struct z_candidate *build_user_type_conversion_1 (tree, tree, int);
|
||||
@ -148,23 +148,23 @@ static tree build_this (tree);
|
||||
static struct z_candidate *splice_viable (struct z_candidate *, bool, bool *);
|
||||
static bool any_strictly_viable (struct z_candidate *);
|
||||
static struct z_candidate *add_template_candidate
|
||||
(struct z_candidate **, tree, tree, tree, tree, tree,
|
||||
tree, tree, int, unification_kind_t);
|
||||
(struct z_candidate **, tree, tree, tree, tree, tree,
|
||||
tree, tree, int, unification_kind_t);
|
||||
static struct z_candidate *add_template_candidate_real
|
||||
(struct z_candidate **, tree, tree, tree, tree, tree,
|
||||
tree, tree, int, tree, unification_kind_t);
|
||||
tree, tree, int, tree, unification_kind_t);
|
||||
static struct z_candidate *add_template_conv_candidate
|
||||
(struct z_candidate **, tree, tree, tree, tree, tree, tree);
|
||||
(struct z_candidate **, tree, tree, tree, tree, tree, tree);
|
||||
static void add_builtin_candidates
|
||||
(struct z_candidate **, enum tree_code, enum tree_code,
|
||||
tree, tree *, int);
|
||||
tree, tree *, int);
|
||||
static void add_builtin_candidate
|
||||
(struct z_candidate **, enum tree_code, enum tree_code,
|
||||
tree, tree, tree, tree *, tree *, int);
|
||||
tree, tree, tree, tree *, tree *, int);
|
||||
static bool is_complete (tree);
|
||||
static void build_builtin_candidate
|
||||
(struct z_candidate **, tree, tree, tree, tree *, tree *,
|
||||
int);
|
||||
int);
|
||||
static struct z_candidate *add_conv_candidate
|
||||
(struct z_candidate **, tree, tree, tree, tree, tree);
|
||||
static struct z_candidate *add_function_candidate
|
||||
@ -177,7 +177,7 @@ static bool is_subseq (conversion *, conversion *);
|
||||
static tree maybe_handle_ref_bind (conversion **);
|
||||
static void maybe_handle_implicit_object (conversion **);
|
||||
static struct z_candidate *add_candidate
|
||||
(struct z_candidate **, tree, tree, size_t,
|
||||
(struct z_candidate **, tree, tree, size_t,
|
||||
conversion **, tree, tree, int);
|
||||
static tree source_type (conversion *);
|
||||
static void add_warning (struct z_candidate *, struct z_candidate *);
|
||||
@ -227,11 +227,11 @@ check_dtor_name (tree basetype, tree name)
|
||||
{
|
||||
/* In the case of:
|
||||
|
||||
template <class T> struct S { ~S(); };
|
||||
int i;
|
||||
i.~S();
|
||||
template <class T> struct S { ~S(); };
|
||||
int i;
|
||||
i.~S();
|
||||
|
||||
NAME will be a class template. */
|
||||
NAME will be a class template. */
|
||||
gcc_assert (DECL_CLASS_TEMPLATE_P (name));
|
||||
return false;
|
||||
}
|
||||
@ -628,18 +628,18 @@ standard_conversion (tree to, tree from, tree expr, int flags)
|
||||
if (tcode == COMPLEX_TYPE && fcode == COMPLEX_TYPE)
|
||||
{
|
||||
/* The standard conversion sequence to convert FROM to TO is
|
||||
the standard conversion sequence to perform componentwise
|
||||
conversion. */
|
||||
the standard conversion sequence to perform componentwise
|
||||
conversion. */
|
||||
conversion *part_conv = standard_conversion
|
||||
(TREE_TYPE (to), TREE_TYPE (from), NULL_TREE, flags);
|
||||
(TREE_TYPE (to), TREE_TYPE (from), NULL_TREE, flags);
|
||||
|
||||
if (part_conv)
|
||||
{
|
||||
{
|
||||
conv = build_conv (part_conv->kind, to, conv);
|
||||
conv->rank = part_conv->rank;
|
||||
}
|
||||
}
|
||||
else
|
||||
conv = NULL;
|
||||
conv = NULL;
|
||||
|
||||
return conv;
|
||||
}
|
||||
@ -705,15 +705,15 @@ standard_conversion (tree to, tree from, tree expr, int flags)
|
||||
&& IS_AGGR_TYPE (TREE_TYPE (to))
|
||||
/* [conv.ptr]
|
||||
|
||||
An rvalue of type "pointer to cv D," where D is a
|
||||
An rvalue of type "pointer to cv D," where D is a
|
||||
class type, can be converted to an rvalue of type
|
||||
"pointer to cv B," where B is a base class (clause
|
||||
_class.derived_) of D. If B is an inaccessible
|
||||
(clause _class.access_) or ambiguous
|
||||
(_class.member.lookup_) base class of D, a program
|
||||
that necessitates this conversion is ill-formed.
|
||||
Therefore, we use DERIVED_FROM_P, and do not check
|
||||
access or uniqueness. */
|
||||
Therefore, we use DERIVED_FROM_P, and do not check
|
||||
access or uniqueness. */
|
||||
&& DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from)))
|
||||
{
|
||||
from =
|
||||
@ -778,7 +778,7 @@ standard_conversion (tree to, tree from, tree expr, int flags)
|
||||
{
|
||||
/* [conv.bool]
|
||||
|
||||
An rvalue of arithmetic, enumeration, pointer, or pointer to
|
||||
An rvalue of arithmetic, enumeration, pointer, or pointer to
|
||||
member type can be converted to an rvalue of type bool. */
|
||||
if (ARITHMETIC_TYPE_P (from)
|
||||
|| fcode == ENUMERAL_TYPE
|
||||
@ -921,7 +921,7 @@ convert_class_to_reference (tree t, tree s, tree expr)
|
||||
cand = NULL;
|
||||
|
||||
/* If this is a template function, try to get an exact
|
||||
match. */
|
||||
match. */
|
||||
if (TREE_CODE (f) == TEMPLATE_DECL)
|
||||
{
|
||||
cand = add_template_candidate (&candidates,
|
||||
@ -1133,7 +1133,7 @@ reference_binding (tree rto, tree rfrom, tree expr, int flags)
|
||||
conversion functions (_over.match.ref_) and choosing the
|
||||
best one through overload resolution. (_over.match_).
|
||||
|
||||
the reference is bound to the lvalue result of the conversion
|
||||
the reference is bound to the lvalue result of the conversion
|
||||
in the second case. */
|
||||
conv = convert_class_to_reference (to, from, expr);
|
||||
if (conv)
|
||||
@ -1169,7 +1169,7 @@ reference_binding (tree rto, tree rfrom, tree expr, int flags)
|
||||
is bound in one of the following ways:
|
||||
|
||||
-- The reference is bound to the object represented by the rvalue
|
||||
or to a sub-object within that object.
|
||||
or to a sub-object within that object.
|
||||
|
||||
-- ...
|
||||
|
||||
@ -1427,7 +1427,7 @@ add_function_candidate (struct z_candidate **candidates,
|
||||
|
||||
static struct z_candidate *
|
||||
add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
|
||||
tree arglist, tree access_path, tree conversion_path)
|
||||
tree arglist, tree access_path, tree conversion_path)
|
||||
{
|
||||
tree totype = TREE_TYPE (TREE_TYPE (fn));
|
||||
int i, len, viable, flags;
|
||||
@ -1494,8 +1494,8 @@ add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
|
||||
|
||||
static void
|
||||
build_builtin_candidate (struct z_candidate **candidates, tree fnname,
|
||||
tree type1, tree type2, tree *args, tree *argtypes,
|
||||
int flags)
|
||||
tree type1, tree type2, tree *args, tree *argtypes,
|
||||
int flags)
|
||||
{
|
||||
conversion *t;
|
||||
conversion **convs;
|
||||
@ -1580,8 +1580,8 @@ promoted_arithmetic_type_p (tree type)
|
||||
|
||||
static void
|
||||
add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
|
||||
enum tree_code code2, tree fnname, tree type1,
|
||||
tree type2, tree *args, tree *argtypes, int flags)
|
||||
enum tree_code code2, tree fnname, tree type1,
|
||||
tree type2, tree *args, tree *argtypes, int flags)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
@ -1769,11 +1769,11 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
|
||||
case MAX_EXPR:
|
||||
case MIN_EXPR:
|
||||
if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2))
|
||||
break;
|
||||
break;
|
||||
if (TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
|
||||
break;
|
||||
if (TREE_CODE (type1) == ENUMERAL_TYPE && TREE_CODE (type2) == ENUMERAL_TYPE)
|
||||
break;
|
||||
break;
|
||||
if (TYPE_PTR_P (type1) && null_ptr_cst_p (args[1]))
|
||||
{
|
||||
type2 = type1;
|
||||
@ -1988,8 +1988,8 @@ type_decays_to (tree type)
|
||||
|
||||
static void
|
||||
add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
|
||||
enum tree_code code2, tree fnname, tree *args,
|
||||
int flags)
|
||||
enum tree_code code2, tree fnname, tree *args,
|
||||
int flags)
|
||||
{
|
||||
int ref1, i;
|
||||
int enum_p = 0;
|
||||
@ -2104,8 +2104,8 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
|
||||
if (i != 0 || ! ref1)
|
||||
{
|
||||
type = TYPE_MAIN_VARIANT (type_decays_to (type));
|
||||
if (enum_p && TREE_CODE (type) == ENUMERAL_TYPE)
|
||||
types[i] = tree_cons (NULL_TREE, type, types[i]);
|
||||
if (enum_p && TREE_CODE (type) == ENUMERAL_TYPE)
|
||||
types[i] = tree_cons (NULL_TREE, type, types[i]);
|
||||
if (INTEGRAL_TYPE_P (type))
|
||||
type = type_promotes_to (type);
|
||||
}
|
||||
@ -2124,7 +2124,7 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
|
||||
{
|
||||
type = TYPE_MAIN_VARIANT (type_decays_to (type));
|
||||
if (enum_p && TREE_CODE (type) == ENUMERAL_TYPE)
|
||||
types[i] = tree_cons (NULL_TREE, type, types[i]);
|
||||
types[i] = tree_cons (NULL_TREE, type, types[i]);
|
||||
if (INTEGRAL_TYPE_P (type))
|
||||
type = type_promotes_to (type);
|
||||
}
|
||||
@ -2163,10 +2163,10 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
|
||||
|
||||
static struct z_candidate*
|
||||
add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
|
||||
tree ctype, tree explicit_targs, tree arglist,
|
||||
tree return_type, tree access_path,
|
||||
tree ctype, tree explicit_targs, tree arglist,
|
||||
tree return_type, tree access_path,
|
||||
tree conversion_path, int flags, tree obj,
|
||||
unification_kind_t strict)
|
||||
unification_kind_t strict)
|
||||
{
|
||||
int ntparms = DECL_NTPARMS (tmpl);
|
||||
tree targs = make_tree_vec (ntparms);
|
||||
@ -2206,7 +2206,7 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
|
||||
in:
|
||||
|
||||
struct A {
|
||||
A(A&);
|
||||
A(A&);
|
||||
template <class T> A(const T&);
|
||||
};
|
||||
const A f ();
|
||||
@ -2262,9 +2262,9 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
|
||||
|
||||
static struct z_candidate *
|
||||
add_template_candidate (struct z_candidate **candidates, tree tmpl, tree ctype,
|
||||
tree explicit_targs, tree arglist, tree return_type,
|
||||
tree access_path, tree conversion_path, int flags,
|
||||
unification_kind_t strict)
|
||||
tree explicit_targs, tree arglist, tree return_type,
|
||||
tree access_path, tree conversion_path, int flags,
|
||||
unification_kind_t strict)
|
||||
{
|
||||
return
|
||||
add_template_candidate_real (candidates, tmpl, ctype,
|
||||
@ -2276,7 +2276,7 @@ add_template_candidate (struct z_candidate **candidates, tree tmpl, tree ctype,
|
||||
|
||||
static struct z_candidate *
|
||||
add_template_conv_candidate (struct z_candidate **candidates, tree tmpl,
|
||||
tree obj, tree arglist, tree return_type,
|
||||
tree obj, tree arglist, tree return_type,
|
||||
tree access_path, tree conversion_path)
|
||||
{
|
||||
return
|
||||
@ -2997,7 +2997,7 @@ build_object_call (tree obj, tree args)
|
||||
|
||||
static void
|
||||
op_error (enum tree_code code, enum tree_code code2,
|
||||
tree arg1, tree arg2, tree arg3, const char *problem)
|
||||
tree arg1, tree arg2, tree arg3, const char *problem)
|
||||
{
|
||||
const char *opname;
|
||||
|
||||
@ -3010,7 +3010,7 @@ op_error (enum tree_code code, enum tree_code code2,
|
||||
{
|
||||
case COND_EXPR:
|
||||
error ("%s for ternary %<operator?:%> in %<%E ? %E : %E%>",
|
||||
problem, arg1, arg2, arg3);
|
||||
problem, arg1, arg2, arg3);
|
||||
break;
|
||||
|
||||
case POSTINCREMENT_EXPR:
|
||||
@ -3030,10 +3030,10 @@ op_error (enum tree_code code, enum tree_code code2,
|
||||
default:
|
||||
if (arg2)
|
||||
error ("%s for %<operator%s%> in %<%E %s %E%>",
|
||||
problem, opname, arg1, opname, arg2);
|
||||
problem, opname, arg1, opname, arg2);
|
||||
else
|
||||
error ("%s for %<operator%s%> in %<%s%E%>",
|
||||
problem, opname, opname, arg1);
|
||||
problem, opname, opname, arg1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3176,7 +3176,7 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3)
|
||||
--Both the second and the third operands have type void; the
|
||||
result is of type void and is an rvalue.
|
||||
|
||||
We must avoid calling force_rvalue for expressions of type
|
||||
We must avoid calling force_rvalue for expressions of type
|
||||
"void" because it will complain that their value is being
|
||||
used. */
|
||||
if (TREE_CODE (arg2) == THROW_EXPR
|
||||
@ -3401,15 +3401,15 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3)
|
||||
arg3_type);
|
||||
|
||||
if (TREE_CODE (arg2_type) == ENUMERAL_TYPE
|
||||
&& TREE_CODE (arg3_type) == ENUMERAL_TYPE)
|
||||
warning (0, "enumeral mismatch in conditional expression: %qT vs %qT",
|
||||
arg2_type, arg3_type);
|
||||
&& TREE_CODE (arg3_type) == ENUMERAL_TYPE)
|
||||
warning (0, "enumeral mismatch in conditional expression: %qT vs %qT",
|
||||
arg2_type, arg3_type);
|
||||
else if (extra_warnings
|
||||
&& ((TREE_CODE (arg2_type) == ENUMERAL_TYPE
|
||||
&& !same_type_p (arg3_type, type_promotes_to (arg2_type)))
|
||||
|| (TREE_CODE (arg3_type) == ENUMERAL_TYPE
|
||||
&& !same_type_p (arg2_type, type_promotes_to (arg3_type)))))
|
||||
warning (0, "enumeral and non-enumeral type in conditional expression");
|
||||
&& ((TREE_CODE (arg2_type) == ENUMERAL_TYPE
|
||||
&& !same_type_p (arg3_type, type_promotes_to (arg2_type)))
|
||||
|| (TREE_CODE (arg3_type) == ENUMERAL_TYPE
|
||||
&& !same_type_p (arg2_type, type_promotes_to (arg3_type)))))
|
||||
warning (0, "enumeral and non-enumeral type in conditional expression");
|
||||
|
||||
arg2 = perform_implicit_conversion (result_type, arg2);
|
||||
arg3 = perform_implicit_conversion (result_type, arg3);
|
||||
@ -3704,9 +3704,9 @@ build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3,
|
||||
one, then we fall back to the old way of doing things. */
|
||||
if (flags & LOOKUP_COMPLAIN)
|
||||
pedwarn ("no %<%D(int)%> declared for postfix %qs, "
|
||||
"trying prefix operator instead",
|
||||
fnname,
|
||||
operator_name_info[code].name);
|
||||
"trying prefix operator instead",
|
||||
fnname,
|
||||
operator_name_info[code].name);
|
||||
if (code == POSTINCREMENT_EXPR)
|
||||
code = PREINCREMENT_EXPR;
|
||||
else
|
||||
@ -3777,7 +3777,7 @@ build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3,
|
||||
!= TYPE_MAIN_VARIANT (TREE_TYPE (arg2))))
|
||||
{
|
||||
warning (0, "comparison between %q#T and %q#T",
|
||||
TREE_TYPE (arg1), TREE_TYPE (arg2));
|
||||
TREE_TYPE (arg1), TREE_TYPE (arg2));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -4444,7 +4444,7 @@ convert_arg_to_ellipsis (tree arg)
|
||||
evaluated. We keep the builtin_trap just as a safety check. */
|
||||
if (!skip_evaluation)
|
||||
warning (0, "cannot pass objects of non-POD type %q#T through %<...%>; "
|
||||
"call will abort at runtime", TREE_TYPE (arg));
|
||||
"call will abort at runtime", TREE_TYPE (arg));
|
||||
arg = call_builtin_trap ();
|
||||
arg = build2 (COMPOUND_EXPR, integer_type_node, arg,
|
||||
integer_zero_node);
|
||||
@ -4470,7 +4470,7 @@ build_x_va_arg (tree expr, tree type)
|
||||
{
|
||||
/* Undefined behavior [expr.call] 5.2.2/7. */
|
||||
warning (0, "cannot receive objects of non-POD type %q#T through %<...%>; "
|
||||
"call will abort at runtime", type);
|
||||
"call will abort at runtime", type);
|
||||
expr = convert (build_pointer_type (type), null_node);
|
||||
expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr),
|
||||
call_builtin_trap (), expr);
|
||||
@ -4718,13 +4718,13 @@ build_over_call (struct z_candidate *cand, int flags)
|
||||
|
||||
if (convs[i]->bad_p)
|
||||
pedwarn ("passing %qT as %<this%> argument of %q#D discards qualifiers",
|
||||
TREE_TYPE (argtype), fn);
|
||||
TREE_TYPE (argtype), fn);
|
||||
|
||||
/* [class.mfct.nonstatic]: If a nonstatic member function of a class
|
||||
X is called for an object that is not of type X, or of a type
|
||||
derived from X, the behavior is undefined.
|
||||
|
||||
So we can assume that anything passed as 'this' is non-null, and
|
||||
So we can assume that anything passed as 'this' is non-null, and
|
||||
optimize accordingly. */
|
||||
gcc_assert (TREE_CODE (parmtype) == POINTER_TYPE);
|
||||
/* Convert to the base in which the function was declared. */
|
||||
@ -4740,8 +4740,8 @@ build_over_call (struct z_candidate *cand, int flags)
|
||||
BINFO_TYPE (cand->conversion_path),
|
||||
TREE_TYPE (argtype));
|
||||
/* If fn was found by a using declaration, the conversion path
|
||||
will be to the derived class, not the base declaring fn. We
|
||||
must convert from derived to base. */
|
||||
will be to the derived class, not the base declaring fn. We
|
||||
must convert from derived to base. */
|
||||
base_binfo = lookup_base (TREE_TYPE (TREE_TYPE (converted_arg)),
|
||||
TREE_TYPE (parmtype), ba_unique, NULL);
|
||||
converted_arg = build_base_path (PLUS_EXPR, converted_arg,
|
||||
@ -4830,10 +4830,10 @@ build_over_call (struct z_candidate *cand, int flags)
|
||||
mark_used (fn);
|
||||
|
||||
/* If we're creating a temp and we already have one, don't create a
|
||||
new one. If we're not creating a temp but we get one, use
|
||||
INIT_EXPR to collapse the temp into our target. Otherwise, if the
|
||||
ctor is trivial, do a bitwise copy with a simple TARGET_EXPR for a
|
||||
temp or an INIT_EXPR otherwise. */
|
||||
new one. If we're not creating a temp but we get one, use
|
||||
INIT_EXPR to collapse the temp into our target. Otherwise, if the
|
||||
ctor is trivial, do a bitwise copy with a simple TARGET_EXPR for a
|
||||
temp or an INIT_EXPR otherwise. */
|
||||
if (integer_zerop (TREE_VALUE (args)))
|
||||
{
|
||||
if (TREE_CODE (arg) == TARGET_EXPR)
|
||||
@ -4998,9 +4998,9 @@ build_java_interface_fn_ref (tree fn, tree instance)
|
||||
for (method = TYPE_METHODS (iface); method; method = TREE_CHAIN (method))
|
||||
{
|
||||
if (!DECL_VIRTUAL_P (method))
|
||||
continue;
|
||||
continue;
|
||||
if (fn == method)
|
||||
break;
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
idx = build_int_cst (NULL_TREE, i);
|
||||
@ -5272,7 +5272,7 @@ build_new_method_call (tree instance, tree fns, tree args,
|
||||
{
|
||||
if ((flags & LOOKUP_COMPLAIN) && basetype != error_mark_node)
|
||||
error ("request for member %qD in %qE, which is of non-aggregate "
|
||||
"type %qT",
|
||||
"type %qT",
|
||||
fns, instance, basetype);
|
||||
|
||||
return error_mark_node;
|
||||
@ -6085,9 +6085,9 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
|
||||
if (cand1->template_decl && cand2->template_decl)
|
||||
{
|
||||
winner = more_specialized_fn
|
||||
(TI_TEMPLATE (cand1->template_decl),
|
||||
TI_TEMPLATE (cand2->template_decl),
|
||||
/* Tell the deduction code how many real function arguments
|
||||
(TI_TEMPLATE (cand1->template_decl),
|
||||
TI_TEMPLATE (cand2->template_decl),
|
||||
/* Tell the deduction code how many real function arguments
|
||||
we saw, not counting the implicit 'this' argument. But,
|
||||
add_function_candidate() suppresses the "this" argument
|
||||
for constructors.
|
||||
@ -6099,7 +6099,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
|
||||
- (DECL_NONSTATIC_MEMBER_FUNCTION_P (cand1->fn)
|
||||
- DECL_CONSTRUCTOR_P (cand1->fn)));
|
||||
if (winner)
|
||||
return winner;
|
||||
return winner;
|
||||
}
|
||||
|
||||
/* or, if not that,
|
||||
@ -6114,7 +6114,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
|
||||
{
|
||||
winner = compare_ics (cand1->second_conv, cand2->second_conv);
|
||||
if (winner)
|
||||
return winner;
|
||||
return winner;
|
||||
}
|
||||
|
||||
/* Check whether we can discard a builtin candidate, either because we
|
||||
@ -6176,7 +6176,7 @@ tweak:
|
||||
if (rank1 > rank2)
|
||||
winner = -1, w = cand2, l = cand1;
|
||||
if (winner)
|
||||
{
|
||||
{
|
||||
if (warn)
|
||||
{
|
||||
pedwarn ("\
|
||||
@ -6188,8 +6188,8 @@ the worst conversion for the second:");
|
||||
}
|
||||
else
|
||||
add_warning (w, l);
|
||||
return winner;
|
||||
}
|
||||
return winner;
|
||||
}
|
||||
}
|
||||
|
||||
gcc_assert (!winner);
|
||||
@ -6450,12 +6450,12 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup)
|
||||
if (!conv || conv->bad_p)
|
||||
{
|
||||
if (!(TYPE_QUALS (TREE_TYPE (type)) & TYPE_QUAL_CONST)
|
||||
&& !real_lvalue_p (expr))
|
||||
error ("invalid initialization of non-const reference of "
|
||||
"type %qT from a temporary of type %qT",
|
||||
type, TREE_TYPE (expr));
|
||||
&& !real_lvalue_p (expr))
|
||||
error ("invalid initialization of non-const reference of "
|
||||
"type %qT from a temporary of type %qT",
|
||||
type, TREE_TYPE (expr));
|
||||
else
|
||||
error ("invalid initialization of reference of type "
|
||||
error ("invalid initialization of reference of type "
|
||||
"%qT from expression of type %qT", type,
|
||||
TREE_TYPE (expr));
|
||||
return error_mark_node;
|
||||
@ -6508,7 +6508,7 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup)
|
||||
if (conv->kind == ck_base)
|
||||
{
|
||||
if (conv->check_copy_constructor_p)
|
||||
check_constructor_callable (TREE_TYPE (expr), expr);
|
||||
check_constructor_callable (TREE_TYPE (expr), expr);
|
||||
base_conv_type = conv->type;
|
||||
conv = conv->u.next;
|
||||
}
|
||||
|
250
gcc/cp/class.c
250
gcc/cp/class.c
@ -227,9 +227,9 @@ int n_inner_fields_searched = 0;
|
||||
|
||||
tree
|
||||
build_base_path (enum tree_code code,
|
||||
tree expr,
|
||||
tree binfo,
|
||||
int nonnull)
|
||||
tree expr,
|
||||
tree binfo,
|
||||
int nonnull)
|
||||
{
|
||||
tree v_binfo = NULL_TREE;
|
||||
tree d_binfo = NULL_TREE;
|
||||
@ -318,8 +318,8 @@ build_base_path (enum tree_code code,
|
||||
if (virtual_access)
|
||||
{
|
||||
/* Going via virtual base V_BINFO. We need the static offset
|
||||
from V_BINFO to BINFO, and the dynamic offset from D_BINFO to
|
||||
V_BINFO. That offset is an entry in D_BINFO's vtable. */
|
||||
from V_BINFO to BINFO, and the dynamic offset from D_BINFO to
|
||||
V_BINFO. That offset is an entry in D_BINFO's vtable. */
|
||||
tree v_offset;
|
||||
|
||||
if (fixed_type_p < 0 && in_base_initializer)
|
||||
@ -414,9 +414,9 @@ build_simple_base_path (tree expr, tree binfo)
|
||||
gcc_assert (TYPE_MAIN_VARIANT (TREE_TYPE (expr)) == type);
|
||||
|
||||
/* Transform `(a, b).x' into `(*(a, &b)).x', `(a ? b : c).x'
|
||||
into `(*(a ? &b : &c)).x', and so on. A COND_EXPR is only
|
||||
an lvalue in the frontend; only _DECLs and _REFs are lvalues
|
||||
in the backend. */
|
||||
into `(*(a ? &b : &c)).x', and so on. A COND_EXPR is only
|
||||
an lvalue in the frontend; only _DECLs and _REFs are lvalues
|
||||
in the backend. */
|
||||
temp = unary_complex_lvalue (ADDR_EXPR, expr);
|
||||
if (temp)
|
||||
expr = build_indirect_ref (temp, NULL);
|
||||
@ -847,10 +847,10 @@ make_new_vtable (tree t, tree binfo)
|
||||
|
||||
static void
|
||||
modify_vtable_entry (tree t,
|
||||
tree binfo,
|
||||
tree fndecl,
|
||||
tree delta,
|
||||
tree *virtuals)
|
||||
tree binfo,
|
||||
tree fndecl,
|
||||
tree delta,
|
||||
tree *virtuals)
|
||||
{
|
||||
tree v;
|
||||
|
||||
@ -1093,7 +1093,7 @@ alter_access (tree t, tree fdecl, tree access)
|
||||
{
|
||||
if (TREE_CODE (TREE_TYPE (fdecl)) == FUNCTION_DECL)
|
||||
cp_error_at ("conflicting access specifications for method"
|
||||
" %qD, ignored", TREE_TYPE (fdecl));
|
||||
" %qD, ignored", TREE_TYPE (fdecl));
|
||||
else
|
||||
error ("conflicting access specifications for field %qE, ignored",
|
||||
DECL_NAME (fdecl));
|
||||
@ -1186,8 +1186,8 @@ handle_using_decl (tree using_decl, tree t)
|
||||
|
||||
static void
|
||||
check_bases (tree t,
|
||||
int* cant_have_const_ctor_p,
|
||||
int* no_const_asn_ref_p)
|
||||
int* cant_have_const_ctor_p,
|
||||
int* no_const_asn_ref_p)
|
||||
{
|
||||
int i;
|
||||
int seen_non_virtual_nearly_empty_base_p;
|
||||
@ -1301,8 +1301,8 @@ determine_primary_bases (tree t)
|
||||
BINFO_INHERITANCE_CHAIN (this_primary) = base_binfo;
|
||||
|
||||
/* A virtual binfo might have been copied from within
|
||||
another hierarchy. As we're about to use it as a
|
||||
primary base, make sure the offsets match. */
|
||||
another hierarchy. As we're about to use it as a
|
||||
primary base, make sure the offsets match. */
|
||||
delta = size_diffop (convert (ssizetype,
|
||||
BINFO_OFFSET (base_binfo)),
|
||||
convert (ssizetype,
|
||||
@ -1364,8 +1364,8 @@ determine_primary_bases (tree t)
|
||||
|
||||
BINFO_INHERITANCE_CHAIN (primary) = type_binfo;
|
||||
/* A virtual binfo might have been copied from within
|
||||
another hierarchy. As we're about to use it as a primary
|
||||
base, make sure the offsets match. */
|
||||
another hierarchy. As we're about to use it as a primary
|
||||
base, make sure the offsets match. */
|
||||
delta = size_diffop (ssize_int (0),
|
||||
convert (ssizetype, BINFO_OFFSET (primary)));
|
||||
|
||||
@ -1573,7 +1573,7 @@ maybe_warn_about_overly_private_class (tree t)
|
||||
if (nonprivate_ctor == 0)
|
||||
{
|
||||
warning (0, "%q#T only defines private constructors and has no friends",
|
||||
t);
|
||||
t);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1632,9 +1632,9 @@ resort_method_name_cmp (const void* m1_p, const void* m2_p)
|
||||
|
||||
void
|
||||
resort_type_method_vec (void* obj,
|
||||
void* orig_obj ATTRIBUTE_UNUSED ,
|
||||
gt_pointer_operator new_value,
|
||||
void* cookie)
|
||||
void* orig_obj ATTRIBUTE_UNUSED ,
|
||||
gt_pointer_operator new_value,
|
||||
void* cookie)
|
||||
{
|
||||
VEC(tree,gc) *method_vec = (VEC(tree,gc) *) obj;
|
||||
int len = VEC_length (tree, method_vec);
|
||||
@ -1981,9 +1981,9 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
|
||||
&& CLASS_TYPE_P (TREE_TYPE (base_return)))
|
||||
{
|
||||
/* If FN is a covariant thunk, we must figure out the adjustment
|
||||
to the final base FN was converting to. As OVERRIDER_TARGET might
|
||||
also be converting to the return type of FN, we have to
|
||||
combine the two conversions here. */
|
||||
to the final base FN was converting to. As OVERRIDER_TARGET might
|
||||
also be converting to the return type of FN, we have to
|
||||
combine the two conversions here. */
|
||||
tree fixed_offset, virtual_offset;
|
||||
|
||||
over_return = TREE_TYPE (over_return);
|
||||
@ -2099,19 +2099,19 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
|
||||
if (overrider_fn != overrider_target && !virtual_base)
|
||||
{
|
||||
/* The ABI specifies that a covariant thunk includes a mangling
|
||||
for a this pointer adjustment. This-adjusting thunks that
|
||||
override a function from a virtual base have a vcall
|
||||
adjustment. When the virtual base in question is a primary
|
||||
virtual base, we know the adjustments are zero, (and in the
|
||||
non-covariant case, we would not use the thunk).
|
||||
Unfortunately we didn't notice this could happen, when
|
||||
designing the ABI and so never mandated that such a covariant
|
||||
thunk should be emitted. Because we must use the ABI mandated
|
||||
name, we must continue searching from the binfo where we
|
||||
found the most recent definition of the function, towards the
|
||||
primary binfo which first introduced the function into the
|
||||
vtable. If that enters a virtual base, we must use a vcall
|
||||
this-adjusting thunk. Bleah! */
|
||||
for a this pointer adjustment. This-adjusting thunks that
|
||||
override a function from a virtual base have a vcall
|
||||
adjustment. When the virtual base in question is a primary
|
||||
virtual base, we know the adjustments are zero, (and in the
|
||||
non-covariant case, we would not use the thunk).
|
||||
Unfortunately we didn't notice this could happen, when
|
||||
designing the ABI and so never mandated that such a covariant
|
||||
thunk should be emitted. Because we must use the ABI mandated
|
||||
name, we must continue searching from the binfo where we
|
||||
found the most recent definition of the function, towards the
|
||||
primary binfo which first introduced the function into the
|
||||
vtable. If that enters a virtual base, we must use a vcall
|
||||
this-adjusting thunk. Bleah! */
|
||||
tree probe = first_defn;
|
||||
|
||||
while ((probe = get_primary_binfo (probe))
|
||||
@ -2296,8 +2296,8 @@ check_for_override (tree decl, tree ctype)
|
||||
if (TREE_CODE (decl) == TEMPLATE_DECL)
|
||||
/* In [temp.mem] we have:
|
||||
|
||||
A specialization of a member function template does not
|
||||
override a virtual function from a base class. */
|
||||
A specialization of a member function template does not
|
||||
override a virtual function from a base class. */
|
||||
return;
|
||||
if ((DECL_DESTRUCTOR_P (decl)
|
||||
|| IDENTIFIER_VIRTUAL_P (DECL_NAME (decl))
|
||||
@ -2426,7 +2426,7 @@ finish_struct_anon (tree t)
|
||||
if (TREE_CODE (elt) != FIELD_DECL)
|
||||
{
|
||||
cp_pedwarn_at ("%q#D invalid; an anonymous union can "
|
||||
"only have non-static data members",
|
||||
"only have non-static data members",
|
||||
elt);
|
||||
continue;
|
||||
}
|
||||
@ -2672,9 +2672,9 @@ check_bitfield_decl (tree field)
|
||||
|
||||
static void
|
||||
check_field_decl (tree field,
|
||||
tree t,
|
||||
int* cant_have_const_ctor,
|
||||
int* no_const_asn_ref,
|
||||
tree t,
|
||||
int* cant_have_const_ctor,
|
||||
int* no_const_asn_ref,
|
||||
int* any_default_members)
|
||||
{
|
||||
tree type = strip_array_types (TREE_TYPE (field));
|
||||
@ -2861,7 +2861,7 @@ check_field_decls (tree t, tree *access_decls,
|
||||
if (TREE_CODE (type) == REFERENCE_TYPE)
|
||||
{
|
||||
cp_error_at ("%qD may not have reference type %qT because"
|
||||
" it is a member of a union",
|
||||
" it is a member of a union",
|
||||
x, type);
|
||||
continue;
|
||||
}
|
||||
@ -2900,7 +2900,7 @@ check_field_decls (tree t, tree *access_decls,
|
||||
/* If this is of reference type, check if it needs an init.
|
||||
Also do a little ANSI jig if necessary. */
|
||||
if (TREE_CODE (type) == REFERENCE_TYPE)
|
||||
{
|
||||
{
|
||||
CLASSTYPE_NON_POD_P (t) = 1;
|
||||
if (DECL_INITIAL (x) == NULL_TREE)
|
||||
SET_CLASSTYPE_REF_FIELDS_NEED_INIT (t, 1);
|
||||
@ -2913,7 +2913,7 @@ check_field_decls (tree t, tree *access_decls,
|
||||
|
||||
if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
|
||||
&& extra_warnings)
|
||||
cp_warning_at ("non-static reference %q#D in class without a constructor", x);
|
||||
cp_warning_at ("non-static reference %q#D in class without a constructor", x);
|
||||
}
|
||||
|
||||
type = strip_array_types (type);
|
||||
@ -2938,8 +2938,8 @@ check_field_decls (tree t, tree *access_decls,
|
||||
CLASSTYPE_HAS_MUTABLE (t) = 1;
|
||||
|
||||
if (! pod_type_p (type))
|
||||
/* DR 148 now allows pointers to members (which are POD themselves),
|
||||
to be allowed in POD structs. */
|
||||
/* DR 148 now allows pointers to members (which are POD themselves),
|
||||
to be allowed in POD structs. */
|
||||
CLASSTYPE_NON_POD_P (t) = 1;
|
||||
|
||||
if (! zero_init_p (type))
|
||||
@ -2960,7 +2960,7 @@ check_field_decls (tree t, tree *access_decls,
|
||||
|
||||
if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
|
||||
&& extra_warnings)
|
||||
cp_warning_at ("non-static const member %q#D in class without a constructor", x);
|
||||
cp_warning_at ("non-static const member %q#D in class without a constructor", x);
|
||||
}
|
||||
/* A field that is pseudo-const makes the structure likewise. */
|
||||
else if (CLASS_TYPE_P (type))
|
||||
@ -3091,11 +3091,11 @@ check_subobject_offset (tree type, tree offset, splay_tree offsets)
|
||||
|
||||
static int
|
||||
walk_subobject_offsets (tree type,
|
||||
subobject_offset_fn f,
|
||||
tree offset,
|
||||
splay_tree offsets,
|
||||
tree max_offset,
|
||||
int vbases_p)
|
||||
subobject_offset_fn f,
|
||||
tree offset,
|
||||
splay_tree offsets,
|
||||
tree max_offset,
|
||||
int vbases_p)
|
||||
{
|
||||
int r = 0;
|
||||
tree type_binfo = NULL_TREE;
|
||||
@ -3285,9 +3285,9 @@ walk_subobject_offsets (tree type,
|
||||
|
||||
static void
|
||||
record_subobject_offsets (tree type,
|
||||
tree offset,
|
||||
splay_tree offsets,
|
||||
int vbases_p)
|
||||
tree offset,
|
||||
splay_tree offsets,
|
||||
int vbases_p)
|
||||
{
|
||||
walk_subobject_offsets (type, record_subobject_offset, offset,
|
||||
offsets, /*max_offset=*/NULL_TREE, vbases_p);
|
||||
@ -3299,9 +3299,9 @@ record_subobject_offsets (tree type,
|
||||
|
||||
static int
|
||||
layout_conflict_p (tree type,
|
||||
tree offset,
|
||||
splay_tree offsets,
|
||||
int vbases_p)
|
||||
tree offset,
|
||||
splay_tree offsets,
|
||||
int vbases_p)
|
||||
{
|
||||
splay_tree_node max_node;
|
||||
|
||||
@ -3817,7 +3817,7 @@ clone_function_decl (tree fn, int update_method_vec_p)
|
||||
corresponds to the correct layout order in the virtual
|
||||
function table.
|
||||
|
||||
For a non-virtual destructor, we do not build a deleting
|
||||
For a non-virtual destructor, we do not build a deleting
|
||||
destructor. */
|
||||
if (DECL_VIRTUAL_P (fn))
|
||||
{
|
||||
@ -4126,7 +4126,7 @@ create_vtable_ptr (tree t, tree* virtuals_p)
|
||||
class constructor was inlined, we could generate bad code for
|
||||
setting up the vtable pointer.
|
||||
|
||||
Therefore, we use one type for all vtable pointers. We still
|
||||
Therefore, we use one type for all vtable pointers. We still
|
||||
use a type-correct type; it's just doesn't indicate the array
|
||||
bounds. That's better than using `void*' or some such; it's
|
||||
cleaner, and it let's the alias analysis code know that these
|
||||
@ -4308,7 +4308,7 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets)
|
||||
bitsize_unit_node),
|
||||
BINFO_OFFSET (vbase))))
|
||||
warning (0, "offset of virtual base %qT is not ABI-compliant and "
|
||||
"may change in a future version of GCC",
|
||||
"may change in a future version of GCC",
|
||||
basetype);
|
||||
|
||||
first_vbase = false;
|
||||
@ -4542,7 +4542,7 @@ layout_class_type (tree t, tree *virtuals_p)
|
||||
struct S1;
|
||||
struct S2 { static S1 s1; };
|
||||
|
||||
At this point, finish_record_layout will be called, but
|
||||
At this point, finish_record_layout will be called, but
|
||||
S1 is still incomplete.) */
|
||||
if (TREE_CODE (field) == VAR_DECL)
|
||||
{
|
||||
@ -4663,7 +4663,7 @@ layout_class_type (tree t, tree *virtuals_p)
|
||||
DECL_FIELD_BIT_OFFSET (field),
|
||||
bitsize_unit_node)))
|
||||
cp_warning_at ("offset of %qD is not ABI-compliant and may "
|
||||
"change in a future version of GCC",
|
||||
"change in a future version of GCC",
|
||||
field);
|
||||
|
||||
/* G++ used to use DECL_FIELD_OFFSET as if it were the byte
|
||||
@ -4989,8 +4989,8 @@ finish_struct_1 (tree t)
|
||||
if (n_fields > 7)
|
||||
{
|
||||
struct sorted_fields_type *field_vec = GGC_NEWVAR
|
||||
(struct sorted_fields_type,
|
||||
sizeof (struct sorted_fields_type) + n_fields * sizeof (tree));
|
||||
(struct sorted_fields_type,
|
||||
sizeof (struct sorted_fields_type) + n_fields * sizeof (tree));
|
||||
field_vec->len = n_fields;
|
||||
add_fields_to_record_type (TYPE_FIELDS (t), field_vec, 0);
|
||||
qsort (field_vec->elts, n_fields, sizeof (tree),
|
||||
@ -5198,7 +5198,7 @@ fixed_type_or_null (tree instance, int* nonnull, int* cdtorp)
|
||||
/* If this component is really a base class reference, then the field
|
||||
itself isn't definitive. */
|
||||
if (DECL_FIELD_IS_BASE (TREE_OPERAND (instance, 1)))
|
||||
return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
|
||||
return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
|
||||
return fixed_type_or_null (TREE_OPERAND (instance, 1), nonnull, cdtorp);
|
||||
|
||||
case VAR_DECL:
|
||||
@ -5221,24 +5221,24 @@ fixed_type_or_null (tree instance, int* nonnull, int* cdtorp)
|
||||
return TREE_TYPE (instance);
|
||||
}
|
||||
else if (instance == current_class_ptr)
|
||||
{
|
||||
if (nonnull)
|
||||
*nonnull = 1;
|
||||
{
|
||||
if (nonnull)
|
||||
*nonnull = 1;
|
||||
|
||||
/* if we're in a ctor or dtor, we know our type. */
|
||||
if (DECL_LANG_SPECIFIC (current_function_decl)
|
||||
&& (DECL_CONSTRUCTOR_P (current_function_decl)
|
||||
|| DECL_DESTRUCTOR_P (current_function_decl)))
|
||||
{
|
||||
if (cdtorp)
|
||||
*cdtorp = 1;
|
||||
return TREE_TYPE (TREE_TYPE (instance));
|
||||
}
|
||||
}
|
||||
/* if we're in a ctor or dtor, we know our type. */
|
||||
if (DECL_LANG_SPECIFIC (current_function_decl)
|
||||
&& (DECL_CONSTRUCTOR_P (current_function_decl)
|
||||
|| DECL_DESTRUCTOR_P (current_function_decl)))
|
||||
{
|
||||
if (cdtorp)
|
||||
*cdtorp = 1;
|
||||
return TREE_TYPE (TREE_TYPE (instance));
|
||||
}
|
||||
}
|
||||
else if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE)
|
||||
{
|
||||
/* Reference variables should be references to objects. */
|
||||
if (nonnull)
|
||||
{
|
||||
/* Reference variables should be references to objects. */
|
||||
if (nonnull)
|
||||
*nonnull = 1;
|
||||
|
||||
/* DECL_VAR_MARKED_P is used to prevent recursion; a
|
||||
@ -5623,8 +5623,8 @@ resolve_address_of_overloaded_function (tree target_type,
|
||||
{
|
||||
if (flags & tf_error)
|
||||
error ("cannot resolve overloaded function %qD based on"
|
||||
" conversion to type %qT",
|
||||
DECL_NAME (OVL_FUNCTION (overload)), target_type);
|
||||
" conversion to type %qT",
|
||||
DECL_NAME (OVL_FUNCTION (overload)), target_type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -5747,15 +5747,15 @@ resolve_address_of_overloaded_function (tree target_type,
|
||||
/* There were *no* matches. */
|
||||
if (flags & tf_error)
|
||||
{
|
||||
error ("no matches converting function %qD to type %q#T",
|
||||
DECL_NAME (OVL_FUNCTION (overload)),
|
||||
target_type);
|
||||
error ("no matches converting function %qD to type %q#T",
|
||||
DECL_NAME (OVL_FUNCTION (overload)),
|
||||
target_type);
|
||||
|
||||
/* print_candidates expects a chain with the functions in
|
||||
TREE_VALUE slots, so we cons one up here (we're losing anyway,
|
||||
so why be clever?). */
|
||||
for (; overload; overload = OVL_NEXT (overload))
|
||||
matches = tree_cons (NULL_TREE, OVL_CURRENT (overload),
|
||||
TREE_VALUE slots, so we cons one up here (we're losing anyway,
|
||||
so why be clever?). */
|
||||
for (; overload; overload = OVL_NEXT (overload))
|
||||
matches = tree_cons (NULL_TREE, OVL_CURRENT (overload),
|
||||
matches);
|
||||
|
||||
print_candidates (matches);
|
||||
@ -5770,7 +5770,7 @@ resolve_address_of_overloaded_function (tree target_type,
|
||||
{
|
||||
tree match;
|
||||
|
||||
error ("converting overloaded function %qD to type %q#T is ambiguous",
|
||||
error ("converting overloaded function %qD to type %q#T is ambiguous",
|
||||
DECL_NAME (OVL_FUNCTION (overload)),
|
||||
target_type);
|
||||
|
||||
@ -5794,14 +5794,14 @@ resolve_address_of_overloaded_function (tree target_type,
|
||||
static int explained;
|
||||
|
||||
if (!(flags & tf_error))
|
||||
return error_mark_node;
|
||||
return error_mark_node;
|
||||
|
||||
pedwarn ("assuming pointer to member %qD", fn);
|
||||
if (!explained)
|
||||
{
|
||||
pedwarn ("(a pointer to member can only be formed with %<&%E%>)", fn);
|
||||
explained = 1;
|
||||
}
|
||||
{
|
||||
pedwarn ("(a pointer to member can only be formed with %<&%E%>)", fn);
|
||||
explained = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're doing overload resolution purely for the purpose of
|
||||
@ -6061,7 +6061,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
|
||||
case ADDR_EXPR:
|
||||
{
|
||||
if (PTRMEM_OK_P (rhs))
|
||||
flags |= tf_ptrmem_ok;
|
||||
flags |= tf_ptrmem_ok;
|
||||
|
||||
return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags);
|
||||
}
|
||||
@ -6123,7 +6123,7 @@ print_class_statistics (void)
|
||||
|
||||
/* Build a dummy reference to ourselves so Derived::Base (and A::A) works,
|
||||
according to [class]:
|
||||
The class-name is also inserted
|
||||
The class-name is also inserted
|
||||
into the scope of the class itself. For purposes of access checking,
|
||||
the inserted class name is treated as if it were a public member name. */
|
||||
|
||||
@ -6313,10 +6313,10 @@ maybe_indent_hierarchy (FILE * stream, int indent, int indented_p)
|
||||
|
||||
static tree
|
||||
dump_class_hierarchy_r (FILE *stream,
|
||||
int flags,
|
||||
tree binfo,
|
||||
tree igo,
|
||||
int indent)
|
||||
int flags,
|
||||
tree binfo,
|
||||
tree igo,
|
||||
int indent)
|
||||
{
|
||||
int indented = 0;
|
||||
tree base_binfo;
|
||||
@ -6808,10 +6808,10 @@ dfs_build_secondary_vptr_vtt_inits (tree binfo, void *data_)
|
||||
|
||||
if (BINFO_VIRTUAL_P (binfo))
|
||||
{
|
||||
/* It's a primary virtual base, and this is not a
|
||||
construction vtable. Find the base this is primary of in
|
||||
the inheritance graph, and use that base's vtable
|
||||
now. */
|
||||
/* It's a primary virtual base, and this is not a
|
||||
construction vtable. Find the base this is primary of in
|
||||
the inheritance graph, and use that base's vtable
|
||||
now. */
|
||||
while (BINFO_PRIMARY_P (binfo))
|
||||
binfo = BINFO_INHERITANCE_CHAIN (binfo);
|
||||
}
|
||||
@ -6922,10 +6922,10 @@ build_ctor_vtbl_group (tree binfo, tree t)
|
||||
|
||||
static void
|
||||
accumulate_vtbl_inits (tree binfo,
|
||||
tree orig_binfo,
|
||||
tree rtti_binfo,
|
||||
tree t,
|
||||
tree inits)
|
||||
tree orig_binfo,
|
||||
tree rtti_binfo,
|
||||
tree t,
|
||||
tree inits)
|
||||
{
|
||||
int i;
|
||||
tree base_binfo;
|
||||
@ -6972,10 +6972,10 @@ accumulate_vtbl_inits (tree binfo,
|
||||
|
||||
static tree
|
||||
dfs_accumulate_vtbl_inits (tree binfo,
|
||||
tree orig_binfo,
|
||||
tree rtti_binfo,
|
||||
tree t,
|
||||
tree l)
|
||||
tree orig_binfo,
|
||||
tree rtti_binfo,
|
||||
tree t,
|
||||
tree l)
|
||||
{
|
||||
tree inits = NULL_TREE;
|
||||
tree vtbl = NULL_TREE;
|
||||
@ -7097,10 +7097,10 @@ static GTY(()) tree abort_fndecl_addr;
|
||||
|
||||
static tree
|
||||
build_vtbl_initializer (tree binfo,
|
||||
tree orig_binfo,
|
||||
tree t,
|
||||
tree rtti_binfo,
|
||||
int* non_fn_entries_p)
|
||||
tree orig_binfo,
|
||||
tree t,
|
||||
tree rtti_binfo,
|
||||
int* non_fn_entries_p)
|
||||
{
|
||||
tree v, b;
|
||||
tree vfun_inits;
|
||||
@ -7261,7 +7261,7 @@ build_vtbl_initializer (tree binfo,
|
||||
}
|
||||
}
|
||||
else
|
||||
vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
|
||||
vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
|
||||
}
|
||||
|
||||
/* The initializers for virtual functions were built up in reverse
|
||||
@ -7638,7 +7638,7 @@ build_rtti_vtbl_entries (tree binfo, vtbl_init_data* vid)
|
||||
primary base, and then add the offset in the vtbl to that value. */
|
||||
b = binfo;
|
||||
while (CLASSTYPE_HAS_PRIMARY_BASE_P (BINFO_TYPE (b))
|
||||
&& !BINFO_LOST_PRIMARY_P (b))
|
||||
&& !BINFO_LOST_PRIMARY_P (b))
|
||||
{
|
||||
tree primary_base;
|
||||
|
||||
|
@ -409,7 +409,7 @@ cp_gimplify_init_expr (tree *expr_p, tree *pre_p, tree *post_p)
|
||||
*expr_p = from;
|
||||
|
||||
/* The initialization is now a side-effect, so the container can
|
||||
become void. */
|
||||
become void. */
|
||||
if (from != sub)
|
||||
TREE_TYPE (from) = void_type_node;
|
||||
}
|
||||
|
@ -89,15 +89,15 @@ cp_expr_size (tree exp)
|
||||
/* And, the gimplifier will sometimes make a copy of
|
||||
an aggregate. In particular, for a case like:
|
||||
|
||||
struct S { S(); };
|
||||
struct X { int a; S s; };
|
||||
X x = { 0 };
|
||||
struct S { S(); };
|
||||
struct X { int a; S s; };
|
||||
X x = { 0 };
|
||||
|
||||
the gimplifier will create a temporary with
|
||||
static storage duration, perform static
|
||||
initialization of the temporary, and then copy
|
||||
the result. Since the "s" subobject is never
|
||||
constructed, this is a valid transformation. */
|
||||
the gimplifier will create a temporary with
|
||||
static storage duration, perform static
|
||||
initialization of the temporary, and then copy
|
||||
the result. Since the "s" subobject is never
|
||||
constructed, this is a valid transformation. */
|
||||
|| CP_AGGREGATE_TYPE_P (type));
|
||||
|
||||
/* This would be wrong for a type with virtual bases, but they are
|
||||
@ -118,9 +118,9 @@ cp_tree_size (enum tree_code code)
|
||||
switch (code)
|
||||
{
|
||||
case TINST_LEVEL: return sizeof (struct tinst_level_s);
|
||||
case PTRMEM_CST: return sizeof (struct ptrmem_cst);
|
||||
case PTRMEM_CST: return sizeof (struct ptrmem_cst);
|
||||
case BASELINK: return sizeof (struct tree_baselink);
|
||||
case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index);
|
||||
case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index);
|
||||
case DEFAULT_ARG: return sizeof (struct tree_default_arg);
|
||||
case OVERLOAD: return sizeof (struct tree_overload);
|
||||
default:
|
||||
|
@ -108,17 +108,17 @@ DEFTREECODE (BASELINK, "baselink", tcc_exceptional, 0)
|
||||
/* Template definition. The following fields have the specified uses,
|
||||
although there are other macros in cp-tree.h that should be used for
|
||||
accessing this data.
|
||||
DECL_ARGUMENTS template parm vector
|
||||
DECL_TEMPLATE_INFO template text &c
|
||||
DECL_ARGUMENTS template parm vector
|
||||
DECL_TEMPLATE_INFO template text &c
|
||||
DECL_VINDEX list of instantiations already produced;
|
||||
only done for functions so far
|
||||
For class template:
|
||||
DECL_INITIAL associated templates (methods &c)
|
||||
DECL_TEMPLATE_RESULT null
|
||||
DECL_INITIAL associated templates (methods &c)
|
||||
DECL_TEMPLATE_RESULT null
|
||||
For non-class templates:
|
||||
TREE_TYPE type of object to be constructed
|
||||
DECL_TEMPLATE_RESULT decl for object to be created
|
||||
(e.g., FUNCTION_DECL with tmpl parms used)
|
||||
DECL_TEMPLATE_RESULT decl for object to be created
|
||||
(e.g., FUNCTION_DECL with tmpl parms used)
|
||||
*/
|
||||
DEFTREECODE (TEMPLATE_DECL, "template_decl", tcc_declaration, 0)
|
||||
|
||||
@ -132,7 +132,7 @@ DEFTREECODE (TEMPLATE_DECL, "template_decl", tcc_declaration, 0)
|
||||
struct S
|
||||
{
|
||||
template <class U, // Index 0, Level 2.
|
||||
class V> // Index 1, Level 2.
|
||||
class V> // Index 1, Level 2.
|
||||
void f();
|
||||
};
|
||||
|
||||
@ -148,7 +148,7 @@ DEFTREECODE (TEMPLATE_DECL, "template_decl", tcc_declaration, 0)
|
||||
struct S<int>
|
||||
{
|
||||
template <class U, // Index 0, Level 1, Orig Level 2
|
||||
class V> // Index 1, Level 1, Orig Level 2
|
||||
class V> // Index 1, Level 1, Orig Level 2
|
||||
void f();
|
||||
};
|
||||
|
||||
|
1004
gcc/cp/cp-tree.h
1004
gcc/cp/cp-tree.h
File diff suppressed because it is too large
Load Diff
126
gcc/cp/cvt.c
126
gcc/cp/cvt.c
@ -54,7 +54,7 @@ static void warn_ref_binding (tree, tree, tree);
|
||||
narrowing is always done with a NOP_EXPR:
|
||||
In convert.c, convert_to_integer.
|
||||
In c-typeck.c, build_binary_op_nodefault (boolean ops),
|
||||
and c_common_truthvalue_conversion.
|
||||
and c_common_truthvalue_conversion.
|
||||
In expr.c: expand_expr, for operands of a MULT_EXPR.
|
||||
In fold-const.c: fold.
|
||||
In tree.c: get_narrower and get_unwidened.
|
||||
@ -88,7 +88,7 @@ cp_convert_to_pointer (tree type, tree expr, bool force)
|
||||
if (!COMPLETE_TYPE_P (intype))
|
||||
{
|
||||
error ("can't convert from incomplete type %qT to %qT",
|
||||
intype, type);
|
||||
intype, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ cp_convert_to_pointer (tree type, tree expr, bool force)
|
||||
{
|
||||
if (rval == error_mark_node)
|
||||
error ("conversion of %qE from %qT to %qT is ambiguous",
|
||||
expr, intype, type);
|
||||
expr, intype, type);
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
@ -166,7 +166,7 @@ cp_convert_to_pointer (tree type, tree expr, bool force)
|
||||
if (TYPE_PTRMEMFUNC_P (type))
|
||||
{
|
||||
error ("cannot convert %qE from type %qT to type %qT",
|
||||
expr, intype, type);
|
||||
expr, intype, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -195,11 +195,11 @@ cp_convert_to_pointer (tree type, tree expr, bool force)
|
||||
{
|
||||
if (force)
|
||||
warning (0, "pointer to member cast from %qT to %qT is via"
|
||||
" virtual base", intype, type);
|
||||
" virtual base", intype, type);
|
||||
else
|
||||
{
|
||||
error ("pointer to member cast from %qT to %qT is"
|
||||
" via virtual base", intype, type);
|
||||
" via virtual base", intype, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
/* This is a reinterpret cast, whose result is unspecified.
|
||||
@ -235,7 +235,7 @@ cp_convert_to_pointer (tree type, tree expr, bool force)
|
||||
}
|
||||
}
|
||||
error ("cannot convert %qE from type %qT to type %qT",
|
||||
expr, intype, type);
|
||||
expr, intype, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ cp_convert_to_pointer (tree type, tree expr, bool force)
|
||||
return instantiate_type (type, expr, tf_error | tf_warning);
|
||||
|
||||
error ("cannot convert %qE from type %qT to type %qT",
|
||||
expr, intype, type);
|
||||
expr, intype, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -322,8 +322,8 @@ convert_to_pointer_force (tree type, tree expr)
|
||||
if (binfo)
|
||||
{
|
||||
expr = build_base_path (code, expr, binfo, 0);
|
||||
if (expr == error_mark_node)
|
||||
return error_mark_node;
|
||||
if (expr == error_mark_node)
|
||||
return error_mark_node;
|
||||
/* Add any qualifier conversions. */
|
||||
if (!same_type_p (TREE_TYPE (TREE_TYPE (expr)),
|
||||
TREE_TYPE (type)))
|
||||
@ -414,16 +414,16 @@ warn_ref_binding (tree reftype, tree intype, tree decl)
|
||||
|
||||
if (CP_TYPE_VOLATILE_P (ttl) && decl)
|
||||
msg = "initialization of volatile reference type %q#T from"
|
||||
" rvalue of type %qT";
|
||||
" rvalue of type %qT";
|
||||
else if (CP_TYPE_VOLATILE_P (ttl))
|
||||
msg = "conversion to volatile reference type %q#T "
|
||||
" from rvalue of type %qT";
|
||||
" from rvalue of type %qT";
|
||||
else if (decl)
|
||||
msg = "initialization of non-const reference type %q#T from"
|
||||
" rvalue of type %qT";
|
||||
" rvalue of type %qT";
|
||||
else
|
||||
msg = "conversion to non-const reference type %q#T from"
|
||||
" rvalue of type %qT";
|
||||
" rvalue of type %qT";
|
||||
|
||||
pedwarn (msg, reftype, intype);
|
||||
}
|
||||
@ -438,7 +438,7 @@ warn_ref_binding (tree reftype, tree intype, tree decl)
|
||||
|
||||
tree
|
||||
convert_to_reference (tree reftype, tree expr, int convtype,
|
||||
int flags, tree decl)
|
||||
int flags, tree decl)
|
||||
{
|
||||
tree type = TYPE_MAIN_VARIANT (TREE_TYPE (reftype));
|
||||
tree intype;
|
||||
@ -495,7 +495,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
|
||||
if (! (convtype & CONV_CONST)
|
||||
&& !at_least_as_qualified_p (ttl, ttr))
|
||||
pedwarn ("conversion from %qT to %qT discards qualifiers",
|
||||
ttr, reftype);
|
||||
ttr, reftype);
|
||||
}
|
||||
|
||||
return build_up_reference (reftype, expr, flags, decl);
|
||||
@ -508,7 +508,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
|
||||
should be done directly (jason). (int &)ri ---> *(int*)&ri */
|
||||
|
||||
/* B* bp; A& ar = (A&)bp; is valid, but it's probably not what they
|
||||
meant. */
|
||||
meant. */
|
||||
if (TREE_CODE (intype) == POINTER_TYPE
|
||||
&& (comptypes (TREE_TYPE (intype), type,
|
||||
COMPARE_BASE | COMPARE_DERIVED)))
|
||||
@ -627,9 +627,9 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
|
||||
convert, which will call ocp_convert, etc. */
|
||||
return e;
|
||||
/* For complex data types, we need to perform componentwise
|
||||
conversion. */
|
||||
conversion. */
|
||||
else if (TREE_CODE (type) == COMPLEX_TYPE)
|
||||
return fold_if_not_in_template (convert_to_complex (type, e));
|
||||
return fold_if_not_in_template (convert_to_complex (type, e));
|
||||
else if (TREE_CODE (e) == TARGET_EXPR)
|
||||
{
|
||||
/* Don't build a NOP_EXPR of class type. Instead, change the
|
||||
@ -659,10 +659,10 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
|
||||
{
|
||||
tree intype = TREE_TYPE (e);
|
||||
/* enum = enum, enum = int, enum = float, (enum)pointer are all
|
||||
errors. */
|
||||
errors. */
|
||||
if (TREE_CODE (type) == ENUMERAL_TYPE
|
||||
&& (((INTEGRAL_OR_ENUMERATION_TYPE_P (intype)
|
||||
|| TREE_CODE (intype) == REAL_TYPE)
|
||||
|| TREE_CODE (intype) == REAL_TYPE)
|
||||
&& ! (convtype & CONV_STATIC))
|
||||
|| TREE_CODE (intype) == POINTER_TYPE))
|
||||
{
|
||||
@ -696,11 +696,11 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
|
||||
{
|
||||
tree ret_val;
|
||||
ret_val = build_type_conversion (type, e);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
if (flags & LOOKUP_COMPLAIN)
|
||||
error ("%q#T used where a %qT was expected", in_vtype, type);
|
||||
return error_mark_node;
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
if (flags & LOOKUP_COMPLAIN)
|
||||
error ("%q#T used where a %qT was expected", in_vtype, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
return fold_if_not_in_template (convert_to_vector (type, e));
|
||||
}
|
||||
@ -762,7 +762,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
|
||||
|
||||
if (flags & LOOKUP_COMPLAIN)
|
||||
error ("conversion from %qT to non-scalar type %qT requested",
|
||||
TREE_TYPE (expr), type);
|
||||
TREE_TYPE (expr), type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -804,37 +804,37 @@ convert_to_void (tree expr, const char *implicit)
|
||||
{
|
||||
case COND_EXPR:
|
||||
{
|
||||
/* The two parts of a cond expr might be separate lvalues. */
|
||||
tree op1 = TREE_OPERAND (expr,1);
|
||||
tree op2 = TREE_OPERAND (expr,2);
|
||||
tree new_op1 = convert_to_void
|
||||
/* The two parts of a cond expr might be separate lvalues. */
|
||||
tree op1 = TREE_OPERAND (expr,1);
|
||||
tree op2 = TREE_OPERAND (expr,2);
|
||||
tree new_op1 = convert_to_void
|
||||
(op1, (implicit && !TREE_SIDE_EFFECTS (op2)
|
||||
? "second operand of conditional" : NULL));
|
||||
tree new_op2 = convert_to_void
|
||||
tree new_op2 = convert_to_void
|
||||
(op2, (implicit && !TREE_SIDE_EFFECTS (op1)
|
||||
? "third operand of conditional" : NULL));
|
||||
|
||||
expr = build3 (COND_EXPR, TREE_TYPE (new_op1),
|
||||
TREE_OPERAND (expr, 0), new_op1, new_op2);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
case COMPOUND_EXPR:
|
||||
{
|
||||
/* The second part of a compound expr contains the value. */
|
||||
tree op1 = TREE_OPERAND (expr,1);
|
||||
tree new_op1 = convert_to_void
|
||||
/* The second part of a compound expr contains the value. */
|
||||
tree op1 = TREE_OPERAND (expr,1);
|
||||
tree new_op1 = convert_to_void
|
||||
(op1, (implicit && !TREE_NO_WARNING (expr)
|
||||
? "right-hand operand of comma" : NULL));
|
||||
|
||||
if (new_op1 != op1)
|
||||
if (new_op1 != op1)
|
||||
{
|
||||
tree t = build2 (COMPOUND_EXPR, TREE_TYPE (new_op1),
|
||||
TREE_OPERAND (expr, 0), new_op1);
|
||||
expr = t;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
case NON_LVALUE_EXPR:
|
||||
@ -847,35 +847,35 @@ convert_to_void (tree expr, const char *implicit)
|
||||
|
||||
case INDIRECT_REF:
|
||||
{
|
||||
tree type = TREE_TYPE (expr);
|
||||
int is_reference = TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0)))
|
||||
== REFERENCE_TYPE;
|
||||
int is_volatile = TYPE_VOLATILE (type);
|
||||
int is_complete = COMPLETE_TYPE_P (complete_type (type));
|
||||
tree type = TREE_TYPE (expr);
|
||||
int is_reference = TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0)))
|
||||
== REFERENCE_TYPE;
|
||||
int is_volatile = TYPE_VOLATILE (type);
|
||||
int is_complete = COMPLETE_TYPE_P (complete_type (type));
|
||||
|
||||
if (is_volatile && !is_complete)
|
||||
warning (0, "object of incomplete type %qT will not be accessed in %s",
|
||||
type, implicit ? implicit : "void context");
|
||||
else if (is_reference && is_volatile)
|
||||
warning (0, "object of type %qT will not be accessed in %s",
|
||||
TREE_TYPE (TREE_OPERAND (expr, 0)),
|
||||
implicit ? implicit : "void context");
|
||||
if (is_reference || !is_volatile || !is_complete)
|
||||
expr = TREE_OPERAND (expr, 0);
|
||||
if (is_volatile && !is_complete)
|
||||
warning (0, "object of incomplete type %qT will not be accessed in %s",
|
||||
type, implicit ? implicit : "void context");
|
||||
else if (is_reference && is_volatile)
|
||||
warning (0, "object of type %qT will not be accessed in %s",
|
||||
TREE_TYPE (TREE_OPERAND (expr, 0)),
|
||||
implicit ? implicit : "void context");
|
||||
if (is_reference || !is_volatile || !is_complete)
|
||||
expr = TREE_OPERAND (expr, 0);
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
case VAR_DECL:
|
||||
{
|
||||
/* External variables might be incomplete. */
|
||||
tree type = TREE_TYPE (expr);
|
||||
int is_complete = COMPLETE_TYPE_P (complete_type (type));
|
||||
/* External variables might be incomplete. */
|
||||
tree type = TREE_TYPE (expr);
|
||||
int is_complete = COMPLETE_TYPE_P (complete_type (type));
|
||||
|
||||
if (TYPE_VOLATILE (type) && !is_complete)
|
||||
warning (0, "object %qE of incomplete type %qT will not be accessed in %s",
|
||||
expr, type, implicit ? implicit : "void context");
|
||||
break;
|
||||
if (TYPE_VOLATILE (type) && !is_complete)
|
||||
warning (0, "object %qE of incomplete type %qT will not be accessed in %s",
|
||||
expr, type, implicit ? implicit : "void context");
|
||||
break;
|
||||
}
|
||||
|
||||
default:;
|
||||
@ -1074,7 +1074,7 @@ build_expr_type_conversion (int desires, tree expr, bool complain)
|
||||
case FUNCTION_TYPE:
|
||||
case ARRAY_TYPE:
|
||||
return (desires & WANT_POINTER) ? decay_conversion (expr)
|
||||
: NULL_TREE;
|
||||
: NULL_TREE;
|
||||
default:
|
||||
return NULL_TREE;
|
||||
}
|
||||
@ -1120,9 +1120,9 @@ build_expr_type_conversion (int desires, tree expr, bool complain)
|
||||
if (complain)
|
||||
{
|
||||
error ("ambiguous default type conversion from %qT",
|
||||
basetype);
|
||||
basetype);
|
||||
error (" candidate conversions include %qD and %qD",
|
||||
winner, cand);
|
||||
winner, cand);
|
||||
}
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -162,20 +162,20 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
|
||||
|
||||
case IDENTIFIER_NODE:
|
||||
if (t == NULL)
|
||||
pp_cxx_identifier (pp, "<unnamed>");
|
||||
pp_cxx_identifier (pp, "<unnamed>");
|
||||
else if (IDENTIFIER_TYPENAME_P (t))
|
||||
pp_cxx_conversion_function_id (pp, t);
|
||||
pp_cxx_conversion_function_id (pp, t);
|
||||
else
|
||||
{
|
||||
if (is_destructor_name (t))
|
||||
{
|
||||
pp_complement (pp);
|
||||
/* FIXME: Why is this necessary? */
|
||||
if (TREE_TYPE (t))
|
||||
t = constructor_name (TREE_TYPE (t));
|
||||
}
|
||||
pp_cxx_tree_identifier (pp, t);
|
||||
}
|
||||
{
|
||||
if (is_destructor_name (t))
|
||||
{
|
||||
pp_complement (pp);
|
||||
/* FIXME: Why is this necessary? */
|
||||
if (TREE_TYPE (t))
|
||||
t = constructor_name (TREE_TYPE (t));
|
||||
}
|
||||
pp_cxx_tree_identifier (pp, t);
|
||||
}
|
||||
break;
|
||||
|
||||
case TEMPLATE_ID_EXPR:
|
||||
@ -195,9 +195,9 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
|
||||
case TEMPLATE_TYPE_PARM:
|
||||
case TEMPLATE_TEMPLATE_PARM:
|
||||
if (TYPE_IDENTIFIER (t))
|
||||
pp_cxx_unqualified_id (pp, TYPE_IDENTIFIER (t));
|
||||
pp_cxx_unqualified_id (pp, TYPE_IDENTIFIER (t));
|
||||
else
|
||||
pp_cxx_canonical_template_parameter (pp, t);
|
||||
pp_cxx_canonical_template_parameter (pp, t);
|
||||
break;
|
||||
|
||||
case TEMPLATE_PARM_INDEX:
|
||||
@ -255,20 +255,20 @@ pp_cxx_qualified_id (cxx_pretty_printer *pp, tree t)
|
||||
break;
|
||||
|
||||
/* In Standard C++, functions cannot possibly be used as
|
||||
nested-name-specifiers. However, there are situations where
|
||||
is "makes sense" to output the surrounding function name for the
|
||||
purpose of emphasizing on the scope kind. Just printing the
|
||||
function name might not be sufficient as it may be overloaded; so,
|
||||
we decorate the function with its signature too.
|
||||
FIXME: This is probably the wrong pretty-printing for conversion
|
||||
functions and some function templates. */
|
||||
nested-name-specifiers. However, there are situations where
|
||||
is "makes sense" to output the surrounding function name for the
|
||||
purpose of emphasizing on the scope kind. Just printing the
|
||||
function name might not be sufficient as it may be overloaded; so,
|
||||
we decorate the function with its signature too.
|
||||
FIXME: This is probably the wrong pretty-printing for conversion
|
||||
functions and some function templates. */
|
||||
case OVERLOAD:
|
||||
t = OVL_CURRENT (t);
|
||||
case FUNCTION_DECL:
|
||||
if (DECL_FUNCTION_MEMBER_P (t))
|
||||
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
|
||||
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
|
||||
pp_cxx_unqualified_id
|
||||
(pp, DECL_CONSTRUCTOR_P (t) ? DECL_CONTEXT (t) : t);
|
||||
(pp, DECL_CONSTRUCTOR_P (t) ? DECL_CONTEXT (t) : t);
|
||||
pp_cxx_parameter_declaration_clause (pp, TREE_TYPE (t));
|
||||
break;
|
||||
|
||||
@ -280,13 +280,13 @@ pp_cxx_qualified_id (cxx_pretty_printer *pp, tree t)
|
||||
|
||||
default:
|
||||
{
|
||||
tree scope = TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t);
|
||||
if (scope != pp->enclosing_scope)
|
||||
{
|
||||
pp_cxx_nested_name_specifier (pp, scope);
|
||||
pp_cxx_template_keyword_if_needed (pp, scope, t);
|
||||
}
|
||||
pp_cxx_unqualified_id (pp, t);
|
||||
tree scope = TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t);
|
||||
if (scope != pp->enclosing_scope)
|
||||
{
|
||||
pp_cxx_nested_name_specifier (pp, scope);
|
||||
pp_cxx_template_keyword_if_needed (pp, scope, t);
|
||||
}
|
||||
pp_cxx_unqualified_id (pp, t);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -365,7 +365,7 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
|
||||
simple-type-specifier ( expression-list(opt) )
|
||||
typename ::(opt) nested-name-specifier identifier ( expression-list(opt) )
|
||||
typename ::(opt) nested-name-specifier template(opt)
|
||||
template-id ( expression-list(opt) )
|
||||
template-id ( expression-list(opt) )
|
||||
postfix-expression . template(opt) ::(opt) id-expression
|
||||
postfix-expression -> template(opt) ::(opt) id-expression
|
||||
postfix-expression . pseudo-destructor-name
|
||||
@ -389,54 +389,54 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
|
||||
case AGGR_INIT_EXPR:
|
||||
case CALL_EXPR:
|
||||
{
|
||||
tree fun = TREE_OPERAND (t, 0);
|
||||
tree args = TREE_OPERAND (t, 1);
|
||||
tree saved_scope = pp->enclosing_scope;
|
||||
tree fun = TREE_OPERAND (t, 0);
|
||||
tree args = TREE_OPERAND (t, 1);
|
||||
tree saved_scope = pp->enclosing_scope;
|
||||
|
||||
if (TREE_CODE (fun) == ADDR_EXPR)
|
||||
fun = TREE_OPERAND (fun, 0);
|
||||
if (TREE_CODE (fun) == ADDR_EXPR)
|
||||
fun = TREE_OPERAND (fun, 0);
|
||||
|
||||
/* In templates, where there is no way to tell whether a given
|
||||
call uses an actual member function. So the parser builds
|
||||
FUN as a COMPONENT_REF or a plain IDENTIFIER_NODE until
|
||||
instantiation time. */
|
||||
if (TREE_CODE (fun) != FUNCTION_DECL)
|
||||
;
|
||||
else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun))
|
||||
{
|
||||
tree object = code == AGGR_INIT_EXPR && AGGR_INIT_VIA_CTOR_P (t)
|
||||
? TREE_OPERAND (t, 2)
|
||||
: TREE_VALUE (args);
|
||||
/* In templates, where there is no way to tell whether a given
|
||||
call uses an actual member function. So the parser builds
|
||||
FUN as a COMPONENT_REF or a plain IDENTIFIER_NODE until
|
||||
instantiation time. */
|
||||
if (TREE_CODE (fun) != FUNCTION_DECL)
|
||||
;
|
||||
else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun))
|
||||
{
|
||||
tree object = code == AGGR_INIT_EXPR && AGGR_INIT_VIA_CTOR_P (t)
|
||||
? TREE_OPERAND (t, 2)
|
||||
: TREE_VALUE (args);
|
||||
|
||||
while (TREE_CODE (object) == NOP_EXPR)
|
||||
object = TREE_OPERAND (object, 0);
|
||||
while (TREE_CODE (object) == NOP_EXPR)
|
||||
object = TREE_OPERAND (object, 0);
|
||||
|
||||
if (TREE_CODE (object) == ADDR_EXPR)
|
||||
object = TREE_OPERAND (object, 0);
|
||||
if (TREE_CODE (object) == ADDR_EXPR)
|
||||
object = TREE_OPERAND (object, 0);
|
||||
|
||||
if (TREE_CODE (TREE_TYPE (object)) != POINTER_TYPE)
|
||||
{
|
||||
pp_cxx_postfix_expression (pp, object);
|
||||
pp_cxx_dot (pp);
|
||||
}
|
||||
else
|
||||
{
|
||||
pp_cxx_postfix_expression (pp, object);
|
||||
pp_cxx_arrow (pp);
|
||||
}
|
||||
args = TREE_CHAIN (args);
|
||||
pp->enclosing_scope = strip_pointer_operator (TREE_TYPE (object));
|
||||
}
|
||||
if (TREE_CODE (TREE_TYPE (object)) != POINTER_TYPE)
|
||||
{
|
||||
pp_cxx_postfix_expression (pp, object);
|
||||
pp_cxx_dot (pp);
|
||||
}
|
||||
else
|
||||
{
|
||||
pp_cxx_postfix_expression (pp, object);
|
||||
pp_cxx_arrow (pp);
|
||||
}
|
||||
args = TREE_CHAIN (args);
|
||||
pp->enclosing_scope = strip_pointer_operator (TREE_TYPE (object));
|
||||
}
|
||||
|
||||
pp_cxx_postfix_expression (pp, fun);
|
||||
pp->enclosing_scope = saved_scope;
|
||||
pp_cxx_call_argument_list (pp, args);
|
||||
pp_cxx_postfix_expression (pp, fun);
|
||||
pp->enclosing_scope = saved_scope;
|
||||
pp_cxx_call_argument_list (pp, args);
|
||||
}
|
||||
if (code == AGGR_INIT_EXPR && AGGR_INIT_VIA_CTOR_P (t))
|
||||
{
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
pp_cxx_postfix_expression (pp, TREE_OPERAND (t, 2));
|
||||
}
|
||||
{
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
pp_cxx_postfix_expression (pp, TREE_OPERAND (t, 2));
|
||||
}
|
||||
break;
|
||||
|
||||
case BASELINK:
|
||||
@ -456,13 +456,13 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
|
||||
case REINTERPRET_CAST_EXPR:
|
||||
case CONST_CAST_EXPR:
|
||||
if (code == DYNAMIC_CAST_EXPR)
|
||||
pp_cxx_identifier (pp, "dynamic_cast");
|
||||
pp_cxx_identifier (pp, "dynamic_cast");
|
||||
else if (code == STATIC_CAST_EXPR)
|
||||
pp_cxx_identifier (pp, "static_cast");
|
||||
pp_cxx_identifier (pp, "static_cast");
|
||||
else if (code == REINTERPRET_CAST_EXPR)
|
||||
pp_cxx_identifier (pp, "reinterpret_cast");
|
||||
pp_cxx_identifier (pp, "reinterpret_cast");
|
||||
else
|
||||
pp_cxx_identifier (pp, "const_cast");
|
||||
pp_cxx_identifier (pp, "const_cast");
|
||||
pp_cxx_begin_template_argument_list (pp);
|
||||
pp_cxx_type_id (pp, TREE_TYPE (t));
|
||||
pp_cxx_end_template_argument_list (pp);
|
||||
@ -482,9 +482,9 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
|
||||
pp_cxx_identifier (pp, "typeid");
|
||||
pp_left_paren (pp);
|
||||
if (TYPE_P (t))
|
||||
pp_cxx_type_id (pp, t);
|
||||
pp_cxx_type_id (pp, t);
|
||||
else
|
||||
pp_cxx_expression (pp, t);
|
||||
pp_cxx_expression (pp, t);
|
||||
pp_right_paren (pp);
|
||||
break;
|
||||
|
||||
@ -538,27 +538,27 @@ pp_cxx_new_expression (cxx_pretty_printer *pp, tree t)
|
||||
case NEW_EXPR:
|
||||
case VEC_NEW_EXPR:
|
||||
if (NEW_EXPR_USE_GLOBAL (t))
|
||||
pp_cxx_colon_colon (pp);
|
||||
pp_cxx_colon_colon (pp);
|
||||
pp_cxx_identifier (pp, "new");
|
||||
if (TREE_OPERAND (t, 0))
|
||||
{
|
||||
pp_cxx_call_argument_list (pp, TREE_OPERAND (t, 0));
|
||||
pp_space (pp);
|
||||
}
|
||||
{
|
||||
pp_cxx_call_argument_list (pp, TREE_OPERAND (t, 0));
|
||||
pp_space (pp);
|
||||
}
|
||||
/* FIXME: array-types are built with one more element. */
|
||||
pp_cxx_type_id (pp, TREE_OPERAND (t, 1));
|
||||
if (TREE_OPERAND (t, 2))
|
||||
{
|
||||
pp_left_paren (pp);
|
||||
t = TREE_OPERAND (t, 2);
|
||||
if (TREE_CODE (t) == TREE_LIST)
|
||||
pp_c_expression_list (pp_c_base (pp), t);
|
||||
else if (t == void_zero_node)
|
||||
; /* OK, empty initializer list. */
|
||||
else
|
||||
pp_cxx_expression (pp, t);
|
||||
pp_right_paren (pp);
|
||||
}
|
||||
{
|
||||
pp_left_paren (pp);
|
||||
t = TREE_OPERAND (t, 2);
|
||||
if (TREE_CODE (t) == TREE_LIST)
|
||||
pp_c_expression_list (pp_c_base (pp), t);
|
||||
else if (t == void_zero_node)
|
||||
; /* OK, empty initializer list. */
|
||||
else
|
||||
pp_cxx_expression (pp, t);
|
||||
pp_right_paren (pp);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -579,13 +579,13 @@ pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
|
||||
case DELETE_EXPR:
|
||||
case VEC_DELETE_EXPR:
|
||||
if (DELETE_EXPR_USE_GLOBAL (t))
|
||||
pp_cxx_colon_colon (pp);
|
||||
pp_cxx_colon_colon (pp);
|
||||
pp_cxx_identifier (pp, "delete");
|
||||
if (code == VEC_DELETE_EXPR)
|
||||
{
|
||||
pp_left_bracket (pp);
|
||||
pp_right_bracket (pp);
|
||||
}
|
||||
{
|
||||
pp_left_bracket (pp);
|
||||
pp_right_bracket (pp);
|
||||
}
|
||||
pp_c_cast_expression (pp_c_base (pp), TREE_OPERAND (t, 0));
|
||||
break;
|
||||
|
||||
@ -685,10 +685,10 @@ pp_cxx_pm_expression (cxx_pretty_printer *pp, tree t)
|
||||
/* Handle unfortunate OFFESET_REF overloading here. */
|
||||
case OFFSET_REF:
|
||||
if (TYPE_P (TREE_OPERAND (t, 0)))
|
||||
{
|
||||
pp_cxx_qualified_id (pp, t);
|
||||
break;
|
||||
}
|
||||
{
|
||||
pp_cxx_qualified_id (pp, t);
|
||||
break;
|
||||
}
|
||||
/* Else fall through. */
|
||||
case MEMBER_REF:
|
||||
case DOTSTAR_EXPR:
|
||||
@ -825,7 +825,7 @@ pp_cxx_assignment_expression (cxx_pretty_printer *pp, tree e)
|
||||
case THROW_EXPR:
|
||||
pp_cxx_identifier (pp, "throw");
|
||||
if (TREE_OPERAND (e, 0))
|
||||
pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 0));
|
||||
pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 0));
|
||||
break;
|
||||
|
||||
case MODOP_EXPR:
|
||||
@ -963,11 +963,11 @@ pp_cxx_function_specifier (cxx_pretty_printer *pp, tree t)
|
||||
{
|
||||
case FUNCTION_DECL:
|
||||
if (DECL_VIRTUAL_P (t))
|
||||
pp_cxx_identifier (pp, "virtual");
|
||||
pp_cxx_identifier (pp, "virtual");
|
||||
else if (DECL_CONSTRUCTOR_P (t) && DECL_NONCONVERTING_P (t))
|
||||
pp_cxx_identifier (pp, "explicit");
|
||||
pp_cxx_identifier (pp, "explicit");
|
||||
else
|
||||
pp_c_function_specifier (pp_c_base (pp), t);
|
||||
pp_c_function_specifier (pp_c_base (pp), t);
|
||||
|
||||
default:
|
||||
break;
|
||||
@ -1004,23 +1004,23 @@ pp_cxx_decl_specifier_seq (cxx_pretty_printer *pp, tree t)
|
||||
|
||||
case RECORD_TYPE:
|
||||
if (TYPE_PTRMEMFUNC_P (t))
|
||||
{
|
||||
tree pfm = TYPE_PTRMEMFUNC_FN_TYPE (t);
|
||||
pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (pfm)));
|
||||
pp_cxx_whitespace (pp);
|
||||
pp_cxx_ptr_operator (pp, t);
|
||||
}
|
||||
{
|
||||
tree pfm = TYPE_PTRMEMFUNC_FN_TYPE (t);
|
||||
pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (pfm)));
|
||||
pp_cxx_whitespace (pp);
|
||||
pp_cxx_ptr_operator (pp, t);
|
||||
}
|
||||
break;
|
||||
|
||||
case FUNCTION_DECL:
|
||||
/* Constructors don't have return types. And conversion functions
|
||||
do not have a type-specifier in their return types. */
|
||||
do not have a type-specifier in their return types. */
|
||||
if (DECL_CONSTRUCTOR_P (t) || DECL_CONV_FN_P (t))
|
||||
pp_cxx_function_specifier (pp, t);
|
||||
pp_cxx_function_specifier (pp, t);
|
||||
else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
|
||||
pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t)));
|
||||
pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t)));
|
||||
else
|
||||
default:
|
||||
default:
|
||||
pp_c_declaration_specifiers (pp_c_base (pp), t);
|
||||
break;
|
||||
}
|
||||
@ -1102,7 +1102,7 @@ pp_cxx_type_specifier_seq (cxx_pretty_printer *pp, tree t)
|
||||
|
||||
default:
|
||||
if (!(TREE_CODE (t) == FUNCTION_DECL && DECL_CONSTRUCTOR_P (t)))
|
||||
pp_c_specifier_qualifier_list (pp_c_base (pp), t);
|
||||
pp_c_specifier_qualifier_list (pp_c_base (pp), t);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1121,35 +1121,35 @@ pp_cxx_ptr_operator (cxx_pretty_printer *pp, tree t)
|
||||
case REFERENCE_TYPE:
|
||||
case POINTER_TYPE:
|
||||
if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE
|
||||
|| TYPE_PTR_TO_MEMBER_P (TREE_TYPE (t)))
|
||||
pp_cxx_ptr_operator (pp, TREE_TYPE (t));
|
||||
|| TYPE_PTR_TO_MEMBER_P (TREE_TYPE (t)))
|
||||
pp_cxx_ptr_operator (pp, TREE_TYPE (t));
|
||||
if (TREE_CODE (t) == POINTER_TYPE)
|
||||
{
|
||||
pp_star (pp);
|
||||
pp_cxx_cv_qualifier_seq (pp, t);
|
||||
}
|
||||
{
|
||||
pp_star (pp);
|
||||
pp_cxx_cv_qualifier_seq (pp, t);
|
||||
}
|
||||
else
|
||||
pp_ampersand (pp);
|
||||
pp_ampersand (pp);
|
||||
break;
|
||||
|
||||
case RECORD_TYPE:
|
||||
if (TYPE_PTRMEMFUNC_P (t))
|
||||
{
|
||||
pp_cxx_left_paren (pp);
|
||||
pp_cxx_nested_name_specifier (pp, TYPE_PTRMEMFUNC_OBJECT_TYPE (t));
|
||||
pp_star (pp);
|
||||
break;
|
||||
}
|
||||
{
|
||||
pp_cxx_left_paren (pp);
|
||||
pp_cxx_nested_name_specifier (pp, TYPE_PTRMEMFUNC_OBJECT_TYPE (t));
|
||||
pp_star (pp);
|
||||
break;
|
||||
}
|
||||
case OFFSET_TYPE:
|
||||
if (TYPE_PTR_TO_MEMBER_P (t))
|
||||
{
|
||||
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
|
||||
pp_cxx_left_paren (pp);
|
||||
pp_cxx_nested_name_specifier (pp, TYPE_PTRMEM_CLASS_TYPE (t));
|
||||
pp_star (pp);
|
||||
pp_cxx_cv_qualifier_seq (pp, t);
|
||||
break;
|
||||
}
|
||||
{
|
||||
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
|
||||
pp_cxx_left_paren (pp);
|
||||
pp_cxx_nested_name_specifier (pp, TYPE_PTRMEM_CLASS_TYPE (t));
|
||||
pp_star (pp);
|
||||
pp_cxx_cv_qualifier_seq (pp, t);
|
||||
break;
|
||||
}
|
||||
/* else fall through. */
|
||||
|
||||
default:
|
||||
@ -1207,16 +1207,16 @@ pp_cxx_parameter_declaration_clause (cxx_pretty_printer *pp, tree t)
|
||||
for (; args; args = TREE_CHAIN (args), types = TREE_CHAIN (types))
|
||||
{
|
||||
if (!first)
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
first = false;
|
||||
pp_cxx_parameter_declaration (pp, abstract ? TREE_VALUE (types) : args);
|
||||
if (!abstract && pp_c_base (pp)->flags & pp_cxx_flag_default_argument)
|
||||
{
|
||||
pp_cxx_whitespace (pp);
|
||||
pp_equal (pp);
|
||||
pp_cxx_whitespace (pp);
|
||||
pp_cxx_assignment_expression (pp, TREE_PURPOSE (types));
|
||||
}
|
||||
{
|
||||
pp_cxx_whitespace (pp);
|
||||
pp_equal (pp);
|
||||
pp_cxx_whitespace (pp);
|
||||
pp_cxx_assignment_expression (pp, TREE_PURPOSE (types));
|
||||
}
|
||||
}
|
||||
pp_cxx_right_paren (pp);
|
||||
}
|
||||
@ -1241,7 +1241,7 @@ pp_cxx_exception_specification (cxx_pretty_printer *pp, tree t)
|
||||
{
|
||||
pp_cxx_type_id (pp, TREE_VALUE (ex_spec));
|
||||
if (TREE_CHAIN (ex_spec))
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
}
|
||||
pp_cxx_right_paren (pp);
|
||||
}
|
||||
@ -1249,7 +1249,7 @@ pp_cxx_exception_specification (cxx_pretty_printer *pp, tree t)
|
||||
/* direct-declarator:
|
||||
declarator-id
|
||||
direct-declarator ( parameter-declaration-clause ) cv-qualifier-seq(opt)
|
||||
exception-specification(opt)
|
||||
exception-specification(opt)
|
||||
direct-declaration [ constant-expression(opt) ]
|
||||
( declarator ) */
|
||||
|
||||
@ -1263,10 +1263,10 @@ pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t)
|
||||
case CONST_DECL:
|
||||
case FIELD_DECL:
|
||||
if (DECL_NAME (t))
|
||||
{
|
||||
pp_cxx_space_for_pointer_operator (pp, TREE_TYPE (t));
|
||||
pp_cxx_id_expression (pp, DECL_NAME (t));
|
||||
}
|
||||
{
|
||||
pp_cxx_space_for_pointer_operator (pp, TREE_TYPE (t));
|
||||
pp_cxx_id_expression (pp, DECL_NAME (t));
|
||||
}
|
||||
pp_cxx_abstract_declarator (pp, TREE_TYPE (t));
|
||||
break;
|
||||
|
||||
@ -1276,10 +1276,10 @@ pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t)
|
||||
pp_cxx_parameter_declaration_clause (pp, t);
|
||||
|
||||
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
|
||||
{
|
||||
pp_base (pp)->padding = pp_before;
|
||||
pp_cxx_cv_qualifier_seq (pp, pp_cxx_implicit_parameter_type (t));
|
||||
}
|
||||
{
|
||||
pp_base (pp)->padding = pp_before;
|
||||
pp_cxx_cv_qualifier_seq (pp, pp_cxx_implicit_parameter_type (t));
|
||||
}
|
||||
|
||||
pp_cxx_exception_specification (pp, TREE_TYPE (t));
|
||||
break;
|
||||
@ -1333,7 +1333,7 @@ pp_cxx_ctor_initializer (cxx_pretty_printer *pp, tree t)
|
||||
pp_cxx_primary_expression (pp, TREE_PURPOSE (t));
|
||||
pp_cxx_call_argument_list (pp, TREE_VALUE (t));
|
||||
if (TREE_CHAIN (t))
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1372,8 +1372,8 @@ pp_cxx_abstract_declarator (cxx_pretty_printer *pp, tree t)
|
||||
else if (POINTER_TYPE_P (t))
|
||||
{
|
||||
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
|
||||
|| TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
|
||||
pp_cxx_right_paren (pp);
|
||||
|| TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
|
||||
pp_cxx_right_paren (pp);
|
||||
t = TREE_TYPE (t);
|
||||
}
|
||||
pp_cxx_direct_abstract_declarator (pp, t);
|
||||
@ -1381,7 +1381,7 @@ pp_cxx_abstract_declarator (cxx_pretty_printer *pp, tree t)
|
||||
|
||||
/* direct-abstract-declarator:
|
||||
direct-abstract-declarator(opt) ( parameter-declaration-clause )
|
||||
cv-qualifier-seq(opt) exception-specification(opt)
|
||||
cv-qualifier-seq(opt) exception-specification(opt)
|
||||
direct-abstract-declarator(opt) [ constant-expression(opt) ]
|
||||
( abstract-declarator ) */
|
||||
|
||||
@ -1396,7 +1396,7 @@ pp_cxx_direct_abstract_declarator (cxx_pretty_printer *pp, tree t)
|
||||
|
||||
case RECORD_TYPE:
|
||||
if (TYPE_PTRMEMFUNC_P (t))
|
||||
pp_cxx_direct_abstract_declarator (pp, TYPE_PTRMEMFUNC_FN_TYPE (t));
|
||||
pp_cxx_direct_abstract_declarator (pp, TYPE_PTRMEMFUNC_FN_TYPE (t));
|
||||
break;
|
||||
|
||||
case METHOD_TYPE:
|
||||
@ -1404,11 +1404,11 @@ pp_cxx_direct_abstract_declarator (cxx_pretty_printer *pp, tree t)
|
||||
pp_cxx_parameter_declaration_clause (pp, t);
|
||||
pp_cxx_direct_abstract_declarator (pp, TREE_TYPE (t));
|
||||
if (TREE_CODE (t) == METHOD_TYPE)
|
||||
{
|
||||
pp_base (pp)->padding = pp_before;
|
||||
pp_cxx_cv_qualifier_seq
|
||||
(pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))));
|
||||
}
|
||||
{
|
||||
pp_base (pp)->padding = pp_before;
|
||||
pp_cxx_cv_qualifier_seq
|
||||
(pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))));
|
||||
}
|
||||
pp_cxx_exception_specification (pp, t);
|
||||
break;
|
||||
|
||||
@ -1479,12 +1479,12 @@ pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t)
|
||||
{
|
||||
tree arg = TREE_VEC_ELT (t, i);
|
||||
if (i != 0)
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL
|
||||
&& TYPE_P (DECL_TEMPLATE_RESULT (arg))))
|
||||
pp_cxx_type_id (pp, arg);
|
||||
pp_cxx_type_id (pp, arg);
|
||||
else
|
||||
pp_cxx_expression (pp, arg);
|
||||
pp_cxx_expression (pp, arg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1527,7 +1527,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
|
||||
break;
|
||||
|
||||
/* try-block:
|
||||
try compound-statement handler-seq */
|
||||
try compound-statement handler-seq */
|
||||
case TRY_BLOCK:
|
||||
pp_maybe_newline_and_indent (pp, 0);
|
||||
pp_cxx_identifier (pp, "try");
|
||||
@ -1535,22 +1535,22 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
|
||||
pp_cxx_statement (pp, TRY_STMTS (t));
|
||||
pp_newline_and_indent (pp, -3);
|
||||
if (CLEANUP_P (t))
|
||||
;
|
||||
;
|
||||
else
|
||||
pp_cxx_statement (pp, TRY_HANDLERS (t));
|
||||
pp_cxx_statement (pp, TRY_HANDLERS (t));
|
||||
break;
|
||||
|
||||
/*
|
||||
handler-seq:
|
||||
handler handler-seq(opt)
|
||||
handler-seq:
|
||||
handler handler-seq(opt)
|
||||
|
||||
handler:
|
||||
catch ( exception-declaration ) compound-statement
|
||||
handler:
|
||||
catch ( exception-declaration ) compound-statement
|
||||
|
||||
exception-declaration:
|
||||
type-specifier-seq declarator
|
||||
type-specifier-seq abstract-declarator
|
||||
... */
|
||||
exception-declaration:
|
||||
type-specifier-seq declarator
|
||||
type-specifier-seq abstract-declarator
|
||||
... */
|
||||
case HANDLER:
|
||||
pp_cxx_identifier (pp, "catch");
|
||||
pp_cxx_left_paren (pp);
|
||||
@ -1564,8 +1564,8 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
|
||||
break;
|
||||
|
||||
/* selection-statement:
|
||||
if ( expression ) statement
|
||||
if ( expression ) statement else statement */
|
||||
if ( expression ) statement
|
||||
if ( expression ) statement else statement */
|
||||
case IF_STMT:
|
||||
pp_cxx_identifier (pp, "if");
|
||||
pp_cxx_whitespace (pp);
|
||||
@ -1602,10 +1602,10 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
|
||||
break;
|
||||
|
||||
/* iteration-statement:
|
||||
while ( expression ) statement
|
||||
do statement while ( expression ) ;
|
||||
for ( expression(opt) ; expression(opt) ; expression(opt) ) statement
|
||||
for ( declaration expression(opt) ; expression(opt) ) statement */
|
||||
while ( expression ) statement
|
||||
do statement while ( expression ) ;
|
||||
for ( expression(opt) ; expression(opt) ; expression(opt) ) statement
|
||||
for ( declaration expression(opt) ; expression(opt) ) statement */
|
||||
case WHILE_STMT:
|
||||
pp_cxx_identifier (pp, "while");
|
||||
pp_space (pp);
|
||||
@ -1637,9 +1637,9 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
|
||||
pp_space (pp);
|
||||
pp_cxx_left_paren (pp);
|
||||
if (FOR_INIT_STMT (t))
|
||||
pp_cxx_statement (pp, FOR_INIT_STMT (t));
|
||||
pp_cxx_statement (pp, FOR_INIT_STMT (t));
|
||||
else
|
||||
pp_cxx_semicolon (pp);
|
||||
pp_cxx_semicolon (pp);
|
||||
pp_needs_newline (pp) = false;
|
||||
pp_cxx_whitespace (pp);
|
||||
if (FOR_COND (t))
|
||||
@ -1657,9 +1657,9 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
|
||||
break;
|
||||
|
||||
/* jump-statement:
|
||||
goto identifier;
|
||||
continue ;
|
||||
return expression(opt) ; */
|
||||
goto identifier;
|
||||
continue ;
|
||||
return expression(opt) ; */
|
||||
case BREAK_STMT:
|
||||
case CONTINUE_STMT:
|
||||
pp_identifier (pp, TREE_CODE (t) == BREAK_STMT ? "break" : "continue");
|
||||
@ -1668,7 +1668,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
|
||||
break;
|
||||
|
||||
/* expression-statement:
|
||||
expression(opt) ; */
|
||||
expression(opt) ; */
|
||||
case EXPR_STMT:
|
||||
pp_cxx_expression (pp, EXPR_STMT_EXPR (t));
|
||||
pp_cxx_semicolon (pp);
|
||||
@ -1756,7 +1756,7 @@ pp_cxx_template_parameter_list (cxx_pretty_printer *pp, tree t)
|
||||
for (i = 0; i < n; ++i)
|
||||
{
|
||||
if (i)
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
pp_cxx_template_parameter (pp, TREE_VEC_ELT (t, i));
|
||||
}
|
||||
}
|
||||
@ -1783,7 +1783,7 @@ pp_cxx_template_parameter (cxx_pretty_printer *pp, tree t)
|
||||
case TYPE_DECL:
|
||||
pp_cxx_identifier (pp, "class");
|
||||
if (DECL_NAME (parameter))
|
||||
pp_cxx_tree_identifier (pp, DECL_NAME (parameter));
|
||||
pp_cxx_tree_identifier (pp, DECL_NAME (parameter));
|
||||
/* FIXME: Chech if we should print also default argument. */
|
||||
break;
|
||||
|
||||
@ -1885,19 +1885,19 @@ pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
|
||||
switch (DECL_USE_TEMPLATE (t))
|
||||
{
|
||||
case 1:
|
||||
pp_cxx_template_declaration (pp, t);
|
||||
break;
|
||||
pp_cxx_template_declaration (pp, t);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
pp_cxx_explicit_specialization (pp, t);
|
||||
break;
|
||||
pp_cxx_explicit_specialization (pp, t);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
pp_cxx_explicit_instantiation (pp, t);
|
||||
break;
|
||||
pp_cxx_explicit_instantiation (pp, t);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
else switch (TREE_CODE (t))
|
||||
{
|
||||
@ -1908,16 +1908,16 @@ pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
|
||||
|
||||
case FUNCTION_DECL:
|
||||
if (DECL_SAVED_TREE (t))
|
||||
pp_cxx_function_definition (pp, t);
|
||||
pp_cxx_function_definition (pp, t);
|
||||
else
|
||||
pp_cxx_simple_declaration (pp, t);
|
||||
pp_cxx_simple_declaration (pp, t);
|
||||
break;
|
||||
|
||||
case NAMESPACE_DECL:
|
||||
if (DECL_NAMESPACE_ALIAS (t))
|
||||
pp_cxx_namespace_alias_definition (pp, t);
|
||||
pp_cxx_namespace_alias_definition (pp, t);
|
||||
else
|
||||
pp_cxx_original_namespace_definition (pp, t);
|
||||
pp_cxx_original_namespace_definition (pp, t);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -44,21 +44,21 @@ typedef struct
|
||||
#define pp_cxx_cv_qualifier_seq(PP, T) \
|
||||
pp_c_type_qualifier_list (pp_c_base (PP), T)
|
||||
|
||||
#define pp_cxx_whitespace(PP) pp_c_whitespace (pp_c_base (PP))
|
||||
#define pp_cxx_left_paren(PP) pp_c_left_paren (pp_c_base (PP))
|
||||
#define pp_cxx_right_paren(PP) pp_c_right_paren (pp_c_base (PP))
|
||||
#define pp_cxx_left_brace(PP) pp_c_left_brace (pp_c_base (PP))
|
||||
#define pp_cxx_right_brace(PP) pp_c_right_brace (pp_c_base (PP))
|
||||
#define pp_cxx_left_bracket(PP) pp_c_left_bracket (pp_c_base (PP))
|
||||
#define pp_cxx_right_bracket(PP) pp_c_right_bracket (pp_c_base (PP))
|
||||
#define pp_cxx_dot(PP) pp_c_dot (pp_c_base (PP))
|
||||
#define pp_cxx_ampersand(PP) pp_c_ampersand (pp_c_base (PP))
|
||||
#define pp_cxx_star(PP) pp_c_star (pp_c_base (PP))
|
||||
#define pp_cxx_arrow(PP) pp_c_arrow (pp_c_base (PP))
|
||||
#define pp_cxx_semicolon(PP) pp_c_semicolon (pp_c_base (PP))
|
||||
#define pp_cxx_complement(PP) pp_c_complement (pp_c_base (PP))
|
||||
#define pp_cxx_whitespace(PP) pp_c_whitespace (pp_c_base (PP))
|
||||
#define pp_cxx_left_paren(PP) pp_c_left_paren (pp_c_base (PP))
|
||||
#define pp_cxx_right_paren(PP) pp_c_right_paren (pp_c_base (PP))
|
||||
#define pp_cxx_left_brace(PP) pp_c_left_brace (pp_c_base (PP))
|
||||
#define pp_cxx_right_brace(PP) pp_c_right_brace (pp_c_base (PP))
|
||||
#define pp_cxx_left_bracket(PP) pp_c_left_bracket (pp_c_base (PP))
|
||||
#define pp_cxx_right_bracket(PP) pp_c_right_bracket (pp_c_base (PP))
|
||||
#define pp_cxx_dot(PP) pp_c_dot (pp_c_base (PP))
|
||||
#define pp_cxx_ampersand(PP) pp_c_ampersand (pp_c_base (PP))
|
||||
#define pp_cxx_star(PP) pp_c_star (pp_c_base (PP))
|
||||
#define pp_cxx_arrow(PP) pp_c_arrow (pp_c_base (PP))
|
||||
#define pp_cxx_semicolon(PP) pp_c_semicolon (pp_c_base (PP))
|
||||
#define pp_cxx_complement(PP) pp_c_complement (pp_c_base (PP))
|
||||
|
||||
#define pp_cxx_identifier(PP, I) pp_c_identifier (pp_c_base (PP), I)
|
||||
#define pp_cxx_identifier(PP, I) pp_c_identifier (pp_c_base (PP), I)
|
||||
#define pp_cxx_tree_identifier(PP, T) \
|
||||
pp_c_tree_identifier (pp_c_base (PP), T)
|
||||
|
||||
|
586
gcc/cp/decl.c
586
gcc/cp/decl.c
File diff suppressed because it is too large
Load Diff
118
gcc/cp/decl2.c
118
gcc/cp/decl2.c
@ -77,7 +77,7 @@ static tree start_static_initialization_or_destruction (tree, int);
|
||||
static void finish_static_initialization_or_destruction (tree);
|
||||
static void generate_ctor_or_dtor_function (bool, int, location_t *);
|
||||
static int generate_ctor_and_dtor_functions_for_priority (splay_tree_node,
|
||||
void *);
|
||||
void *);
|
||||
static tree prune_vars_needing_no_initialization (tree *);
|
||||
static void write_out_vars (tree);
|
||||
static void import_export_class (tree);
|
||||
@ -370,7 +370,7 @@ grok_array_decl (tree array_expr, tree index_exp)
|
||||
else
|
||||
{
|
||||
error ("invalid types %<%T[%T]%> for array subscript",
|
||||
type, TREE_TYPE (index_exp));
|
||||
type, TREE_TYPE (index_exp));
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -419,7 +419,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete)
|
||||
if (t == NULL_TREE || t == error_mark_node)
|
||||
{
|
||||
error ("type %q#T argument given to %<delete%>, expected pointer",
|
||||
TREE_TYPE (exp));
|
||||
TREE_TYPE (exp));
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -431,7 +431,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete)
|
||||
if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
|
||||
{
|
||||
error ("cannot delete a function. Only pointer-to-objects are "
|
||||
"valid arguments to %<delete%>");
|
||||
"valid arguments to %<delete%>");
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -475,7 +475,7 @@ check_member_template (tree tmpl)
|
||||
|
||||
A local class shall not have member templates. */
|
||||
error ("invalid declaration of member template %q#D in local class",
|
||||
decl);
|
||||
decl);
|
||||
|
||||
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
|
||||
{
|
||||
@ -543,7 +543,7 @@ check_java_method (tree method)
|
||||
if (!acceptable_java_type (ret_type))
|
||||
{
|
||||
error ("Java method %qD has non-Java return type %qT",
|
||||
method, ret_type);
|
||||
method, ret_type);
|
||||
jerr = true;
|
||||
}
|
||||
|
||||
@ -558,8 +558,8 @@ check_java_method (tree method)
|
||||
tree type = TREE_VALUE (arg_types);
|
||||
if (!acceptable_java_type (type))
|
||||
{
|
||||
error ("Java method %qD has non-Java parameter type %qT",
|
||||
method, type);
|
||||
error ("Java method %qD has non-Java parameter type %qT",
|
||||
method, type);
|
||||
jerr = true;
|
||||
}
|
||||
}
|
||||
@ -590,8 +590,8 @@ check_classfn (tree ctype, tree function, tree template_parms)
|
||||
we're not going to find the declaration in the class.
|
||||
For example, in:
|
||||
|
||||
struct S { template <typename T> void f(T); };
|
||||
template <> void S::f(int);
|
||||
struct S { template <typename T> void f(T); };
|
||||
template <> void S::f(int);
|
||||
|
||||
we're not going to find `S::f(int)', but there's no
|
||||
reason we should, either. We let our callers know we didn't
|
||||
@ -743,7 +743,7 @@ note_vague_linkage_var (tree var)
|
||||
|
||||
void
|
||||
finish_static_data_member_decl (tree decl, tree init, tree asmspec_tree,
|
||||
int flags)
|
||||
int flags)
|
||||
{
|
||||
gcc_assert (TREE_PUBLIC (decl));
|
||||
|
||||
@ -770,7 +770,7 @@ finish_static_data_member_decl (tree decl, tree init, tree asmspec_tree,
|
||||
|
||||
error ("initializer invalid for static member with constructor");
|
||||
if (!explained)
|
||||
{
|
||||
{
|
||||
error ("(an out of class initialization is required)");
|
||||
explained = 1;
|
||||
}
|
||||
@ -808,7 +808,7 @@ tree
|
||||
grokfield (const cp_declarator *declarator,
|
||||
cp_decl_specifier_seq *declspecs,
|
||||
tree init, tree asmspec_tree,
|
||||
tree attrlist)
|
||||
tree attrlist)
|
||||
{
|
||||
tree value;
|
||||
const char *asmspec = 0;
|
||||
@ -853,7 +853,7 @@ grokfield (const cp_declarator *declarator,
|
||||
&& IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_'
|
||||
&& ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr"))
|
||||
error ("member %qD conflicts with virtual function table field name",
|
||||
value);
|
||||
value);
|
||||
|
||||
/* Stash away type declarations. */
|
||||
if (TREE_CODE (value) == TYPE_DECL)
|
||||
@ -904,7 +904,7 @@ grokfield (const cp_declarator *declarator,
|
||||
else
|
||||
{
|
||||
/* We allow initializers to become parameters to base
|
||||
initializers. */
|
||||
initializers. */
|
||||
if (TREE_CODE (init) == TREE_LIST)
|
||||
{
|
||||
if (TREE_CHAIN (init) == NULL_TREE)
|
||||
@ -1021,7 +1021,7 @@ grokbitfield (const cp_declarator *declarator,
|
||||
if (DECL_IN_AGGR_P (value))
|
||||
{
|
||||
error ("%qD is already defined in the class %qT", value,
|
||||
DECL_CONTEXT (value));
|
||||
DECL_CONTEXT (value));
|
||||
return void_type_node;
|
||||
}
|
||||
|
||||
@ -1086,7 +1086,7 @@ build_anon_union_vars (tree type, tree object)
|
||||
if (TREE_CODE (field) != FIELD_DECL)
|
||||
{
|
||||
cp_pedwarn_at ("%q#D invalid; an anonymous union can only "
|
||||
"have non-static data members",
|
||||
"have non-static data members",
|
||||
field);
|
||||
continue;
|
||||
}
|
||||
@ -1200,9 +1200,9 @@ coerce_new_type (tree type)
|
||||
{
|
||||
e = 2;
|
||||
if (args && args != void_list_node)
|
||||
args = TREE_CHAIN (args);
|
||||
args = TREE_CHAIN (args);
|
||||
pedwarn ("%<operator new%> takes type %<size_t%> (%qT) "
|
||||
"as first parameter", size_type_node);
|
||||
"as first parameter", size_type_node);
|
||||
}
|
||||
switch (e)
|
||||
{
|
||||
@ -1211,8 +1211,8 @@ coerce_new_type (tree type)
|
||||
/* Fall through. */
|
||||
case 1:
|
||||
type = build_exception_variant
|
||||
(build_function_type (ptr_type_node, args),
|
||||
TYPE_RAISES_EXCEPTIONS (type));
|
||||
(build_function_type (ptr_type_node, args),
|
||||
TYPE_RAISES_EXCEPTIONS (type));
|
||||
/* Fall through. */
|
||||
default:;
|
||||
}
|
||||
@ -1238,9 +1238,9 @@ coerce_delete_type (tree type)
|
||||
{
|
||||
e = 2;
|
||||
if (args && args != void_list_node)
|
||||
args = TREE_CHAIN (args);
|
||||
args = TREE_CHAIN (args);
|
||||
error ("%<operator delete%> takes type %qT as first parameter",
|
||||
ptr_type_node);
|
||||
ptr_type_node);
|
||||
}
|
||||
switch (e)
|
||||
{
|
||||
@ -1249,8 +1249,8 @@ coerce_delete_type (tree type)
|
||||
/* Fall through. */
|
||||
case 1:
|
||||
type = build_exception_variant
|
||||
(build_function_type (void_type_node, args),
|
||||
TYPE_RAISES_EXCEPTIONS (type));
|
||||
(build_function_type (void_type_node, args),
|
||||
TYPE_RAISES_EXCEPTIONS (type));
|
||||
/* Fall through. */
|
||||
default:;
|
||||
}
|
||||
@ -1983,7 +1983,7 @@ get_guard (tree decl)
|
||||
DECL_COMMON (guard) = DECL_COMMON (decl);
|
||||
DECL_ONE_ONLY (guard) = DECL_ONE_ONLY (decl);
|
||||
if (TREE_PUBLIC (decl))
|
||||
DECL_WEAK (guard) = DECL_WEAK (decl);
|
||||
DECL_WEAK (guard) = DECL_WEAK (decl);
|
||||
|
||||
DECL_ARTIFICIAL (guard) = 1;
|
||||
DECL_IGNORED_P (guard) = 1;
|
||||
@ -2813,9 +2813,9 @@ cp_finish_file (void)
|
||||
These include:
|
||||
|
||||
o Template specializations that we have not yet instantiated,
|
||||
but which are needed.
|
||||
but which are needed.
|
||||
o Initialization and destruction for non-local objects with
|
||||
static storage duration. (Local objects with static storage
|
||||
static storage duration. (Local objects with static storage
|
||||
duration are initialized when their scope is first entered,
|
||||
and are cleaned up via atexit.)
|
||||
o Virtual function tables.
|
||||
@ -2842,42 +2842,42 @@ cp_finish_file (void)
|
||||
ggc_collect ();
|
||||
|
||||
/* Write out virtual tables as required. Note that writing out
|
||||
the virtual table for a template class may cause the
|
||||
instantiation of members of that class. If we write out
|
||||
vtables then we remove the class from our list so we don't
|
||||
have to look at it again. */
|
||||
the virtual table for a template class may cause the
|
||||
instantiation of members of that class. If we write out
|
||||
vtables then we remove the class from our list so we don't
|
||||
have to look at it again. */
|
||||
|
||||
while (keyed_classes != NULL_TREE
|
||||
&& maybe_emit_vtables (TREE_VALUE (keyed_classes)))
|
||||
{
|
||||
reconsider = true;
|
||||
keyed_classes = TREE_CHAIN (keyed_classes);
|
||||
}
|
||||
&& maybe_emit_vtables (TREE_VALUE (keyed_classes)))
|
||||
{
|
||||
reconsider = true;
|
||||
keyed_classes = TREE_CHAIN (keyed_classes);
|
||||
}
|
||||
|
||||
t = keyed_classes;
|
||||
if (t != NULL_TREE)
|
||||
{
|
||||
tree next = TREE_CHAIN (t);
|
||||
{
|
||||
tree next = TREE_CHAIN (t);
|
||||
|
||||
while (next)
|
||||
{
|
||||
if (maybe_emit_vtables (TREE_VALUE (next)))
|
||||
{
|
||||
reconsider = true;
|
||||
TREE_CHAIN (t) = TREE_CHAIN (next);
|
||||
}
|
||||
else
|
||||
t = next;
|
||||
while (next)
|
||||
{
|
||||
if (maybe_emit_vtables (TREE_VALUE (next)))
|
||||
{
|
||||
reconsider = true;
|
||||
TREE_CHAIN (t) = TREE_CHAIN (next);
|
||||
}
|
||||
else
|
||||
t = next;
|
||||
|
||||
next = TREE_CHAIN (t);
|
||||
}
|
||||
}
|
||||
next = TREE_CHAIN (t);
|
||||
}
|
||||
}
|
||||
|
||||
/* Write out needed type info variables. We have to be careful
|
||||
looping through unemitted decls, because emit_tinfo_decl may
|
||||
cause other variables to be needed. New elements will be
|
||||
appended, and we remove from the vector those that actually
|
||||
get emitted. */
|
||||
looping through unemitted decls, because emit_tinfo_decl may
|
||||
cause other variables to be needed. New elements will be
|
||||
appended, and we remove from the vector those that actually
|
||||
get emitted. */
|
||||
for (i = VEC_length (tree, unemitted_tinfo_decls);
|
||||
VEC_iterate (tree, unemitted_tinfo_decls, --i, t);)
|
||||
if (emit_tinfo_decl (t))
|
||||
@ -2967,8 +2967,8 @@ cp_finish_file (void)
|
||||
up with CURRENT_FUNCTION_DECL set. */
|
||||
push_to_top_level ();
|
||||
/* The decl's location will mark where it was first
|
||||
needed. Save that so synthesize method can indicate
|
||||
where it was needed from, in case of error */
|
||||
needed. Save that so synthesize method can indicate
|
||||
where it was needed from, in case of error */
|
||||
input_location = DECL_SOURCE_LOCATION (decl);
|
||||
synthesize_method (decl);
|
||||
pop_from_top_level ();
|
||||
@ -3234,8 +3234,8 @@ mark_used (tree decl)
|
||||
return;
|
||||
|
||||
/* Remember the current location for a function we will end up
|
||||
synthesizing. Then we can inform the user where it was
|
||||
required in the case of error. */
|
||||
synthesizing. Then we can inform the user where it was
|
||||
required in the case of error. */
|
||||
if (DECL_ARTIFICIAL (decl) && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
|
||||
&& !DECL_THUNK_P (decl))
|
||||
DECL_SOURCE_LOCATION (decl) = input_location;
|
||||
|
@ -91,63 +91,63 @@ dump_op (dump_info_p di, tree t)
|
||||
break;
|
||||
case PLUS_EXPR:
|
||||
if (DECL_ASSIGNMENT_OPERATOR_P (t))
|
||||
dump_string (di, "plusassign");
|
||||
dump_string (di, "plusassign");
|
||||
else
|
||||
dump_string(di, "plus");
|
||||
dump_string(di, "plus");
|
||||
break;
|
||||
case MINUS_EXPR:
|
||||
if (DECL_ASSIGNMENT_OPERATOR_P (t))
|
||||
dump_string (di, "minusassign");
|
||||
dump_string (di, "minusassign");
|
||||
else
|
||||
dump_string(di, "minus");
|
||||
dump_string(di, "minus");
|
||||
break;
|
||||
case MULT_EXPR:
|
||||
if (DECL_ASSIGNMENT_OPERATOR_P (t))
|
||||
dump_string (di, "multassign");
|
||||
dump_string (di, "multassign");
|
||||
else
|
||||
dump_string (di, "mult");
|
||||
dump_string (di, "mult");
|
||||
break;
|
||||
case TRUNC_DIV_EXPR:
|
||||
if (DECL_ASSIGNMENT_OPERATOR_P (t))
|
||||
dump_string (di, "divassign");
|
||||
dump_string (di, "divassign");
|
||||
else
|
||||
dump_string (di, "div");
|
||||
dump_string (di, "div");
|
||||
break;
|
||||
case TRUNC_MOD_EXPR:
|
||||
if (DECL_ASSIGNMENT_OPERATOR_P (t))
|
||||
dump_string (di, "modassign");
|
||||
dump_string (di, "modassign");
|
||||
else
|
||||
dump_string (di, "mod");
|
||||
dump_string (di, "mod");
|
||||
break;
|
||||
case BIT_AND_EXPR:
|
||||
if (DECL_ASSIGNMENT_OPERATOR_P (t))
|
||||
dump_string (di, "andassign");
|
||||
dump_string (di, "andassign");
|
||||
else
|
||||
dump_string (di, "and");
|
||||
dump_string (di, "and");
|
||||
break;
|
||||
case BIT_IOR_EXPR:
|
||||
if (DECL_ASSIGNMENT_OPERATOR_P (t))
|
||||
dump_string (di, "orassign");
|
||||
dump_string (di, "orassign");
|
||||
else
|
||||
dump_string (di, "or");
|
||||
dump_string (di, "or");
|
||||
break;
|
||||
case BIT_XOR_EXPR:
|
||||
if (DECL_ASSIGNMENT_OPERATOR_P (t))
|
||||
dump_string (di, "xorassign");
|
||||
dump_string (di, "xorassign");
|
||||
else
|
||||
dump_string (di, "xor");
|
||||
dump_string (di, "xor");
|
||||
break;
|
||||
case LSHIFT_EXPR:
|
||||
if (DECL_ASSIGNMENT_OPERATOR_P (t))
|
||||
dump_string (di, "lshiftassign");
|
||||
dump_string (di, "lshiftassign");
|
||||
else
|
||||
dump_string (di, "lshift");
|
||||
dump_string (di, "lshift");
|
||||
break;
|
||||
case RSHIFT_EXPR:
|
||||
if (DECL_ASSIGNMENT_OPERATOR_P (t))
|
||||
dump_string (di, "rshiftassign");
|
||||
dump_string (di, "rshiftassign");
|
||||
else
|
||||
dump_string (di, "rshift");
|
||||
dump_string (di, "rshift");
|
||||
break;
|
||||
case EQ_EXPR:
|
||||
dump_string (di, "eq");
|
||||
@ -196,7 +196,7 @@ dump_op (dump_info_p di, tree t)
|
||||
break;
|
||||
case NOP_EXPR:
|
||||
if (DECL_ASSIGNMENT_OPERATOR_P (t))
|
||||
dump_string (di, "assign");
|
||||
dump_string (di, "assign");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -263,7 +263,7 @@ cp_dump_tree (void* dump_info, tree t)
|
||||
|
||||
dump_child ("vfld", TYPE_VFIELD (t));
|
||||
if (CLASSTYPE_TEMPLATE_SPECIALIZATION(t))
|
||||
dump_string(di, "spec");
|
||||
dump_string(di, "spec");
|
||||
|
||||
if (!dump_flag (di, TDF_SLIM, t) && TYPE_BINFO (t))
|
||||
{
|
||||
@ -285,32 +285,32 @@ cp_dump_tree (void* dump_info, tree t)
|
||||
case FIELD_DECL:
|
||||
dump_access (di, t);
|
||||
if (DECL_MUTABLE_P (t))
|
||||
dump_string(di, "mutable");
|
||||
dump_string(di, "mutable");
|
||||
break;
|
||||
|
||||
case VAR_DECL:
|
||||
if (TREE_CODE (CP_DECL_CONTEXT (t)) == RECORD_TYPE)
|
||||
dump_access (di, t);
|
||||
dump_access (di, t);
|
||||
if (TREE_STATIC (t) && !TREE_PUBLIC (t))
|
||||
dump_string (di, "static");
|
||||
dump_string (di, "static");
|
||||
break;
|
||||
|
||||
case FUNCTION_DECL:
|
||||
if (!DECL_THUNK_P (t))
|
||||
{
|
||||
if (DECL_OVERLOADED_OPERATOR_P (t)) {
|
||||
if (DECL_OVERLOADED_OPERATOR_P (t)) {
|
||||
dump_string (di, "operator");
|
||||
dump_op (di, t);
|
||||
}
|
||||
dump_op (di, t);
|
||||
}
|
||||
if (DECL_FUNCTION_MEMBER_P (t))
|
||||
{
|
||||
dump_string (di, "member");
|
||||
dump_access (di, t);
|
||||
}
|
||||
if (DECL_PURE_VIRTUAL_P (t))
|
||||
dump_string (di, "pure");
|
||||
if (DECL_VIRTUAL_P (t))
|
||||
dump_string (di, "virtual");
|
||||
if (DECL_PURE_VIRTUAL_P (t))
|
||||
dump_string (di, "pure");
|
||||
if (DECL_VIRTUAL_P (t))
|
||||
dump_string (di, "virtual");
|
||||
if (DECL_CONSTRUCTOR_P (t))
|
||||
dump_string (di, "constructor");
|
||||
if (DECL_DESTRUCTOR_P (t))
|
||||
|
392
gcc/cp/error.c
392
gcc/cp/error.c
@ -81,7 +81,7 @@ static const char *function_category (tree);
|
||||
static void maybe_print_instantiation_context (diagnostic_context *);
|
||||
static void print_instantiation_full_context (diagnostic_context *);
|
||||
static void print_instantiation_partial_context (diagnostic_context *,
|
||||
tree, location_t);
|
||||
tree, location_t);
|
||||
static void cp_diagnostic_starter (diagnostic_context *, diagnostic_info *);
|
||||
static void cp_diagnostic_finalizer (diagnostic_context *, diagnostic_info *);
|
||||
static void cp_print_error_function (diagnostic_context *, diagnostic_info *);
|
||||
@ -114,10 +114,10 @@ dump_scope (tree scope, int flags)
|
||||
if (TREE_CODE (scope) == NAMESPACE_DECL)
|
||||
{
|
||||
if (scope != global_namespace)
|
||||
{
|
||||
dump_decl (scope, f);
|
||||
pp_cxx_colon_colon (cxx_pp);
|
||||
}
|
||||
{
|
||||
dump_decl (scope, f);
|
||||
pp_cxx_colon_colon (cxx_pp);
|
||||
}
|
||||
}
|
||||
else if (AGGREGATE_TYPE_P (scope))
|
||||
{
|
||||
@ -155,7 +155,7 @@ dump_template_argument_list (tree args, int flags)
|
||||
for (i = 0; i< n; ++i)
|
||||
{
|
||||
if (need_comma)
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
dump_template_argument (TREE_VEC_ELT (args, i), flags);
|
||||
need_comma = 1;
|
||||
}
|
||||
@ -172,15 +172,15 @@ dump_template_parameter (tree parm, int flags)
|
||||
if (TREE_CODE (p) == TYPE_DECL)
|
||||
{
|
||||
if (flags & TFF_DECL_SPECIFIERS)
|
||||
{
|
||||
pp_cxx_identifier (cxx_pp, "class");
|
||||
if (DECL_NAME (p))
|
||||
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p));
|
||||
}
|
||||
{
|
||||
pp_cxx_identifier (cxx_pp, "class");
|
||||
if (DECL_NAME (p))
|
||||
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p));
|
||||
}
|
||||
else if (DECL_NAME (p))
|
||||
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p));
|
||||
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p));
|
||||
else
|
||||
pp_cxx_canonical_template_parameter (cxx_pp, TREE_TYPE (p));
|
||||
pp_cxx_canonical_template_parameter (cxx_pp, TREE_TYPE (p));
|
||||
}
|
||||
else
|
||||
dump_decl (p, flags | TFF_DECL_SPECIFIERS);
|
||||
@ -191,9 +191,9 @@ dump_template_parameter (tree parm, int flags)
|
||||
pp_equal (cxx_pp);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
if (TREE_CODE (p) == TYPE_DECL || TREE_CODE (p) == TEMPLATE_DECL)
|
||||
dump_type (a, flags & ~TFF_CHASE_TYPEDEF);
|
||||
dump_type (a, flags & ~TFF_CHASE_TYPEDEF);
|
||||
else
|
||||
dump_expr (a, flags | TFF_EXPR_IN_PARENS);
|
||||
dump_expr (a, flags | TFF_EXPR_IN_PARENS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,9 +228,9 @@ dump_template_bindings (tree parms, tree args)
|
||||
if (need_comma)
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
dump_template_parameter (TREE_VEC_ELT (p, i), TFF_PLAIN_IDENTIFIER);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
pp_equal (cxx_pp);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
pp_equal (cxx_pp);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
if (arg)
|
||||
dump_template_argument (arg, TFF_PLAIN_IDENTIFIER);
|
||||
else
|
||||
@ -283,11 +283,11 @@ dump_type (tree t, int flags)
|
||||
|
||||
case TYPE_DECL:
|
||||
if (flags & TFF_CHASE_TYPEDEF)
|
||||
{
|
||||
dump_type (DECL_ORIGINAL_TYPE (t)
|
||||
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), flags);
|
||||
break;
|
||||
}
|
||||
{
|
||||
dump_type (DECL_ORIGINAL_TYPE (t)
|
||||
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), flags);
|
||||
break;
|
||||
}
|
||||
/* Else fall through. */
|
||||
|
||||
case TEMPLATE_DECL:
|
||||
@ -309,7 +309,7 @@ dump_type (tree t, int flags)
|
||||
if (TYPE_IDENTIFIER (t))
|
||||
pp_cxx_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
|
||||
else
|
||||
pp_cxx_canonical_template_parameter (cxx_pp, t);
|
||||
pp_cxx_canonical_template_parameter (cxx_pp, t);
|
||||
break;
|
||||
|
||||
case BOUND_TEMPLATE_TEMPLATE_PARM:
|
||||
@ -318,7 +318,7 @@ dump_type (tree t, int flags)
|
||||
pp_cxx_cv_qualifier_seq (cxx_pp, t);
|
||||
pp_cxx_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
|
||||
pp_cxx_begin_template_argument_list (cxx_pp);
|
||||
dump_template_argument_list (args, flags);
|
||||
dump_template_argument_list (args, flags);
|
||||
pp_cxx_end_template_argument_list (cxx_pp);
|
||||
}
|
||||
break;
|
||||
@ -328,8 +328,8 @@ dump_type (tree t, int flags)
|
||||
if (TYPE_IDENTIFIER (t))
|
||||
pp_cxx_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
|
||||
else
|
||||
pp_cxx_canonical_template_parameter
|
||||
(cxx_pp, TEMPLATE_TYPE_PARM_INDEX (t));
|
||||
pp_cxx_canonical_template_parameter
|
||||
(cxx_pp, TEMPLATE_TYPE_PARM_INDEX (t));
|
||||
break;
|
||||
|
||||
/* This is not always necessary for pointers and such, but doing this
|
||||
@ -436,38 +436,38 @@ dump_aggr_type (tree t, int flags)
|
||||
{
|
||||
typdef = !DECL_ARTIFICIAL (name);
|
||||
tmplate = !typdef && TREE_CODE (t) != ENUMERAL_TYPE
|
||||
&& TYPE_LANG_SPECIFIC (t) && CLASSTYPE_TEMPLATE_INFO (t)
|
||||
&& (CLASSTYPE_TEMPLATE_SPECIALIZATION (t)
|
||||
|| TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL
|
||||
|| DECL_TEMPLATE_SPECIALIZATION (CLASSTYPE_TI_TEMPLATE (t))
|
||||
|| PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)));
|
||||
&& TYPE_LANG_SPECIFIC (t) && CLASSTYPE_TEMPLATE_INFO (t)
|
||||
&& (CLASSTYPE_TEMPLATE_SPECIALIZATION (t)
|
||||
|| TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL
|
||||
|| DECL_TEMPLATE_SPECIALIZATION (CLASSTYPE_TI_TEMPLATE (t))
|
||||
|| PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)));
|
||||
dump_scope (CP_DECL_CONTEXT (name), flags | TFF_SCOPE);
|
||||
if (tmplate)
|
||||
{
|
||||
/* Because the template names are mangled, we have to locate
|
||||
the most general template, and use that name. */
|
||||
tree tpl = CLASSTYPE_TI_TEMPLATE (t);
|
||||
{
|
||||
/* Because the template names are mangled, we have to locate
|
||||
the most general template, and use that name. */
|
||||
tree tpl = CLASSTYPE_TI_TEMPLATE (t);
|
||||
|
||||
while (DECL_TEMPLATE_INFO (tpl))
|
||||
tpl = DECL_TI_TEMPLATE (tpl);
|
||||
name = tpl;
|
||||
}
|
||||
while (DECL_TEMPLATE_INFO (tpl))
|
||||
tpl = DECL_TI_TEMPLATE (tpl);
|
||||
name = tpl;
|
||||
}
|
||||
name = DECL_NAME (name);
|
||||
}
|
||||
|
||||
if (name == 0 || ANON_AGGRNAME_P (name))
|
||||
{
|
||||
if (flags & TFF_CLASS_KEY_OR_ENUM)
|
||||
pp_identifier (cxx_pp, "<anonymous>");
|
||||
pp_identifier (cxx_pp, "<anonymous>");
|
||||
else
|
||||
pp_printf (pp_base (cxx_pp), "<anonymous %s>", variety);
|
||||
pp_printf (pp_base (cxx_pp), "<anonymous %s>", variety);
|
||||
}
|
||||
else
|
||||
pp_cxx_tree_identifier (cxx_pp, name);
|
||||
if (tmplate)
|
||||
dump_template_parms (TYPE_TEMPLATE_INFO (t),
|
||||
!CLASSTYPE_USE_TEMPLATE (t),
|
||||
flags & ~TFF_TEMPLATE_HEADER);
|
||||
!CLASSTYPE_USE_TEMPLATE (t),
|
||||
flags & ~TFF_TEMPLATE_HEADER);
|
||||
}
|
||||
|
||||
/* Dump into the obstack the initial part of the output for a given type.
|
||||
@ -504,8 +504,8 @@ dump_type_prefix (tree t, int flags)
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
}
|
||||
pp_character (cxx_pp, "&*"[TREE_CODE (t) == POINTER_TYPE]);
|
||||
pp_base (cxx_pp)->padding = pp_before;
|
||||
pp_cxx_cv_qualifier_seq (cxx_pp, t);
|
||||
pp_base (cxx_pp)->padding = pp_before;
|
||||
pp_cxx_cv_qualifier_seq (cxx_pp, t);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -514,9 +514,9 @@ dump_type_prefix (tree t, int flags)
|
||||
dump_type_prefix (TREE_TYPE (t), flags);
|
||||
if (TREE_CODE (t) == OFFSET_TYPE) /* pmfs deal with this in d_t_p */
|
||||
{
|
||||
pp_maybe_space (cxx_pp);
|
||||
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
pp_maybe_space (cxx_pp);
|
||||
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
dump_type (TYPE_OFFSET_BASETYPE (t), flags);
|
||||
pp_cxx_colon_colon (cxx_pp);
|
||||
}
|
||||
@ -526,7 +526,7 @@ dump_type_prefix (tree t, int flags)
|
||||
break;
|
||||
|
||||
/* Can only be reached through function pointer -- this would not be
|
||||
correct if FUNCTION_DECLs used it. */
|
||||
correct if FUNCTION_DECLs used it. */
|
||||
case FUNCTION_TYPE:
|
||||
dump_type_prefix (TREE_TYPE (t), flags);
|
||||
pp_maybe_space (cxx_pp);
|
||||
@ -601,7 +601,7 @@ dump_type_suffix (tree t, int flags)
|
||||
case METHOD_TYPE:
|
||||
{
|
||||
tree arg;
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
arg = TYPE_ARG_TYPES (t);
|
||||
if (TREE_CODE (t) == METHOD_TYPE)
|
||||
arg = TREE_CHAIN (arg);
|
||||
@ -611,10 +611,10 @@ dump_type_suffix (tree t, int flags)
|
||||
dump_parameters (arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
|
||||
|
||||
if (TREE_CODE (t) == METHOD_TYPE)
|
||||
pp_cxx_cv_qualifier_seq
|
||||
(cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))));
|
||||
else
|
||||
pp_cxx_cv_qualifier_seq(cxx_pp, t);
|
||||
pp_cxx_cv_qualifier_seq
|
||||
(cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))));
|
||||
else
|
||||
pp_cxx_cv_qualifier_seq(cxx_pp, t);
|
||||
dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), flags);
|
||||
dump_type_suffix (TREE_TYPE (t), flags);
|
||||
break;
|
||||
@ -627,15 +627,15 @@ dump_type_suffix (tree t, int flags)
|
||||
{
|
||||
if (host_integerp (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0))
|
||||
pp_wide_integer
|
||||
(cxx_pp, tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0) + 1);
|
||||
(cxx_pp, tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0) + 1);
|
||||
else if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) == MINUS_EXPR)
|
||||
dump_expr (TREE_OPERAND (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0),
|
||||
flags & ~TFF_EXPR_IN_PARENS);
|
||||
flags & ~TFF_EXPR_IN_PARENS);
|
||||
else
|
||||
dump_expr (fold (cp_build_binary_op
|
||||
(PLUS_EXPR, TYPE_MAX_VALUE (TYPE_DOMAIN (t)),
|
||||
integer_one_node)),
|
||||
flags & ~TFF_EXPR_IN_PARENS);
|
||||
flags & ~TFF_EXPR_IN_PARENS);
|
||||
}
|
||||
pp_cxx_right_bracket (cxx_pp);
|
||||
dump_type_suffix (TREE_TYPE (t), flags);
|
||||
@ -666,7 +666,7 @@ dump_type_suffix (tree t, int flags)
|
||||
pp_unsupported_tree (cxx_pp, t);
|
||||
case ERROR_MARK:
|
||||
/* Don't mark it here, we should have already done in
|
||||
dump_type_prefix. */
|
||||
dump_type_prefix. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -730,7 +730,7 @@ dump_decl (tree t, int flags)
|
||||
pp_cxx_identifier (cxx_pp, "typedef");
|
||||
dump_simple_decl (t, DECL_ORIGINAL_TYPE (t)
|
||||
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t),
|
||||
flags);
|
||||
flags);
|
||||
break;
|
||||
|
||||
case VAR_DECL:
|
||||
@ -755,15 +755,15 @@ dump_decl (tree t, int flags)
|
||||
|
||||
case NAMESPACE_DECL:
|
||||
if (flags & TFF_DECL_SPECIFIERS)
|
||||
pp_cxx_declaration (cxx_pp, t);
|
||||
pp_cxx_declaration (cxx_pp, t);
|
||||
else
|
||||
{
|
||||
dump_scope (CP_DECL_CONTEXT (t), flags);
|
||||
if (DECL_NAME (t) == NULL_TREE)
|
||||
pp_identifier (cxx_pp, "<unnamed>");
|
||||
else
|
||||
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t));
|
||||
}
|
||||
{
|
||||
dump_scope (CP_DECL_CONTEXT (t), flags);
|
||||
if (DECL_NAME (t) == NULL_TREE)
|
||||
pp_identifier (cxx_pp, "<unnamed>");
|
||||
else
|
||||
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t));
|
||||
}
|
||||
break;
|
||||
|
||||
case SCOPE_REF:
|
||||
@ -786,7 +786,7 @@ dump_decl (tree t, int flags)
|
||||
|
||||
case BIT_NOT_EXPR:
|
||||
/* This is a pseudo destructor call which has not been folded into
|
||||
a PSEUDO_DTOR_EXPR yet. */
|
||||
a PSEUDO_DTOR_EXPR yet. */
|
||||
pp_cxx_complement (cxx_pp);
|
||||
dump_type (TREE_OPERAND (t, 0), flags);
|
||||
break;
|
||||
@ -816,12 +816,12 @@ dump_decl (tree t, int flags)
|
||||
if (DECL_CLASS_SCOPE_P (t))
|
||||
{
|
||||
dump_type (DECL_CONTEXT (t), flags);
|
||||
pp_cxx_colon_colon (cxx_pp);
|
||||
pp_cxx_colon_colon (cxx_pp);
|
||||
}
|
||||
else if (DECL_CONTEXT (t))
|
||||
{
|
||||
dump_decl (DECL_CONTEXT (t), flags);
|
||||
pp_cxx_colon_colon (cxx_pp);
|
||||
pp_cxx_colon_colon (cxx_pp);
|
||||
}
|
||||
dump_decl (DECL_NAME (t), flags);
|
||||
break;
|
||||
@ -838,7 +838,7 @@ dump_decl (tree t, int flags)
|
||||
else if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
|
||||
dump_global_iord (t);
|
||||
else
|
||||
dump_function_decl (t, flags);
|
||||
dump_function_decl (t, flags);
|
||||
break;
|
||||
|
||||
case TEMPLATE_DECL:
|
||||
@ -893,9 +893,9 @@ dump_decl (tree t, int flags)
|
||||
|
||||
case TEMPLATE_TYPE_PARM:
|
||||
if (flags & TFF_DECL_SPECIFIERS)
|
||||
pp_cxx_declaration (cxx_pp, t);
|
||||
pp_cxx_declaration (cxx_pp, t);
|
||||
else
|
||||
pp_type_id (cxx_pp, t);
|
||||
pp_type_id (cxx_pp, t);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -921,28 +921,28 @@ dump_template_decl (tree t, int flags)
|
||||
if (flags & TFF_TEMPLATE_HEADER)
|
||||
{
|
||||
for (parms = orig_parms = nreverse (orig_parms);
|
||||
parms;
|
||||
parms = TREE_CHAIN (parms))
|
||||
{
|
||||
parms;
|
||||
parms = TREE_CHAIN (parms))
|
||||
{
|
||||
tree inner_parms = INNERMOST_TEMPLATE_PARMS (parms);
|
||||
int len = TREE_VEC_LENGTH (inner_parms);
|
||||
int len = TREE_VEC_LENGTH (inner_parms);
|
||||
|
||||
pp_cxx_identifier (cxx_pp, "template");
|
||||
pp_cxx_begin_template_argument_list (cxx_pp);
|
||||
pp_cxx_identifier (cxx_pp, "template");
|
||||
pp_cxx_begin_template_argument_list (cxx_pp);
|
||||
|
||||
/* If we've shown the template prefix, we'd better show the
|
||||
parameters' and decl's type too. */
|
||||
flags |= TFF_DECL_SPECIFIERS;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (i)
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
dump_template_parameter (TREE_VEC_ELT (inner_parms, i), flags);
|
||||
}
|
||||
pp_cxx_end_template_argument_list (cxx_pp);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
}
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (i)
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
dump_template_parameter (TREE_VEC_ELT (inner_parms, i), flags);
|
||||
}
|
||||
pp_cxx_end_template_argument_list (cxx_pp);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
}
|
||||
nreverse(orig_parms);
|
||||
|
||||
if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
|
||||
@ -952,8 +952,8 @@ dump_template_decl (tree t, int flags)
|
||||
|
||||
if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
|
||||
dump_type (TREE_TYPE (t),
|
||||
((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
|
||||
| (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0)));
|
||||
((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
|
||||
| (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0)));
|
||||
else if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL)
|
||||
dump_decl (DECL_TEMPLATE_RESULT (t), flags | TFF_TEMPLATE_NAME);
|
||||
else
|
||||
@ -1026,7 +1026,7 @@ dump_function_decl (tree t, int flags)
|
||||
/* Print the return type? */
|
||||
if (show_return)
|
||||
show_return = !DECL_CONV_FN_P (t) && !DECL_CONSTRUCTOR_P (t)
|
||||
&& !DECL_DESTRUCTOR_P (t);
|
||||
&& !DECL_DESTRUCTOR_P (t);
|
||||
if (show_return)
|
||||
dump_type_prefix (TREE_TYPE (fntype), flags);
|
||||
|
||||
@ -1046,17 +1046,17 @@ dump_function_decl (tree t, int flags)
|
||||
dump_parameters (parmtypes, flags);
|
||||
|
||||
if (TREE_CODE (fntype) == METHOD_TYPE)
|
||||
{
|
||||
pp_base (cxx_pp)->padding = pp_before;
|
||||
pp_cxx_cv_qualifier_seq
|
||||
(cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))));
|
||||
}
|
||||
{
|
||||
pp_base (cxx_pp)->padding = pp_before;
|
||||
pp_cxx_cv_qualifier_seq
|
||||
(cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))));
|
||||
}
|
||||
|
||||
if (flags & TFF_EXCEPTION_SPECIFICATION)
|
||||
{
|
||||
pp_base (cxx_pp)->padding = pp_before;
|
||||
dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags);
|
||||
}
|
||||
{
|
||||
pp_base (cxx_pp)->padding = pp_before;
|
||||
dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags);
|
||||
}
|
||||
|
||||
if (show_return)
|
||||
dump_type_suffix (TREE_TYPE (fntype), flags);
|
||||
@ -1089,22 +1089,22 @@ dump_parameters (tree parmtypes, int flags)
|
||||
parmtypes = TREE_CHAIN (parmtypes))
|
||||
{
|
||||
if (!first)
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
first = 0;
|
||||
if (!parmtypes)
|
||||
{
|
||||
pp_cxx_identifier (cxx_pp, "...");
|
||||
break;
|
||||
}
|
||||
{
|
||||
pp_cxx_identifier (cxx_pp, "...");
|
||||
break;
|
||||
}
|
||||
dump_type (TREE_VALUE (parmtypes), flags);
|
||||
|
||||
if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && TREE_PURPOSE (parmtypes))
|
||||
{
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
pp_equal (cxx_pp);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
dump_expr (TREE_PURPOSE (parmtypes), flags | TFF_EXPR_IN_PARENS);
|
||||
}
|
||||
{
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
pp_equal (cxx_pp);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
dump_expr (TREE_PURPOSE (parmtypes), flags | TFF_EXPR_IN_PARENS);
|
||||
}
|
||||
}
|
||||
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
@ -1121,14 +1121,14 @@ dump_exception_spec (tree t, int flags)
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
if (TREE_VALUE (t) != NULL_TREE)
|
||||
while (1)
|
||||
{
|
||||
dump_type (TREE_VALUE (t), flags);
|
||||
t = TREE_CHAIN (t);
|
||||
if (!t)
|
||||
break;
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
dump_type (TREE_VALUE (t), flags);
|
||||
t = TREE_CHAIN (t);
|
||||
if (!t)
|
||||
break;
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
}
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
}
|
||||
}
|
||||
@ -1218,17 +1218,17 @@ dump_template_parms (tree info, int primary, int flags)
|
||||
len = TREE_VEC_LENGTH (args);
|
||||
|
||||
for (ix = 0; ix != len; ix++)
|
||||
{
|
||||
tree arg = TREE_VEC_ELT (args, ix);
|
||||
{
|
||||
tree arg = TREE_VEC_ELT (args, ix);
|
||||
|
||||
if (ix)
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
if (ix)
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
|
||||
if (!arg)
|
||||
pp_identifier (cxx_pp, "<template parameter error>");
|
||||
else
|
||||
dump_template_argument (arg, flags);
|
||||
}
|
||||
if (!arg)
|
||||
pp_identifier (cxx_pp, "<template parameter error>");
|
||||
else
|
||||
dump_template_argument (arg, flags);
|
||||
}
|
||||
}
|
||||
else if (primary)
|
||||
{
|
||||
@ -1240,14 +1240,14 @@ dump_template_parms (tree info, int primary, int flags)
|
||||
len = parms ? TREE_VEC_LENGTH (parms) : 0;
|
||||
|
||||
for (ix = 0; ix != len; ix++)
|
||||
{
|
||||
tree parm = TREE_VALUE (TREE_VEC_ELT (parms, ix));
|
||||
{
|
||||
tree parm = TREE_VALUE (TREE_VEC_ELT (parms, ix));
|
||||
|
||||
if (ix)
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
if (ix)
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
|
||||
dump_decl (parm, flags & ~TFF_DECL_SPECIFIERS);
|
||||
}
|
||||
dump_decl (parm, flags & ~TFF_DECL_SPECIFIERS);
|
||||
}
|
||||
}
|
||||
pp_cxx_end_template_argument_list (cxx_pp);
|
||||
}
|
||||
@ -1335,11 +1335,11 @@ dump_expr (tree t, int flags)
|
||||
if (TREE_HAS_CONSTRUCTOR (t))
|
||||
{
|
||||
pp_cxx_identifier (cxx_pp, "new");
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
dump_type (TREE_TYPE (TREE_TYPE (t)), flags);
|
||||
}
|
||||
else
|
||||
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
|
||||
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
|
||||
break;
|
||||
|
||||
case AGGR_INIT_EXPR:
|
||||
@ -1401,14 +1401,14 @@ dump_expr (tree t, int flags)
|
||||
tree type = TREE_OPERAND (t, 1);
|
||||
tree init = TREE_OPERAND (t, 2);
|
||||
if (NEW_EXPR_USE_GLOBAL (t))
|
||||
pp_cxx_colon_colon (cxx_pp);
|
||||
pp_cxx_colon_colon (cxx_pp);
|
||||
pp_cxx_identifier (cxx_pp, "new");
|
||||
if (TREE_OPERAND (t, 0))
|
||||
{
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
dump_expr_list (TREE_OPERAND (t, 0), flags);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
pp_cxx_whitespace (cxx_pp);
|
||||
}
|
||||
if (TREE_CODE (type) == ARRAY_REF)
|
||||
type = build_cplus_array_type
|
||||
@ -1579,11 +1579,11 @@ dump_expr (tree t, int flags)
|
||||
if (TREE_CODE (next) == FUNCTION_TYPE)
|
||||
{
|
||||
if (flags & TFF_EXPR_IN_PARENS)
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
pp_cxx_star (cxx_pp);
|
||||
dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
|
||||
if (flags & TFF_EXPR_IN_PARENS)
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
break;
|
||||
}
|
||||
/* Else fall through. */
|
||||
@ -1622,12 +1622,12 @@ dump_expr (tree t, int flags)
|
||||
if (integer_zerop (idx))
|
||||
{
|
||||
/* A NULL pointer-to-member constant. */
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
dump_type (TREE_TYPE (t), flags);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
pp_character (cxx_pp, '0');
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
pp_character (cxx_pp, '0');
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
break;
|
||||
}
|
||||
else if (host_integerp (idx, 0))
|
||||
@ -1653,7 +1653,7 @@ dump_expr (tree t, int flags)
|
||||
if (virtuals)
|
||||
{
|
||||
dump_expr (BV_FN (virtuals),
|
||||
flags | TFF_EXPR_IN_PARENS);
|
||||
flags | TFF_EXPR_IN_PARENS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1661,14 +1661,14 @@ dump_expr (tree t, int flags)
|
||||
if (TREE_TYPE (t) && !CONSTRUCTOR_ELTS (t))
|
||||
{
|
||||
dump_type (TREE_TYPE (t), 0);
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
}
|
||||
else
|
||||
{
|
||||
pp_cxx_left_brace (cxx_pp);
|
||||
pp_cxx_left_brace (cxx_pp);
|
||||
dump_expr_list (CONSTRUCTOR_ELTS (t), flags);
|
||||
pp_cxx_right_brace (cxx_pp);
|
||||
pp_cxx_right_brace (cxx_pp);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1693,14 +1693,14 @@ dump_expr (tree t, int flags)
|
||||
if (TREE_CODE (ob) == INDIRECT_REF)
|
||||
{
|
||||
dump_expr (TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS);
|
||||
pp_cxx_arrow (cxx_pp);
|
||||
pp_cxx_star (cxx_pp);
|
||||
pp_cxx_arrow (cxx_pp);
|
||||
pp_cxx_star (cxx_pp);
|
||||
}
|
||||
else
|
||||
{
|
||||
dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
|
||||
pp_cxx_dot (cxx_pp);
|
||||
pp_cxx_star (cxx_pp);
|
||||
pp_cxx_dot (cxx_pp);
|
||||
pp_cxx_star (cxx_pp);
|
||||
}
|
||||
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
|
||||
}
|
||||
@ -1728,8 +1728,8 @@ dump_expr (tree t, int flags)
|
||||
{
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
dump_type (TREE_TYPE (t), flags);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
dump_expr_list (TREE_OPERAND (t, 0), flags);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
}
|
||||
@ -1763,7 +1763,7 @@ dump_expr (tree t, int flags)
|
||||
case SIZEOF_EXPR:
|
||||
case ALIGNOF_EXPR:
|
||||
if (TREE_CODE (t) == SIZEOF_EXPR)
|
||||
pp_cxx_identifier (cxx_pp, "sizeof");
|
||||
pp_cxx_identifier (cxx_pp, "sizeof");
|
||||
else
|
||||
{
|
||||
gcc_assert (TREE_CODE (t) == ALIGNOF_EXPR);
|
||||
@ -1774,7 +1774,7 @@ dump_expr (tree t, int flags)
|
||||
if (TYPE_P (TREE_OPERAND (t, 0)))
|
||||
dump_type (TREE_OPERAND (t, 0), flags);
|
||||
else
|
||||
dump_expr (TREE_OPERAND (t, 0), flags);
|
||||
dump_expr (TREE_OPERAND (t, 0), flags);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
break;
|
||||
|
||||
@ -2111,7 +2111,7 @@ cxx_print_error_function (diagnostic_context *context, const char *file)
|
||||
|
||||
static void
|
||||
cp_diagnostic_starter (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic)
|
||||
diagnostic_info *diagnostic)
|
||||
{
|
||||
diagnostic_report_current_module (context);
|
||||
cp_print_error_function (context, diagnostic);
|
||||
@ -2121,7 +2121,7 @@ cp_diagnostic_starter (diagnostic_context *context,
|
||||
|
||||
static void
|
||||
cp_diagnostic_finalizer (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
|
||||
diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
|
||||
{
|
||||
pp_base_destroy_prefix (context->printer);
|
||||
}
|
||||
@ -2130,7 +2130,7 @@ cp_diagnostic_finalizer (diagnostic_context *context,
|
||||
a diagnostic message. Called from cp_diagnostic_starter. */
|
||||
static void
|
||||
cp_print_error_function (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic)
|
||||
diagnostic_info *diagnostic)
|
||||
{
|
||||
if (diagnostic_last_function_changed (context))
|
||||
{
|
||||
@ -2141,11 +2141,11 @@ cp_print_error_function (diagnostic_context *context,
|
||||
pp_base_set_prefix (context->printer, new_prefix);
|
||||
|
||||
if (current_function_decl == NULL)
|
||||
pp_base_string (context->printer, "At global scope:");
|
||||
pp_base_string (context->printer, "At global scope:");
|
||||
else
|
||||
pp_printf (context->printer, "In %s %qs:",
|
||||
function_category (current_function_decl),
|
||||
cxx_printable_name (current_function_decl, 2));
|
||||
pp_printf (context->printer, "In %s %qs:",
|
||||
function_category (current_function_decl),
|
||||
cxx_printable_name (current_function_decl, 2));
|
||||
pp_base_newline (context->printer);
|
||||
|
||||
diagnostic_set_last_function (context);
|
||||
@ -2161,15 +2161,15 @@ function_category (tree fn)
|
||||
if (DECL_FUNCTION_MEMBER_P (fn))
|
||||
{
|
||||
if (DECL_STATIC_FUNCTION_P (fn))
|
||||
return "static member function";
|
||||
return "static member function";
|
||||
else if (DECL_COPY_CONSTRUCTOR_P (fn))
|
||||
return "copy constructor";
|
||||
return "copy constructor";
|
||||
else if (DECL_CONSTRUCTOR_P (fn))
|
||||
return "constructor";
|
||||
return "constructor";
|
||||
else if (DECL_DESTRUCTOR_P (fn))
|
||||
return "destructor";
|
||||
return "destructor";
|
||||
else
|
||||
return "member function";
|
||||
return "member function";
|
||||
}
|
||||
else
|
||||
return "function";
|
||||
@ -2197,10 +2197,10 @@ print_instantiation_full_context (diagnostic_context *context)
|
||||
/* Avoid redundancy with the "In function" line. */;
|
||||
else
|
||||
pp_verbatim (context->printer,
|
||||
"%s: In instantiation of %qs:\n",
|
||||
"%s: In instantiation of %qs:\n",
|
||||
LOCATION_FILE (location),
|
||||
decl_as_string (TINST_DECL (p),
|
||||
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
|
||||
decl_as_string (TINST_DECL (p),
|
||||
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
|
||||
|
||||
location = TINST_LOCATION (p);
|
||||
p = TREE_CHAIN (p);
|
||||
@ -2213,7 +2213,7 @@ print_instantiation_full_context (diagnostic_context *context)
|
||||
/* Same as above but less verbose. */
|
||||
static void
|
||||
print_instantiation_partial_context (diagnostic_context *context,
|
||||
tree t, location_t loc)
|
||||
tree t, location_t loc)
|
||||
{
|
||||
expanded_location xloc;
|
||||
for (; ; t = TREE_CHAIN (t))
|
||||
@ -2222,13 +2222,13 @@ print_instantiation_partial_context (diagnostic_context *context,
|
||||
if (t == NULL_TREE)
|
||||
break;
|
||||
pp_verbatim (context->printer, "%s:%d: instantiated from %qs\n",
|
||||
xloc.file, xloc.line,
|
||||
decl_as_string (TINST_DECL (t),
|
||||
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
|
||||
xloc.file, xloc.line,
|
||||
decl_as_string (TINST_DECL (t),
|
||||
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
|
||||
loc = TINST_LOCATION (t);
|
||||
}
|
||||
pp_verbatim (context->printer, "%s:%d: instantiated from here\n",
|
||||
xloc.file, xloc.line);
|
||||
xloc.file, xloc.line);
|
||||
}
|
||||
|
||||
/* Called from cp_thing to print the template context for an error. */
|
||||
@ -2285,14 +2285,14 @@ cp_printer (pretty_printer *pp, text_info *text)
|
||||
switch (*text->format_spec)
|
||||
{
|
||||
case 'A': result = args_to_string (next_tree, verbose); break;
|
||||
case 'C': result = code_to_string (next_tcode); break;
|
||||
case 'C': result = code_to_string (next_tcode); break;
|
||||
case 'D': result = decl_to_string (next_tree, verbose); break;
|
||||
case 'E': result = expr_to_string (next_tree); break;
|
||||
case 'E': result = expr_to_string (next_tree); break;
|
||||
case 'F': result = fndecl_to_string (next_tree, verbose); break;
|
||||
case 'L': result = language_to_string (next_lang); break;
|
||||
case 'O': result = op_to_string (next_tcode); break;
|
||||
case 'P': result = parm_to_string (next_int); break;
|
||||
case 'Q': result = assop_to_string (next_tcode); break;
|
||||
case 'L': result = language_to_string (next_lang); break;
|
||||
case 'O': result = op_to_string (next_tcode); break;
|
||||
case 'P': result = parm_to_string (next_int); break;
|
||||
case 'Q': result = assop_to_string (next_tcode); break;
|
||||
case 'T': result = type_to_string (next_tree, verbose); break;
|
||||
case 'V': result = cv_to_string (next_tree, verbose); break;
|
||||
|
||||
@ -2323,14 +2323,14 @@ locate_error (const char *gmsgid, va_list ap)
|
||||
plus = 0;
|
||||
if (*f == '%')
|
||||
{
|
||||
if (*++f == 'q')
|
||||
++f; /* ignore quoting flag. */
|
||||
if (*++f == 'q')
|
||||
++f; /* ignore quoting flag. */
|
||||
|
||||
if (*f == '+')
|
||||
{
|
||||
++f;
|
||||
plus = 1;
|
||||
}
|
||||
{
|
||||
++f;
|
||||
plus = 1;
|
||||
}
|
||||
if (*f == '#')
|
||||
f++;
|
||||
|
||||
@ -2386,10 +2386,10 @@ cp_error_at (const char *gmsgid, ...)
|
||||
|
||||
va_start (ap, gmsgid);
|
||||
diagnostic_set_info (&diagnostic, gmsgid, &ap,
|
||||
input_location, DK_ERROR);
|
||||
input_location, DK_ERROR);
|
||||
cp_diagnostic_starter (global_dc, &diagnostic);
|
||||
diagnostic_set_info (&diagnostic, gmsgid, &ap,
|
||||
location_of (here), DK_ERROR);
|
||||
location_of (here), DK_ERROR);
|
||||
report_diagnostic (&diagnostic);
|
||||
va_end (ap);
|
||||
}
|
||||
@ -2407,7 +2407,7 @@ cp_warning_at (const char *gmsgid, ...)
|
||||
|
||||
va_start (ap, gmsgid);
|
||||
diagnostic_set_info (&diagnostic, gmsgid, &ap,
|
||||
location_of (here), DK_WARNING);
|
||||
location_of (here), DK_WARNING);
|
||||
report_diagnostic (&diagnostic);
|
||||
va_end (ap);
|
||||
}
|
||||
@ -2425,7 +2425,7 @@ cp_pedwarn_at (const char *gmsgid, ...)
|
||||
|
||||
va_start (ap, gmsgid);
|
||||
diagnostic_set_info (&diagnostic, gmsgid, &ap,
|
||||
location_of (here), pedantic_error_kind());
|
||||
location_of (here), pedantic_error_kind());
|
||||
report_diagnostic (&diagnostic);
|
||||
va_end (ap);
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ decl_is_java_type (tree decl, int err)
|
||||
{
|
||||
/* Can't throw a reference. */
|
||||
error ("type %qT is disallowed in Java %<throw%> or %<catch%>",
|
||||
decl);
|
||||
decl);
|
||||
}
|
||||
|
||||
if (r)
|
||||
@ -278,7 +278,7 @@ decl_is_java_type (tree decl, int err)
|
||||
{
|
||||
/* Thrown object must be a Throwable. */
|
||||
error ("type %qT is not derived from %<java::lang::Throwable%>",
|
||||
TREE_TYPE (decl));
|
||||
TREE_TYPE (decl));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -557,7 +557,7 @@ do_free_exception (tree ptr)
|
||||
|
||||
static tree
|
||||
wrap_cleanups_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
|
||||
void *data ATTRIBUTE_UNUSED)
|
||||
void *data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
tree exp = *tp;
|
||||
tree cleanup;
|
||||
@ -604,7 +604,7 @@ build_throw (tree exp)
|
||||
if (exp != NULL_TREE)
|
||||
{
|
||||
if (!is_admissible_throw_operand (exp))
|
||||
return error_mark_node;
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
if (! doing_eh (1))
|
||||
@ -710,10 +710,10 @@ build_throw (tree exp)
|
||||
BUT: Issue 475 may do away with this inconsistency by removing the
|
||||
terminate() in this situation.
|
||||
|
||||
Note that we don't check the return value from stabilize_init
|
||||
because it will only return false in cases where elided is true,
|
||||
and therefore we don't need to work around the failure to
|
||||
preevaluate. */
|
||||
Note that we don't check the return value from stabilize_init
|
||||
because it will only return false in cases where elided is true,
|
||||
and therefore we don't need to work around the failure to
|
||||
preevaluate. */
|
||||
temp_expr = NULL_TREE;
|
||||
stabilize_init (exp, &temp_expr);
|
||||
|
||||
@ -805,9 +805,9 @@ complete_ptr_ref_or_void_ptr_p (tree type, tree from)
|
||||
tree core = TREE_TYPE (type);
|
||||
|
||||
if (is_ptr && VOID_TYPE_P (core))
|
||||
/* OK */;
|
||||
/* OK */;
|
||||
else if (!complete_type_or_else (core, from))
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -822,22 +822,22 @@ is_admissible_throw_operand (tree expr)
|
||||
tree type = TREE_TYPE (expr);
|
||||
|
||||
/* 15.1/4 [...] The type of the throw-expression shall not be an
|
||||
incomplete type, or a pointer or a reference to an incomplete
|
||||
type, other than void*, const void*, volatile void*, or
|
||||
const volatile void*. Except for these restriction and the
|
||||
restrictions on type matching mentioned in 15.3, the operand
|
||||
of throw is treated exactly as a function argument in a call
|
||||
(5.2.2) or the operand of a return statement. */
|
||||
incomplete type, or a pointer or a reference to an incomplete
|
||||
type, other than void*, const void*, volatile void*, or
|
||||
const volatile void*. Except for these restriction and the
|
||||
restrictions on type matching mentioned in 15.3, the operand
|
||||
of throw is treated exactly as a function argument in a call
|
||||
(5.2.2) or the operand of a return statement. */
|
||||
if (!complete_ptr_ref_or_void_ptr_p (type, expr))
|
||||
return false;
|
||||
|
||||
/* 10.4/3 An abstract class shall not be used as a parameter type,
|
||||
as a function return type or as type of an explicit
|
||||
conversion. */
|
||||
as a function return type or as type of an explicit
|
||||
conversion. */
|
||||
else if (CLASS_TYPE_P (type) && CLASSTYPE_PURE_VIRTUALS (type))
|
||||
{
|
||||
error ("expression %qE of abstract class type %qT cannot "
|
||||
"be used in throw-expression", expr, type);
|
||||
"be used in throw-expression", expr, type);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -926,7 +926,7 @@ check_handlers_1 (tree master, tree_stmt_iterator i)
|
||||
warning (0, "%H by earlier handler for %qT",
|
||||
EXPR_LOCUS (master), type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -946,7 +946,7 @@ check_handlers (tree handlers)
|
||||
if (!tsi_end_p (i))
|
||||
while (1)
|
||||
{
|
||||
tree handler = tsi_stmt (i);
|
||||
tree handler = tsi_stmt (i);
|
||||
tsi_next (&i);
|
||||
|
||||
/* No more handlers; nothing to shadow. */
|
||||
|
@ -537,9 +537,9 @@ do_friend (tree ctype, tree declarator, tree decl,
|
||||
else
|
||||
{
|
||||
/* We can't use pushdecl, as we might be in a template
|
||||
class specialization, and pushdecl will insert an
|
||||
unqualified friend decl into the template parameter
|
||||
scope, rather than the namespace containing it. */
|
||||
class specialization, and pushdecl will insert an
|
||||
unqualified friend decl into the template parameter
|
||||
scope, rather than the namespace containing it. */
|
||||
tree ns = decl_namespace_context (decl);
|
||||
|
||||
push_nested_namespace (ns);
|
||||
@ -551,13 +551,13 @@ do_friend (tree ctype, tree declarator, tree decl,
|
||||
{
|
||||
static int explained;
|
||||
warning (0, "friend declaration %q#D declares a non-template "
|
||||
"function", decl);
|
||||
"function", decl);
|
||||
if (! explained)
|
||||
{
|
||||
warning (0, "(if this is not what you intended, make sure "
|
||||
"the function template has already been declared "
|
||||
"and add <> after the function name here) "
|
||||
"-Wno-non-template-friend disables this warning");
|
||||
"the function template has already been declared "
|
||||
"and add <> after the function name here) "
|
||||
"-Wno-non-template-friend disables this warning");
|
||||
explained = 1;
|
||||
}
|
||||
}
|
||||
|
@ -156,16 +156,16 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
|
||||
To zero-initialization storage for an object of type T means:
|
||||
|
||||
-- if T is a scalar type, the storage is set to the value of zero
|
||||
converted to T.
|
||||
converted to T.
|
||||
|
||||
-- if T is a non-union class type, the storage for each nonstatic
|
||||
data member and each base-class subobject is zero-initialized.
|
||||
data member and each base-class subobject is zero-initialized.
|
||||
|
||||
-- if T is a union type, the storage for its first data member is
|
||||
zero-initialized.
|
||||
zero-initialized.
|
||||
|
||||
-- if T is an array type, the storage for each element is
|
||||
zero-initialized.
|
||||
zero-initialized.
|
||||
|
||||
-- if T is a reference type, no initialization is performed. */
|
||||
|
||||
@ -518,7 +518,7 @@ sort_mem_initializers (tree t, tree mem_inits)
|
||||
|
||||
/* Issue a warning if the explicit initializer order does not
|
||||
match that which will actually occur.
|
||||
??? Are all these on the correct lines? */
|
||||
??? Are all these on the correct lines? */
|
||||
if (warn_reorder && !subobject_init)
|
||||
{
|
||||
if (TREE_CODE (TREE_PURPOSE (next_subobject)) == FIELD_DECL)
|
||||
@ -1004,7 +1004,7 @@ expand_member_init (tree name)
|
||||
|
||||
/* [class.base.init]
|
||||
|
||||
If a mem-initializer-id is ambiguous because it designates
|
||||
If a mem-initializer-id is ambiguous because it designates
|
||||
both a direct non-virtual base class and an inherited virtual
|
||||
base class, the mem-initializer is ill-formed. */
|
||||
if (direct_binfo && virtual_binfo)
|
||||
@ -1372,9 +1372,9 @@ build_offset_ref (tree type, tree name, bool address_p)
|
||||
{
|
||||
tree t = lookup_namespace_name (type, name);
|
||||
if (t == error_mark_node)
|
||||
return t;
|
||||
return t;
|
||||
if (TREE_CODE (orig_name) == TEMPLATE_ID_EXPR)
|
||||
/* Reconstruct the TEMPLATE_ID_EXPR. */
|
||||
/* Reconstruct the TEMPLATE_ID_EXPR. */
|
||||
t = build2 (TEMPLATE_ID_EXPR, TREE_TYPE (t),
|
||||
t, TREE_OPERAND (orig_name, 1));
|
||||
if (! type_unknown_p (t))
|
||||
@ -1462,11 +1462,11 @@ build_offset_ref (tree type, tree name, bool address_p)
|
||||
expects to encounter OVERLOADs, not raw functions. */
|
||||
t = ovl_cons (t, NULL_TREE);
|
||||
|
||||
t = build2 (TEMPLATE_ID_EXPR, TREE_TYPE (t), t,
|
||||
t = build2 (TEMPLATE_ID_EXPR, TREE_TYPE (t), t,
|
||||
TREE_OPERAND (orig_name, 1));
|
||||
t = build2 (OFFSET_REF, unknown_type_node, decl, t);
|
||||
|
||||
PTRMEM_OK_P (t) = 1;
|
||||
PTRMEM_OK_P (t) = 1;
|
||||
|
||||
return t;
|
||||
}
|
||||
@ -1588,13 +1588,13 @@ decl_constant_value (tree decl)
|
||||
if ((TREE_CODE (decl) == CONST_DECL
|
||||
|| (TREE_CODE (decl) == VAR_DECL
|
||||
/* And so are variables with a 'const' type -- unless they
|
||||
are also 'volatile'. */
|
||||
are also 'volatile'. */
|
||||
&& CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (decl))))
|
||||
&& DECL_INITIAL (decl)
|
||||
&& DECL_INITIAL (decl) != error_mark_node
|
||||
/* This is invalid if initial value is not constant. If it has
|
||||
either a function call, a memory reference, or a variable,
|
||||
then re-evaluating it could give different results. */
|
||||
either a function call, a memory reference, or a variable,
|
||||
then re-evaluating it could give different results. */
|
||||
&& TREE_CONSTANT (DECL_INITIAL (decl)))
|
||||
return DECL_INITIAL (decl);
|
||||
|
||||
@ -2446,7 +2446,7 @@ build_vec_init (tree base, tree maxindex, tree init, int from_array)
|
||||
++t1;
|
||||
}
|
||||
} catch (...) {
|
||||
... destroy elements that were constructed ...
|
||||
... destroy elements that were constructed ...
|
||||
}
|
||||
rval;
|
||||
})
|
||||
|
@ -43,7 +43,7 @@ Boston, MA 02111-1307, USA. */
|
||||
cc1plus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.ii} %{!save-temps:%g.ii}}\
|
||||
%{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\
|
||||
%(cc1_options) %2 %{+e1*}\
|
||||
-o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
|
||||
-o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
|
||||
CPLUSPLUS_CPP_SPEC, 0, 0},
|
||||
{"@c++",
|
||||
"%{E|M|MM:cc1plus -E %(cpp_options) %2 %(cpp_debug_options)}\
|
||||
|
@ -117,7 +117,7 @@ init_operators (void)
|
||||
: &operator_name_info[(int) CODE]); \
|
||||
oni->identifier = identifier; \
|
||||
oni->name = NAME; \
|
||||
oni->mangled_name = MANGLING; \
|
||||
oni->mangled_name = MANGLING; \
|
||||
oni->arity = ARITY;
|
||||
|
||||
#include "operators.def"
|
||||
@ -184,7 +184,7 @@ static const struct resword reswords[] =
|
||||
{ "_Complex", RID_COMPLEX, 0 },
|
||||
{ "__FUNCTION__", RID_FUNCTION_NAME, 0 },
|
||||
{ "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
|
||||
{ "__alignof", RID_ALIGNOF, 0 },
|
||||
{ "__alignof", RID_ALIGNOF, 0 },
|
||||
{ "__alignof__", RID_ALIGNOF, 0 },
|
||||
{ "__asm", RID_ASM, 0 },
|
||||
{ "__asm__", RID_ASM, 0 },
|
||||
@ -277,7 +277,7 @@ static const struct resword reswords[] =
|
||||
{ "virtual", RID_VIRTUAL, 0 },
|
||||
{ "void", RID_VOID, 0 },
|
||||
{ "volatile", RID_VOLATILE, 0 },
|
||||
{ "wchar_t", RID_WCHAR, 0 },
|
||||
{ "wchar_t", RID_WCHAR, 0 },
|
||||
{ "while", RID_WHILE, 0 },
|
||||
|
||||
/* The remaining keywords are specific to Objective-C++. NB:
|
||||
@ -553,7 +553,7 @@ handle_pragma_implementation (cpp_reader* dfile ATTRIBUTE_UNUSED )
|
||||
filename = ggc_strdup (TREE_STRING_POINTER (fname));
|
||||
#if 0
|
||||
/* We currently cannot give this diagnostic, as we reach this point
|
||||
only after cpplib has scanned the entire translation unit, so
|
||||
only after cpplib has scanned the entire translation unit, so
|
||||
cpp_included always returns true. A plausible fix is to compare
|
||||
the current source-location cookie with the first source-location
|
||||
cookie (if any) of the filename, but this requires completing the
|
||||
|
224
gcc/cp/mangle.c
224
gcc/cp/mangle.c
@ -39,12 +39,12 @@
|
||||
particular constructs when the appropriate decl for that construct
|
||||
is not available. These are:
|
||||
|
||||
mangle_typeinfo_for_type: typeinfo data
|
||||
mangle_typeinfo_string_for_type: typeinfo type name
|
||||
mangle_vtbl_for_type: virtual table data
|
||||
mangle_vtt_for_type: VTT data
|
||||
mangle_ctor_vtbl_for_type: `C-in-B' constructor virtual table data
|
||||
mangle_thunk: thunk function or entry
|
||||
mangle_typeinfo_for_type: typeinfo data
|
||||
mangle_typeinfo_string_for_type: typeinfo type name
|
||||
mangle_vtbl_for_type: virtual table data
|
||||
mangle_vtt_for_type: VTT data
|
||||
mangle_ctor_vtbl_for_type: `C-in-B' constructor virtual table data
|
||||
mangle_thunk: thunk function or entry
|
||||
|
||||
*/
|
||||
|
||||
@ -75,7 +75,7 @@
|
||||
fprintf (stderr, " %-24s: %-24s\n", (FN), (INPUT))
|
||||
# define MANGLE_TRACE_TREE(FN, NODE) \
|
||||
fprintf (stderr, " %-24s: %-24s (%p)\n", \
|
||||
(FN), tree_code_name[TREE_CODE (NODE)], (void *) (NODE))
|
||||
(FN), tree_code_name[TREE_CODE (NODE)], (void *) (NODE))
|
||||
#else
|
||||
# define MANGLE_TRACE(FN, INPUT)
|
||||
# define MANGLE_TRACE_TREE(FN, NODE)
|
||||
@ -234,32 +234,32 @@ static void write_java_integer_type_codes (const tree);
|
||||
|
||||
/* Append a single character to the end of the mangled
|
||||
representation. */
|
||||
#define write_char(CHAR) \
|
||||
#define write_char(CHAR) \
|
||||
obstack_1grow (mangle_obstack, (CHAR))
|
||||
|
||||
/* Append a sized buffer to the end of the mangled representation. */
|
||||
#define write_chars(CHAR, LEN) \
|
||||
#define write_chars(CHAR, LEN) \
|
||||
obstack_grow (mangle_obstack, (CHAR), (LEN))
|
||||
|
||||
/* Append a NUL-terminated string to the end of the mangled
|
||||
representation. */
|
||||
#define write_string(STRING) \
|
||||
#define write_string(STRING) \
|
||||
obstack_grow (mangle_obstack, (STRING), strlen (STRING))
|
||||
|
||||
/* Nonzero if NODE1 and NODE2 are both TREE_LIST nodes and have the
|
||||
same purpose (context, which may be a type) and value (template
|
||||
decl). See write_template_prefix for more information on what this
|
||||
is used for. */
|
||||
#define NESTED_TEMPLATE_MATCH(NODE1, NODE2) \
|
||||
(TREE_CODE (NODE1) == TREE_LIST \
|
||||
&& TREE_CODE (NODE2) == TREE_LIST \
|
||||
&& ((TYPE_P (TREE_PURPOSE (NODE1)) \
|
||||
&& same_type_p (TREE_PURPOSE (NODE1), TREE_PURPOSE (NODE2)))\
|
||||
|| TREE_PURPOSE (NODE1) == TREE_PURPOSE (NODE2)) \
|
||||
#define NESTED_TEMPLATE_MATCH(NODE1, NODE2) \
|
||||
(TREE_CODE (NODE1) == TREE_LIST \
|
||||
&& TREE_CODE (NODE2) == TREE_LIST \
|
||||
&& ((TYPE_P (TREE_PURPOSE (NODE1)) \
|
||||
&& same_type_p (TREE_PURPOSE (NODE1), TREE_PURPOSE (NODE2))) \
|
||||
|| TREE_PURPOSE (NODE1) == TREE_PURPOSE (NODE2)) \
|
||||
&& TREE_VALUE (NODE1) == TREE_VALUE (NODE2))
|
||||
|
||||
/* Write out an unsigned quantity in base 10. */
|
||||
#define write_unsigned_number(NUMBER) \
|
||||
#define write_unsigned_number(NUMBER) \
|
||||
write_number ((NUMBER), /*unsigned_p=*/1, 10)
|
||||
|
||||
/* Save the current (incomplete) mangled name and release the obstack
|
||||
@ -497,27 +497,27 @@ is_std_substitution_char (const tree node,
|
||||
First, check standard special-case substitutions.
|
||||
|
||||
<substitution> ::= St
|
||||
# ::std
|
||||
# ::std
|
||||
|
||||
::= Sa
|
||||
::= Sa
|
||||
# ::std::allocator
|
||||
|
||||
::= Sb
|
||||
# ::std::basic_string
|
||||
::= Sb
|
||||
# ::std::basic_string
|
||||
|
||||
::= Ss
|
||||
# ::std::basic_string<char,
|
||||
::= Ss
|
||||
# ::std::basic_string<char,
|
||||
::std::char_traits<char>,
|
||||
::std::allocator<char> >
|
||||
|
||||
::= Si
|
||||
# ::std::basic_istream<char, ::std::char_traits<char> >
|
||||
::= Si
|
||||
# ::std::basic_istream<char, ::std::char_traits<char> >
|
||||
|
||||
::= So
|
||||
# ::std::basic_ostream<char, ::std::char_traits<char> >
|
||||
::= So
|
||||
# ::std::basic_ostream<char, ::std::char_traits<char> >
|
||||
|
||||
::= Sd
|
||||
# ::std::basic_iostream<char, ::std::char_traits<char> >
|
||||
::= Sd
|
||||
# ::std::basic_iostream<char, ::std::char_traits<char> >
|
||||
|
||||
Then examine the stack of currently available substitution
|
||||
candidates for entities appearing earlier in the same mangling
|
||||
@ -562,8 +562,8 @@ find_substitution (tree node)
|
||||
{
|
||||
/* If this is a type (i.e. a fully-qualified template-id),
|
||||
check for
|
||||
std::basic_string <char,
|
||||
std::char_traits<char>,
|
||||
std::basic_string <char,
|
||||
std::char_traits<char>,
|
||||
std::allocator<char> > . */
|
||||
if (cp_type_quals (type) == TYPE_UNQUALIFIED
|
||||
&& CLASSTYPE_USE_TEMPLATE (type))
|
||||
@ -679,10 +679,10 @@ write_mangled_name (const tree decl, bool top_level)
|
||||
else
|
||||
{
|
||||
/* The standard notes: "The <encoding> of an extern "C"
|
||||
function is treated like global-scope data, i.e. as its
|
||||
<source-name> without a type." We cannot write
|
||||
overloaded operators that way though, because it contains
|
||||
characters invalid in assembler. */
|
||||
function is treated like global-scope data, i.e. as its
|
||||
<source-name> without a type." We cannot write
|
||||
overloaded operators that way though, because it contains
|
||||
characters invalid in assembler. */
|
||||
if (abi_version_at_least (2))
|
||||
write_string ("_Z");
|
||||
else
|
||||
@ -771,7 +771,7 @@ write_encoding (const tree decl)
|
||||
}
|
||||
|
||||
/* <name> ::= <unscoped-name>
|
||||
::= <unscoped-template-name> <template-args>
|
||||
::= <unscoped-template-name> <template-args>
|
||||
::= <nested-name>
|
||||
::= <local-name>
|
||||
|
||||
@ -823,10 +823,10 @@ write_name (tree decl, const int ignore_local_scope)
|
||||
else
|
||||
{
|
||||
/* Handle local names, unless we asked not to (that is, invoked
|
||||
under <local-name>, to handle only the part of the name under
|
||||
the local scope). */
|
||||
under <local-name>, to handle only the part of the name under
|
||||
the local scope). */
|
||||
if (!ignore_local_scope)
|
||||
{
|
||||
{
|
||||
/* Scan up the list of scope context, looking for a
|
||||
function. If we find one, this entity is in local
|
||||
function scope. local_entity tracks context one scope
|
||||
@ -861,7 +861,7 @@ write_name (tree decl, const int ignore_local_scope)
|
||||
}
|
||||
|
||||
/* <unscoped-name> ::= <unqualified-name>
|
||||
::= St <unqualified-name> # ::std:: */
|
||||
::= St <unqualified-name> # ::std:: */
|
||||
|
||||
static void
|
||||
write_unscoped_name (const tree decl)
|
||||
@ -879,7 +879,7 @@ write_unscoped_name (const tree decl)
|
||||
else
|
||||
{
|
||||
/* If not, it should be either in the global namespace, or directly
|
||||
in a local function scope. */
|
||||
in a local function scope. */
|
||||
gcc_assert (context == global_namespace
|
||||
|| context == NULL
|
||||
|| TREE_CODE (context) == FUNCTION_DECL);
|
||||
@ -889,7 +889,7 @@ write_unscoped_name (const tree decl)
|
||||
}
|
||||
|
||||
/* <unscoped-template-name> ::= <unscoped-name>
|
||||
::= <substitution> */
|
||||
::= <substitution> */
|
||||
|
||||
static void
|
||||
write_unscoped_template_name (const tree decl)
|
||||
@ -905,7 +905,7 @@ write_unscoped_template_name (const tree decl)
|
||||
/* Write the nested name, including CV-qualifiers, of DECL.
|
||||
|
||||
<nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
|
||||
::= N [<CV-qualifiers>] <template-prefix> <template-args> E
|
||||
::= N [<CV-qualifiers>] <template-prefix> <template-args> E
|
||||
|
||||
<CV-qualifiers> ::= [r] [V] [K] */
|
||||
|
||||
@ -945,8 +945,8 @@ write_nested_name (const tree decl)
|
||||
}
|
||||
|
||||
/* <prefix> ::= <prefix> <unqualified-name>
|
||||
::= <template-param>
|
||||
::= <template-prefix> <template-args>
|
||||
::= <template-param>
|
||||
::= <template-prefix> <template-args>
|
||||
::= # empty
|
||||
::= <substitution> */
|
||||
|
||||
@ -1012,8 +1012,8 @@ write_prefix (const tree node)
|
||||
}
|
||||
|
||||
/* <template-prefix> ::= <prefix> <template component>
|
||||
::= <template-param>
|
||||
::= <substitution> */
|
||||
::= <template-param>
|
||||
::= <substitution> */
|
||||
|
||||
static void
|
||||
write_template_prefix (const tree node)
|
||||
@ -1105,7 +1105,7 @@ write_unqualified_name (const tree decl)
|
||||
else if (DECL_CONV_FN_P (decl))
|
||||
{
|
||||
/* Conversion operator. Handle it right here.
|
||||
<operator> ::= cv <type> */
|
||||
<operator> ::= cv <type> */
|
||||
tree type;
|
||||
if (decl_is_template_id (decl, NULL))
|
||||
{
|
||||
@ -1296,11 +1296,11 @@ write_integer_cst (const tree cst)
|
||||
for floating point numbers. (Spaces are for readability, not
|
||||
part of the encoding.)
|
||||
|
||||
1.0f Lf 3f80 0000 E
|
||||
-1.0f Lf bf80 0000 E
|
||||
1.17549435e-38f Lf 0080 0000 E
|
||||
1.40129846e-45f Lf 0000 0001 E
|
||||
0.0f Lf 0000 0000 E"
|
||||
1.0f Lf 3f80 0000 E
|
||||
-1.0f Lf bf80 0000 E
|
||||
1.17549435e-38f Lf 0080 0000 E
|
||||
1.40129846e-45f Lf 0000 0001 E
|
||||
0.0f Lf 0000 0000 E"
|
||||
|
||||
Caller is responsible for the Lx and the E. */
|
||||
static void
|
||||
@ -1319,7 +1319,7 @@ write_real_cst (const tree value)
|
||||
TYPE_MODE (type));
|
||||
|
||||
/* The value in target_real is in the target word order,
|
||||
so we must write it out backward if that happens to be
|
||||
so we must write it out backward if that happens to be
|
||||
little-endian. write_number cannot be used, it will
|
||||
produce uppercase. */
|
||||
if (FLOAT_WORDS_BIG_ENDIAN)
|
||||
@ -1363,8 +1363,8 @@ write_identifier (const char *identifier)
|
||||
CTOR is a constructor FUNCTION_DECL.
|
||||
|
||||
<special-name> ::= C1 # complete object constructor
|
||||
::= C2 # base object constructor
|
||||
::= C3 # complete object allocating constructor
|
||||
::= C2 # base object constructor
|
||||
::= C3 # complete object allocating constructor
|
||||
|
||||
Currently, allocating constructors are never used.
|
||||
|
||||
@ -1393,8 +1393,8 @@ write_special_name_constructor (const tree ctor)
|
||||
DTOR is a destructor FUNCTION_DECL.
|
||||
|
||||
<special-name> ::= D0 # deleting (in-charge) destructor
|
||||
::= D1 # complete object (in-charge) destructor
|
||||
::= D2 # base object (not-in-charge) destructor
|
||||
::= D1 # complete object (in-charge) destructor
|
||||
::= D2 # base object (not-in-charge) destructor
|
||||
|
||||
We also need to provide mangled names for the maybe-incharge
|
||||
destructor, so we treat it here too. mangle_decl_string will
|
||||
@ -1411,9 +1411,9 @@ write_special_name_destructor (const tree dtor)
|
||||
{
|
||||
gcc_assert (DECL_COMPLETE_DESTRUCTOR_P (dtor)
|
||||
/* Even though we don't ever emit a definition of
|
||||
the old-style destructor, we still have to
|
||||
consider entities (like static variables) nested
|
||||
inside it. */
|
||||
the old-style destructor, we still have to
|
||||
consider entities (like static variables) nested
|
||||
inside it. */
|
||||
|| DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (dtor));
|
||||
write_string ("D1");
|
||||
}
|
||||
@ -1487,7 +1487,7 @@ write_discriminator (const int discriminator)
|
||||
of ENTITY.
|
||||
|
||||
<local-name> := Z <function encoding> E <entity name> [<discriminator>]
|
||||
:= Z <function encoding> E s [<discriminator>] */
|
||||
:= Z <function encoding> E s [<discriminator>] */
|
||||
|
||||
static void
|
||||
write_local_name (const tree function, const tree local_entity,
|
||||
@ -1517,18 +1517,18 @@ write_local_name (const tree function, const tree local_entity,
|
||||
/* Non-terminals <type> and <CV-qualifier>.
|
||||
|
||||
<type> ::= <builtin-type>
|
||||
::= <function-type>
|
||||
::= <class-enum-type>
|
||||
::= <array-type>
|
||||
::= <pointer-to-member-type>
|
||||
::= <template-param>
|
||||
::= <substitution>
|
||||
::= <CV-qualifier>
|
||||
::= P <type> # pointer-to
|
||||
::= R <type> # reference-to
|
||||
::= C <type> # complex pair (C 2000)
|
||||
::= G <type> # imaginary (C 2000) [not supported]
|
||||
::= U <source-name> <type> # vendor extended type qualifier
|
||||
::= <function-type>
|
||||
::= <class-enum-type>
|
||||
::= <array-type>
|
||||
::= <pointer-to-member-type>
|
||||
::= <template-param>
|
||||
::= <substitution>
|
||||
::= <CV-qualifier>
|
||||
::= P <type> # pointer-to
|
||||
::= R <type> # reference-to
|
||||
::= C <type> # complex pair (C 2000)
|
||||
::= G <type> # imaginary (C 2000) [not supported]
|
||||
::= U <source-name> <type> # vendor extended type qualifier
|
||||
|
||||
TYPE is a type node. */
|
||||
|
||||
@ -1700,26 +1700,26 @@ write_CV_qualifiers_for_type (const tree type)
|
||||
/* Non-terminal <builtin-type>.
|
||||
|
||||
<builtin-type> ::= v # void
|
||||
::= b # bool
|
||||
::= w # wchar_t
|
||||
::= c # char
|
||||
::= a # signed char
|
||||
::= h # unsigned char
|
||||
::= s # short
|
||||
::= t # unsigned short
|
||||
::= i # int
|
||||
::= j # unsigned int
|
||||
::= l # long
|
||||
::= m # unsigned long
|
||||
::= x # long long, __int64
|
||||
::= y # unsigned long long, __int64
|
||||
::= n # __int128
|
||||
::= o # unsigned __int128
|
||||
::= f # float
|
||||
::= d # double
|
||||
::= e # long double, __float80
|
||||
::= g # __float128 [not supported]
|
||||
::= u <source-name> # vendor extended type */
|
||||
::= b # bool
|
||||
::= w # wchar_t
|
||||
::= c # char
|
||||
::= a # signed char
|
||||
::= h # unsigned char
|
||||
::= s # short
|
||||
::= t # unsigned short
|
||||
::= i # int
|
||||
::= j # unsigned int
|
||||
::= l # long
|
||||
::= m # unsigned long
|
||||
::= x # long long, __int64
|
||||
::= y # unsigned long long, __int64
|
||||
::= n # __int128
|
||||
::= o # unsigned __int128
|
||||
::= f # float
|
||||
::= d # double
|
||||
::= e # long double, __float80
|
||||
::= g # __float128 [not supported]
|
||||
::= u <source-name> # vendor extended type */
|
||||
|
||||
static void
|
||||
write_builtin_type (tree type)
|
||||
@ -1843,7 +1843,7 @@ write_function_type (const tree type)
|
||||
|
||||
extern "C" typedef void function_t();
|
||||
function_t f; // f has C++ linkage, but its type is
|
||||
// `extern "C"'
|
||||
// `extern "C"'
|
||||
|
||||
typedef void function_t();
|
||||
extern "C" function_t f; // Vice versa.
|
||||
@ -1982,10 +1982,10 @@ write_template_args (tree args)
|
||||
::= <expr-primary>
|
||||
|
||||
<expr-primary> ::= <template-param>
|
||||
::= L <type> <value number> E # literal
|
||||
::= L <mangled-name> E # external name
|
||||
::= sr <type> <unqualified-name>
|
||||
::= sr <type> <unqualified-name> <template-args> */
|
||||
::= L <type> <value number> E # literal
|
||||
::= L <mangled-name> E # external name
|
||||
::= sr <type> <unqualified-name>
|
||||
::= sr <type> <unqualified-name> <template-args> */
|
||||
|
||||
static void
|
||||
write_expression (tree expr)
|
||||
@ -2135,9 +2135,9 @@ write_expression (tree expr)
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case CALL_EXPR:
|
||||
sorry ("call_expr cannot be mangled due to a defect in the C++ ABI");
|
||||
break;
|
||||
case CALL_EXPR:
|
||||
sorry ("call_expr cannot be mangled due to a defect in the C++ ABI");
|
||||
break;
|
||||
|
||||
case CAST_EXPR:
|
||||
write_type (TREE_TYPE (expr));
|
||||
@ -2242,10 +2242,10 @@ write_template_arg_literal (const tree value)
|
||||
|
||||
/* Non-terminal <template-arg>.
|
||||
|
||||
<template-arg> ::= <type> # type
|
||||
::= L <type> </value/ number> E # literal
|
||||
::= LZ <name> E # external name
|
||||
::= X <expression> E # expression */
|
||||
<template-arg> ::= <type> # type
|
||||
::= L <type> </value/ number> E # literal
|
||||
::= LZ <name> E # external name
|
||||
::= X <expression> E # expression */
|
||||
|
||||
static void
|
||||
write_template_arg (tree node)
|
||||
@ -2335,7 +2335,7 @@ write_template_template_arg (const tree decl)
|
||||
/* Non-terminal <array-type>. TYPE is an ARRAY_TYPE.
|
||||
|
||||
<array-type> ::= A [</dimension/ number>] _ </element/ type>
|
||||
::= A <expression> _ </element/ type>
|
||||
::= A <expression> _ </element/ type>
|
||||
|
||||
"Array types encode the dimension (number of elements) and the
|
||||
element type. For variable length arrays, the dimension (but not
|
||||
@ -2367,7 +2367,7 @@ write_array_type (const tree type)
|
||||
if (!abi_version_at_least (2))
|
||||
{
|
||||
/* value_dependent_expression_p presumes nothing is
|
||||
dependent when PROCESSING_TEMPLATE_DECL is zero. */
|
||||
dependent when PROCESSING_TEMPLATE_DECL is zero. */
|
||||
++processing_template_decl;
|
||||
if (!value_dependent_expression_p (max))
|
||||
G.need_abi_warning = 1;
|
||||
@ -2437,7 +2437,7 @@ write_template_param (const tree parm)
|
||||
}
|
||||
|
||||
/* <template-template-param>
|
||||
::= <template-param>
|
||||
::= <template-param>
|
||||
::= <substitution> */
|
||||
|
||||
static void
|
||||
@ -2466,7 +2466,7 @@ write_template_template_param (const tree parm)
|
||||
/* Non-terminal <substitution>.
|
||||
|
||||
<substitution> ::= S <seq-id> _
|
||||
::= S_ */
|
||||
::= S_ */
|
||||
|
||||
static void
|
||||
write_substitution (const int seq_id)
|
||||
@ -2718,8 +2718,8 @@ mangle_call_offset (const tree fixed_offset, const tree virtual_offset)
|
||||
for the this pointer, even if there is none.
|
||||
|
||||
<special-name> ::= T <call-offset> <base encoding>
|
||||
::= Tc <this_adjust call-offset> <result_adjust call-offset>
|
||||
<base encoding>
|
||||
::= Tc <this_adjust call-offset> <result_adjust call-offset>
|
||||
<base encoding>
|
||||
*/
|
||||
|
||||
tree
|
||||
|
@ -99,9 +99,9 @@ make_thunk (tree function, bool this_adjusting,
|
||||
if (this_adjusting && virtual_offset)
|
||||
virtual_offset
|
||||
= size_binop (MULT_EXPR,
|
||||
virtual_offset,
|
||||
convert (ssizetype,
|
||||
TYPE_SIZE_UNIT (vtable_entry_type)));
|
||||
virtual_offset,
|
||||
convert (ssizetype,
|
||||
TYPE_SIZE_UNIT (vtable_entry_type)));
|
||||
|
||||
d = tree_low_cst (fixed_offset, 0);
|
||||
|
||||
@ -688,14 +688,14 @@ do_build_assign_ref (tree fndecl)
|
||||
|
||||
if (CP_TYPE_CONST_P (expr_type))
|
||||
{
|
||||
error ("non-static const member %q#D, can't use default "
|
||||
"assignment operator", field);
|
||||
error ("non-static const member %q#D, can't use default "
|
||||
"assignment operator", field);
|
||||
continue;
|
||||
}
|
||||
else if (TREE_CODE (expr_type) == REFERENCE_TYPE)
|
||||
{
|
||||
error ("non-static reference member %q#D, can't use "
|
||||
"default assignment operator", field);
|
||||
"default assignment operator", field);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -818,7 +818,7 @@ synthesize_method (tree fndecl)
|
||||
|
||||
static tree
|
||||
synthesize_exception_spec (tree type, tree (*extractor) (tree, void*),
|
||||
void *client)
|
||||
void *client)
|
||||
{
|
||||
tree raises = empty_except_spec;
|
||||
tree fields = TYPE_FIELDS (type);
|
||||
@ -830,11 +830,11 @@ synthesize_exception_spec (tree type, tree (*extractor) (tree, void*),
|
||||
{
|
||||
tree fn = (*extractor) (BINFO_TYPE (base_binfo), client);
|
||||
if (fn)
|
||||
{
|
||||
tree fn_raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
|
||||
{
|
||||
tree fn_raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
|
||||
|
||||
raises = merge_exception_specifiers (raises, fn_raises);
|
||||
}
|
||||
raises = merge_exception_specifiers (raises, fn_raises);
|
||||
}
|
||||
}
|
||||
for (; fields; fields = TREE_CHAIN (fields))
|
||||
{
|
||||
@ -842,19 +842,19 @@ synthesize_exception_spec (tree type, tree (*extractor) (tree, void*),
|
||||
tree fn;
|
||||
|
||||
if (TREE_CODE (fields) != FIELD_DECL || DECL_ARTIFICIAL (fields))
|
||||
continue;
|
||||
continue;
|
||||
while (TREE_CODE (type) == ARRAY_TYPE)
|
||||
type = TREE_TYPE (type);
|
||||
type = TREE_TYPE (type);
|
||||
if (TREE_CODE (type) != RECORD_TYPE)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
fn = (*extractor) (type, client);
|
||||
if (fn)
|
||||
{
|
||||
tree fn_raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
|
||||
{
|
||||
tree fn_raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
|
||||
|
||||
raises = merge_exception_specifiers (raises, fn_raises);
|
||||
}
|
||||
raises = merge_exception_specifiers (raises, fn_raises);
|
||||
}
|
||||
}
|
||||
return raises;
|
||||
}
|
||||
@ -888,7 +888,7 @@ locate_ctor (tree type, void *client ATTRIBUTE_UNUSED)
|
||||
tree parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
|
||||
|
||||
if (sufficient_parms_p (TREE_CHAIN (parms)))
|
||||
return fn;
|
||||
return fn;
|
||||
}
|
||||
return NULL_TREE;
|
||||
}
|
||||
@ -939,24 +939,24 @@ locate_copy (tree type, void *client_)
|
||||
|
||||
parms = TREE_CHAIN (parms);
|
||||
if (!parms)
|
||||
continue;
|
||||
continue;
|
||||
src_type = non_reference (TREE_VALUE (parms));
|
||||
if (!same_type_ignoring_top_level_qualifiers_p (src_type, type))
|
||||
continue;
|
||||
continue;
|
||||
if (!sufficient_parms_p (TREE_CHAIN (parms)))
|
||||
continue;
|
||||
continue;
|
||||
quals = cp_type_quals (src_type);
|
||||
if (client->quals & ~quals)
|
||||
continue;
|
||||
continue;
|
||||
excess = quals & ~client->quals;
|
||||
if (!best || (excess_p && !excess))
|
||||
{
|
||||
best = fn;
|
||||
excess_p = excess;
|
||||
}
|
||||
{
|
||||
best = fn;
|
||||
excess_p = excess;
|
||||
}
|
||||
else
|
||||
/* Ambiguous */
|
||||
return NULL_TREE;
|
||||
/* Ambiguous */
|
||||
return NULL_TREE;
|
||||
}
|
||||
return best;
|
||||
}
|
||||
@ -1026,19 +1026,19 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p)
|
||||
data.name = NULL;
|
||||
data.quals = 0;
|
||||
if (kind == sfk_assignment_operator)
|
||||
{
|
||||
{
|
||||
return_type = build_reference_type (type);
|
||||
name = ansi_assopname (NOP_EXPR);
|
||||
data.name = name;
|
||||
}
|
||||
name = ansi_assopname (NOP_EXPR);
|
||||
data.name = name;
|
||||
}
|
||||
else
|
||||
name = constructor_name (type);
|
||||
|
||||
if (const_p)
|
||||
{
|
||||
data.quals = TYPE_QUAL_CONST;
|
||||
{
|
||||
data.quals = TYPE_QUAL_CONST;
|
||||
rhs_parm_type = build_qualified_type (type, TYPE_QUAL_CONST);
|
||||
}
|
||||
}
|
||||
else
|
||||
rhs_parm_type = type;
|
||||
rhs_parm_type = build_reference_type (rhs_parm_type);
|
||||
|
@ -46,7 +46,7 @@ static cxx_binding *binding_for_name (cxx_scope *, tree);
|
||||
static tree lookup_name_innermost_nonclass_level (tree);
|
||||
static tree push_overloaded_decl (tree, int);
|
||||
static bool lookup_using_namespace (tree, struct scope_binding *, tree,
|
||||
tree, int);
|
||||
tree, int);
|
||||
static bool qualified_lookup_using_namespace (tree, tree,
|
||||
struct scope_binding *, int);
|
||||
static tree lookup_type_current_level (tree);
|
||||
@ -145,11 +145,11 @@ binding_table_free (binding_table table)
|
||||
{
|
||||
binding_entry temp = table->chain[i];
|
||||
while (temp != NULL)
|
||||
{
|
||||
binding_entry entry = temp;
|
||||
temp = entry->chain;
|
||||
binding_entry_free (entry);
|
||||
}
|
||||
{
|
||||
binding_entry entry = temp;
|
||||
temp = entry->chain;
|
||||
binding_entry_free (entry);
|
||||
}
|
||||
table->chain[i] = NULL;
|
||||
}
|
||||
table->entry_count = 0;
|
||||
@ -183,14 +183,14 @@ binding_table_expand (binding_table table)
|
||||
{
|
||||
binding_entry entry = old_chains[i];
|
||||
for (; entry != NULL; entry = old_chains[i])
|
||||
{
|
||||
const unsigned int hash = IDENTIFIER_HASH_VALUE (entry->name);
|
||||
const size_t j = ENTRY_INDEX (hash, new_chain_count);
|
||||
{
|
||||
const unsigned int hash = IDENTIFIER_HASH_VALUE (entry->name);
|
||||
const size_t j = ENTRY_INDEX (hash, new_chain_count);
|
||||
|
||||
old_chains[i] = entry->chain;
|
||||
entry->chain = table->chain[j];
|
||||
table->chain[j] = entry;
|
||||
}
|
||||
old_chains[i] = entry->chain;
|
||||
entry->chain = table->chain[j];
|
||||
table->chain[j] = entry;
|
||||
}
|
||||
}
|
||||
table->entry_count = old_entry_count;
|
||||
}
|
||||
@ -238,7 +238,7 @@ binding_table_foreach (binding_table table, bt_foreach_proc proc, void *data)
|
||||
{
|
||||
binding_entry entry = table->chain[i];
|
||||
for (; entry != NULL; entry = entry->chain)
|
||||
proc (entry, data);
|
||||
proc (entry, data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -465,7 +465,7 @@ supplement_binding (cxx_binding *binding, tree decl)
|
||||
/* We have two typedef-names, both naming the same type to have
|
||||
the same name. In general, this is OK because of:
|
||||
|
||||
[dcl.typedef]
|
||||
[dcl.typedef]
|
||||
|
||||
In a given scope, a typedef specifier can be used to redefine
|
||||
the name of any type declared in that scope to refer to the
|
||||
@ -531,7 +531,7 @@ add_decl_to_level (tree decl, cxx_scope *b)
|
||||
else
|
||||
{
|
||||
/* We build up the list in reverse order, and reverse it later if
|
||||
necessary. */
|
||||
necessary. */
|
||||
TREE_CHAIN (decl) = b->names;
|
||||
b->names = decl;
|
||||
b->names_size++;
|
||||
@ -576,7 +576,7 @@ pushdecl (tree x)
|
||||
{
|
||||
if (current_function_decl && x != current_function_decl
|
||||
/* A local declaration for a function doesn't constitute
|
||||
nesting. */
|
||||
nesting. */
|
||||
&& TREE_CODE (x) != FUNCTION_DECL
|
||||
/* A local declaration for an `extern' variable is in the
|
||||
scope of the current namespace, not the current
|
||||
@ -690,7 +690,7 @@ pushdecl (tree x)
|
||||
{
|
||||
if (pedantic && ! DECL_IN_SYSTEM_HEADER (x))
|
||||
pedwarn ("redeclaration of %<wchar_t%> as %qT",
|
||||
TREE_TYPE (x));
|
||||
TREE_TYPE (x));
|
||||
|
||||
/* Throw away the redeclaration. */
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
|
||||
@ -766,28 +766,28 @@ pushdecl (tree x)
|
||||
{
|
||||
tree type = TREE_TYPE (x);
|
||||
if (DECL_IS_BUILTIN (x))
|
||||
{
|
||||
{
|
||||
if (TYPE_NAME (type) == 0)
|
||||
TYPE_NAME (type) = x;
|
||||
}
|
||||
else if (type != error_mark_node && TYPE_NAME (type) != x
|
||||
TYPE_NAME (type) = x;
|
||||
}
|
||||
else if (type != error_mark_node && TYPE_NAME (type) != x
|
||||
/* We don't want to copy the type when all we're
|
||||
doing is making a TYPE_DECL for the purposes of
|
||||
inlining. */
|
||||
&& (!TYPE_NAME (type)
|
||||
|| TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x)))
|
||||
{
|
||||
{
|
||||
DECL_ORIGINAL_TYPE (x) = type;
|
||||
type = build_variant_type_copy (type);
|
||||
type = build_variant_type_copy (type);
|
||||
TYPE_STUB_DECL (type) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x));
|
||||
TYPE_NAME (type) = x;
|
||||
TREE_TYPE (x) = type;
|
||||
}
|
||||
TYPE_NAME (type) = x;
|
||||
TREE_TYPE (x) = type;
|
||||
}
|
||||
|
||||
if (type != error_mark_node
|
||||
&& TYPE_NAME (type)
|
||||
&& TYPE_IDENTIFIER (type))
|
||||
set_identifier_type_value (DECL_NAME (x), x);
|
||||
set_identifier_type_value (DECL_NAME (x), x);
|
||||
}
|
||||
|
||||
/* Multiple external decls of the same identifier ought to match.
|
||||
@ -826,16 +826,16 @@ pushdecl (tree x)
|
||||
if (IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE && TREE_PUBLIC (x))
|
||||
TREE_PUBLIC (name) = 1;
|
||||
|
||||
/* Bind the name for the entity. */
|
||||
if (!(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)
|
||||
&& t != NULL_TREE)
|
||||
&& (TREE_CODE (x) == TYPE_DECL
|
||||
|| TREE_CODE (x) == VAR_DECL
|
||||
|| TREE_CODE (x) == ALIAS_DECL
|
||||
|| TREE_CODE (x) == NAMESPACE_DECL
|
||||
|| TREE_CODE (x) == CONST_DECL
|
||||
|| TREE_CODE (x) == TEMPLATE_DECL))
|
||||
SET_IDENTIFIER_NAMESPACE_VALUE (name, x);
|
||||
/* Bind the name for the entity. */
|
||||
if (!(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)
|
||||
&& t != NULL_TREE)
|
||||
&& (TREE_CODE (x) == TYPE_DECL
|
||||
|| TREE_CODE (x) == VAR_DECL
|
||||
|| TREE_CODE (x) == ALIAS_DECL
|
||||
|| TREE_CODE (x) == NAMESPACE_DECL
|
||||
|| TREE_CODE (x) == CONST_DECL
|
||||
|| TREE_CODE (x) == TEMPLATE_DECL))
|
||||
SET_IDENTIFIER_NAMESPACE_VALUE (name, x);
|
||||
|
||||
/* If new decl is `static' and an `extern' was seen previously,
|
||||
warn about it. */
|
||||
@ -1115,7 +1115,7 @@ check_for_out_of_scope_variable (tree decl)
|
||||
error ("name lookup of %qD changed for new ISO %<for%> scoping",
|
||||
DECL_NAME (decl));
|
||||
cp_error_at (" cannot use obsolete binding at %qD because "
|
||||
"it has a destructor", decl);
|
||||
"it has a destructor", decl);
|
||||
return error_mark_node;
|
||||
}
|
||||
else
|
||||
@ -1176,7 +1176,7 @@ cxx_scope_debug (cxx_scope *scope, int line, const char *action)
|
||||
const char *desc = cxx_scope_descriptor (scope);
|
||||
if (scope->this_entity)
|
||||
verbatim ("%s %s(%E) %p %d\n", action, desc,
|
||||
scope->this_entity, (void *) scope, line);
|
||||
scope->this_entity, (void *) scope, line);
|
||||
else
|
||||
verbatim ("%s %s %p %d\n", action, desc, (void *) scope, line);
|
||||
}
|
||||
@ -1302,10 +1302,10 @@ leave_scope (void)
|
||||
indent (--binding_depth);
|
||||
cxx_scope_debug (scope, input_line, "leave");
|
||||
if (is_class_level != (scope == class_binding_level))
|
||||
{
|
||||
indent (binding_depth);
|
||||
verbatim ("XXX is_class_level != (current_scope == class_scope)\n");
|
||||
}
|
||||
{
|
||||
indent (binding_depth);
|
||||
verbatim ("XXX is_class_level != (current_scope == class_scope)\n");
|
||||
}
|
||||
is_class_level = 0;
|
||||
}
|
||||
|
||||
@ -1432,7 +1432,7 @@ kept_level_p (void)
|
||||
{
|
||||
return (current_binding_level->blocks != NULL_TREE
|
||||
|| current_binding_level->keep
|
||||
|| current_binding_level->kind == sk_cleanup
|
||||
|| current_binding_level->kind == sk_cleanup
|
||||
|| current_binding_level->names != NULL_TREE);
|
||||
}
|
||||
|
||||
@ -1517,7 +1517,7 @@ print_binding_level (struct cp_binding_level* lvl)
|
||||
break;
|
||||
}
|
||||
if (i)
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
if (VEC_length (cp_class_binding, lvl->class_shadowed))
|
||||
{
|
||||
@ -1534,9 +1534,9 @@ print_binding_level (struct cp_binding_level* lvl)
|
||||
{
|
||||
fprintf (stderr, " type-shadowed:");
|
||||
for (t = lvl->type_shadowed; t; t = TREE_CHAIN (t))
|
||||
{
|
||||
{
|
||||
fprintf (stderr, " %s ", IDENTIFIER_POINTER (TREE_PURPOSE (t)));
|
||||
}
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
}
|
||||
@ -1560,7 +1560,7 @@ print_binding_stack (void)
|
||||
"\nclass_binding_level=" HOST_PTR_PRINTF
|
||||
"\nNAMESPACE_LEVEL (global_namespace)=" HOST_PTR_PRINTF "\n",
|
||||
(void *) current_binding_level, (void *) class_binding_level,
|
||||
(void *) NAMESPACE_LEVEL (global_namespace));
|
||||
(void *) NAMESPACE_LEVEL (global_namespace));
|
||||
if (class_binding_level)
|
||||
{
|
||||
for (b = class_binding_level; b; b = b->level_chain)
|
||||
@ -1737,7 +1737,7 @@ cxx_scope_find_binding_for_name (cxx_scope *scope, tree name)
|
||||
{
|
||||
/* Fold-in case where NAME is used only once. */
|
||||
if (scope == b->scope && b->previous == NULL)
|
||||
return b;
|
||||
return b;
|
||||
return find_binding (scope, b);
|
||||
}
|
||||
return NULL;
|
||||
@ -1782,7 +1782,7 @@ push_using_decl (tree scope, tree name)
|
||||
break;
|
||||
if (decl)
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
|
||||
namespace_bindings_p () ? decl : NULL_TREE);
|
||||
namespace_bindings_p () ? decl : NULL_TREE);
|
||||
decl = build_lang_decl (USING_DECL, name, NULL_TREE);
|
||||
USING_DECL_SCOPE (decl) = scope;
|
||||
TREE_CHAIN (decl) = current_binding_level->usings;
|
||||
@ -1830,9 +1830,9 @@ pushdecl_with_scope (tree x, cxx_scope *level)
|
||||
|
||||
FLAGS is a bitwise-or of the following values:
|
||||
PUSH_LOCAL: Bind DECL in the current scope, rather than at
|
||||
namespace scope.
|
||||
namespace scope.
|
||||
PUSH_USING: DECL is being pushed as the result of a using
|
||||
declaration.
|
||||
declaration.
|
||||
|
||||
The value returned may be a previous declaration if we guessed wrong
|
||||
about what language DECL should belong to (C or C++). Otherwise,
|
||||
@ -1864,8 +1864,8 @@ push_overloaded_decl (tree decl, int flags)
|
||||
old = NULL_TREE;
|
||||
}
|
||||
else if (is_overloaded_fn (old))
|
||||
{
|
||||
tree tmp;
|
||||
{
|
||||
tree tmp;
|
||||
|
||||
for (tmp = old; tmp; tmp = OVL_NEXT (tmp))
|
||||
{
|
||||
@ -1877,7 +1877,7 @@ push_overloaded_decl (tree decl, int flags)
|
||||
TYPE_ARG_TYPES (TREE_TYPE (decl)))
|
||||
&& ! decls_match (fn, decl))
|
||||
error ("%q#D conflicts with previous using declaration %q#D",
|
||||
decl, fn);
|
||||
decl, fn);
|
||||
|
||||
if (duplicate_decls (decl, fn) == fn)
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, fn);
|
||||
@ -1985,7 +1985,7 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name)
|
||||
/* 7.3.3/5
|
||||
A using-declaration shall not name a template-id. */
|
||||
error ("a using-declaration cannot specify a template-id. "
|
||||
"Try %<using %D%>", name);
|
||||
"Try %<using %D%>", name);
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
@ -2016,7 +2016,7 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name)
|
||||
|
||||
static void
|
||||
do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype,
|
||||
tree *newval, tree *newtype)
|
||||
tree *newval, tree *newtype)
|
||||
{
|
||||
struct scope_binding decls = EMPTY_SCOPE_BINDING;
|
||||
|
||||
@ -2066,23 +2066,23 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype,
|
||||
{
|
||||
tree old_fn = OVL_CURRENT (tmp1);
|
||||
|
||||
if (new_fn == old_fn)
|
||||
/* The function already exists in the current namespace. */
|
||||
break;
|
||||
if (new_fn == old_fn)
|
||||
/* The function already exists in the current namespace. */
|
||||
break;
|
||||
else if (OVL_USED (tmp1))
|
||||
continue; /* this is a using decl */
|
||||
continue; /* this is a using decl */
|
||||
else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)),
|
||||
TYPE_ARG_TYPES (TREE_TYPE (old_fn))))
|
||||
TYPE_ARG_TYPES (TREE_TYPE (old_fn))))
|
||||
{
|
||||
gcc_assert (!DECL_ANTICIPATED (old_fn));
|
||||
|
||||
/* There was already a non-using declaration in
|
||||
/* There was already a non-using declaration in
|
||||
this scope with the same parameter types. If both
|
||||
are the same extern "C" functions, that's ok. */
|
||||
if (decls_match (new_fn, old_fn))
|
||||
are the same extern "C" functions, that's ok. */
|
||||
if (decls_match (new_fn, old_fn))
|
||||
break;
|
||||
else
|
||||
{
|
||||
{
|
||||
error ("%qD is already declared in this scope", name);
|
||||
break;
|
||||
}
|
||||
@ -2124,7 +2124,7 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype,
|
||||
if (oldtype && *newtype && !same_type_p (oldtype, *newtype))
|
||||
{
|
||||
error ("using declaration %qD introduced ambiguous type %qT",
|
||||
name, oldtype);
|
||||
name, oldtype);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2629,9 +2629,9 @@ push_class_level_binding (tree name, tree x)
|
||||
if (INHERITED_VALUE_BINDING_P (binding))
|
||||
{
|
||||
/* If the old binding was from a base class, and was for a
|
||||
tag name, slide it over to make room for the new binding.
|
||||
The old binding is still visible if explicitly qualified
|
||||
with a class-key. */
|
||||
tag name, slide it over to make room for the new binding.
|
||||
The old binding is still visible if explicitly qualified
|
||||
with a class-key. */
|
||||
if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval)
|
||||
&& !(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)))
|
||||
{
|
||||
@ -2818,7 +2818,7 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
|
||||
/* It is ok for friends to be qualified in parallel space. */
|
||||
if (!friendp && !is_ancestor (current_namespace, scope))
|
||||
error ("declaration of %qD not in a namespace surrounding %qD",
|
||||
decl, scope);
|
||||
decl, scope);
|
||||
DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
|
||||
|
||||
/* Writing "int N::i" to declare a variable within "N" is invalid. */
|
||||
@ -2904,14 +2904,14 @@ push_namespace (tree name)
|
||||
if (anon)
|
||||
{
|
||||
/* The name of anonymous namespace is unique for the translation
|
||||
unit. */
|
||||
unit. */
|
||||
if (!anonymous_namespace_name)
|
||||
anonymous_namespace_name = get_file_function_name ('N');
|
||||
anonymous_namespace_name = get_file_function_name ('N');
|
||||
name = anonymous_namespace_name;
|
||||
d = IDENTIFIER_NAMESPACE_VALUE (name);
|
||||
if (d)
|
||||
/* Reopening anonymous namespace. */
|
||||
need_new = 0;
|
||||
/* Reopening anonymous namespace. */
|
||||
need_new = 0;
|
||||
implicit_use = 1;
|
||||
}
|
||||
else
|
||||
@ -2919,15 +2919,15 @@ push_namespace (tree name)
|
||||
/* Check whether this is an extended namespace definition. */
|
||||
d = IDENTIFIER_NAMESPACE_VALUE (name);
|
||||
if (d != NULL_TREE && TREE_CODE (d) == NAMESPACE_DECL)
|
||||
{
|
||||
need_new = 0;
|
||||
if (DECL_NAMESPACE_ALIAS (d))
|
||||
{
|
||||
error ("namespace alias %qD not allowed here, assuming %qD",
|
||||
d, DECL_NAMESPACE_ALIAS (d));
|
||||
d = DECL_NAMESPACE_ALIAS (d);
|
||||
}
|
||||
}
|
||||
{
|
||||
need_new = 0;
|
||||
if (DECL_NAMESPACE_ALIAS (d))
|
||||
{
|
||||
error ("namespace alias %qD not allowed here, assuming %qD",
|
||||
d, DECL_NAMESPACE_ALIAS (d));
|
||||
d = DECL_NAMESPACE_ALIAS (d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (need_new)
|
||||
@ -3006,7 +3006,7 @@ push_decl_namespace (tree decl)
|
||||
if (TREE_CODE (decl) != NAMESPACE_DECL)
|
||||
decl = decl_namespace_context (decl);
|
||||
decl_namespace_list = tree_cons (ORIGINAL_NAMESPACE (decl),
|
||||
NULL_TREE, decl_namespace_list);
|
||||
NULL_TREE, decl_namespace_list);
|
||||
}
|
||||
|
||||
/* [namespace.memdef]/2 */
|
||||
@ -3027,7 +3027,7 @@ namespace_ancestor (tree ns1, tree ns2)
|
||||
if (is_ancestor (ns1, ns2))
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ns1);
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
|
||||
namespace_ancestor (CP_DECL_CONTEXT (ns1), ns2));
|
||||
namespace_ancestor (CP_DECL_CONTEXT (ns1), ns2));
|
||||
}
|
||||
|
||||
/* Process a namespace-alias declaration. */
|
||||
@ -3075,28 +3075,28 @@ pushdecl_namespace_level (tree x)
|
||||
tree newval;
|
||||
tree *ptr = (tree *)0;
|
||||
for (; !global_scope_p (b); b = b->level_chain)
|
||||
{
|
||||
tree shadowed = b->type_shadowed;
|
||||
for (; shadowed; shadowed = TREE_CHAIN (shadowed))
|
||||
if (TREE_PURPOSE (shadowed) == name)
|
||||
{
|
||||
{
|
||||
tree shadowed = b->type_shadowed;
|
||||
for (; shadowed; shadowed = TREE_CHAIN (shadowed))
|
||||
if (TREE_PURPOSE (shadowed) == name)
|
||||
{
|
||||
ptr = &TREE_VALUE (shadowed);
|
||||
/* Can't break out of the loop here because sometimes
|
||||
a binding level will have duplicate bindings for
|
||||
PT names. It's gross, but I haven't time to fix it. */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newval = TREE_TYPE (t);
|
||||
if (ptr == (tree *)0)
|
||||
{
|
||||
/* @@ This shouldn't be needed. My test case "zstring.cc" trips
|
||||
up here if this is changed to an assertion. --KR */
|
||||
{
|
||||
/* @@ This shouldn't be needed. My test case "zstring.cc" trips
|
||||
up here if this is changed to an assertion. --KR */
|
||||
SET_IDENTIFIER_TYPE_VALUE (name, t);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
*ptr = newval;
|
||||
}
|
||||
}
|
||||
}
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
|
||||
}
|
||||
@ -3344,29 +3344,29 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new,
|
||||
switch (TREE_CODE (val))
|
||||
{
|
||||
case TEMPLATE_DECL:
|
||||
/* If we expect types or namespaces, and not templates,
|
||||
or this is not a template class. */
|
||||
if ((LOOKUP_QUALIFIERS_ONLY (flags)
|
||||
/* If we expect types or namespaces, and not templates,
|
||||
or this is not a template class. */
|
||||
if ((LOOKUP_QUALIFIERS_ONLY (flags)
|
||||
&& !DECL_CLASS_TEMPLATE_P (val))
|
||||
|| hidden_name_p (val))
|
||||
val = NULL_TREE;
|
||||
break;
|
||||
val = NULL_TREE;
|
||||
break;
|
||||
case TYPE_DECL:
|
||||
if (LOOKUP_NAMESPACES_ONLY (flags) || hidden_name_p (val))
|
||||
val = NULL_TREE;
|
||||
break;
|
||||
if (LOOKUP_NAMESPACES_ONLY (flags) || hidden_name_p (val))
|
||||
val = NULL_TREE;
|
||||
break;
|
||||
case NAMESPACE_DECL:
|
||||
if (LOOKUP_TYPES_ONLY (flags))
|
||||
val = NULL_TREE;
|
||||
break;
|
||||
if (LOOKUP_TYPES_ONLY (flags))
|
||||
val = NULL_TREE;
|
||||
break;
|
||||
case FUNCTION_DECL:
|
||||
/* Ignore built-in functions that are still anticipated. */
|
||||
if (LOOKUP_QUALIFIERS_ONLY (flags) || hidden_name_p (val))
|
||||
val = NULL_TREE;
|
||||
break;
|
||||
/* Ignore built-in functions that are still anticipated. */
|
||||
if (LOOKUP_QUALIFIERS_ONLY (flags) || hidden_name_p (val))
|
||||
val = NULL_TREE;
|
||||
break;
|
||||
default:
|
||||
if (LOOKUP_QUALIFIERS_ONLY (flags))
|
||||
val = NULL_TREE;
|
||||
if (LOOKUP_QUALIFIERS_ONLY (flags))
|
||||
val = NULL_TREE;
|
||||
}
|
||||
|
||||
if (!old->value)
|
||||
@ -3374,12 +3374,12 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new,
|
||||
else if (val && val != old->value)
|
||||
{
|
||||
if (is_overloaded_fn (old->value) && is_overloaded_fn (val))
|
||||
old->value = merge_functions (old->value, val);
|
||||
old->value = merge_functions (old->value, val);
|
||||
else
|
||||
{
|
||||
/* Some declarations are functions, some are not. */
|
||||
if (flags & LOOKUP_COMPLAIN)
|
||||
{
|
||||
if (flags & LOOKUP_COMPLAIN)
|
||||
{
|
||||
/* If we've already given this error for this lookup,
|
||||
old->value is error_mark_node, so let's not
|
||||
repeat ourselves. */
|
||||
@ -3388,8 +3388,8 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new,
|
||||
error ("use of %qD is ambiguous", name);
|
||||
cp_error_at (" first declared as %q#D here", old->value);
|
||||
}
|
||||
cp_error_at (" also declared as %q#D here", val);
|
||||
}
|
||||
cp_error_at (" also declared as %q#D here", val);
|
||||
}
|
||||
old->value = error_mark_node;
|
||||
}
|
||||
}
|
||||
@ -3402,11 +3402,11 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new,
|
||||
else if (type && old->type != type)
|
||||
{
|
||||
if (flags & LOOKUP_COMPLAIN)
|
||||
{
|
||||
error ("%qD denotes an ambiguous type",name);
|
||||
error ("%J first type here", TYPE_MAIN_DECL (old->type));
|
||||
error ("%J other type here", TYPE_MAIN_DECL (type));
|
||||
}
|
||||
{
|
||||
error ("%qD denotes an ambiguous type",name);
|
||||
error ("%J first type here", TYPE_MAIN_DECL (old->type));
|
||||
error ("%J other type here", TYPE_MAIN_DECL (type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3516,7 +3516,7 @@ lookup_namespace_name (tree namespace, tree name)
|
||||
/*in_decl=*/NULL_TREE,
|
||||
/*context=*/NULL_TREE,
|
||||
/*entering_scope=*/0,
|
||||
tf_error | tf_warning);
|
||||
tf_error | tf_warning);
|
||||
else if (DECL_FUNCTION_TEMPLATE_P (val)
|
||||
|| TREE_CODE (val) == OVERLOAD)
|
||||
val = lookup_template_function (val,
|
||||
@ -3535,7 +3535,7 @@ lookup_namespace_name (tree namespace, tree name)
|
||||
/* Ignore built-in functions and friends that haven't been declared
|
||||
yet. */
|
||||
if (!val || !hidden_name_p (val))
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
|
||||
}
|
||||
|
||||
error ("%qD undeclared in namespace %qD", name, namespace);
|
||||
@ -3555,7 +3555,7 @@ select_decl (const struct scope_binding *binding, int flags)
|
||||
{
|
||||
/* We are not interested in types. */
|
||||
if (val && TREE_CODE (val) == NAMESPACE_DECL)
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
|
||||
}
|
||||
|
||||
@ -3589,7 +3589,7 @@ unqualified_namespace_lookup (tree name, int flags)
|
||||
for (; !val; scope = CP_DECL_CONTEXT (scope))
|
||||
{
|
||||
cxx_binding *b =
|
||||
cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);
|
||||
cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);
|
||||
|
||||
if (b)
|
||||
{
|
||||
@ -3606,7 +3606,7 @@ unqualified_namespace_lookup (tree name, int flags)
|
||||
level->kind != sk_namespace;
|
||||
level = level->level_chain)
|
||||
if (!lookup_using_namespace (name, &binding, level->using_directives,
|
||||
scope, flags))
|
||||
scope, flags))
|
||||
/* Give up because of error. */
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
|
||||
|
||||
@ -3616,7 +3616,7 @@ unqualified_namespace_lookup (tree name, int flags)
|
||||
while (1)
|
||||
{
|
||||
if (!lookup_using_namespace (name, &binding,
|
||||
DECL_NAMESPACE_USING (siter),
|
||||
DECL_NAMESPACE_USING (siter),
|
||||
scope, flags))
|
||||
/* Give up because of error. */
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
|
||||
@ -3684,12 +3684,12 @@ lookup_using_namespace (tree name, struct scope_binding *val,
|
||||
for (iter = usings; iter; iter = TREE_CHAIN (iter))
|
||||
if (TREE_VALUE (iter) == scope)
|
||||
{
|
||||
tree used = ORIGINAL_NAMESPACE (TREE_PURPOSE (iter));
|
||||
cxx_binding *val1 =
|
||||
cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (used), name);
|
||||
/* Resolve ambiguities. */
|
||||
if (val1)
|
||||
ambiguous_decl (name, val, val1, flags);
|
||||
tree used = ORIGINAL_NAMESPACE (TREE_PURPOSE (iter));
|
||||
cxx_binding *val1 =
|
||||
cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (used), name);
|
||||
/* Resolve ambiguities. */
|
||||
if (val1)
|
||||
ambiguous_decl (name, val, val1, flags);
|
||||
}
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val->value != error_mark_node);
|
||||
}
|
||||
@ -3718,7 +3718,7 @@ qualified_lookup_using_namespace (tree name, tree scope,
|
||||
cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);
|
||||
seen = tree_cons (scope, NULL_TREE, seen);
|
||||
if (binding)
|
||||
ambiguous_decl (name, result, binding, flags);
|
||||
ambiguous_decl (name, result, binding, flags);
|
||||
|
||||
/* Consider strong using directives always, and non-strong ones
|
||||
if we haven't found a binding yet. ??? Shouldn't we consider
|
||||
@ -4107,7 +4107,7 @@ lookup_type_current_level (tree name)
|
||||
{
|
||||
if (purpose_member (name, b->type_shadowed))
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
|
||||
REAL_IDENTIFIER_TYPE_VALUE (name));
|
||||
REAL_IDENTIFIER_TYPE_VALUE (name));
|
||||
if (b->kind == sk_cleanup)
|
||||
b = b->level_chain;
|
||||
else
|
||||
@ -4258,10 +4258,10 @@ arg_assoc_template_arg (struct arg_lookup *k, tree arg)
|
||||
|
||||
/* It's not a member template. */
|
||||
if (TREE_CODE (ctx) == NAMESPACE_DECL)
|
||||
return arg_assoc_namespace (k, ctx);
|
||||
return arg_assoc_namespace (k, ctx);
|
||||
/* Otherwise, it must be member template. */
|
||||
else
|
||||
return arg_assoc_class (k, ctx);
|
||||
return arg_assoc_class (k, ctx);
|
||||
}
|
||||
/* It's not a template template argument, but it is a type template
|
||||
argument. */
|
||||
@ -4333,7 +4333,7 @@ arg_assoc_class (struct arg_lookup *k, tree type)
|
||||
{
|
||||
list = INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (type));
|
||||
for (i = 0; i < TREE_VEC_LENGTH (list); ++i)
|
||||
arg_assoc_template_arg (k, TREE_VEC_ELT (list, i));
|
||||
arg_assoc_template_arg (k, TREE_VEC_ELT (list, i));
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -4454,7 +4454,7 @@ arg_assoc (struct arg_lookup *k, tree n)
|
||||
int ix;
|
||||
|
||||
if (TREE_CODE (template) == COMPONENT_REF)
|
||||
template = TREE_OPERAND (template, 1);
|
||||
template = TREE_OPERAND (template, 1);
|
||||
|
||||
/* First, the template. There may actually be more than one if
|
||||
this is an overloaded function template. But, in that case,
|
||||
@ -4566,7 +4566,7 @@ push_using_directive (tree used)
|
||||
|
||||
static tree
|
||||
maybe_process_template_type_declaration (tree type, int is_friend,
|
||||
cxx_scope *b)
|
||||
cxx_scope *b)
|
||||
{
|
||||
tree decl = TYPE_NAME (type);
|
||||
|
||||
@ -4574,7 +4574,7 @@ maybe_process_template_type_declaration (tree type, int is_friend,
|
||||
/* You can't declare a new template type in a template parameter
|
||||
list. But, you can declare a non-template type:
|
||||
|
||||
template <class A*> struct S;
|
||||
template <class A*> struct S;
|
||||
|
||||
is a forward-declaration of `A'. */
|
||||
;
|
||||
@ -4665,8 +4665,8 @@ pushtag (tree name, tree type, tag_scope scope)
|
||||
{
|
||||
/* Do C++ gratuitous typedefing. */
|
||||
if (IDENTIFIER_TYPE_VALUE (name) != type)
|
||||
{
|
||||
tree d = NULL_TREE;
|
||||
{
|
||||
tree d = NULL_TREE;
|
||||
int in_class = 0;
|
||||
tree context = TYPE_CONTEXT (type);
|
||||
|
||||
@ -4744,7 +4744,7 @@ pushtag (tree name, tree type, tag_scope scope)
|
||||
if (TYPE_CONTEXT (type)
|
||||
&& TREE_CODE (TYPE_CONTEXT (type)) == FUNCTION_DECL)
|
||||
VEC_safe_push (tree, gc, local_classes, type);
|
||||
}
|
||||
}
|
||||
if (b->kind == sk_class
|
||||
&& !COMPLETE_TYPE_P (current_class_type))
|
||||
{
|
||||
|
@ -40,11 +40,11 @@ struct binding_entry_s GTY(())
|
||||
};
|
||||
|
||||
/* These macros indicate the initial chains count for binding_table. */
|
||||
#define SCOPE_DEFAULT_HT_SIZE (1 << 3)
|
||||
#define CLASS_SCOPE_HT_SIZE (1 << 3)
|
||||
#define NAMESPACE_ORDINARY_HT_SIZE (1 << 5)
|
||||
#define NAMESPACE_STD_HT_SIZE (1 << 8)
|
||||
#define GLOBAL_SCOPE_HT_SIZE (1 << 8)
|
||||
#define SCOPE_DEFAULT_HT_SIZE (1 << 3)
|
||||
#define CLASS_SCOPE_HT_SIZE (1 << 3)
|
||||
#define NAMESPACE_ORDINARY_HT_SIZE (1 << 5)
|
||||
#define NAMESPACE_STD_HT_SIZE (1 << 8)
|
||||
#define GLOBAL_SCOPE_HT_SIZE (1 << 8)
|
||||
|
||||
extern void binding_table_foreach (binding_table, bt_foreach_proc, void *);
|
||||
extern binding_entry binding_table_find (binding_table, tree);
|
||||
@ -105,16 +105,16 @@ typedef enum scope_kind {
|
||||
is initialized by using "memset" to set the
|
||||
contents to zero, and the default scope kind
|
||||
is "sk_block". */
|
||||
sk_cleanup, /* A scope for (pseudo-)scope for cleanup. It is
|
||||
peusdo in that it is transparent to name lookup
|
||||
activities. */
|
||||
sk_cleanup, /* A scope for (pseudo-)scope for cleanup. It is
|
||||
peusdo in that it is transparent to name lookup
|
||||
activities. */
|
||||
sk_try, /* A try-block. */
|
||||
sk_catch, /* A catch-block. */
|
||||
sk_for, /* The scope of the variable declared in a
|
||||
sk_catch, /* A catch-block. */
|
||||
sk_for, /* The scope of the variable declared in a
|
||||
for-init-statement. */
|
||||
sk_function_parms, /* The scope containing function parameters. */
|
||||
sk_class, /* The scope containing the members of a class. */
|
||||
sk_namespace, /* The scope containing the members of a
|
||||
sk_class, /* The scope containing the members of a class. */
|
||||
sk_namespace, /* The scope containing the members of a
|
||||
namespace, including the global scope. */
|
||||
sk_template_parms, /* A scope for template parameters. */
|
||||
sk_template_spec /* Like sk_template_parms, but for an explicit
|
||||
|
316
gcc/cp/parser.c
316
gcc/cp/parser.c
@ -379,7 +379,7 @@ cp_lexer_saving_tokens (const cp_lexer* lexer)
|
||||
|
||||
static void
|
||||
cp_lexer_get_preprocessor_token (cp_lexer *lexer ATTRIBUTE_UNUSED ,
|
||||
cp_token *token)
|
||||
cp_token *token)
|
||||
{
|
||||
static int is_extern_c = 0;
|
||||
|
||||
@ -904,7 +904,7 @@ cp_declarator *
|
||||
make_call_declarator (cp_declarator *target,
|
||||
cp_parameter_declarator *parms,
|
||||
cp_cv_quals cv_qualifiers,
|
||||
tree exception_specification)
|
||||
tree exception_specification)
|
||||
{
|
||||
cp_declarator *declarator;
|
||||
|
||||
@ -2082,7 +2082,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
|
||||
&& DECL_NAME (field) == id)
|
||||
{
|
||||
inform ("(perhaps %<typename %T::%E%> was intended)",
|
||||
BINFO_TYPE (b), id);
|
||||
BINFO_TYPE (b), id);
|
||||
break;
|
||||
}
|
||||
if (field)
|
||||
@ -2268,7 +2268,7 @@ cp_parser_skip_to_end_of_statement (cp_parser* parser)
|
||||
scanned, stop -- but only after consuming the token.
|
||||
That way given:
|
||||
|
||||
void f g () { ... }
|
||||
void f g () { ... }
|
||||
typedef int I;
|
||||
|
||||
we will stop after the body of the erroneously declared
|
||||
@ -2800,7 +2800,7 @@ cp_parser_primary_expression (cp_parser *parser,
|
||||
case CPP_STRING:
|
||||
case CPP_WSTRING:
|
||||
/* ??? Should wide strings be allowed when parser->translate_strings_p
|
||||
is false (i.e. in attributes)? If not, we can kill the third
|
||||
is false (i.e. in attributes)? If not, we can kill the third
|
||||
argument to cp_parser_string_literal. */
|
||||
return cp_parser_string_literal (parser,
|
||||
parser->translate_strings_p,
|
||||
@ -2830,7 +2830,7 @@ cp_parser_primary_expression (cp_parser *parser,
|
||||
/* And they're not allowed outside of a function-body; you
|
||||
cannot, for example, write:
|
||||
|
||||
int i = ({ int j = 3; j + 1; });
|
||||
int i = ({ int j = 3; j + 1; });
|
||||
|
||||
at class or namespace scope. */
|
||||
if (!at_function_scope_p ())
|
||||
@ -3229,7 +3229,7 @@ cp_parser_id_expression (cp_parser *parser,
|
||||
|
||||
static tree
|
||||
cp_parser_unqualified_id (cp_parser* parser,
|
||||
bool template_keyword_p,
|
||||
bool template_keyword_p,
|
||||
bool check_dependency_p,
|
||||
bool declarator_p)
|
||||
{
|
||||
@ -3279,7 +3279,7 @@ cp_parser_unqualified_id (cp_parser* parser,
|
||||
template <typename T> struct S { ~S (); };
|
||||
template <typename T> S<T>::~S() {}
|
||||
|
||||
is invalid, since `~' must be followed by a class-name, but
|
||||
is invalid, since `~' must be followed by a class-name, but
|
||||
`S<T>' is dependent, and so not known to be a class.
|
||||
That's not right; we need to look in uninstantiated
|
||||
templates. A further complication arises from:
|
||||
@ -3294,14 +3294,14 @@ cp_parser_unqualified_id (cp_parser* parser,
|
||||
|
||||
Yet another issue is:
|
||||
|
||||
struct S {
|
||||
int S;
|
||||
~S();
|
||||
};
|
||||
struct S {
|
||||
int S;
|
||||
~S();
|
||||
};
|
||||
|
||||
S::~S() {}
|
||||
S::~S() {}
|
||||
|
||||
The standard does not seem to say that the `S' in `~S'
|
||||
The standard does not seem to say that the `S' in `~S'
|
||||
should refer to the type `S' and not the data member
|
||||
`S::S'. */
|
||||
|
||||
@ -4472,8 +4472,8 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
|
||||
However, if the name was not dependent and has already been
|
||||
resolved; there is no need to build the SCOPE_REF. For example;
|
||||
|
||||
struct X { void f(); };
|
||||
template <typename T> void f(T* t) { t->X::f(); }
|
||||
struct X { void f(); };
|
||||
template <typename T> void f(T* t) { t->X::f(); }
|
||||
|
||||
Even though "t" is dependent, "X::f" is not and has been resolved
|
||||
to a BASELINK; there is no need to include scope information. */
|
||||
@ -4659,8 +4659,8 @@ cp_parser_parenthesized_expression_list (cp_parser* parser,
|
||||
|
||||
static void
|
||||
cp_parser_pseudo_destructor_name (cp_parser* parser,
|
||||
tree* scope,
|
||||
tree* type)
|
||||
tree* scope,
|
||||
tree* type)
|
||||
{
|
||||
bool nested_name_specifier_p;
|
||||
|
||||
@ -5003,7 +5003,7 @@ cp_parser_new_expression (cp_parser* parser)
|
||||
/* Look for the closing `)'. */
|
||||
cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
|
||||
/* There should not be a direct-new-declarator in this production,
|
||||
but GCC used to allowed this, so we check and emit a sensible error
|
||||
but GCC used to allowed this, so we check and emit a sensible error
|
||||
message for this case. */
|
||||
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
|
||||
{
|
||||
@ -5211,7 +5211,7 @@ cp_parser_direct_new_declarator (cp_parser* parser)
|
||||
if (!expression)
|
||||
{
|
||||
error ("expression in new-declarator must have integral "
|
||||
"or enumeration type");
|
||||
"or enumeration type");
|
||||
expression = error_mark_node;
|
||||
}
|
||||
}
|
||||
@ -5384,9 +5384,9 @@ cp_parser_cast_expression (cp_parser *parser, bool address_p, bool cast_p)
|
||||
parser->type_definition_forbidden_message = saved_message;
|
||||
|
||||
/* If ok so far, parse the dependent expression. We cannot be
|
||||
sure it is a cast. Consider `(T ())'. It is a parenthesized
|
||||
ctor of T, but looks like a cast to function returning T
|
||||
without a dependent expression. */
|
||||
sure it is a cast. Consider `(T ())'. It is a parenthesized
|
||||
ctor of T, but looks like a cast to function returning T
|
||||
without a dependent expression. */
|
||||
if (!cp_parser_error_occurred (parser))
|
||||
expr = cp_parser_cast_expression (parser,
|
||||
/*address_p=*/false,
|
||||
@ -5524,19 +5524,19 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p)
|
||||
new_prec = TOKEN_PRECEDENCE (token);
|
||||
|
||||
/* Popping an entry off the stack means we completed a subexpression:
|
||||
- either we found a token which is not an operator (`>' where it is not
|
||||
an operator, or prec == PREC_NOT_OPERATOR), in which case popping
|
||||
will happen repeatedly;
|
||||
- or, we found an operator which has lower priority. This is the case
|
||||
where the recursive descent *ascends*, as in `3 * 4 + 5' after
|
||||
parsing `3 * 4'. */
|
||||
- either we found a token which is not an operator (`>' where it is not
|
||||
an operator, or prec == PREC_NOT_OPERATOR), in which case popping
|
||||
will happen repeatedly;
|
||||
- or, we found an operator which has lower priority. This is the case
|
||||
where the recursive descent *ascends*, as in `3 * 4 + 5' after
|
||||
parsing `3 * 4'. */
|
||||
if (new_prec <= prec)
|
||||
{
|
||||
if (sp == stack)
|
||||
{
|
||||
if (sp == stack)
|
||||
break;
|
||||
else
|
||||
else
|
||||
goto pop;
|
||||
}
|
||||
}
|
||||
|
||||
get_rhs:
|
||||
tree_type = binops_by_token[token->type].tree_type;
|
||||
@ -5545,57 +5545,57 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p)
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
|
||||
/* Extract another operand. It may be the RHS of this expression
|
||||
or the LHS of a new, higher priority expression. */
|
||||
or the LHS of a new, higher priority expression. */
|
||||
rhs = cp_parser_simple_cast_expression (parser);
|
||||
|
||||
/* Get another operator token. Look up its precedence to avoid
|
||||
building a useless (immediately popped) stack entry for common
|
||||
cases such as 3 + 4 + 5 or 3 * 4 + 5. */
|
||||
building a useless (immediately popped) stack entry for common
|
||||
cases such as 3 + 4 + 5 or 3 * 4 + 5. */
|
||||
token = cp_lexer_peek_token (parser->lexer);
|
||||
lookahead_prec = TOKEN_PRECEDENCE (token);
|
||||
if (lookahead_prec > new_prec)
|
||||
{
|
||||
/* ... and prepare to parse the RHS of the new, higher priority
|
||||
expression. Since precedence levels on the stack are
|
||||
{
|
||||
/* ... and prepare to parse the RHS of the new, higher priority
|
||||
expression. Since precedence levels on the stack are
|
||||
monotonically increasing, we do not have to care about
|
||||
stack overflows. */
|
||||
sp->prec = prec;
|
||||
sp->tree_type = tree_type;
|
||||
sp->lhs = lhs;
|
||||
sp++;
|
||||
lhs = rhs;
|
||||
prec = new_prec;
|
||||
new_prec = lookahead_prec;
|
||||
goto get_rhs;
|
||||
sp->prec = prec;
|
||||
sp->tree_type = tree_type;
|
||||
sp->lhs = lhs;
|
||||
sp++;
|
||||
lhs = rhs;
|
||||
prec = new_prec;
|
||||
new_prec = lookahead_prec;
|
||||
goto get_rhs;
|
||||
|
||||
pop:
|
||||
/* If the stack is not empty, we have parsed into LHS the right side
|
||||
pop:
|
||||
/* If the stack is not empty, we have parsed into LHS the right side
|
||||
(`4' in the example above) of an expression we had suspended.
|
||||
We can use the information on the stack to recover the LHS (`3')
|
||||
from the stack together with the tree code (`MULT_EXPR'), and
|
||||
the precedence of the higher level subexpression
|
||||
(`PREC_ADDITIVE_EXPRESSION'). TOKEN is the CPP_PLUS token,
|
||||
which will be used to actually build the additive expression. */
|
||||
--sp;
|
||||
--sp;
|
||||
prec = sp->prec;
|
||||
tree_type = sp->tree_type;
|
||||
rhs = lhs;
|
||||
lhs = sp->lhs;
|
||||
}
|
||||
tree_type = sp->tree_type;
|
||||
rhs = lhs;
|
||||
lhs = sp->lhs;
|
||||
}
|
||||
|
||||
overloaded_p = false;
|
||||
lhs = build_x_binary_op (tree_type, lhs, rhs, &overloaded_p);
|
||||
|
||||
/* If the binary operator required the use of an overloaded operator,
|
||||
then this expression cannot be an integral constant-expression.
|
||||
An overloaded operator can be used even if both operands are
|
||||
otherwise permissible in an integral constant-expression if at
|
||||
least one of the operands is of enumeration type. */
|
||||
then this expression cannot be an integral constant-expression.
|
||||
An overloaded operator can be used even if both operands are
|
||||
otherwise permissible in an integral constant-expression if at
|
||||
least one of the operands is of enumeration type. */
|
||||
|
||||
if (overloaded_p
|
||||
&& (cp_parser_non_integral_constant_expression
|
||||
(parser, "calls to overloaded operators")))
|
||||
return error_mark_node;
|
||||
&& (cp_parser_non_integral_constant_expression
|
||||
(parser, "calls to overloaded operators")))
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
return lhs;
|
||||
@ -6165,11 +6165,11 @@ cp_parser_labeled_statement (cp_parser* parser, tree in_statement_expr)
|
||||
ellipsis = cp_lexer_peek_token (parser->lexer);
|
||||
if (ellipsis->type == CPP_ELLIPSIS)
|
||||
{
|
||||
/* Consume the `...' token. */
|
||||
/* Consume the `...' token. */
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
expr_hi =
|
||||
cp_parser_constant_expression (parser,
|
||||
/*allow_non_constant_p=*/false,
|
||||
/*allow_non_constant_p=*/false,
|
||||
NULL);
|
||||
/* We don't need to emit warnings here, as the common code
|
||||
will do this for us. */
|
||||
@ -7074,7 +7074,7 @@ cp_parser_block_declaration (cp_parser *parser,
|
||||
|
||||
static void
|
||||
cp_parser_simple_declaration (cp_parser* parser,
|
||||
bool function_definition_allowed_p)
|
||||
bool function_definition_allowed_p)
|
||||
{
|
||||
cp_decl_specifier_seq decl_specifiers;
|
||||
int declares_class_or_enum;
|
||||
@ -7203,9 +7203,9 @@ cp_parser_simple_declaration (cp_parser* parser,
|
||||
/* After the first time around, a function-definition is not
|
||||
allowed -- even if it was OK at first. For example:
|
||||
|
||||
int i, f() {}
|
||||
int i, f() {}
|
||||
|
||||
is not valid. */
|
||||
is not valid. */
|
||||
function_definition_allowed_p = false;
|
||||
}
|
||||
|
||||
@ -7252,9 +7252,9 @@ cp_parser_simple_declaration (cp_parser* parser,
|
||||
flags:
|
||||
|
||||
1: one of the decl-specifiers is an elaborated-type-specifier
|
||||
(i.e., a type declaration)
|
||||
(i.e., a type declaration)
|
||||
2: one of the decl-specifiers is an enum-specifier or a
|
||||
class-specifier (i.e., a type definition)
|
||||
class-specifier (i.e., a type definition)
|
||||
|
||||
*/
|
||||
|
||||
@ -7335,7 +7335,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
|
||||
extern
|
||||
mutable
|
||||
|
||||
GNU Extension:
|
||||
GNU Extension:
|
||||
thread */
|
||||
case RID_AUTO:
|
||||
/* Consume the token. */
|
||||
@ -7641,7 +7641,7 @@ cp_parser_conversion_function_id (cp_parser* parser)
|
||||
conversion-type-id. For example, consider:
|
||||
|
||||
struct S {
|
||||
typedef int I;
|
||||
typedef int I;
|
||||
operator I();
|
||||
};
|
||||
|
||||
@ -7693,7 +7693,7 @@ cp_parser_conversion_type_id (cp_parser* parser)
|
||||
declarator = cp_parser_conversion_declarator_opt (parser);
|
||||
|
||||
type_specified = grokdeclarator (declarator, &type_specifiers, TYPENAME,
|
||||
/*initialized=*/0, &attributes);
|
||||
/*initialized=*/0, &attributes);
|
||||
if (attributes)
|
||||
cplus_decl_attributes (&type_specified, attributes, /*flags=*/0);
|
||||
return type_specified;
|
||||
@ -8397,7 +8397,7 @@ cp_parser_type_parameter (cp_parser* parser)
|
||||
tree default_argument;
|
||||
|
||||
/* If the next token is an identifier, then it names the
|
||||
parameter. */
|
||||
parameter. */
|
||||
if (cp_lexer_next_token_is (parser->lexer, CPP_NAME))
|
||||
identifier = cp_parser_identifier (parser);
|
||||
else
|
||||
@ -8599,7 +8599,7 @@ cp_parser_template_id (cp_parser *parser,
|
||||
/* Change `:' into `::'. */
|
||||
next_token_2->type = CPP_SCOPE;
|
||||
/* Consume the first token (CPP_OPEN_SQUARE - which we pretend it is
|
||||
CPP_LESS. */
|
||||
CPP_LESS. */
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
/* Parse the arguments. */
|
||||
arguments = cp_parser_enclosed_template_argument_list (parser);
|
||||
@ -8614,7 +8614,7 @@ cp_parser_template_id (cp_parser *parser,
|
||||
return error_mark_node;
|
||||
}
|
||||
/* Otherwise, emit an error about the invalid digraph, but continue
|
||||
parsing because we got our argument list. */
|
||||
parsing because we got our argument list. */
|
||||
pedwarn ("%<<::%> cannot begin a template-argument list");
|
||||
inform ("%<<:%> is an alternate spelling for %<[%>. Insert whitespace "
|
||||
"between %<<%> and %<::%>");
|
||||
@ -8733,8 +8733,8 @@ cp_parser_template_id (cp_parser *parser,
|
||||
|
||||
static tree
|
||||
cp_parser_template_name (cp_parser* parser,
|
||||
bool template_keyword_p,
|
||||
bool check_dependency_p,
|
||||
bool template_keyword_p,
|
||||
bool check_dependency_p,
|
||||
bool is_declaration,
|
||||
bool *is_identifier)
|
||||
{
|
||||
@ -8753,10 +8753,10 @@ cp_parser_template_name (cp_parser* parser,
|
||||
identifier = cp_parser_operator_function_id (parser);
|
||||
/* If that didn't work, try a conversion-function-id. */
|
||||
if (!cp_parser_parse_definitely (parser))
|
||||
{
|
||||
{
|
||||
cp_parser_error (parser, "expected template-name");
|
||||
return error_mark_node;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Look for the identifier. */
|
||||
else
|
||||
@ -9045,7 +9045,7 @@ cp_parser_template_argument (cp_parser* parser)
|
||||
in [temp.arg.nontype]:
|
||||
|
||||
-- an integral constant-expression of integral or enumeration
|
||||
type; or
|
||||
type; or
|
||||
|
||||
-- the name of a non-type template-parameter; or
|
||||
|
||||
@ -9386,7 +9386,7 @@ cp_parser_type_specifier (cp_parser* parser,
|
||||
if (cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_OPEN_BRACE
|
||||
|| (cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_NAME
|
||||
&& cp_lexer_peek_nth_token (parser->lexer, 3)->type
|
||||
== CPP_OPEN_BRACE))
|
||||
== CPP_OPEN_BRACE))
|
||||
{
|
||||
if (parser->num_template_parameter_lists)
|
||||
{
|
||||
@ -9823,7 +9823,7 @@ cp_parser_type_name (cp_parser* parser)
|
||||
elaborated-type-specifier:
|
||||
class-key attributes :: [opt] nested-name-specifier [opt] identifier
|
||||
class-key attributes :: [opt] nested-name-specifier [opt]
|
||||
template [opt] template-id
|
||||
template [opt] template-id
|
||||
enum attributes :: [opt] nested-name-specifier [opt] identifier
|
||||
|
||||
If IS_FRIEND is TRUE, then this elaborated-type-specifier is being
|
||||
@ -9835,8 +9835,8 @@ cp_parser_type_name (cp_parser* parser)
|
||||
|
||||
static tree
|
||||
cp_parser_elaborated_type_specifier (cp_parser* parser,
|
||||
bool is_friend,
|
||||
bool is_declaration)
|
||||
bool is_friend,
|
||||
bool is_declaration)
|
||||
{
|
||||
enum tag_types tag_type;
|
||||
tree identifier;
|
||||
@ -9906,7 +9906,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
|
||||
/* Allow the `template' keyword. */
|
||||
template_p = cp_parser_optional_template_keyword (parser);
|
||||
/* If we didn't see `template', we don't know if there's a
|
||||
template-id or not. */
|
||||
template-id or not. */
|
||||
if (!template_p)
|
||||
cp_parser_parse_tentatively (parser);
|
||||
/* Parse the template-id. */
|
||||
@ -9914,7 +9914,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
|
||||
/*check_dependency_p=*/true,
|
||||
is_declaration);
|
||||
/* If we didn't find a template-id, look for an ordinary
|
||||
identifier. */
|
||||
identifier. */
|
||||
if (!template_p && !cp_parser_parse_definitely (parser))
|
||||
;
|
||||
/* If DECL is a TEMPLATE_ID_EXPR, and the `typename' keyword is
|
||||
@ -10055,8 +10055,8 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
|
||||
else
|
||||
ts = ts_global;
|
||||
|
||||
/* Warn about attributes. They are ignored. */
|
||||
if (attributes)
|
||||
/* Warn about attributes. They are ignored. */
|
||||
if (attributes)
|
||||
warning (OPT_Wattributes,
|
||||
"type attributes are honored only at type definition");
|
||||
|
||||
@ -10511,10 +10511,10 @@ cp_parser_using_directive (cp_parser* parser)
|
||||
asm volatile [opt] ( string-literal ) ;
|
||||
asm volatile [opt] ( string-literal : asm-operand-list [opt] ) ;
|
||||
asm volatile [opt] ( string-literal : asm-operand-list [opt]
|
||||
: asm-operand-list [opt] ) ;
|
||||
: asm-operand-list [opt] ) ;
|
||||
asm volatile [opt] ( string-literal : asm-operand-list [opt]
|
||||
: asm-operand-list [opt]
|
||||
: asm-operand-list [opt] ) ; */
|
||||
: asm-operand-list [opt]
|
||||
: asm-operand-list [opt] ) ; */
|
||||
|
||||
static void
|
||||
cp_parser_asm_definition (cp_parser* parser)
|
||||
@ -10989,8 +10989,8 @@ cp_parser_init_declarator (cp_parser* parser,
|
||||
|
||||
static cp_declarator *
|
||||
cp_parser_declarator (cp_parser* parser,
|
||||
cp_parser_declarator_kind dcl_kind,
|
||||
int* ctor_dtor_or_conv_p,
|
||||
cp_parser_declarator_kind dcl_kind,
|
||||
int* ctor_dtor_or_conv_p,
|
||||
bool* parenthesized_p,
|
||||
bool member_p)
|
||||
{
|
||||
@ -11098,8 +11098,8 @@ cp_parser_declarator (cp_parser* parser,
|
||||
|
||||
static cp_declarator *
|
||||
cp_parser_direct_declarator (cp_parser* parser,
|
||||
cp_parser_declarator_kind dcl_kind,
|
||||
int* ctor_dtor_or_conv_p,
|
||||
cp_parser_declarator_kind dcl_kind,
|
||||
int* ctor_dtor_or_conv_p,
|
||||
bool member_p)
|
||||
{
|
||||
cp_token *token;
|
||||
@ -11117,15 +11117,15 @@ cp_parser_direct_declarator (cp_parser* parser,
|
||||
if (token->type == CPP_OPEN_PAREN)
|
||||
{
|
||||
/* This is either a parameter-declaration-clause, or a
|
||||
parenthesized declarator. When we know we are parsing a
|
||||
named declarator, it must be a parenthesized declarator
|
||||
if FIRST is true. For instance, `(int)' is a
|
||||
parameter-declaration-clause, with an omitted
|
||||
direct-abstract-declarator. But `((*))', is a
|
||||
parenthesized abstract declarator. Finally, when T is a
|
||||
template parameter `(T)' is a
|
||||
parameter-declaration-clause, and not a parenthesized
|
||||
named declarator.
|
||||
parenthesized declarator. When we know we are parsing a
|
||||
named declarator, it must be a parenthesized declarator
|
||||
if FIRST is true. For instance, `(int)' is a
|
||||
parameter-declaration-clause, with an omitted
|
||||
direct-abstract-declarator. But `((*))', is a
|
||||
parenthesized abstract declarator. Finally, when T is a
|
||||
template parameter `(T)' is a
|
||||
parameter-declaration-clause, and not a parenthesized
|
||||
named declarator.
|
||||
|
||||
We first try and parse a parameter-declaration-clause,
|
||||
and then try a nested declarator (if FIRST is true).
|
||||
@ -11145,7 +11145,7 @@ cp_parser_direct_declarator (cp_parser* parser,
|
||||
these two alternatives should be selected. Even more
|
||||
complex are examples like:
|
||||
|
||||
int i (int (a));
|
||||
int i (int (a));
|
||||
int i (int (3));
|
||||
|
||||
The former is a function-declaration; the latter is a
|
||||
@ -11191,7 +11191,7 @@ cp_parser_direct_declarator (cp_parser* parser,
|
||||
= saved_num_template_parameter_lists;
|
||||
|
||||
/* If all went well, parse the cv-qualifier-seq and the
|
||||
exception-specification. */
|
||||
exception-specification. */
|
||||
if (member_p || cp_parser_parse_definitely (parser))
|
||||
{
|
||||
cp_cv_quals cv_quals;
|
||||
@ -11215,8 +11215,8 @@ cp_parser_direct_declarator (cp_parser* parser,
|
||||
cv_quals,
|
||||
exception_specification);
|
||||
/* Any subsequent parameter lists are to do with
|
||||
return type, so are not those of the declared
|
||||
function. */
|
||||
return type, so are not those of the declared
|
||||
function. */
|
||||
parser->default_arg_ok_p = false;
|
||||
|
||||
/* Repeat the main loop. */
|
||||
@ -11337,21 +11337,21 @@ cp_parser_direct_declarator (cp_parser* parser,
|
||||
&& TREE_CODE (qualifying_scope) == TYPENAME_TYPE)
|
||||
{
|
||||
/* In the declaration of a member of a template class
|
||||
outside of the class itself, the SCOPE will sometimes
|
||||
be a TYPENAME_TYPE. For example, given:
|
||||
outside of the class itself, the SCOPE will sometimes
|
||||
be a TYPENAME_TYPE. For example, given:
|
||||
|
||||
template <typename T>
|
||||
int S<T>::R::i = 3;
|
||||
template <typename T>
|
||||
int S<T>::R::i = 3;
|
||||
|
||||
the SCOPE will be a TYPENAME_TYPE for `S<T>::R'. In
|
||||
this context, we must resolve S<T>::R to an ordinary
|
||||
type, rather than a typename type.
|
||||
the SCOPE will be a TYPENAME_TYPE for `S<T>::R'. In
|
||||
this context, we must resolve S<T>::R to an ordinary
|
||||
type, rather than a typename type.
|
||||
|
||||
The reason we normally avoid resolving TYPENAME_TYPEs
|
||||
is that a specialization of `S' might render
|
||||
`S<T>::R' not a type. However, if `S' is
|
||||
specialized, then this `i' will not be used, so there
|
||||
is no harm in resolving the types here. */
|
||||
The reason we normally avoid resolving TYPENAME_TYPEs
|
||||
is that a specialization of `S' might render
|
||||
`S<T>::R' not a type. However, if `S' is
|
||||
specialized, then this `i' will not be used, so there
|
||||
is no harm in resolving the types here. */
|
||||
tree type;
|
||||
|
||||
/* Resolve the TYPENAME_TYPE. */
|
||||
@ -11404,8 +11404,8 @@ cp_parser_direct_declarator (cp_parser* parser,
|
||||
{
|
||||
error ("invalid use of constructor as a template");
|
||||
inform ("use %<%T::%D%> instead of %<%T::%T%> to name "
|
||||
"the constructor in a qualified name",
|
||||
class_type,
|
||||
"the constructor in a qualified name",
|
||||
class_type,
|
||||
DECL_NAME (TYPE_TI_TEMPLATE (class_type)),
|
||||
class_type, class_type);
|
||||
}
|
||||
@ -11470,7 +11470,7 @@ cp_parser_direct_declarator (cp_parser* parser,
|
||||
|
||||
static enum tree_code
|
||||
cp_parser_ptr_operator (cp_parser* parser,
|
||||
tree* type,
|
||||
tree* type,
|
||||
cp_cv_quals *cv_quals)
|
||||
{
|
||||
enum tree_code code = ERROR_MARK;
|
||||
@ -11740,20 +11740,20 @@ cp_parser_type_specifier_seq (cp_parser* parser,
|
||||
seen_type_specifier = true;
|
||||
/* The standard says that a condition can be:
|
||||
|
||||
type-specifier-seq declarator = assignment-expression
|
||||
type-specifier-seq declarator = assignment-expression
|
||||
|
||||
However, given:
|
||||
|
||||
struct S {};
|
||||
if (int S = ...)
|
||||
|
||||
we should treat the "S" as a declarator, not as a
|
||||
type-specifier. The standard doesn't say that explicitly for
|
||||
type-specifier-seq, but it does say that for
|
||||
decl-specifier-seq in an ordinary declaration. Perhaps it
|
||||
would be clearer just to allow a decl-specifier-seq here, and
|
||||
then add a semantic restriction that if any decl-specifiers
|
||||
that are not type-specifiers appear, the program is invalid. */
|
||||
we should treat the "S" as a declarator, not as a
|
||||
type-specifier. The standard doesn't say that explicitly for
|
||||
type-specifier-seq, but it does say that for
|
||||
decl-specifier-seq in an ordinary declaration. Perhaps it
|
||||
would be clearer just to allow a decl-specifier-seq here, and
|
||||
then add a semantic restriction that if any decl-specifiers
|
||||
that are not type-specifiers appear, the program is invalid. */
|
||||
if (is_condition && !is_cv_qualifier)
|
||||
flags |= CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES;
|
||||
}
|
||||
@ -11913,9 +11913,9 @@ cp_parser_parameter_declaration_list (cp_parser* parser, bool *is_error)
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
/* When parsing something like:
|
||||
|
||||
int i(float f, double d)
|
||||
int i(float f, double d)
|
||||
|
||||
we can tell after seeing the declaration for "f" that we
|
||||
we can tell after seeing the declaration for "f" that we
|
||||
are not looking at an initialization of a variable "i",
|
||||
but rather at the declaration of a function "i".
|
||||
|
||||
@ -12151,14 +12151,14 @@ cp_parser_parameter_declaration (cp_parser *parser,
|
||||
}
|
||||
|
||||
/* Create a DEFAULT_ARG to represented the unparsed default
|
||||
argument. */
|
||||
argument. */
|
||||
default_argument = make_node (DEFAULT_ARG);
|
||||
DEFARG_TOKENS (default_argument)
|
||||
= cp_token_cache_new (first_token, token);
|
||||
DEFARG_INSTANTIATIONS (default_argument) = NULL;
|
||||
}
|
||||
/* Outside of a class definition, we can just parse the
|
||||
assignment-expression. */
|
||||
assignment-expression. */
|
||||
else
|
||||
{
|
||||
bool saved_local_variables_forbidden_p;
|
||||
@ -12650,7 +12650,7 @@ cp_parser_class_specifier (cp_parser* parser)
|
||||
class-specifier for that class. Consider:
|
||||
|
||||
struct A {
|
||||
struct B { void f() { sizeof (A); } };
|
||||
struct B { void f() { sizeof (A); } };
|
||||
};
|
||||
|
||||
If `f' were processed before the processing of `A' were
|
||||
@ -12675,11 +12675,11 @@ cp_parser_class_specifier (cp_parser* parser)
|
||||
This two-phased approach handles cases like:
|
||||
|
||||
struct S {
|
||||
void f() { g(); }
|
||||
void g(int i = 3);
|
||||
};
|
||||
void f() { g(); }
|
||||
void g(int i = 3);
|
||||
};
|
||||
|
||||
*/
|
||||
*/
|
||||
for (TREE_PURPOSE (parser->unparsed_functions_queues)
|
||||
= nreverse (TREE_PURPOSE (parser->unparsed_functions_queues));
|
||||
(queue_entry = TREE_PURPOSE (parser->unparsed_functions_queues));
|
||||
@ -12826,10 +12826,10 @@ cp_parser_class_head (cp_parser* parser,
|
||||
|
||||
It is OK to define an inaccessible class; for example:
|
||||
|
||||
class A { class B; };
|
||||
class A::B {};
|
||||
class A { class B; };
|
||||
class A::B {};
|
||||
|
||||
We do not know if we will see a class-name, or a
|
||||
We do not know if we will see a class-name, or a
|
||||
template-name. We look for a class-name first, in case the
|
||||
class-name is a template-id; if we looked for the
|
||||
template-name first we would stop after the template-name. */
|
||||
@ -12942,13 +12942,13 @@ cp_parser_class_head (cp_parser* parser,
|
||||
if (scope && !is_ancestor (scope, nested_name_specifier))
|
||||
{
|
||||
error ("declaration of %qD in %qD which does not enclose %qD",
|
||||
type, scope, nested_name_specifier);
|
||||
type, scope, nested_name_specifier);
|
||||
type = NULL_TREE;
|
||||
goto done;
|
||||
}
|
||||
/* [dcl.meaning]
|
||||
|
||||
A declarator-id shall not be qualified exception of the
|
||||
A declarator-id shall not be qualified exception of the
|
||||
definition of a ... nested class outside of its class
|
||||
... [or] a the definition or explicit instantiation of a
|
||||
class member of a namespace outside of its namespace. */
|
||||
@ -13306,8 +13306,8 @@ cp_parser_member_declaration (cp_parser* parser)
|
||||
/* In this case:
|
||||
|
||||
template <typename T> struct A {
|
||||
friend struct A<T>::B;
|
||||
};
|
||||
friend struct A<T>::B;
|
||||
};
|
||||
|
||||
A<T>::B will be represented by a TYPENAME_TYPE, and
|
||||
therefore not recognized by check_tag_decl. */
|
||||
@ -14679,7 +14679,7 @@ cp_parser_maybe_treat_template_as_class (tree decl, bool tag_name_p)
|
||||
the translation from TEMPLATE_DECL to TYPE_DECL occurs:
|
||||
|
||||
struct A {
|
||||
template <typename T> struct B;
|
||||
template <typename T> struct B;
|
||||
};
|
||||
|
||||
template <typename T> struct A::B {};
|
||||
@ -14689,7 +14689,7 @@ cp_parser_maybe_treat_template_as_class (tree decl, bool tag_name_p)
|
||||
namespace N { struct X{}; }
|
||||
|
||||
struct A {
|
||||
template <typename T> friend struct N::X;
|
||||
template <typename T> friend struct N::X;
|
||||
};
|
||||
|
||||
However, if the DECL refers to a class type, and we are in
|
||||
@ -14698,7 +14698,7 @@ cp_parser_maybe_treat_template_as_class (tree decl, bool tag_name_p)
|
||||
than a TEMPLATE_DECL. For example, in:
|
||||
|
||||
template <class T> struct S {
|
||||
S s;
|
||||
S s;
|
||||
};
|
||||
|
||||
there is no need to handle such case. */
|
||||
@ -14786,7 +14786,7 @@ cp_parser_check_declarator_template_parameters (cp_parser* parser,
|
||||
|
||||
static bool
|
||||
cp_parser_check_template_parameters (cp_parser* parser,
|
||||
unsigned num_templates)
|
||||
unsigned num_templates)
|
||||
{
|
||||
/* If there are more template classes than parameter lists, we have
|
||||
something like:
|
||||
@ -15158,7 +15158,7 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p)
|
||||
else
|
||||
{
|
||||
/* There are no access checks when parsing a template, as we do not
|
||||
know if a specialization will be a friend. */
|
||||
know if a specialization will be a friend. */
|
||||
push_deferring_access_checks (dk_no_check);
|
||||
|
||||
decl = cp_parser_single_declaration (parser,
|
||||
@ -15831,8 +15831,8 @@ cp_parser_friend_p (const cp_decl_specifier_seq *decl_specifiers)
|
||||
|
||||
static cp_token *
|
||||
cp_parser_require (cp_parser* parser,
|
||||
enum cpp_ttype type,
|
||||
const char* token_desc)
|
||||
enum cpp_ttype type,
|
||||
const char* token_desc)
|
||||
{
|
||||
if (cp_lexer_next_token_is (parser->lexer, type))
|
||||
return cp_lexer_consume_token (parser->lexer);
|
||||
@ -15855,8 +15855,8 @@ cp_parser_require (cp_parser* parser,
|
||||
|
||||
static void
|
||||
cp_parser_skip_until_found (cp_parser* parser,
|
||||
enum cpp_ttype type,
|
||||
const char* token_desc)
|
||||
enum cpp_ttype type,
|
||||
const char* token_desc)
|
||||
{
|
||||
cp_token *token;
|
||||
unsigned nesting_depth = 0;
|
||||
@ -15903,8 +15903,8 @@ cp_parser_skip_until_found (cp_parser* parser,
|
||||
|
||||
static cp_token *
|
||||
cp_parser_require_keyword (cp_parser* parser,
|
||||
enum rid keyword,
|
||||
const char* token_desc)
|
||||
enum rid keyword,
|
||||
const char* token_desc)
|
||||
{
|
||||
cp_token *token = cp_parser_require (parser, CPP_KEYWORD, token_desc);
|
||||
|
||||
@ -16669,7 +16669,7 @@ cp_parser_objc_protocol_qualifiers (cp_parser* parser)
|
||||
|| node == ridpointers [(int) RID_OUT]
|
||||
|| node == ridpointers [(int) RID_INOUT]
|
||||
|| node == ridpointers [(int) RID_BYCOPY]
|
||||
|| node == ridpointers [(int) RID_BYREF]
|
||||
|| node == ridpointers [(int) RID_BYREF]
|
||||
|| node == ridpointers [(int) RID_ONEWAY]))
|
||||
{
|
||||
quals = tree_cons (NULL_TREE, node, quals);
|
||||
|
576
gcc/cp/pt.c
576
gcc/cp/pt.c
File diff suppressed because it is too large
Load Diff
122
gcc/cp/rtti.c
122
gcc/cp/rtti.c
@ -320,7 +320,7 @@ get_tinfo_decl (tree type)
|
||||
&& TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
|
||||
{
|
||||
error ("cannot create type information for type %qT because "
|
||||
"its size is variable",
|
||||
"its size is variable",
|
||||
type);
|
||||
return error_mark_node;
|
||||
}
|
||||
@ -420,7 +420,7 @@ ifnonnull (tree test, tree result)
|
||||
{
|
||||
return build3 (COND_EXPR, TREE_TYPE (result),
|
||||
build2 (EQ_EXPR, boolean_type_node, test,
|
||||
cp_convert (TREE_TYPE (test), integer_zero_node)),
|
||||
cp_convert (TREE_TYPE (test), integer_zero_node)),
|
||||
cp_convert (TREE_TYPE (result), integer_zero_node),
|
||||
result);
|
||||
}
|
||||
@ -557,21 +557,21 @@ build_dynamic_cast_1 (tree type, tree expr)
|
||||
else
|
||||
{
|
||||
tree retval;
|
||||
tree result, td2, td3, elems;
|
||||
tree static_type, target_type, boff;
|
||||
tree result, td2, td3, elems;
|
||||
tree static_type, target_type, boff;
|
||||
|
||||
/* If we got here, we can't convert statically. Therefore,
|
||||
/* If we got here, we can't convert statically. Therefore,
|
||||
dynamic_cast<D&>(b) (b an object) cannot succeed. */
|
||||
if (tc == REFERENCE_TYPE)
|
||||
{
|
||||
if (TREE_CODE (old_expr) == VAR_DECL
|
||||
&& TREE_CODE (TREE_TYPE (old_expr)) == RECORD_TYPE)
|
||||
{
|
||||
tree expr = throw_bad_cast ();
|
||||
tree expr = throw_bad_cast ();
|
||||
warning (0, "dynamic_cast of %q#D to %q#T can never succeed",
|
||||
old_expr, type);
|
||||
/* Bash it to the expected type. */
|
||||
TREE_TYPE (expr) = type;
|
||||
old_expr, type);
|
||||
/* Bash it to the expected type. */
|
||||
TREE_TYPE (expr) = type;
|
||||
return expr;
|
||||
}
|
||||
}
|
||||
@ -583,7 +583,7 @@ build_dynamic_cast_1 (tree type, tree expr)
|
||||
&& TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE)
|
||||
{
|
||||
warning (0, "dynamic_cast of %q#D to %q#T can never succeed",
|
||||
op, type);
|
||||
op, type);
|
||||
retval = build_int_cst (type, 0);
|
||||
return retval;
|
||||
}
|
||||
@ -598,8 +598,8 @@ build_dynamic_cast_1 (tree type, tree expr)
|
||||
mark_used (td3);
|
||||
td3 = build_unary_op (ADDR_EXPR, td3, 0);
|
||||
|
||||
/* Determine how T and V are related. */
|
||||
boff = dcast_base_hint (static_type, target_type);
|
||||
/* Determine how T and V are related. */
|
||||
boff = dcast_base_hint (static_type, target_type);
|
||||
|
||||
/* Since expr is used twice below, save it. */
|
||||
expr = save_expr (expr);
|
||||
@ -639,10 +639,10 @@ build_dynamic_cast_1 (tree type, tree expr)
|
||||
tmp = build_function_type (ptr_type_node, tmp);
|
||||
dcast_fn = build_library_fn_ptr (name, tmp);
|
||||
DECL_IS_PURE (dcast_fn) = 1;
|
||||
pop_nested_namespace (ns);
|
||||
dynamic_cast_node = dcast_fn;
|
||||
pop_nested_namespace (ns);
|
||||
dynamic_cast_node = dcast_fn;
|
||||
}
|
||||
result = build_cxx_call (dcast_fn, elems);
|
||||
result = build_cxx_call (dcast_fn, elems);
|
||||
|
||||
if (tc == REFERENCE_TYPE)
|
||||
{
|
||||
@ -654,7 +654,7 @@ build_dynamic_cast_1 (tree type, tree expr)
|
||||
|
||||
/* Now back to the type we want from a void*. */
|
||||
result = cp_convert (type, result);
|
||||
return ifnonnull (expr, result);
|
||||
return ifnonnull (expr, result);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -662,7 +662,7 @@ build_dynamic_cast_1 (tree type, tree expr)
|
||||
|
||||
fail:
|
||||
error ("cannot dynamic_cast %qE (of type %q#T) to type %q#T (%s)",
|
||||
expr, exprtype, type, errstr);
|
||||
expr, exprtype, type, errstr);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -769,8 +769,8 @@ tinfo_base_init (tree desc, tree target)
|
||||
|
||||
/* Generate the NTBS array variable. */
|
||||
tree name_type = build_cplus_array_type
|
||||
(build_qualified_type (char_type_node, TYPE_QUAL_CONST),
|
||||
NULL_TREE);
|
||||
(build_qualified_type (char_type_node, TYPE_QUAL_CONST),
|
||||
NULL_TREE);
|
||||
tree name_string = tinfo_name (target);
|
||||
|
||||
/* Determine the name of the variable -- and remember with which
|
||||
@ -811,7 +811,7 @@ tinfo_base_init (tree desc, tree target)
|
||||
|
||||
if (!COMPLETE_TYPE_P (real_type))
|
||||
{
|
||||
/* We never saw a definition of this type, so we need to
|
||||
/* We never saw a definition of this type, so we need to
|
||||
tell the compiler that this is an exported class, as
|
||||
indeed all of the __*_type_info classes are. */
|
||||
SET_CLASSTYPE_INTERFACE_KNOWN (real_type);
|
||||
@ -876,8 +876,8 @@ ptr_initializer (tree desc, tree target)
|
||||
flags |= 8;
|
||||
init = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, flags), init);
|
||||
init = tree_cons (NULL_TREE,
|
||||
get_tinfo_ptr (TYPE_MAIN_VARIANT (to)),
|
||||
init);
|
||||
get_tinfo_ptr (TYPE_MAIN_VARIANT (to)),
|
||||
init);
|
||||
|
||||
init = build_constructor (NULL_TREE, nreverse (init));
|
||||
TREE_CONSTANT (init) = 1;
|
||||
@ -907,7 +907,7 @@ ptm_initializer (tree desc, tree target)
|
||||
init = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, flags), init);
|
||||
init = tree_cons (NULL_TREE,
|
||||
get_tinfo_ptr (TYPE_MAIN_VARIANT (to)),
|
||||
init);
|
||||
init);
|
||||
init = tree_cons (NULL_TREE,
|
||||
get_tinfo_ptr (klass),
|
||||
init);
|
||||
@ -992,38 +992,38 @@ get_pseudo_ti_init (tree type, tree var_desc)
|
||||
return class_initializer (var_desc, type, NULL_TREE);
|
||||
else if (var_desc == si_class_desc_type_node)
|
||||
{
|
||||
tree base_binfo = BINFO_BASE_BINFO (TYPE_BINFO (type), 0);
|
||||
tree base_binfo = BINFO_BASE_BINFO (TYPE_BINFO (type), 0);
|
||||
tree tinfo = get_tinfo_ptr (BINFO_TYPE (base_binfo));
|
||||
tree base_inits = tree_cons (NULL_TREE, tinfo, NULL_TREE);
|
||||
|
||||
return class_initializer (var_desc, type, base_inits);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
int hint = ((CLASSTYPE_REPEATED_BASE_P (type) << 0)
|
||||
| (CLASSTYPE_DIAMOND_SHAPED_P (type) << 1));
|
||||
tree binfo = TYPE_BINFO (type);
|
||||
int nbases = BINFO_N_BASE_BINFOS (binfo);
|
||||
int nbases = BINFO_N_BASE_BINFOS (binfo);
|
||||
VEC(tree,gc) *base_accesses = BINFO_BASE_ACCESSES (binfo);
|
||||
tree base_inits = NULL_TREE;
|
||||
int ix;
|
||||
tree base_inits = NULL_TREE;
|
||||
int ix;
|
||||
|
||||
/* Generate the base information initializer. */
|
||||
for (ix = nbases; ix--;)
|
||||
{
|
||||
tree base_binfo = BINFO_BASE_BINFO (binfo, ix);
|
||||
tree base_init = NULL_TREE;
|
||||
int flags = 0;
|
||||
tree tinfo;
|
||||
tree offset;
|
||||
/* Generate the base information initializer. */
|
||||
for (ix = nbases; ix--;)
|
||||
{
|
||||
tree base_binfo = BINFO_BASE_BINFO (binfo, ix);
|
||||
tree base_init = NULL_TREE;
|
||||
int flags = 0;
|
||||
tree tinfo;
|
||||
tree offset;
|
||||
|
||||
if (VEC_index (tree, base_accesses, ix) == access_public_node)
|
||||
flags |= 2;
|
||||
tinfo = get_tinfo_ptr (BINFO_TYPE (base_binfo));
|
||||
if (VEC_index (tree, base_accesses, ix) == access_public_node)
|
||||
flags |= 2;
|
||||
tinfo = get_tinfo_ptr (BINFO_TYPE (base_binfo));
|
||||
if (BINFO_VIRTUAL_P (base_binfo))
|
||||
{
|
||||
/* We store the vtable offset at which the virtual
|
||||
base offset can be found. */
|
||||
base offset can be found. */
|
||||
offset = BINFO_VPTR_FIELD (base_binfo);
|
||||
offset = convert (sizetype, offset);
|
||||
flags |= 1;
|
||||
@ -1031,16 +1031,16 @@ get_pseudo_ti_init (tree type, tree var_desc)
|
||||
else
|
||||
offset = BINFO_OFFSET (base_binfo);
|
||||
|
||||
/* Combine offset and flags into one field. */
|
||||
offset = cp_build_binary_op (LSHIFT_EXPR, offset,
|
||||
/* Combine offset and flags into one field. */
|
||||
offset = cp_build_binary_op (LSHIFT_EXPR, offset,
|
||||
build_int_cst (NULL_TREE, 8));
|
||||
offset = cp_build_binary_op (BIT_IOR_EXPR, offset,
|
||||
offset = cp_build_binary_op (BIT_IOR_EXPR, offset,
|
||||
build_int_cst (NULL_TREE, flags));
|
||||
base_init = tree_cons (NULL_TREE, offset, base_init);
|
||||
base_init = tree_cons (NULL_TREE, tinfo, base_init);
|
||||
base_init = build_constructor (NULL_TREE, base_init);
|
||||
base_inits = tree_cons (NULL_TREE, base_init, base_inits);
|
||||
}
|
||||
base_init = tree_cons (NULL_TREE, offset, base_init);
|
||||
base_init = tree_cons (NULL_TREE, tinfo, base_init);
|
||||
base_init = build_constructor (NULL_TREE, base_init);
|
||||
base_inits = tree_cons (NULL_TREE, base_init, base_inits);
|
||||
}
|
||||
base_inits = build_constructor (NULL_TREE, base_inits);
|
||||
base_inits = tree_cons (NULL_TREE, base_inits, NULL_TREE);
|
||||
/* Prepend the number of bases. */
|
||||
@ -1052,8 +1052,8 @@ get_pseudo_ti_init (tree type, tree var_desc)
|
||||
build_int_cst (NULL_TREE, hint),
|
||||
base_inits);
|
||||
|
||||
return class_initializer (var_desc, type, base_inits);
|
||||
}
|
||||
return class_initializer (var_desc, type, base_inits);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1250,22 +1250,22 @@ create_tinfo_types (void)
|
||||
NULL);
|
||||
func_desc_type_node = create_pseudo_type_info
|
||||
("__function_type_info", 0,
|
||||
NULL);
|
||||
NULL);
|
||||
enum_desc_type_node = create_pseudo_type_info
|
||||
("__enum_type_info", 0,
|
||||
NULL);
|
||||
NULL);
|
||||
|
||||
/* Class type_info. Add a flags field. */
|
||||
class_desc_type_node = create_pseudo_type_info
|
||||
("__class_type_info", 0,
|
||||
NULL);
|
||||
("__class_type_info", 0,
|
||||
NULL);
|
||||
|
||||
/* Single public non-virtual base class. Add pointer to base class.
|
||||
This is really a descendant of __class_type_info. */
|
||||
si_class_desc_type_node = create_pseudo_type_info
|
||||
("__si_class_type_info", 0,
|
||||
build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
|
||||
NULL);
|
||||
("__si_class_type_info", 0,
|
||||
build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
|
||||
NULL);
|
||||
|
||||
/* Base class internal helper. Pointer to base type, offset to base,
|
||||
flags. */
|
||||
@ -1302,10 +1302,10 @@ create_tinfo_types (void)
|
||||
This is really a descendant of __pbase_type_info. */
|
||||
ptm_desc_type_node = create_pseudo_type_info
|
||||
("__pointer_to_member_type_info", 0,
|
||||
build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
|
||||
build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
|
||||
build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
|
||||
NULL);
|
||||
build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
|
||||
build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
|
||||
build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
|
||||
NULL);
|
||||
|
||||
pop_nested_namespace (abi_node);
|
||||
}
|
||||
|
@ -82,13 +82,13 @@ static int n_contexts_saved;
|
||||
struct lookup_base_data_s
|
||||
{
|
||||
tree t; /* type being searched. */
|
||||
tree base; /* The base type we're looking for. */
|
||||
tree binfo; /* Found binfo. */
|
||||
bool via_virtual; /* Found via a virtual path. */
|
||||
tree base; /* The base type we're looking for. */
|
||||
tree binfo; /* Found binfo. */
|
||||
bool via_virtual; /* Found via a virtual path. */
|
||||
bool ambiguous; /* Found multiply ambiguous */
|
||||
bool repeated_base; /* Whether there are repeated bases in the
|
||||
bool repeated_base; /* Whether there are repeated bases in the
|
||||
hierarchy. */
|
||||
bool want_any; /* Whether we want any matching binfo. */
|
||||
bool want_any; /* Whether we want any matching binfo. */
|
||||
};
|
||||
|
||||
/* Worker function for lookup_base. See if we've found the desired
|
||||
@ -1084,8 +1084,8 @@ lookup_field_r (tree binfo, void *data)
|
||||
nval = NULL_TREE;
|
||||
if (!nval && CLASSTYPE_NESTED_UTDS (type) != NULL)
|
||||
{
|
||||
binding_entry e = binding_table_find (CLASSTYPE_NESTED_UTDS (type),
|
||||
lfi->name);
|
||||
binding_entry e = binding_table_find (CLASSTYPE_NESTED_UTDS (type),
|
||||
lfi->name);
|
||||
if (e != NULL)
|
||||
nval = TYPE_MAIN_DECL (e->type);
|
||||
else
|
||||
@ -1256,7 +1256,7 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type)
|
||||
{
|
||||
error (errstr, name, type);
|
||||
if (lfi.ambiguous)
|
||||
print_candidates (lfi.ambiguous);
|
||||
print_candidates (lfi.ambiguous);
|
||||
rval = error_mark_node;
|
||||
}
|
||||
|
||||
@ -1655,8 +1655,8 @@ dfs_walk_once (tree binfo, tree (*pre_fn) (tree, void *),
|
||||
if (!BINFO_INHERITANCE_CHAIN (binfo))
|
||||
{
|
||||
/* We are at the top of the hierarchy, and can use the
|
||||
CLASSTYPE_VBASECLASSES list for unmarking the virtual
|
||||
bases. */
|
||||
CLASSTYPE_VBASECLASSES list for unmarking the virtual
|
||||
bases. */
|
||||
VEC(tree,gc) *vbases;
|
||||
unsigned ix;
|
||||
tree base_binfo;
|
||||
@ -1710,8 +1710,8 @@ dfs_walk_once_accessible_r (tree binfo, bool friends_p, bool once,
|
||||
continue;
|
||||
|
||||
/* If the base is inherited via private or protected
|
||||
inheritance, then we can't see it, unless we are a friend of
|
||||
the current binfo. */
|
||||
inheritance, then we can't see it, unless we are a friend of
|
||||
the current binfo. */
|
||||
if (BINFO_BASE_ACCESS (binfo, ix) != access_public_node)
|
||||
{
|
||||
tree scope;
|
||||
@ -1763,8 +1763,8 @@ dfs_walk_once_accessible (tree binfo, bool friends_p,
|
||||
if (!BINFO_INHERITANCE_CHAIN (binfo))
|
||||
{
|
||||
/* We are at the top of the hierarchy, and can use the
|
||||
CLASSTYPE_VBASECLASSES list for unmarking the virtual
|
||||
bases. */
|
||||
CLASSTYPE_VBASECLASSES list for unmarking the virtual
|
||||
bases. */
|
||||
VEC(tree,gc) *vbases;
|
||||
unsigned ix;
|
||||
tree base_binfo;
|
||||
@ -1903,7 +1903,7 @@ look_for_overrides (tree type, tree fndecl)
|
||||
tree basetype = BINFO_TYPE (base_binfo);
|
||||
|
||||
if (TYPE_POLYMORPHIC_P (basetype))
|
||||
found += look_for_overrides_r (basetype, fndecl);
|
||||
found += look_for_overrides_r (basetype, fndecl);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
@ -1931,21 +1931,21 @@ look_for_overrides_here (tree type, tree fndecl)
|
||||
tree fns = VEC_index (tree, CLASSTYPE_METHOD_VEC (type), ix);
|
||||
|
||||
for (; fns; fns = OVL_NEXT (fns))
|
||||
{
|
||||
tree fn = OVL_CURRENT (fns);
|
||||
{
|
||||
tree fn = OVL_CURRENT (fns);
|
||||
|
||||
if (!DECL_VIRTUAL_P (fn))
|
||||
/* Not a virtual. */;
|
||||
else if (DECL_CONTEXT (fn) != type)
|
||||
/* Introduced with a using declaration. */;
|
||||
if (!DECL_VIRTUAL_P (fn))
|
||||
/* Not a virtual. */;
|
||||
else if (DECL_CONTEXT (fn) != type)
|
||||
/* Introduced with a using declaration. */;
|
||||
else if (DECL_STATIC_FUNCTION_P (fndecl))
|
||||
{
|
||||
tree btypes = TYPE_ARG_TYPES (TREE_TYPE (fn));
|
||||
tree dtypes = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
|
||||
if (compparms (TREE_CHAIN (btypes), dtypes))
|
||||
if (compparms (TREE_CHAIN (btypes), dtypes))
|
||||
return fn;
|
||||
}
|
||||
else if (same_signature_p (fndecl, fn))
|
||||
}
|
||||
else if (same_signature_p (fndecl, fn))
|
||||
return fn;
|
||||
}
|
||||
}
|
||||
@ -2149,7 +2149,7 @@ check_hidden_convs (tree binfo, int virtual_depth, int virtualness,
|
||||
if (virtual_depth || virtualness)
|
||||
{
|
||||
/* In a virtual hierarchy, we could be hidden, or could hide a
|
||||
conversion function on the other_convs list. */
|
||||
conversion function on the other_convs list. */
|
||||
for (level = other_convs; level; level = TREE_CHAIN (level))
|
||||
{
|
||||
int we_hide_them;
|
||||
|
@ -75,9 +75,9 @@ static tree finalize_nrv_r (tree *, int *, void *);
|
||||
example:
|
||||
|
||||
class A {
|
||||
typedef int X;
|
||||
typedef int X;
|
||||
public:
|
||||
X f();
|
||||
X f();
|
||||
};
|
||||
|
||||
A::X A::f();
|
||||
@ -122,8 +122,8 @@ typedef struct deferred_access GTY(())
|
||||
declared because code like:
|
||||
|
||||
class A {
|
||||
class B {};
|
||||
B* f();
|
||||
class B {};
|
||||
B* f();
|
||||
}
|
||||
|
||||
A::B* A::f() { return 0; }
|
||||
@ -498,11 +498,11 @@ finish_cond (tree *cond_p, tree expr)
|
||||
|
||||
/* If *COND_P specifies a conditional with a declaration, transform the
|
||||
loop such that
|
||||
while (A x = 42) { }
|
||||
for (; A x = 42;) { }
|
||||
while (A x = 42) { }
|
||||
for (; A x = 42;) { }
|
||||
becomes
|
||||
while (true) { A x = 42; if (!x) break; }
|
||||
for (;;) { A x = 42; if (!x) break; }
|
||||
while (true) { A x = 42; if (!x) break; }
|
||||
for (;;) { A x = 42; if (!x) break; }
|
||||
The statement list for BODY will be empty if the conditional did
|
||||
not declare anything. */
|
||||
|
||||
@ -827,7 +827,7 @@ finish_for_expr (tree expr, tree for_stmt)
|
||||
if (!processing_template_decl)
|
||||
{
|
||||
if (warn_sequence_point)
|
||||
verify_sequence_points (expr);
|
||||
verify_sequence_points (expr);
|
||||
expr = convert_to_void (expr, "3rd expression in for");
|
||||
}
|
||||
else if (!type_dependent_expression_p (expr))
|
||||
@ -1224,7 +1224,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands,
|
||||
if (TREE_TYPE (operand) == unknown_type_node)
|
||||
{
|
||||
error ("type of asm operand %qE could not be determined",
|
||||
TREE_VALUE (t));
|
||||
TREE_VALUE (t));
|
||||
operand = error_mark_node;
|
||||
}
|
||||
|
||||
@ -1445,7 +1445,7 @@ check_accessibility_of_qualified_id (tree decl,
|
||||
I *p;
|
||||
p->A::I::~I();
|
||||
|
||||
In this case, we will have "A::I" as the DECL, but "I" as the
|
||||
In this case, we will have "A::I" as the DECL, but "I" as the
|
||||
OBJECT_TYPE. */
|
||||
&& CLASS_TYPE_P (object_type)
|
||||
&& DERIVED_FROM_P (scope, object_type))
|
||||
@ -1822,7 +1822,7 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p)
|
||||
. operator.... [Otherwise] a contrived object of type T
|
||||
becomes the implied object argument.
|
||||
|
||||
This paragraph is unclear about this situation:
|
||||
This paragraph is unclear about this situation:
|
||||
|
||||
struct A { void f(); };
|
||||
struct B : public A {};
|
||||
@ -1865,7 +1865,7 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p)
|
||||
if (TREE_CODE (fn) == FUNCTION_DECL
|
||||
&& (DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
|
||||
|| DECL_BUILT_IN_CLASS (fn) == BUILT_IN_MD))
|
||||
result = resolve_overloaded_builtin (fn, args);
|
||||
result = resolve_overloaded_builtin (fn, args);
|
||||
|
||||
if (!result)
|
||||
/* A call to a namespace-scope function. */
|
||||
@ -1963,17 +1963,17 @@ finish_pseudo_destructor_expr (tree object, tree scope, tree destructor)
|
||||
|
||||
/* [expr.pseudo] says both:
|
||||
|
||||
The type designated by the pseudo-destructor-name shall be
|
||||
The type designated by the pseudo-destructor-name shall be
|
||||
the same as the object type.
|
||||
|
||||
and:
|
||||
and:
|
||||
|
||||
The cv-unqualified versions of the object type and of the
|
||||
The cv-unqualified versions of the object type and of the
|
||||
type designated by the pseudo-destructor-name shall be the
|
||||
same type.
|
||||
|
||||
We implement the more generous second sentence, since that is
|
||||
what most other compilers do. */
|
||||
We implement the more generous second sentence, since that is
|
||||
what most other compilers do. */
|
||||
if (!same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (object),
|
||||
destructor))
|
||||
{
|
||||
@ -2122,10 +2122,10 @@ check_template_template_default_arg (tree argument)
|
||||
if (CLASSTYPE_TEMPLATE_INFO (t)
|
||||
&& CLASSTYPE_TEMPLATE_INSTANTIATION (t))
|
||||
error ("invalid use of type %qT as a default value for a "
|
||||
"template template-parameter", t);
|
||||
"template template-parameter", t);
|
||||
else
|
||||
error ("invalid use of %qD as a default value for a template "
|
||||
"template-parameter", argument);
|
||||
"template-parameter", argument);
|
||||
}
|
||||
else
|
||||
error ("invalid default argument for a template template parameter");
|
||||
@ -2151,7 +2151,7 @@ begin_class_definition (tree t)
|
||||
/* A non-implicit typename comes from code like:
|
||||
|
||||
template <typename T> struct A {
|
||||
template <typename U> struct A<T>::B ...
|
||||
template <typename U> struct A<T>::B ...
|
||||
|
||||
This is erroneous. */
|
||||
else if (TREE_CODE (t) == TYPENAME_TYPE)
|
||||
@ -2380,10 +2380,10 @@ finish_base_specifier (tree base, tree access, bool virtual_p)
|
||||
else
|
||||
{
|
||||
if (cp_type_quals (base) != 0)
|
||||
{
|
||||
error ("base class %qT has cv qualifiers", base);
|
||||
base = TYPE_MAIN_VARIANT (base);
|
||||
}
|
||||
{
|
||||
error ("base class %qT has cv qualifiers", base);
|
||||
base = TYPE_MAIN_VARIANT (base);
|
||||
}
|
||||
result = build_tree_list (access, base);
|
||||
if (virtual_p)
|
||||
TREE_TYPE (result) = integer_type_node;
|
||||
@ -2686,8 +2686,8 @@ finish_id_expression (tree id_expression,
|
||||
}
|
||||
|
||||
/* Only certain kinds of names are allowed in constant
|
||||
expression. Enumerators and template parameters have already
|
||||
been handled above. */
|
||||
expression. Enumerators and template parameters have already
|
||||
been handled above. */
|
||||
if (integral_constant_expression_p
|
||||
&& ! DECL_INTEGRAL_CONSTANT_VAR_P (decl)
|
||||
&& ! builtin_valid_in_constant_expr_p (decl))
|
||||
@ -2851,8 +2851,8 @@ finish_typeof (tree expr)
|
||||
|
||||
static tree
|
||||
simplify_aggr_init_exprs_r (tree* tp,
|
||||
int* walk_subtrees,
|
||||
void* data ATTRIBUTE_UNUSED)
|
||||
int* walk_subtrees,
|
||||
void* data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* We don't need to walk into types; there's nothing in a type that
|
||||
needs simplification. (And, furthermore, there are places we
|
||||
@ -3022,9 +3022,9 @@ expand_body (tree fn)
|
||||
if (DECL_CLONED_FUNCTION_P (fn))
|
||||
{
|
||||
/* If this is a clone, go through the other clones now and mark
|
||||
their parameters used. We have to do that here, as we don't
|
||||
know whether any particular clone will be expanded, and
|
||||
therefore cannot pick one arbitrarily. */
|
||||
their parameters used. We have to do that here, as we don't
|
||||
know whether any particular clone will be expanded, and
|
||||
therefore cannot pick one arbitrarily. */
|
||||
tree probe;
|
||||
|
||||
for (probe = TREE_CHAIN (DECL_CLONED_FUNCTION (fn));
|
||||
|
@ -59,7 +59,7 @@ static tree handle_init_priority_attribute (tree *, tree, tree, int, bool *);
|
||||
|
||||
static cp_lvalue_kind
|
||||
lvalue_p_1 (tree ref,
|
||||
int treat_class_rvalues_as_lvalues)
|
||||
int treat_class_rvalues_as_lvalues)
|
||||
{
|
||||
cp_lvalue_kind op1_lvalue_kind = clk_none;
|
||||
cp_lvalue_kind op2_lvalue_kind = clk_none;
|
||||
@ -93,9 +93,9 @@ lvalue_p_1 (tree ref,
|
||||
/* Look at the member designator. */
|
||||
if (!op1_lvalue_kind
|
||||
/* The "field" can be a FUNCTION_DECL or an OVERLOAD in some
|
||||
situations. */
|
||||
|| TREE_CODE (TREE_OPERAND (ref, 1)) != FIELD_DECL)
|
||||
;
|
||||
situations. */
|
||||
|| TREE_CODE (TREE_OPERAND (ref, 1)) != FIELD_DECL)
|
||||
;
|
||||
else if (DECL_C_BIT_FIELD (TREE_OPERAND (ref, 1)))
|
||||
{
|
||||
/* Clear the ordinary bit. If this object was a class
|
||||
@ -433,8 +433,8 @@ build_cplus_array_type (tree elt_type, tree index_type)
|
||||
|
||||
tree
|
||||
cp_build_qualified_type_real (tree type,
|
||||
int type_quals,
|
||||
tsubst_flags_t complain)
|
||||
int type_quals,
|
||||
tsubst_flags_t complain)
|
||||
{
|
||||
tree result;
|
||||
int bad_quals = TYPE_UNQUALIFIED;
|
||||
@ -528,17 +528,17 @@ cp_build_qualified_type_real (tree type,
|
||||
else
|
||||
{
|
||||
if (complain & tf_ignore_bad_quals)
|
||||
/* We're not going to warn about constifying things that can't
|
||||
be constified. */
|
||||
bad_quals &= ~TYPE_QUAL_CONST;
|
||||
/* We're not going to warn about constifying things that can't
|
||||
be constified. */
|
||||
bad_quals &= ~TYPE_QUAL_CONST;
|
||||
if (bad_quals)
|
||||
{
|
||||
tree bad_type = build_qualified_type (ptr_type_node, bad_quals);
|
||||
{
|
||||
tree bad_type = build_qualified_type (ptr_type_node, bad_quals);
|
||||
|
||||
if (!(complain & tf_ignore_bad_quals))
|
||||
error ("%qV qualifiers cannot be applied to %qT",
|
||||
if (!(complain & tf_ignore_bad_quals))
|
||||
error ("%qV qualifiers cannot be applied to %qT",
|
||||
bad_type, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Retrieve (or create) the appropriately qualified variant. */
|
||||
@ -899,7 +899,7 @@ build_exception_variant (tree type, tree raises)
|
||||
|
||||
for (; v; v = TYPE_NEXT_VARIANT (v))
|
||||
if (check_qualified_type (v, type, type_quals)
|
||||
&& comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), 1))
|
||||
&& comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), 1))
|
||||
return v;
|
||||
|
||||
/* Need to build a new variant. */
|
||||
@ -965,8 +965,8 @@ count_trees (tree t)
|
||||
|
||||
static tree
|
||||
verify_stmt_tree_r (tree* tp,
|
||||
int* walk_subtrees ATTRIBUTE_UNUSED ,
|
||||
void* data)
|
||||
int* walk_subtrees ATTRIBUTE_UNUSED ,
|
||||
void* data)
|
||||
{
|
||||
tree t = *tp;
|
||||
htab_t *statements = (htab_t *) data;
|
||||
@ -1002,8 +1002,8 @@ verify_stmt_tree (tree t)
|
||||
|
||||
static tree
|
||||
find_tree_r (tree* tp,
|
||||
int* walk_subtrees ATTRIBUTE_UNUSED ,
|
||||
void* data)
|
||||
int* walk_subtrees ATTRIBUTE_UNUSED ,
|
||||
void* data)
|
||||
{
|
||||
if (*tp == (tree) data)
|
||||
return (tree) data;
|
||||
@ -1146,8 +1146,8 @@ bot_manip (tree* tp, int* walk_subtrees, void* data)
|
||||
if (!TYPE_P (t) && TREE_CONSTANT (t))
|
||||
{
|
||||
/* There can't be any TARGET_EXPRs or their slot variables below
|
||||
this point. We used to check !TREE_SIDE_EFFECTS, but then we
|
||||
failed to copy an ADDR_EXPR of the slot VAR_DECL. */
|
||||
this point. We used to check !TREE_SIDE_EFFECTS, but then we
|
||||
failed to copy an ADDR_EXPR of the slot VAR_DECL. */
|
||||
*walk_subtrees = 0;
|
||||
return NULL_TREE;
|
||||
}
|
||||
@ -1193,8 +1193,8 @@ bot_manip (tree* tp, int* walk_subtrees, void* data)
|
||||
|
||||
static tree
|
||||
bot_replace (tree* t,
|
||||
int* walk_subtrees ATTRIBUTE_UNUSED ,
|
||||
void* data)
|
||||
int* walk_subtrees ATTRIBUTE_UNUSED ,
|
||||
void* data)
|
||||
{
|
||||
splay_tree target_remap = ((splay_tree) data);
|
||||
|
||||
@ -1642,8 +1642,8 @@ maybe_dummy_object (tree type, tree* binfop)
|
||||
|
||||
if (current_class_ref && context == current_class_type
|
||||
/* Kludge: Make sure that current_class_type is actually
|
||||
correct. It might not be if we're in the middle of
|
||||
tsubst_default_argument. */
|
||||
correct. It might not be if we're in the middle of
|
||||
tsubst_default_argument. */
|
||||
&& same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (current_class_ref)),
|
||||
current_class_type))
|
||||
decl = current_class_ref;
|
||||
@ -1722,17 +1722,17 @@ const struct attribute_spec cxx_attribute_table[] =
|
||||
{ "java_interface", 0, 0, false, false, false, handle_java_interface_attribute },
|
||||
{ "com_interface", 0, 0, false, false, false, handle_com_interface_attribute },
|
||||
{ "init_priority", 1, 1, true, false, false, handle_init_priority_attribute },
|
||||
{ NULL, 0, 0, false, false, false, NULL }
|
||||
{ NULL, 0, 0, false, false, false, NULL }
|
||||
};
|
||||
|
||||
/* Handle a "java_interface" attribute; arguments as in
|
||||
struct attribute_spec.handler. */
|
||||
static tree
|
||||
handle_java_interface_attribute (tree* node,
|
||||
tree name,
|
||||
tree args ATTRIBUTE_UNUSED ,
|
||||
int flags,
|
||||
bool* no_add_attrs)
|
||||
tree name,
|
||||
tree args ATTRIBUTE_UNUSED ,
|
||||
int flags,
|
||||
bool* no_add_attrs)
|
||||
{
|
||||
if (DECL_P (*node)
|
||||
|| !CLASS_TYPE_P (*node)
|
||||
@ -1754,10 +1754,10 @@ handle_java_interface_attribute (tree* node,
|
||||
struct attribute_spec.handler. */
|
||||
static tree
|
||||
handle_com_interface_attribute (tree* node,
|
||||
tree name,
|
||||
tree args ATTRIBUTE_UNUSED ,
|
||||
int flags ATTRIBUTE_UNUSED ,
|
||||
bool* no_add_attrs)
|
||||
tree name,
|
||||
tree args ATTRIBUTE_UNUSED ,
|
||||
int flags ATTRIBUTE_UNUSED ,
|
||||
bool* no_add_attrs)
|
||||
{
|
||||
static int warned;
|
||||
|
||||
@ -1783,10 +1783,10 @@ handle_com_interface_attribute (tree* node,
|
||||
struct attribute_spec.handler. */
|
||||
static tree
|
||||
handle_init_priority_attribute (tree* node,
|
||||
tree name,
|
||||
tree args,
|
||||
int flags ATTRIBUTE_UNUSED ,
|
||||
bool* no_add_attrs)
|
||||
tree name,
|
||||
tree args,
|
||||
int flags ATTRIBUTE_UNUSED ,
|
||||
bool* no_add_attrs)
|
||||
{
|
||||
tree initp_expr = TREE_VALUE (args);
|
||||
tree decl = *node;
|
||||
@ -1819,7 +1819,7 @@ handle_init_priority_attribute (tree* node,
|
||||
|| current_function_decl)
|
||||
{
|
||||
error ("can only use %qE attribute on file-scope definitions "
|
||||
"of objects of class type", name);
|
||||
"of objects of class type", name);
|
||||
*no_add_attrs = true;
|
||||
return NULL_TREE;
|
||||
}
|
||||
@ -1921,7 +1921,7 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
|
||||
case TYPEOF_TYPE:
|
||||
case BASELINK:
|
||||
/* None of these have subtrees other than those already walked
|
||||
above. */
|
||||
above. */
|
||||
*walk_subtrees_p = 0;
|
||||
break;
|
||||
|
||||
|
202
gcc/cp/typeck.c
202
gcc/cp/typeck.c
@ -380,10 +380,10 @@ type_after_usual_arithmetic_conversions (tree t1, tree t2)
|
||||
attributes);
|
||||
|
||||
/* Two floating-point types whose TYPE_MAIN_VARIANTs are none of
|
||||
the standard C++ floating-point types. Logic earlier in this
|
||||
function has already eliminated the possibility that
|
||||
TYPE_PRECISION (t2) != TYPE_PRECISION (t1), so there's no
|
||||
compelling reason to choose one or the other. */
|
||||
the standard C++ floating-point types. Logic earlier in this
|
||||
function has already eliminated the possibility that
|
||||
TYPE_PRECISION (t2) != TYPE_PRECISION (t1), so there's no
|
||||
compelling reason to choose one or the other. */
|
||||
return build_type_attribute_variant (t1, attributes);
|
||||
}
|
||||
}
|
||||
@ -504,7 +504,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
|
||||
|
||||
if (pedantic && TYPE_PTRFN_P (t2))
|
||||
pedwarn ("ISO C++ forbids %s between pointer of type %<void *%> "
|
||||
"and pointer-to-function", location);
|
||||
"and pointer-to-function", location);
|
||||
result_type
|
||||
= cp_build_qualified_type (void_type_node,
|
||||
(cp_type_quals (TREE_TYPE (t1))
|
||||
@ -785,23 +785,23 @@ comp_except_types (tree a, tree b, bool exact)
|
||||
else if (!exact)
|
||||
{
|
||||
if (cp_type_quals (a) || cp_type_quals (b))
|
||||
return false;
|
||||
return false;
|
||||
|
||||
if (TREE_CODE (a) == POINTER_TYPE
|
||||
&& TREE_CODE (b) == POINTER_TYPE)
|
||||
{
|
||||
a = TREE_TYPE (a);
|
||||
b = TREE_TYPE (b);
|
||||
if (cp_type_quals (a) || cp_type_quals (b))
|
||||
return false;
|
||||
}
|
||||
&& TREE_CODE (b) == POINTER_TYPE)
|
||||
{
|
||||
a = TREE_TYPE (a);
|
||||
b = TREE_TYPE (b);
|
||||
if (cp_type_quals (a) || cp_type_quals (b))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TREE_CODE (a) != RECORD_TYPE
|
||||
|| TREE_CODE (b) != RECORD_TYPE)
|
||||
return false;
|
||||
|| TREE_CODE (b) != RECORD_TYPE)
|
||||
return false;
|
||||
|
||||
if (PUBLICLY_UNIQUELY_DERIVED_P (a, b))
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -822,11 +822,11 @@ comp_except_specs (tree t1, tree t2, bool exact)
|
||||
if (t1 == t2)
|
||||
return true;
|
||||
|
||||
if (t1 == NULL_TREE) /* T1 is ... */
|
||||
if (t1 == NULL_TREE) /* T1 is ... */
|
||||
return t2 == NULL_TREE || !exact;
|
||||
if (!TREE_VALUE (t1)) /* t1 is EMPTY */
|
||||
if (!TREE_VALUE (t1)) /* t1 is EMPTY */
|
||||
return t2 != NULL_TREE && !TREE_VALUE (t2);
|
||||
if (t2 == NULL_TREE) /* T2 is ... */
|
||||
if (t2 == NULL_TREE) /* T2 is ... */
|
||||
return false;
|
||||
if (TREE_VALUE (t1) && !TREE_VALUE (t2)) /* T2 is EMPTY, T1 is not */
|
||||
return !exact;
|
||||
@ -838,20 +838,20 @@ comp_except_specs (tree t1, tree t2, bool exact)
|
||||
for (base = t1; t2 != NULL_TREE; t2 = TREE_CHAIN (t2))
|
||||
{
|
||||
for (probe = base; probe != NULL_TREE; probe = TREE_CHAIN (probe))
|
||||
{
|
||||
tree a = TREE_VALUE (probe);
|
||||
tree b = TREE_VALUE (t2);
|
||||
{
|
||||
tree a = TREE_VALUE (probe);
|
||||
tree b = TREE_VALUE (t2);
|
||||
|
||||
if (comp_except_types (a, b, exact))
|
||||
{
|
||||
if (probe == base && exact)
|
||||
base = TREE_CHAIN (probe);
|
||||
length++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (comp_except_types (a, b, exact))
|
||||
{
|
||||
if (probe == base && exact)
|
||||
base = TREE_CHAIN (probe);
|
||||
length++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (probe == NULL_TREE)
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
return !exact || base == NULL_TREE || length == list_length (t1);
|
||||
}
|
||||
@ -905,9 +905,9 @@ comp_array_types (tree t1, tree t2, bool allow_redeclaration)
|
||||
&& !value_dependent_expression_p (max2))
|
||||
{
|
||||
/* With abi-1 we do not fold non-dependent array bounds, (and
|
||||
consequently mangle them incorrectly). We must therefore
|
||||
fold them here, to verify the domains have the same
|
||||
value. */
|
||||
consequently mangle them incorrectly). We must therefore
|
||||
fold them here, to verify the domains have the same
|
||||
value. */
|
||||
max1 = fold (max1);
|
||||
max2 = fold (max2);
|
||||
}
|
||||
@ -1058,14 +1058,14 @@ comptypes (tree t1, tree t2, int strict)
|
||||
case TYPENAME_TYPE:
|
||||
if (!cp_tree_equal (TYPENAME_TYPE_FULLNAME (t1),
|
||||
TYPENAME_TYPE_FULLNAME (t2)))
|
||||
return false;
|
||||
return false;
|
||||
if (!same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2)))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case UNBOUND_CLASS_TEMPLATE:
|
||||
if (!cp_tree_equal (TYPE_IDENTIFIER (t1), TYPE_IDENTIFIER (t2)))
|
||||
return false;
|
||||
return false;
|
||||
if (!same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2)))
|
||||
return false;
|
||||
break;
|
||||
@ -1291,7 +1291,7 @@ cxx_sizeof_or_alignof_expr (tree e, enum tree_code op)
|
||||
else if (is_overloaded_fn (e))
|
||||
{
|
||||
pedwarn ("ISO C++ forbids applying %qs to an expression of "
|
||||
"function type", op_name);
|
||||
"function type", op_name);
|
||||
e = char_type_node;
|
||||
}
|
||||
else if (type_unknown_p (e))
|
||||
@ -1632,9 +1632,9 @@ build_class_member_access_expr (tree object, tree member,
|
||||
if (!member_scope || !DERIVED_FROM_P (member_scope, object_type))
|
||||
{
|
||||
if (TREE_CODE (member) == FIELD_DECL)
|
||||
error ("invalid use of nonstatic data member %qE", member);
|
||||
error ("invalid use of nonstatic data member %qE", member);
|
||||
else
|
||||
error ("%qD is not a member of %qT", member, object_type);
|
||||
error ("%qD is not a member of %qT", member, object_type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -1685,7 +1685,7 @@ build_class_member_access_expr (tree object, tree member,
|
||||
if (null_object_p && kind == bk_via_virtual)
|
||||
{
|
||||
error ("invalid access to non-static data member %qD of "
|
||||
"NULL object",
|
||||
"NULL object",
|
||||
member);
|
||||
error ("(perhaps the %<offsetof%> macro was used incorrectly)");
|
||||
return error_mark_node;
|
||||
@ -2088,18 +2088,18 @@ build_indirect_ref (tree ptr, const char *errorstring)
|
||||
If the type of the expression is "pointer to T," the type
|
||||
of the result is "T."
|
||||
|
||||
We must use the canonical variant because certain parts of
|
||||
We must use the canonical variant because certain parts of
|
||||
the back end, like fold, do pointer comparisons between
|
||||
types. */
|
||||
tree t = canonical_type_variant (TREE_TYPE (type));
|
||||
|
||||
if (VOID_TYPE_P (t))
|
||||
{
|
||||
/* A pointer to incomplete type (other than cv void) can be
|
||||
dereferenced [expr.unary.op]/1 */
|
||||
error ("%qT is not a pointer-to-object type", type);
|
||||
return error_mark_node;
|
||||
}
|
||||
{
|
||||
/* A pointer to incomplete type (other than cv void) can be
|
||||
dereferenced [expr.unary.op]/1 */
|
||||
error ("%qT is not a pointer-to-object type", type);
|
||||
return error_mark_node;
|
||||
}
|
||||
else if (TREE_CODE (pointer) == ADDR_EXPR
|
||||
&& same_type_p (t, TREE_TYPE (TREE_OPERAND (pointer, 0))))
|
||||
/* The POINTER was something like `&x'. We simplify `*&x' to
|
||||
@ -2467,8 +2467,8 @@ build_function_call (tree function, tree params)
|
||||
if (TYPE_PTRMEMFUNC_P (fntype))
|
||||
{
|
||||
error ("must use %<.*%> or %<->*%> to call pointer-to-member "
|
||||
"function in %<%E (...)%>",
|
||||
original);
|
||||
"function in %<%E (...)%>",
|
||||
original);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -2663,7 +2663,7 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags)
|
||||
if (fndecl)
|
||||
{
|
||||
cp_error_at ("too few arguments to %s %q+#D",
|
||||
called_thing, fndecl);
|
||||
called_thing, fndecl);
|
||||
error ("at this point in file");
|
||||
}
|
||||
else
|
||||
@ -2815,7 +2815,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
|
||||
if (t != error_mark_node)
|
||||
{
|
||||
pedwarn ("assuming cast to type %qT from overloaded function",
|
||||
TREE_TYPE (t));
|
||||
TREE_TYPE (t));
|
||||
op0 = t;
|
||||
}
|
||||
}
|
||||
@ -2825,7 +2825,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
|
||||
if (t != error_mark_node)
|
||||
{
|
||||
pedwarn ("assuming cast to type %qT from overloaded function",
|
||||
TREE_TYPE (t));
|
||||
TREE_TYPE (t));
|
||||
op1 = t;
|
||||
}
|
||||
}
|
||||
@ -3356,10 +3356,10 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
|
||||
if (TREE_CODE (TREE_TYPE (orig_op0)) == ENUMERAL_TYPE
|
||||
&& TREE_CODE (TREE_TYPE (orig_op1)) == ENUMERAL_TYPE
|
||||
&& TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0))
|
||||
!= TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1)))
|
||||
!= TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1)))
|
||||
{
|
||||
warning (0, "comparison between types %q#T and %q#T",
|
||||
TREE_TYPE (orig_op0), TREE_TYPE (orig_op1));
|
||||
TREE_TYPE (orig_op0), TREE_TYPE (orig_op1));
|
||||
}
|
||||
|
||||
/* Give warnings for comparisons between signed and unsigned
|
||||
@ -3607,34 +3607,34 @@ build_x_unary_op (enum tree_code code, tree xarg)
|
||||
if (TREE_CODE (xarg) != OFFSET_REF)
|
||||
{
|
||||
error ("invalid use of %qE to form a pointer-to-member-function."
|
||||
" Use a qualified-id.",
|
||||
" Use a qualified-id.",
|
||||
xarg);
|
||||
return error_mark_node;
|
||||
}
|
||||
else
|
||||
{
|
||||
error ("parenthesis around %qE cannot be used to form a"
|
||||
" pointer-to-member-function",
|
||||
" pointer-to-member-function",
|
||||
xarg);
|
||||
PTRMEM_OK_P (xarg) = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (TREE_CODE (xarg) == OFFSET_REF)
|
||||
{
|
||||
ptrmem = PTRMEM_OK_P (xarg);
|
||||
{
|
||||
ptrmem = PTRMEM_OK_P (xarg);
|
||||
|
||||
if (!ptrmem && !flag_ms_extensions
|
||||
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (xarg, 1))) == METHOD_TYPE)
|
||||
if (!ptrmem && !flag_ms_extensions
|
||||
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (xarg, 1))) == METHOD_TYPE)
|
||||
{
|
||||
/* A single non-static member, make sure we don't allow a
|
||||
pointer-to-member. */
|
||||
pointer-to-member. */
|
||||
xarg = build2 (OFFSET_REF, TREE_TYPE (xarg),
|
||||
TREE_OPERAND (xarg, 0),
|
||||
ovl_cons (TREE_OPERAND (xarg, 1), NULL_TREE));
|
||||
PTRMEM_OK_P (xarg) = ptrmem;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (TREE_CODE (xarg) == TARGET_EXPR)
|
||||
warning (0, "taking address of temporary");
|
||||
exp = build_unary_op (ADDR_EXPR, xarg, 0);
|
||||
@ -3882,15 +3882,15 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
|
||||
|
||||
if (!COMPLETE_OR_VOID_TYPE_P (type))
|
||||
error ("cannot %s a pointer to incomplete type %qT",
|
||||
((code == PREINCREMENT_EXPR
|
||||
|| code == POSTINCREMENT_EXPR)
|
||||
? "increment" : "decrement"), TREE_TYPE (argtype));
|
||||
((code == PREINCREMENT_EXPR
|
||||
|| code == POSTINCREMENT_EXPR)
|
||||
? "increment" : "decrement"), TREE_TYPE (argtype));
|
||||
else if ((pedantic || warn_pointer_arith)
|
||||
&& !TYPE_PTROB_P (argtype))
|
||||
pedwarn ("ISO C++ forbids %sing a pointer of type %qT",
|
||||
((code == PREINCREMENT_EXPR
|
||||
|| code == POSTINCREMENT_EXPR)
|
||||
? "increment" : "decrement"), argtype);
|
||||
((code == PREINCREMENT_EXPR
|
||||
|| code == POSTINCREMENT_EXPR)
|
||||
? "increment" : "decrement"), argtype);
|
||||
inc = cxx_sizeof_nowarn (TREE_TYPE (argtype));
|
||||
}
|
||||
else
|
||||
@ -4007,7 +4007,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
|
||||
|
||||
if (TREE_CODE (arg) == COMPONENT_REF && type_unknown_p (arg)
|
||||
&& !really_overloaded_fn (TREE_OPERAND (arg, 1)))
|
||||
{
|
||||
{
|
||||
/* They're trying to take the address of a unique non-static
|
||||
member function. This is ill-formed (except in MS-land),
|
||||
but let's try to DTRT.
|
||||
@ -4041,7 +4041,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
|
||||
base, name);
|
||||
}
|
||||
arg = build_offset_ref (base, name, /*address_p=*/true);
|
||||
}
|
||||
}
|
||||
|
||||
offset_ref:
|
||||
if (type_unknown_p (arg))
|
||||
@ -4297,7 +4297,7 @@ cxx_mark_addressable (tree exp)
|
||||
case PARM_DECL:
|
||||
if (x == current_class_ptr)
|
||||
{
|
||||
error ("cannot take the address of %<this%>, which is an rvalue expression");
|
||||
error ("cannot take the address of %<this%>, which is an rvalue expression");
|
||||
TREE_ADDRESSABLE (x) = 1; /* so compiler doesn't die later. */
|
||||
return true;
|
||||
}
|
||||
@ -4442,7 +4442,7 @@ build_compound_expr (tree lhs, tree rhs)
|
||||
if (TREE_CODE (rhs) == TARGET_EXPR)
|
||||
{
|
||||
/* If the rhs is a TARGET_EXPR, then build the compound
|
||||
expression inside the target_expr's initializer. This
|
||||
expression inside the target_expr's initializer. This
|
||||
helps the compiler to eliminate unnecessary temporaries. */
|
||||
tree init = TREE_OPERAND (rhs, 1);
|
||||
|
||||
@ -4614,7 +4614,7 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p,
|
||||
}
|
||||
/* [expr.static.cast]
|
||||
|
||||
If T is a reference type, the result is an lvalue; otherwise,
|
||||
If T is a reference type, the result is an lvalue; otherwise,
|
||||
the result is an rvalue. */
|
||||
if (TREE_CODE (type) != REFERENCE_TYPE
|
||||
&& real_lvalue_p (result))
|
||||
@ -4833,7 +4833,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
|
||||
if (! real_lvalue_p (expr))
|
||||
{
|
||||
error ("invalid cast of an rvalue expression of type "
|
||||
"%qT to type %qT",
|
||||
"%qT to type %qT",
|
||||
intype, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
@ -4892,7 +4892,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
|
||||
{
|
||||
if (TYPE_PRECISION (type) < TYPE_PRECISION (intype))
|
||||
pedwarn ("cast from %qT to %qT loses precision",
|
||||
intype, type);
|
||||
intype, type);
|
||||
}
|
||||
/* [expr.reinterpret.cast]
|
||||
A value of integral or enumeration type can be explicitly
|
||||
@ -4927,10 +4927,10 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
|
||||
{
|
||||
if (pedantic)
|
||||
/* Only issue a warning, as we have always supported this
|
||||
where possible, and it is necessary in some cases. DR 195
|
||||
addresses this issue, but as of 2004/10/26 is still in
|
||||
drafting. */
|
||||
warning (0, "ISO C++ forbids casting between pointer-to-function and pointer-to-object");
|
||||
where possible, and it is necessary in some cases. DR 195
|
||||
addresses this issue, but as of 2004/10/26 is still in
|
||||
drafting. */
|
||||
warning (0, "ISO C++ forbids casting between pointer-to-function and pointer-to-object");
|
||||
return fold_if_not_in_template (build_nop (type, expr));
|
||||
}
|
||||
else if (TREE_CODE (type) == VECTOR_TYPE)
|
||||
@ -5360,8 +5360,8 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
|
||||
else
|
||||
{
|
||||
/* A binary op has been requested. Combine the old LHS
|
||||
value with the RHS producing the value we should actually
|
||||
store into the LHS. */
|
||||
value with the RHS producing the value we should actually
|
||||
store into the LHS. */
|
||||
|
||||
gcc_assert (!PROMOTES_TO_AGGR_TYPE (lhstype, REFERENCE_TYPE));
|
||||
lhs = stabilize_reference (lhs);
|
||||
@ -5447,7 +5447,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
|
||||
pedwarn ("ISO C++ forbids assignment of arrays");
|
||||
|
||||
from_array = TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
|
||||
? 1 + (modifycode != INIT_EXPR): 0;
|
||||
? 1 + (modifycode != INIT_EXPR): 0;
|
||||
return build_vec_init (lhs, NULL_TREE, newrhs, from_array);
|
||||
}
|
||||
|
||||
@ -5674,7 +5674,7 @@ build_ptrmemfunc (tree type, tree pfn, int force, bool c_cast_p)
|
||||
if (!force
|
||||
&& !can_convert_arg (to_type, TREE_TYPE (pfn), pfn))
|
||||
error ("invalid conversion to type %qT from type %qT",
|
||||
to_type, pfn_type);
|
||||
to_type, pfn_type);
|
||||
|
||||
n = get_delta_difference (TYPE_PTRMEMFUNC_OBJECT_TYPE (pfn_type),
|
||||
TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type),
|
||||
@ -5765,8 +5765,8 @@ expand_ptrmemfunc_cst (tree cst, tree *delta, tree *pfn)
|
||||
else
|
||||
{
|
||||
/* If we're dealing with a virtual function, we have to adjust 'this'
|
||||
again, to point to the base which provides the vtable entry for
|
||||
fn; the call will do the opposite adjustment. */
|
||||
again, to point to the base which provides the vtable entry for
|
||||
fn; the call will do the opposite adjustment. */
|
||||
tree orig_class = DECL_CONTEXT (fn);
|
||||
tree binfo = binfo_or_else (orig_class, fn_class);
|
||||
*delta = build2 (PLUS_EXPR, TREE_TYPE (*delta),
|
||||
@ -5918,7 +5918,7 @@ convert_for_assignment (tree type, tree rhs,
|
||||
instantiate_type (type, rhs, tf_error | tf_warning);
|
||||
else if (fndecl)
|
||||
error ("cannot convert %qT to %qT for argument %qP to %qD",
|
||||
rhstype, type, parmnum, fndecl);
|
||||
rhstype, type, parmnum, fndecl);
|
||||
else
|
||||
error ("cannot convert %qT to %qT in %s", rhstype, type, errtype);
|
||||
return error_mark_node;
|
||||
@ -6149,7 +6149,7 @@ check_return_expr (tree retval)
|
||||
finish_expr_stmt (retval);
|
||||
else
|
||||
pedwarn ("return-statement with a value, in function "
|
||||
"returning 'void'");
|
||||
"returning 'void'");
|
||||
|
||||
current_function_returns_null = 1;
|
||||
|
||||
@ -6180,7 +6180,7 @@ check_return_expr (tree retval)
|
||||
&& ! flag_check_new
|
||||
&& null_ptr_cst_p (retval))
|
||||
warning (0, "%<operator new%> must not return NULL unless it is "
|
||||
"declared %<throw()%> (or -fcheck-new is in effect)");
|
||||
"declared %<throw()%> (or -fcheck-new is in effect)");
|
||||
|
||||
/* Effective C++ rule 15. See also start_function. */
|
||||
if (warn_ecpp
|
||||
@ -6262,7 +6262,7 @@ check_return_expr (tree retval)
|
||||
|
||||
/* First convert the value to the function's return type, then
|
||||
to the type of return value's location to handle the
|
||||
case that functype is smaller than the valtype. */
|
||||
case that functype is smaller than the valtype. */
|
||||
retval = convert_for_initialization
|
||||
(NULL_TREE, functype, retval, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
|
||||
"return", NULL_TREE, 0);
|
||||
@ -6446,14 +6446,14 @@ cp_apply_type_quals_to_decl (int type_quals, tree decl)
|
||||
&& type_quals != TYPE_UNQUALIFIED)
|
||||
{
|
||||
/* This was an error in C++98 (cv-qualifiers cannot be added to
|
||||
a function type), but DR 295 makes the code well-formed by
|
||||
dropping the extra qualifiers. */
|
||||
a function type), but DR 295 makes the code well-formed by
|
||||
dropping the extra qualifiers. */
|
||||
if (pedantic)
|
||||
{
|
||||
tree bad_type = build_qualified_type (type, type_quals);
|
||||
pedwarn ("ignoring %qV qualifiers added to function type %qT",
|
||||
bad_type, type);
|
||||
}
|
||||
{
|
||||
tree bad_type = build_qualified_type (type, type_quals);
|
||||
pedwarn ("ignoring %qV qualifiers added to function type %qT",
|
||||
bad_type, type);
|
||||
}
|
||||
|
||||
TREE_TYPE (decl) = TYPE_MAIN_VARIANT (type);
|
||||
return;
|
||||
@ -6494,19 +6494,19 @@ casts_away_constness_r (tree *t1, tree *t2)
|
||||
|
||||
For two pointer types:
|
||||
|
||||
X1 is T1cv1,1 * ... cv1,N * where T1 is not a pointer type
|
||||
X2 is T2cv2,1 * ... cv2,M * where T2 is not a pointer type
|
||||
K is min(N,M)
|
||||
X1 is T1cv1,1 * ... cv1,N * where T1 is not a pointer type
|
||||
X2 is T2cv2,1 * ... cv2,M * where T2 is not a pointer type
|
||||
K is min(N,M)
|
||||
|
||||
casting from X1 to X2 casts away constness if, for a non-pointer
|
||||
type T there does not exist an implicit conversion (clause
|
||||
_conv_) from:
|
||||
|
||||
Tcv1,(N-K+1) * cv1,(N-K+2) * ... cv1,N *
|
||||
Tcv1,(N-K+1) * cv1,(N-K+2) * ... cv1,N *
|
||||
|
||||
to
|
||||
|
||||
Tcv2,(M-K+1) * cv2,(M-K+2) * ... cv2,M *. */
|
||||
Tcv2,(M-K+1) * cv2,(M-K+2) * ... cv2,M *. */
|
||||
if ((!TYPE_PTR_P (*t1) && !TYPE_PTRMEM_P (*t1))
|
||||
|| (!TYPE_PTR_P (*t2) && !TYPE_PTRMEM_P (*t2)))
|
||||
{
|
||||
|
108
gcc/cp/typeck2.c
108
gcc/cp/typeck2.c
@ -84,9 +84,9 @@ readonly_error (tree arg, const char* string, int soft)
|
||||
if (TREE_CODE (arg) == COMPONENT_REF)
|
||||
{
|
||||
if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
|
||||
fmt = "%s of data-member %qD in read-only structure";
|
||||
fmt = "%s of data-member %qD in read-only structure";
|
||||
else
|
||||
fmt = "%s of read-only data-member %qD";
|
||||
fmt = "%s of read-only data-member %qD";
|
||||
(*fn) (fmt, string, TREE_OPERAND (arg, 1));
|
||||
}
|
||||
else if (TREE_CODE (arg) == VAR_DECL)
|
||||
@ -102,9 +102,9 @@ readonly_error (tree arg, const char* string, int soft)
|
||||
else if (TREE_CODE (arg) == PARM_DECL)
|
||||
(*fn) ("%s of read-only parameter %qD", string, arg);
|
||||
else if (TREE_CODE (arg) == INDIRECT_REF
|
||||
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REFERENCE_TYPE
|
||||
&& (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
|
||||
|| TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))
|
||||
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REFERENCE_TYPE
|
||||
&& (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
|
||||
|| TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))
|
||||
(*fn) ("%s of read-only reference %qD", string, TREE_OPERAND (arg, 0));
|
||||
else if (TREE_CODE (arg) == RESULT_DECL)
|
||||
(*fn) ("%s of read-only named return value %qD", string, arg);
|
||||
@ -326,8 +326,8 @@ abstract_virtuals_error (tree decl, tree type)
|
||||
for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++)
|
||||
inform ("%J\t%#D", fn, fn);
|
||||
/* Now truncate the vector. This leaves it non-null, so we know
|
||||
there are pure virtuals, but empty so we don't list them out
|
||||
again. */
|
||||
there are pure virtuals, but empty so we don't list them out
|
||||
again. */
|
||||
VEC_truncate (tree, pure, 0);
|
||||
}
|
||||
else
|
||||
@ -386,7 +386,7 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
|
||||
case UNION_TYPE:
|
||||
case ENUMERAL_TYPE:
|
||||
if (!decl)
|
||||
(*p_msg) ("invalid use of undefined type %q#T", type);
|
||||
(*p_msg) ("invalid use of undefined type %q#T", type);
|
||||
if (!TYPE_TEMPLATE_INFO (type))
|
||||
(*p_msg_at) ("forward declaration of %q#T", type);
|
||||
else
|
||||
@ -399,10 +399,10 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
|
||||
|
||||
case ARRAY_TYPE:
|
||||
if (TYPE_DOMAIN (type))
|
||||
{
|
||||
type = TREE_TYPE (type);
|
||||
goto retry;
|
||||
}
|
||||
{
|
||||
type = TREE_TYPE (type);
|
||||
goto retry;
|
||||
}
|
||||
(*p_msg) ("invalid use of array with unspecified bounds");
|
||||
break;
|
||||
|
||||
@ -417,14 +417,14 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
|
||||
|
||||
case UNKNOWN_TYPE:
|
||||
if (value && TREE_CODE (value) == COMPONENT_REF)
|
||||
goto bad_member;
|
||||
goto bad_member;
|
||||
else if (value && TREE_CODE (value) == ADDR_EXPR)
|
||||
(*p_msg) ("address of overloaded function with no contextual "
|
||||
"type information");
|
||||
(*p_msg) ("address of overloaded function with no contextual "
|
||||
"type information");
|
||||
else if (value && TREE_CODE (value) == OVERLOAD)
|
||||
(*p_msg) ("overloaded function with no contextual type information");
|
||||
(*p_msg) ("overloaded function with no contextual type information");
|
||||
else
|
||||
(*p_msg) ("insufficient contextual information to determine type");
|
||||
(*p_msg) ("insufficient contextual information to determine type");
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -474,10 +474,10 @@ split_nonconstant_init_1 (tree dest, tree init)
|
||||
if (TREE_CODE (value) == CONSTRUCTOR)
|
||||
{
|
||||
if (array_type_p)
|
||||
sub = build4 (ARRAY_REF, inner_type, dest, field_index,
|
||||
sub = build4 (ARRAY_REF, inner_type, dest, field_index,
|
||||
NULL_TREE, NULL_TREE);
|
||||
else
|
||||
sub = build3 (COMPONENT_REF, inner_type, dest, field_index,
|
||||
sub = build3 (COMPONENT_REF, inner_type, dest, field_index,
|
||||
NULL_TREE);
|
||||
|
||||
split_nonconstant_init_1 (sub, value);
|
||||
@ -487,10 +487,10 @@ split_nonconstant_init_1 (tree dest, tree init)
|
||||
*pelt = TREE_CHAIN (elt);
|
||||
|
||||
if (array_type_p)
|
||||
sub = build4 (ARRAY_REF, inner_type, dest, field_index,
|
||||
sub = build4 (ARRAY_REF, inner_type, dest, field_index,
|
||||
NULL_TREE, NULL_TREE);
|
||||
else
|
||||
sub = build3 (COMPONENT_REF, inner_type, dest, field_index,
|
||||
sub = build3 (COMPONENT_REF, inner_type, dest, field_index,
|
||||
NULL_TREE);
|
||||
|
||||
code = build2 (MODIFY_EXPR, inner_type, sub, value);
|
||||
@ -580,7 +580,7 @@ store_init_value (tree decl, tree init)
|
||||
if (TREE_CODE (init) == TREE_LIST)
|
||||
{
|
||||
error ("constructor syntax used, but no constructor declared "
|
||||
"for type %qT", type);
|
||||
"for type %qT", type);
|
||||
init = build_constructor (NULL_TREE, nreverse (init));
|
||||
}
|
||||
}
|
||||
@ -774,7 +774,7 @@ digest_init (tree type, tree init, tree* tail)
|
||||
if (TYPE_NON_AGGREGATE_CLASS (type))
|
||||
{
|
||||
error ("subobject of type %qT must be initialized by "
|
||||
"constructor, not by %qE",
|
||||
"constructor, not by %qE",
|
||||
type, init);
|
||||
return error_mark_node;
|
||||
}
|
||||
@ -994,17 +994,17 @@ process_init_constructor (tree type, tree init, tree* elts)
|
||||
next1 = build_functional_cast (TREE_TYPE (field),
|
||||
NULL_TREE);
|
||||
else
|
||||
{
|
||||
{
|
||||
next1 = build_constructor (NULL_TREE, NULL_TREE);
|
||||
if (init)
|
||||
TREE_HAS_CONSTRUCTOR (next1)
|
||||
= TREE_HAS_CONSTRUCTOR (init);
|
||||
}
|
||||
if (init)
|
||||
TREE_HAS_CONSTRUCTOR (next1)
|
||||
= TREE_HAS_CONSTRUCTOR (init);
|
||||
}
|
||||
next1 = digest_init (TREE_TYPE (field), next1, 0);
|
||||
|
||||
/* Warn when some struct elements are implicitly initialized. */
|
||||
if (warn_missing_field_initializers
|
||||
&& (!init || BRACE_ENCLOSED_INITIALIZER_P (init)))
|
||||
&& (!init || BRACE_ENCLOSED_INITIALIZER_P (init)))
|
||||
warning (0, "missing initializer for member %qD", field);
|
||||
}
|
||||
else
|
||||
@ -1019,7 +1019,7 @@ process_init_constructor (tree type, tree init, tree* elts)
|
||||
/* Warn when some struct elements are implicitly initialized
|
||||
to zero. */
|
||||
if (warn_missing_field_initializers
|
||||
&& (!init || BRACE_ENCLOSED_INITIALIZER_P (init)))
|
||||
&& (!init || BRACE_ENCLOSED_INITIALIZER_P (init)))
|
||||
warning (0, "missing initializer for member %qD", field);
|
||||
|
||||
if (! zero_init_p (TREE_TYPE (field)))
|
||||
@ -1074,7 +1074,7 @@ process_init_constructor (tree type, tree init, tree* elts)
|
||||
field = temp, win = 1;
|
||||
else
|
||||
error ("no field %qD in union being initialized",
|
||||
TREE_PURPOSE (tail));
|
||||
TREE_PURPOSE (tail));
|
||||
}
|
||||
if (!win)
|
||||
TREE_VALUE (tail) = error_mark_node;
|
||||
@ -1082,7 +1082,7 @@ process_init_constructor (tree type, tree init, tree* elts)
|
||||
else if (field == 0)
|
||||
{
|
||||
error ("union %qT with no named members cannot be initialized",
|
||||
type);
|
||||
type);
|
||||
TREE_VALUE (tail) = error_mark_node;
|
||||
}
|
||||
|
||||
@ -1288,7 +1288,7 @@ build_m_component_ref (tree datum, tree component)
|
||||
if (!TYPE_PTR_TO_MEMBER_P (ptrmem_type))
|
||||
{
|
||||
error ("%qE cannot be used as a member pointer, since it is of "
|
||||
"type %qT",
|
||||
"type %qT",
|
||||
component, ptrmem_type);
|
||||
return error_mark_node;
|
||||
}
|
||||
@ -1297,8 +1297,8 @@ build_m_component_ref (tree datum, tree component)
|
||||
if (! IS_AGGR_TYPE (objtype))
|
||||
{
|
||||
error ("cannot apply member pointer %qE to %qE, which is of "
|
||||
"non-aggregate type %qT",
|
||||
component, datum, objtype);
|
||||
"non-aggregate type %qT",
|
||||
component, datum, objtype);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
@ -1319,7 +1319,7 @@ build_m_component_ref (tree datum, tree component)
|
||||
{
|
||||
mismatch:
|
||||
error ("pointer to member type %qT incompatible with object "
|
||||
"type %qT",
|
||||
"type %qT",
|
||||
type, objtype);
|
||||
return error_mark_node;
|
||||
}
|
||||
@ -1459,9 +1459,9 @@ add_exception_specifier (tree list, tree spec, int complain)
|
||||
{
|
||||
ok = true;
|
||||
/* 15.4/1 says that types in an exception specifier must be complete,
|
||||
but it seems more reasonable to only require this on definitions
|
||||
and calls. So just give a pedwarn at this point; we will give an
|
||||
error later if we hit one of those two cases. */
|
||||
but it seems more reasonable to only require this on definitions
|
||||
and calls. So just give a pedwarn at this point; we will give an
|
||||
error later if we hit one of those two cases. */
|
||||
if (!COMPLETE_TYPE_P (complete_type (core)))
|
||||
diag_type = 2; /* pedwarn */
|
||||
}
|
||||
@ -1471,8 +1471,8 @@ add_exception_specifier (tree list, tree spec, int complain)
|
||||
tree probe;
|
||||
|
||||
for (probe = list; probe; probe = TREE_CHAIN (probe))
|
||||
if (same_type_p (TREE_VALUE (probe), spec))
|
||||
break;
|
||||
if (same_type_p (TREE_VALUE (probe), spec))
|
||||
break;
|
||||
if (!probe)
|
||||
list = tree_cons (NULL_TREE, spec, list);
|
||||
}
|
||||
@ -1502,20 +1502,20 @@ merge_exception_specifiers (tree list, tree add)
|
||||
tree orig_list = list;
|
||||
|
||||
for (; add; add = TREE_CHAIN (add))
|
||||
{
|
||||
tree spec = TREE_VALUE (add);
|
||||
tree probe;
|
||||
{
|
||||
tree spec = TREE_VALUE (add);
|
||||
tree probe;
|
||||
|
||||
for (probe = orig_list; probe; probe = TREE_CHAIN (probe))
|
||||
if (same_type_p (TREE_VALUE (probe), spec))
|
||||
break;
|
||||
if (!probe)
|
||||
{
|
||||
spec = build_tree_list (NULL_TREE, spec);
|
||||
TREE_CHAIN (spec) = list;
|
||||
list = spec;
|
||||
}
|
||||
}
|
||||
for (probe = orig_list; probe; probe = TREE_CHAIN (probe))
|
||||
if (same_type_p (TREE_VALUE (probe), spec))
|
||||
break;
|
||||
if (!probe)
|
||||
{
|
||||
spec = build_tree_list (NULL_TREE, spec);
|
||||
TREE_CHAIN (spec) = list;
|
||||
list = spec;
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user