Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
594740f3
Commit
594740f3
authored
Jul 19, 1996
by
Mike Stump
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
87th Cygnus<->FSF quick merge
From-SVN: r12535
parent
686cada4
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
410 additions
and
106 deletions
+410
-106
gcc/cp/ChangeLog
+82
-5
gcc/cp/call.c
+2
-0
gcc/cp/cp-tree.def
+1
-0
gcc/cp/cvt.c
+76
-17
gcc/cp/decl.c
+9
-4
gcc/cp/decl2.c
+1
-1
gcc/cp/init.c
+9
-8
gcc/cp/mpw-config.in
+11
-0
gcc/cp/mpw-make.sed
+110
-0
gcc/cp/parse.y
+2
-1
gcc/cp/typeck.c
+104
-70
gcc/cp/typeck2.c
+3
-0
No files found.
gcc/cp/ChangeLog
View file @
594740f3
Fri Jul 19 14:04:05 1996 Mike Stump <mrs@cygnus.com>
* decl.c (lookup_name_real): Make sure we do obj->X::i correctly.
Thu Jul 18 14:48:23 1996 Bob Manson <manson@charmed.cygnus.com>
* decl2.c (import_export_vtable): ASM_OUTPUT_EXTERNAL, not
ASSEMBLE_EXTERNAL.
Mon Jul 15 17:48:43 1996 Mike Stump <mrs@cygnus.com>
* typeck2.c (process_init_constructor): New pedwarn for using { }
to initialize a pointer to member function.
* typeck.c (build_ptrmemfunc1): Avoid use of digest_init so that
we can avoid the new error.
Mon Jul 15 15:42:03 1996 Mike Stump <mrs@cygnus.com>
* typeck.c (build_ptrmemfunc1): New function to hide details of
pointer to member functions better.
Mon Jul 15 14:23:02 1996 Mike Stump <mrs@cygnus.com>
* init.c (resolve_offset_ref): Resolve OFFSET_REFs that are
methods into the actual method, as we know the implied object is
not used.
Mon Jul 15 13:08:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* parse.y (maybecomma_warn): Only emit the pedwarn if we're not
inside a system header.
Fri Jul 12 16:30:05 1996 Bob Manson <manson@charmed.cygnus.com>
* call.c (build_method_call): Call complete_type on the
instance type.
Thu Jul 11 17:16:40 1996 Mike Stump <mrs@cygnus.com>
* typeck.c (build_component_ref): Always build up an OFFSET_REF
for obj_ptr->func so that we can know which object to use in a
method call.
Wed Jul 10 19:36:37 1996 Mike Stump <mrs@cygnus.com>
* typeck.c (build_ptrmemfunc): Remove sorry, now we can cast
around things. Also improve maintainability.
Wed Jul 10 18:20:11 1996 Bob Manson <manson@charmed.cygnus.com>
* decl.c (grokdeclarator): Check for overflow when evaluating an
array dimension.
Wed Jul 10 17:26:19 1996 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (cp_convert): Don't check for ambiguity with constructor
if NEW_OVER.
* typeck.c (build_x_function_call): Pass function overload
questions to new overloading code if NEW_OVER.
* init.c (expand_aggr_init_1): Only check for type conversion ops
if we're doing copy-initialization (i.e. LOOKUP_ONLYCONVERTING).
Don't check for ambiguity with constructor if NEW_OVER.
* cvt.c (convert_to_reference): Dereference the result of a type
conversion operator.
(build_conv): Propagate ICS_USER_FLAG.
(implicit_conversion): Call instantiate_type.
Pass LOOKUP_ONLYCONVERTING instead of LOOKUP_NORMAL.
(add_function_candidate): Fix cv-quals on argtype.
(print_z_candidates): New function.
(build_new_function_call): Call it.
(build_user_type_conversion_1): If LOOKUP_ONLYCONVERTING, don't
consider non-converting constructors.
Call print_z_candidates.
Return an AMBIG_CONV for an ambiguous conversion.
(build_user_type_conversion): Handle AMBIG_CONV.
(convert_like): Fix test for building TARGET_EXPR.
Call instantiate_type.
Handle AMBIG_CONV and LVALUE_CONV.
(build_over_call): Handle 0 args and ellipsis.
* cp-tree.def: Add AMBIG_CONV.
Tue Jul 9 17:48:48 1996 Mike Stump <mrs@cygnus.com>
* decl.c (lookup_name_real): If we find mem in obj when parsing
...
...
@@ -223,11 +305,6 @@ Fri Jun 7 10:37:33 1996 Mike Stump <mrs@cygnus.com>
* typeck.c (c_expand_return): Don't try and convert the return
value twice when we want a reference, once is enough.
Sat May 11 04:33:50 1996 Doug Evans <dje@canuck.cygnus.com>
* decl2.c (finish_vtable_vardecl): Surround DECL_ONE_ONLY with ifdef.
(finish_file): Likewise.
Tue Jun 4 15:41:45 1996 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (tsubst_expr, case DECL_STMT): Don't pass
...
...
gcc/cp/call.c
View file @
594740f3
...
...
@@ -1928,6 +1928,8 @@ build_method_call (instance, name, parms, basetype_path, flags)
&&
TYPE_IDENTIFIER
(
basetype
)
!=
name
)
basetype
=
SIGNATURE_TYPE
(
basetype
);
basetype
=
complete_type
(
basetype
);
if
((
IS_SIGNATURE
(
basetype
)
&&
(
instance_ptr
=
instance
))
||
(
lvalue_p
(
instance
)
...
...
gcc/cp/cp-tree.def
View file @
594740f3
...
...
@@ -147,3 +147,4 @@ DEFTREECODE (PMEM_CONV, "pmem_conv", "e", 1)
DEFTREECODE (BASE_CONV, "base_conv", "e", 1)
DEFTREECODE (REF_BIND, "ref_bind", "e", 1)
DEFTREECODE (USER_CONV, "user_conv", "e", 4)
DEFTREECODE (AMBIG_CONV, "ambig_conv", "e", 1)
gcc/cp/cvt.c
View file @
594740f3
...
...
@@ -719,6 +719,8 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
#ifdef NEW_OVER
rval_as_conversion
=
build_type_conversion
(
CONVERT_EXPR
,
reftype
,
expr
,
1
);
if
(
rval_as_conversion
)
rval_as_conversion
=
convert_from_reference
(
rval_as_conversion
);
#else
rval_as_conversion
=
build_type_conversion
(
CONVERT_EXPR
,
type
,
expr
,
1
);
#endif
...
...
@@ -1340,6 +1342,7 @@ cp_convert (type, expr, convtype, flags)
return
conversion
;
}
#ifndef NEW_OVER
if
(
TYPE_HAS_CONSTRUCTOR
(
complete_type
(
type
)))
ctor
=
build_method_call
(
NULL_TREE
,
ctor_identifier
,
build_tree_list
(
NULL_TREE
,
e
),
...
...
@@ -1366,13 +1369,14 @@ cp_convert (type, expr, convtype, flags)
return
NULL_TREE
;
return
error_mark_node
;
}
else
if
(
conversion
)
return
conversion
;
else
if
(
ctor
)
{
ctor
=
build_cplus_new
(
type
,
ctor
);
return
ctor
;
}
#endif
else
if
(
conversion
)
return
conversion
;
}
/* If TYPE or TREE_TYPE (E) is not on the permanent_obstack,
...
...
@@ -1914,6 +1918,7 @@ build_conv (code, type, from)
break
;
}
ICS_STD_RANK
(
t
)
=
rank
;
ICS_USER_FLAG
(
t
)
=
ICS_USER_FLAG
(
from
);
return
t
;
}
...
...
@@ -2124,6 +2129,14 @@ implicit_conversion (to, from, expr, flags)
tree
conv
;
struct
z_candidate
*
cand
;
if
(
expr
&&
type_unknown_p
(
expr
))
{
expr
=
instantiate_type
(
to
,
expr
,
0
);
if
(
expr
==
error_mark_node
)
return
0
;
from
=
TREE_TYPE
(
expr
);
}
if
(
TREE_CODE
(
to
)
==
REFERENCE_TYPE
)
conv
=
reference_binding
(
to
,
from
,
expr
);
else
...
...
@@ -2137,7 +2150,7 @@ implicit_conversion (to, from, expr, flags)
||
IS_AGGR_TYPE
(
non_reference
(
to
)))
&&
(
flags
&
LOOKUP_NO_CONVERSION
)
==
0
)
{
cand
=
build_user_type_conversion_1
(
to
,
expr
,
LOOKUP_
NORMAL
);
cand
=
build_user_type_conversion_1
(
to
,
expr
,
LOOKUP_
ONLYCONVERTING
);
if
(
cand
)
conv
=
cand
->
second_conv
;
else
if
(
TREE_CODE
(
to
)
==
REFERENCE_TYPE
...
...
@@ -2145,7 +2158,7 @@ implicit_conversion (to, from, expr, flags)
&&
!
TYPE_VOLATILE
(
TREE_TYPE
(
to
)))
{
cand
=
build_user_type_conversion_1
(
TYPE_MAIN_VARIANT
(
TREE_TYPE
(
to
)),
expr
,
LOOKUP_
NORMAL
);
(
TYPE_MAIN_VARIANT
(
TREE_TYPE
(
to
)),
expr
,
LOOKUP_
ONLYCONVERTING
);
if
(
cand
)
conv
=
build_conv
(
REF_BIND
,
TREE_TYPE
(
to
),
cand
->
second_conv
);
}
...
...
@@ -2181,6 +2194,9 @@ add_function_candidate (candidates, fn, arglist, flags)
tree
argtype
=
TREE_TYPE
(
arg
);
tree
t
;
argtype
=
cp_build_type_variant
(
argtype
,
TREE_READONLY
(
arg
),
TREE_THIS_VOLATILE
(
arg
));
if
(
parmnode
==
void_list_node
)
break
;
else
if
(
parmnode
)
...
...
@@ -2286,6 +2302,17 @@ build_this (obj)
return
build_unary_op
(
ADDR_EXPR
,
obj
,
0
);
}
void
print_z_candidates
(
candidates
)
struct
z_candidate
*
candidates
;
{
cp_error_at
(
"candidates are: %D"
,
candidates
->
fn
);
candidates
=
candidates
->
next
;
for
(;
candidates
;
candidates
=
candidates
->
next
)
cp_error_at
(
" %D"
,
candidates
->
fn
);
}
/* Returns the best overload candidate to perform the requested
conversion. */
...
...
@@ -2314,6 +2341,9 @@ build_user_type_conversion_1 (totype, expr, flags)
}
for
(;
ctors
;
ctors
=
DECL_CHAIN
(
ctors
))
{
if
((
flags
&
LOOKUP_ONLYCONVERTING
)
&&
DECL_NONCONVERTING_P
(
ctors
))
continue
;
candidates
=
add_function_candidate
(
candidates
,
ctors
,
args
,
flags
);
candidates
->
second_conv
=
build1
(
EXACT_CONV
,
totype
,
NULL_TREE
);
candidates
->
basetype_path
=
TYPE_BINFO
(
totype
);
...
...
@@ -2355,12 +2385,16 @@ build_user_type_conversion_1 (totype, expr, flags)
if
(
cand
==
0
)
{
/* For recursive overloading, we need to wait and only diagnose this
if we are chosen */
if
(
flags
&
LOOKUP_COMPLAIN
)
cp_error
(
"ambiguous user-defined type conversion"
);
{
cp_error
(
"ambiguous user-defined type conversion"
);
print_z_candidates
(
candidates
);
}
return
0
;
cand
=
candidates
;
/* any one will do */
cand
->
second_conv
=
build1
(
AMBIG_CONV
,
totype
,
expr
);
return
cand
;
}
for
(
p
=
&
(
cand
->
second_conv
);
TREE_CODE
(
*
p
)
!=
EXACT_CONV
;
)
...
...
@@ -2384,7 +2418,11 @@ build_user_type_conversion (totype, expr, flags)
=
build_user_type_conversion_1
(
totype
,
expr
,
flags
);
if
(
cand
)
return
convert_like
(
cand
->
second_conv
,
expr
);
{
if
(
TREE_CODE
(
cand
->
second_conv
)
==
AMBIG_CONV
)
return
error_mark_node
;
return
convert_like
(
cand
->
second_conv
,
expr
);
}
return
NULL_TREE
;
}
...
...
@@ -2422,6 +2460,7 @@ build_new_function_call (fn, args, obj)
if
(
cand
==
0
)
{
cp_error
(
"ambiguous function call"
);
print_z_candidates
(
candidates
);
return
error_mark_node
;
}
...
...
@@ -2466,21 +2505,35 @@ convert_like (convs, expr)
expr
=
build_over_call
(
TREE_OPERAND
(
convs
,
1
),
TREE_OPERAND
(
convs
,
2
),
DECL_CONSTRUCTOR_P
(
fn
)
?
expr
:
build_this
(
expr
),
LOOKUP_NORMAL
);
if
(
IS_AGGR_TYPE
(
TREE_TYPE
(
convs
)))
/* If this is a constructor or a function returning an aggr type,
we need to build up a TARGET_EXPR. */
if
(
DECL_CONSTRUCTOR_P
(
fn
)
||
IS_AGGR_TYPE
(
TREE_TYPE
(
TREE_TYPE
(
fn
))))
expr
=
build_cplus_new
(
TREE_TYPE
(
convs
),
expr
);
return
expr
;
}
case
EXACT_CONV
:
if
(
type_unknown_p
(
expr
))
expr
=
instantiate_type
(
TREE_TYPE
(
convs
),
expr
,
1
);
return
expr
;
case
AMBIG_CONV
:
/* Call build_user_type_conversion again for the error. */
return
build_user_type_conversion
(
TREE_TYPE
(
convs
),
TREE_OPERAND
(
convs
,
0
),
LOOKUP_NORMAL
);
};
expr
=
convert_like
(
TREE_OPERAND
(
convs
,
0
),
expr
);
switch
(
TREE_CODE
(
convs
))
{
case
REF_BIND
:
expr
=
convert_like
(
TREE_OPERAND
(
convs
,
0
),
expr
);
return
convert_to_reference
(
build_reference_type
(
TREE_TYPE
(
convs
)),
expr
,
CONV_IMPLICIT
,
LOOKUP_NORMAL
|
LOOKUP_NO_CONVERSION
,
error_mark_node
);
case
LVALUE_CONV
:
return
decay_conversion
(
expr
);
}
expr
=
convert_like
(
TREE_OPERAND
(
convs
,
0
),
expr
);
return
cp_convert
(
TREE_TYPE
(
convs
),
expr
,
CONV_IMPLICIT
,
LOOKUP_NORMAL
|
LOOKUP_NO_CONVERSION
);
}
...
...
@@ -2526,7 +2579,7 @@ build_over_call (fn, convs, args, flags)
tree
conv
,
arg
;
int
i
;
if
(
TREE_CODE
(
args
)
!=
TREE_LIST
)
if
(
args
&&
TREE_CODE
(
args
)
!=
TREE_LIST
)
args
=
build_tree_list
(
NULL_TREE
,
args
);
arg
=
args
;
...
...
@@ -2555,18 +2608,24 @@ build_over_call (fn, convs, args, flags)
conv
=
TREE_CHAIN
(
conv
);
}
for
(
i
=
0
;
conv
=
TREE_VEC_ELT
(
convs
,
i
),
arg
;
for
(
i
=
0
;
conv
=
TREE_VEC_ELT
(
convs
,
i
),
arg
&&
parm
;
parm
=
TREE_CHAIN
(
parm
),
arg
=
TREE_CHAIN
(
arg
),
++
i
)
converted_args
=
tree_cons
(
NULL_TREE
,
convert_like
(
conv
,
TREE_VALUE
(
arg
)),
converted_args
);
/* Default arguments */
for
(;
parm
&&
parm
!=
void_list_node
;
parm
=
TREE_CHAIN
(
parm
))
converted_args
=
tree_cons
(
NULL_TREE
,
convert_default_arg
(
TREE_VALUE
(
parm
),
TREE_PURPOSE
(
parm
)),
converted_args
);
/* Ellipsis */
for
(;
arg
;
arg
=
TREE_CHAIN
(
arg
))
converted_args
=
tree_cons
(
NULL_TREE
,
default_conversion
(
TREE_VALUE
(
arg
)),
converted_args
);
converted_args
=
nreverse
(
converted_args
);
mark_used
(
fn
);
...
...
@@ -2594,9 +2653,9 @@ build_over_call (fn, convs, args, flags)
}
/* Compare two implicit conversion sequences that differ only in their
qualification conversion. */
qualification conversion.
Subroutine of compare_ics.
*/
int
static
int
compare_qual
(
ics1
,
ics2
)
tree
ics1
,
ics2
;
{
...
...
gcc/cp/decl.c
View file @
594740f3
...
...
@@ -4444,11 +4444,9 @@ lookup_name_real (name, prefer_type, nonclass)
}
#endif
if
(
got_scope
||
val
)
if
(
got_scope
)
goto
done
;
/* This special lookup only applies to types. */
else
if
(
got_object
&&
val
&&
TREE_CODE
(
val
)
==
TYPE_DECL
)
else
if
(
got_object
&&
val
)
from_obj
=
val
;
}
...
...
@@ -4522,6 +4520,8 @@ lookup_name_real (name, prefer_type, nonclass)
cp_pedwarn
(
" does not match lookup in the current scope (`%#T')"
,
TREE_TYPE
(
val
));
}
val
=
from_obj
;
}
if
((
TREE_CODE
(
val
)
==
TEMPLATE_DECL
&&
looking_for_template
)
...
...
@@ -8435,6 +8435,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
integer_one_node
),
1
));
if
(
!
TREE_CONSTANT
(
itype
))
itype
=
variable_size
(
itype
);
else
if
(
TREE_OVERFLOW
(
itype
))
{
error
(
"overflow in array dimension"
);
TREE_OVERFLOW
(
itype
)
=
0
;
}
/* If we're a parm, we need to have a permanent type so
mangling checks for re-use will work right. If both the
...
...
gcc/cp/decl2.c
View file @
594740f3
...
...
@@ -2542,7 +2542,7 @@ import_export_vtable (decl, type, final)
TREE_PUBLIC
(
decl
)
=
1
;
DECL_WEAK
(
decl
)
=
1
;
}
#ifdef AS
SEMBLE
_EXTERNAL
#ifdef AS
M_OUTPUT
_EXTERNAL
else
if
(
TREE_PUBLIC
(
decl
))
cp_error
(
"all virtual functions redeclared inline"
);
#endif
...
...
gcc/cp/init.c
View file @
594740f3
...
...
@@ -1530,21 +1530,20 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
return
;
}
#ifndef NEW_OVER
/* See whether we can go through a type conversion operator.
This wins over going through a non-existent constructor. If
there is a constructor, it is ambiguous. */
if
(
TREE_CODE
(
init
)
!=
TREE_LIST
)
/* If this is copy-initialization, see whether we can go through a
type conversion operator. */
if
(
TREE_CODE
(
init
)
!=
TREE_LIST
&&
(
flags
&
LOOKUP_ONLYCONVERTING
))
{
tree
ttype
=
TREE_CODE
(
init_type
)
==
REFERENCE_TYPE
?
TREE_TYPE
(
init_type
)
:
init_type
;
if
(
ttype
!=
type
&&
IS_AGGR_TYPE
(
ttype
))
{
tree
rval
=
build_type_conversion
(
CONVERT_EXPR
,
type
,
init
,
0
);
tree
rval
=
build_type_conversion
(
CONVERT_EXPR
,
type
,
init
,
1
);
if
(
rval
)
{
#ifndef NEW_OVER
/* See if there is a constructor for``type'' that takes a
``ttype''-typed object. */
tree
parms
=
build_tree_list
(
NULL_TREE
,
init
);
...
...
@@ -1558,12 +1557,13 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
cp_error
(
"ambiguity between conversion to `%T' and constructor"
,
type
);
else
#endif
if
(
rval
!=
error_mark_node
)
expand_aggr_init_1
(
binfo
,
true_exp
,
exp
,
rval
,
alias_this
,
flags
);
return
;
}
}
}
#endif
}
/* We know that expand_default_init can handle everything we want
...
...
@@ -2022,7 +2022,8 @@ resolve_offset_ref (exp)
if
((
TREE_CODE
(
member
)
==
VAR_DECL
&&
!
TYPE_PTRMEMFUNC_P
(
TREE_TYPE
(
member
)))
||
TREE_CODE
(
TREE_TYPE
(
member
))
==
FUNCTION_TYPE
)
||
TREE_CODE
(
TREE_TYPE
(
member
))
==
FUNCTION_TYPE
||
TREE_CODE
(
TREE_TYPE
(
member
))
==
METHOD_TYPE
)
{
/* These were static members. */
if
(
mark_addressable
(
member
)
==
0
)
...
...
gcc/cp/mpw-config.in
0 → 100644
View file @
594740f3
# Configuration fragment for G++.
# Most of the real configuration work happens in the main GCC configure.
# We need to join some lines in the Makefile.in before the sed
# process will work properly. The funky little sed script works by
# recognizing lines with a trailing '$@ \', adding the next line to
# its "pattern space", editing out the backslash and line, then
# putting the result out.
sed -e '/$@ \\/{N;s/$@ \\./$@ /;P;D;}' \Option-d
"{srcdir}"Makefile.in >"{o}"hacked_Makefile.in
gcc/cp/mpw-make.sed
0 → 100644
View file @
594740f3
# Sed commands to finish translating the G++ Unix makefile into MPW syntax.
# Remove control-Ls, they upset MPW make.
s
/
//
g
# Remove references to always-empty variables used to mark things.
/
CYGNUS-LOCAL-
/
s
/
{CYGNUS-LOCAL-
[
a-z0-9
]
*
}
//
g
# Add a bunch of definitions, mostly empty.
/
^
# Variables that exist for you to override
.$
/
a
\
\
xmake_file =
\
tmake_file =
\
build_xm_file =
\
MALLOC =
\
MD_DEPS =
\
REAL_H =
\
HOST_CC_LD = {CC_LD}
\
ALL_CCLDFLAGS =
\
HOST_CCLDFLAGS =
\
CONFIG_H =
\
LIBDEPS =
\
# The "target" variable is special to MPW make, avoid it.
/
{target}
/
s
/
{target}
/
{target_canonical}
/
g
# Suppress the suppression of smart makes.
/
^
\.
y
\.
c
/
d
# Whack out "..." assignments.
/
\.\.\.
/
s
/
^
\(
[
a-z
_
]
*
=
\.\.\.\)
/
#
\1
/
# Previous edits go a little overboard, undo.
/
^
objext =
/
s
/
"{o}"
//
# Always link in low-level MPW functions.
/
^
LIBDEPS=
/
s
/
$
/
::strerror.c.o ::mpwlib.c.o
/
/
{CLIB}
/
s
/
{CLIB}
/
::strerror.c.o ::mpwlib.c.o {CLIB}
/
# Don't get tricky about finding various .o file, point at dir above.
/
^
SUBDIR_OBSTACK
/
s
/
`
.*
`
/
::obstack.c.o
/
/
^
SUBDIR_USE_ALLOCA
/
s
/
`
.*
`
/
::alloca.c.o
/
/
^
SUBDIR_MALLOC
/
s
/
`
.*
`
//
# Point includes at parent directly correctly.
/
^
INCLUDES =
.*$
/
s
/
:
\.
/
::
/
g
/
^
INCLUDES =
.*$
/
s
/
"{srcdir}"
\.\.
/
"{topsrcdir}"gcc:
/
g
# Add the special MPW include dirs.
/
^
INCLUDES =
.*$
/
s
/
$
/
-i "{topsrcdir}"include:mpw: -i :::extra-include:
/
# A nasty hack to reduce confusion.
/
true
/
s
/
; @true
$
//
# (should be in common translation?)
/
{CC_LD}
/
s
/
$
/
{EXTRALIBS}
/
# Don't use general compiler flags (which may include definitions
# and other compiler-only bits) with linking commands.
/
{CC_LD}
/
s
/
ALL_CFLAGS
/
ALL_CCLDFLAGS
/
# Whack out build rules that are not useful.
/
^
Makefile
\\
Option-f
/,/
^$
/
d
/^
c
onfig.status \\Option-f /,/^$/d
# (Note that MPW make is not case sensitive, and so this name
# is considered the same as "md_file".)
/
^
{MD_FILE}
\\
Option-f
/,/
^$
/
d
# Depending on config.status is not useful for us.
/
config
.
status
/
s
/
config
.
status
//
# Repeat of stuff from generic edit.
/
{s}
/
s
/
"{s}""{s}"
/
"{s}"
/
g
/
{s}
/
s
/
"{s}""{srcdir}"
/
"{s}"
/
g
/
{s}
/
s
/
"{srcdir}""{s}"
/
"{s}"
/
g
# Fix references to C frontend files in main dir.
/
::c-
/
s
/
"{o}"::c-
/
"{o}":c-
/
g
# Fix pathnames to generated files in the objdir.
/
parse
/
s
/
"{s}"parse
\.\(
[
chy
]
\)
/
"{o}"parse.
\1
/
g
/
parse
/
s
/
^
parse
\.\(
[
chy
]
\)
/
"{o}"parse.
\1
/
/
y
.
tab
.
c
/
s
/
"{s}"y
\.
tab
\.
c
/
"{o}"y.tab.c
/
g
/
y
.
tab
.
c
/
s
/
^
y
\.
tab
\.
c
/
"{o}"y.tab.c
/
/
y
.
tab
.
h
/
s
/
"{s}"y
\.
tab
\.
h
/
"{o}"y.tab.h
/
g
/
y
.
tab
.
h
/
s
/
^
y
\.
tab
\.
h
/
"{o}"y.tab.h
/
# Put in the definition of YYEMPTY directly.
/
grep
/
s
/
grep
.*
>>
/
Echo '#define YYEMPTY -1' >>
/
# If the dates are wrong, then this tries to run gperf, which we don't
# really want.
/
^
"{srcdir}"hash
.
h
/,/
hash
.
h
$
/
d
# Sed the object file list instead of using cat (meow).
/
cat
/
s
/
`cat
/
`sed -e 's,:,::,g' -e 's,{objext},.o,g'
/
# Simplify dependencies of generated parser files.
/
^
{PARSE_C}
/
s
/
^
/
#
/
/
^
stamp-parse
/
s
/
^
stamp-parse
/
{PARSE_C}
/
# Fix the compile line for the generated parser.
/
{CC} -c
/,/
echo {PARSE_C}
/
c
\
{CC} {ALL_CFLAGS} {ALL_CPPFLAGS} {INCLUDES} {BIG_SWITCHFLAG} "{o}"parse.c -o "{o}"parse.c.o
\
# Change all Rez commands to use mac-gcc.r.
/
{REZ}
/
s
/
"{s}"
[
-
a-zA-Z
{}
]
*
\.
r
/
"{topsrcdir}"gcc:mac-gcc.r
/
# Remove pathname junk from the container name.
/
{REZ}
/
s
/
'"'::cc1plus'"'
/
'"'cc1plus'"'
/
gcc/cp/parse.y
View file @
594740f3
...
...
@@ -2246,7 +2246,8 @@ maybecomma:
maybecomma_warn:
/* empty */
| ','
{ if (pedantic) pedwarn ("comma at end of enumerator list"); }
{ if (pedantic && !in_system_header)
pedwarn ("comma at end of enumerator list"); }
;
aggr: AGGR
...
...
gcc/cp/typeck.c
View file @
594740f3
...
...
@@ -1889,7 +1889,7 @@ build_component_ref (datum, component, basetype_path, protect)
fndecl
=
build_vfn_ref
(
&
addr
,
datum
,
DECL_VINDEX
(
fndecl
));
}
mark_used
(
fndecl
);
return
fndecl
;
return
build
(
OFFSET_REF
,
TREE_TYPE
(
fndecl
),
datum
,
fndecl
)
;
}
if
(
access
==
access_protected_node
)
cp_error
(
"member function `%D' is protected"
,
fndecl
);
...
...
@@ -2372,6 +2372,9 @@ build_x_function_call (function, params, decl)
}
else
{
#ifdef NEW_OVER
return
build_new_function_call
(
function
,
params
,
NULL_TREE
);
#else
tree
val
=
TREE_VALUE
(
function
);
if
(
TREE_CODE
(
val
)
==
TEMPLATE_DECL
)
...
...
@@ -2382,6 +2385,7 @@ build_x_function_call (function, params, decl)
(
function
,
params
,
LOOKUP_COMPLAIN
);
else
my_friendly_abort
(
360
);
#endif
}
}
...
...
@@ -6007,6 +6011,79 @@ get_delta_difference (from, to, force)
return
BINFO_OFFSET
(
binfo
);
}
static
tree
build_ptrmemfunc1
(
type
,
delta
,
idx
,
pfn
,
delta2
)
tree
type
,
delta
,
idx
,
pfn
,
delta2
;
{
tree
u
;
#if 0
/* This is the old way we did it. We want to avoid calling
digest_init, so that it can give an error if we use { } when
initializing a pointer to member function. */
if (pfn)
{
u = build_nt (CONSTRUCTOR, NULL_TREE,
tree_cons (pfn_identifier, pfn, NULL_TREE));
}
else
{
u = build_nt (CONSTRUCTOR, NULL_TREE,
tree_cons (delta2_identifier, delta2, NULL_TREE));
}
u = build_nt (CONSTRUCTOR, NULL_TREE,
tree_cons (NULL_TREE, delta,
tree_cons (NULL_TREE, idx,
tree_cons (NULL_TREE, u, NULL_TREE))));
return digest_init (type, u, (tree*)0);
#else
tree
delta_field
,
idx_field
,
pfn_or_delta2_field
,
pfn_field
,
delta2_field
;
tree
subtype
;
int
allconstant
,
allsimple
;
delta_field
=
TYPE_FIELDS
(
type
);
idx_field
=
TREE_CHAIN
(
delta_field
);
pfn_or_delta2_field
=
TREE_CHAIN
(
idx_field
);
subtype
=
TREE_TYPE
(
pfn_or_delta2_field
);
pfn_field
=
TYPE_FIELDS
(
subtype
);
delta2_field
=
TREE_CHAIN
(
pfn_field
);
if
(
pfn
)
{
allconstant
=
TREE_CONSTANT
(
pfn
);
allsimple
=
initializer_constant_valid_p
(
pfn
,
TREE_TYPE
(
pfn
));
u
=
tree_cons
(
pfn_field
,
pfn
,
NULL_TREE
);
}
else
{
delta2
=
convert_and_check
(
delta_type_node
,
delta2
);
allconstant
=
TREE_CONSTANT
(
delta2
);
allsimple
=
initializer_constant_valid_p
(
delta2
,
TREE_TYPE
(
delta2
));
u
=
tree_cons
(
delta2_field
,
delta2
,
NULL_TREE
);
}
delta
=
convert_and_check
(
delta_type_node
,
delta
);
idx
=
convert_and_check
(
delta_type_node
,
idx
);
allconstant
=
allconstant
&&
TREE_CONSTANT
(
delta
)
&&
TREE_CONSTANT
(
idx
);
allsimple
=
allsimple
&&
initializer_constant_valid_p
(
delta
,
TREE_TYPE
(
delta
))
&&
initializer_constant_valid_p
(
idx
,
TREE_TYPE
(
idx
));
u
=
build
(
CONSTRUCTOR
,
subtype
,
NULL_TREE
,
u
);
u
=
tree_cons
(
delta_field
,
delta
,
tree_cons
(
idx_field
,
idx
,
tree_cons
(
pfn_or_delta2_field
,
u
,
NULL_TREE
)));
u
=
build
(
CONSTRUCTOR
,
type
,
NULL_TREE
,
u
);
TREE_CONSTANT
(
u
)
=
allconstant
;
TREE_STATIC
(
u
)
=
allconstant
&&
allsimple
;
return
u
;
#endif
}
/* Build a constructor for a pointer to member function. It can be
used to initialize global variables, local variable, or used
as a value in expressions. TYPE is the POINTER to METHOD_TYPE we
...
...
@@ -6027,87 +6104,50 @@ build_ptrmemfunc (type, pfn, force)
tree
delta
=
integer_zero_node
;
tree
delta2
=
integer_zero_node
;
tree
vfield_offset
;
tree
npfn
;
tree
npfn
=
NULL_TREE
;
tree
u
;
/* Handle multiple conversions of pointer to member functions. */
if
(
TYPE_PTRMEMFUNC_P
(
TREE_TYPE
(
pfn
)))
{
tree
ndelta
,
ndelta2
,
nindex
;
tree
e1
,
e2
,
e3
,
n
;
/* Is is already the right type? */
if
(
type
==
TYPE_PTRMEMFUNC_FN_TYPE
(
TREE_TYPE
(
pfn
)))
return
pfn
;
if
(
TREE_CODE
(
pfn
)
!=
CONSTRUCTOR
)
{
tree
e1
,
e2
,
e3
;
ndelta
=
convert
(
ptrdiff_type_node
,
build_component_ref
(
pfn
,
delta_identifier
,
NULL_TREE
,
0
));
ndelta2
=
convert
(
ptrdiff_type_node
,
DELTA2_FROM_PTRMEMFUNC
(
pfn
));
idx
=
build_component_ref
(
pfn
,
index_identifier
,
NULL_TREE
,
0
);
delta
=
get_delta_difference
(
TYPE_METHOD_BASETYPE
(
TREE_TYPE
(
TYPE_PTRMEMFUNC_FN_TYPE
(
TREE_TYPE
(
pfn
)))),
TYPE_METHOD_BASETYPE
(
TREE_TYPE
(
type
)),
force
);
delta
=
build_binary_op
(
PLUS_EXPR
,
delta
,
ndelta
,
1
);
delta2
=
build_binary_op
(
PLUS_EXPR
,
ndelta2
,
delta2
,
1
);
e1
=
fold
(
build
(
GT_EXPR
,
boolean_type_node
,
idx
,
integer_zero_node
));
ndelta
=
convert
(
ptrdiff_type_node
,
build_component_ref
(
pfn
,
delta_identifier
,
NULL_TREE
,
0
));
ndelta2
=
convert
(
ptrdiff_type_node
,
DELTA2_FROM_PTRMEMFUNC
(
pfn
));
idx
=
build_component_ref
(
pfn
,
index_identifier
,
NULL_TREE
,
0
);
n
=
get_delta_difference
(
TYPE_METHOD_BASETYPE
(
TREE_TYPE
(
TYPE_PTRMEMFUNC_FN_TYPE
(
TREE_TYPE
(
pfn
)))),
TYPE_METHOD_BASETYPE
(
TREE_TYPE
(
type
)),
force
);
delta
=
build_binary_op
(
PLUS_EXPR
,
ndelta
,
n
,
1
);
delta2
=
build_binary_op
(
PLUS_EXPR
,
ndelta2
,
n
,
1
);
e1
=
fold
(
build
(
GT_EXPR
,
boolean_type_node
,
idx
,
integer_zero_node
));
u
=
build_nt
(
CONSTRUCTOR
,
NULL_TREE
,
tree_cons
(
delta2_identifier
,
delta2
,
NULL_TREE
));
u
=
build_nt
(
CONSTRUCTOR
,
NULL_TREE
,
tree_cons
(
NULL_TREE
,
delta
,
tree_cons
(
NULL_TREE
,
idx
,
tree_cons
(
NULL_TREE
,
u
,
NULL_TREE
))));
e2
=
digest_init
(
TYPE_GET_PTRMEMFUNC_TYPE
(
type
),
u
,
(
tree
*
)
0
);
e2
=
build_ptrmemfunc1
(
TYPE_GET_PTRMEMFUNC_TYPE
(
type
),
delta
,
idx
,
NULL_TREE
,
delta2
);
pfn
=
PFN_FROM_PTRMEMFUNC
(
pfn
);
npfn
=
build1
(
NOP_EXPR
,
type
,
pfn
);
TREE_CONSTANT
(
npfn
)
=
TREE_CONSTANT
(
pfn
);
pfn
=
PFN_FROM_PTRMEMFUNC
(
pfn
);
npfn
=
build1
(
NOP_EXPR
,
type
,
pfn
);
TREE_CONSTANT
(
npfn
)
=
TREE_CONSTANT
(
pfn
);
u
=
build_nt
(
CONSTRUCTOR
,
NULL_TREE
,
tree_cons
(
pfn_identifier
,
npfn
,
NULL_TREE
));
u
=
build_nt
(
CONSTRUCTOR
,
NULL_TREE
,
tree_cons
(
NULL_TREE
,
delta
,
tree_cons
(
NULL_TREE
,
idx
,
tree_cons
(
NULL_TREE
,
u
,
NULL_TREE
))));
e3
=
digest_init
(
TYPE_GET_PTRMEMFUNC_TYPE
(
type
),
u
,
(
tree
*
)
0
);
return
build_conditional_expr
(
e1
,
e2
,
e3
);
}
ndelta
=
TREE_VALUE
(
CONSTRUCTOR_ELTS
(
pfn
));
nindex
=
TREE_VALUE
(
TREE_CHAIN
(
CONSTRUCTOR_ELTS
(
pfn
)));
npfn
=
TREE_VALUE
(
TREE_CHAIN
(
TREE_CHAIN
(
CONSTRUCTOR_ELTS
(
pfn
))));
npfn
=
TREE_VALUE
(
CONSTRUCTOR_ELTS
(
npfn
));
if
(
integer_zerop
(
nindex
))
pfn
=
integer_zero_node
;
else
if
(
integer_zerop
(
fold
(
size_binop
(
PLUS_EXPR
,
nindex
,
integer_one_node
))))
{
tree
e3
;
delta
=
get_delta_difference
(
TYPE_METHOD_BASETYPE
(
TREE_TYPE
(
TYPE_PTRMEMFUNC_FN_TYPE
(
TREE_TYPE
(
pfn
)))),
TYPE_METHOD_BASETYPE
(
TREE_TYPE
(
type
)),
force
);
delta
=
build_binary_op
(
PLUS_EXPR
,
delta
,
ndelta
,
1
);
pfn
=
build1
(
NOP_EXPR
,
type
,
npfn
);
TREE_CONSTANT
(
pfn
)
=
TREE_CONSTANT
(
npfn
);
u
=
build_nt
(
CONSTRUCTOR
,
NULL_TREE
,
tree_cons
(
pfn_identifier
,
pfn
,
NULL_TREE
));
u
=
build_nt
(
CONSTRUCTOR
,
NULL_TREE
,
tree_cons
(
NULL_TREE
,
delta
,
tree_cons
(
NULL_TREE
,
nindex
,
tree_cons
(
NULL_TREE
,
u
,
NULL_TREE
))));
e3
=
digest_init
(
TYPE_GET_PTRMEMFUNC_TYPE
(
type
),
u
,
(
tree
*
)
0
);
return
e3
;
}
else
{
sorry
(
"value casting of variable nonnull pointer to member functions not supported"
);
return
error_mark_node
;
}
e3
=
build_ptrmemfunc1
(
TYPE_GET_PTRMEMFUNC_TYPE
(
type
),
delta
,
idx
,
npfn
,
NULL_TREE
);
return
build_conditional_expr
(
e1
,
e2
,
e3
);
}
/* Handle null pointer to member function conversions. */
if
(
integer_zerop
(
pfn
))
{
pfn
=
build_c_cast
(
type
,
integer_zero_node
,
0
);
u
=
build_nt
(
CONSTRUCTOR
,
NULL_TREE
,
tree_cons
(
pfn_identifier
,
pfn
,
NULL_TREE
));
u
=
build_nt
(
CONSTRUCTOR
,
NULL_TREE
,
tree_cons
(
NULL_TREE
,
integer_zero_node
,
tree_cons
(
NULL_TREE
,
integer_zero_node
,
tree_cons
(
NULL_TREE
,
u
,
NULL_TREE
))));
return
digest_init
(
TYPE_GET_PTRMEMFUNC_TYPE
(
type
),
u
,
(
tree
*
)
0
);
return
build_ptrmemfunc1
(
TYPE_GET_PTRMEMFUNC_TYPE
(
type
),
integer_zero_node
,
integer_zero_node
,
pfn
,
NULL_TREE
);
}
if
(
TREE_CODE
(
pfn
)
==
TREE_LIST
...
...
@@ -6151,7 +6191,6 @@ build_ptrmemfunc (type, pfn, force)
idx
=
size_binop
(
PLUS_EXPR
,
DECL_VINDEX
(
TREE_OPERAND
(
pfn
,
0
)),
integer_one_node
);
u
=
build_nt
(
CONSTRUCTOR
,
NULL_TREE
,
tree_cons
(
delta2_identifier
,
delta2
,
NULL_TREE
));
}
else
{
...
...
@@ -6166,14 +6205,9 @@ build_ptrmemfunc (type, pfn, force)
npfn
=
build1
(
NOP_EXPR
,
type
,
pfn
);
TREE_CONSTANT
(
npfn
)
=
TREE_CONSTANT
(
pfn
);
}
u
=
build_nt
(
CONSTRUCTOR
,
NULL_TREE
,
tree_cons
(
pfn_identifier
,
npfn
,
NULL_TREE
));
}
u
=
build_nt
(
CONSTRUCTOR
,
NULL_TREE
,
tree_cons
(
NULL_TREE
,
delta
,
tree_cons
(
NULL_TREE
,
idx
,
tree_cons
(
NULL_TREE
,
u
,
NULL_TREE
))));
return
digest_init
(
TYPE_GET_PTRMEMFUNC_TYPE
(
type
),
u
,
(
tree
*
)
0
);
return
build_ptrmemfunc1
(
TYPE_GET_PTRMEMFUNC_TYPE
(
type
),
delta
,
idx
,
npfn
,
delta2
);
}
/* Convert value RHS to type TYPE as preparation for an assignment
...
...
gcc/cp/typeck2.c
View file @
594740f3
...
...
@@ -1011,6 +1011,9 @@ process_init_constructor (type, init, elts)
sorry
(
"initializer list for object using virtual functions"
);
return
error_mark_node
;
}
if
(
TYPE_PTRMEMFUNC_P
(
type
))
cp_pedwarn
(
"initializer list for `%T'"
,
type
);
}
for
(
field
=
TYPE_FIELDS
(
type
);
field
&&
tail
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment