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
e3417fcd
Commit
e3417fcd
authored
Feb 18, 1995
by
Mike Stump
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
57 Cygnus<->FSF merge
From-SVN: r8971
parent
71a81095
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
161 additions
and
67 deletions
+161
-67
gcc/cp/ChangeLog
+53
-0
gcc/cp/Makefile.in
+2
-2
gcc/cp/class.c
+3
-9
gcc/cp/cp-tree.h
+3
-5
gcc/cp/decl2.c
+63
-26
gcc/cp/init.c
+2
-2
gcc/cp/parse.y
+0
-0
gcc/cp/typeck.c
+35
-23
No files found.
gcc/cp/ChangeLog
View file @
e3417fcd
...
...
@@ -10,6 +10,59 @@ Wed Jan 25 15:02:09 1995 David S. Miller (davem@nadzieja.rutgers.edu)
* class.c (instantiate_type): Change error message text.
* typeck2.c (store_init_value): Likewise.
Fri Feb 17 15:31:31 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* decl2.c (reparse_decl_as_expr): Support being called without a
type argument.
* parse.y (primary): Add '(' expr_or_declarator ')'. Adds 4 r/r
conflicts. Sigh.
Fri Feb 17 12:02:06 1995 Mike Stump <mrs@cygnus.com>
* parse.y (template_def, fndef, fn.def1, return_init, condition,
initdcl0, initdcl, notype_initdcl0, nomods_initdcl0,
component_decl_1, after_type_component_declarator0,
notype_component_declarator0, after_type_component_declarator,
notype_component_declarator, after_type_component_declarator,
full_parm, maybe_raises, exception_specification_opt): Fix up,
include exception_specification_opt maybeasm maybe_attribute and
maybe_init if missing. Rename maybe_raises to
exception_specification_opt to match draft wording. Use maybe_init
to simplify rules.
Fri Feb 17 01:54:46 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* init.c (build_new): Set TREE_NO_UNUSED_WARNING on COMPOUND_EXPRs
built for news of scalar types.
Thu Feb 16 17:48:28 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* typeck.c (build_binary_op_nodefault): Update code for warning
about signed/unsigned comparisons from C frontend. Realize that the
code in the C frontend is, if anything, even more bogus. Fix it.
(build_binary_op): Undo default_conversion if it wasn't useful.
* typeck.c (build_unary_op, ADDR_EXPR): Lose bogus special case for
PRE*CREMENT_EXPR.
* decl2.c (import_export_vtable): Don't try the vtable hack
if the class doesn't have any real non-inline virtual functions.
(finish_vtable_vardecl): Don't bother trying to find a non-inline
virtual function in a non-polymorphic class.
(finish_prevtable_vardecl): Ditto.
* decl2.c (import_export_vtable): Use and set DECL_INTERFACE_KNOWN.
* cp-tree.h (DECL_INTERFACE_KNOWN): Use DECL_LANG_FLAG_5.
* init.c (expand_virtual_init): Always call assemble_external.
* class.c (build_vfn_ref): Always call assemble_external.
(build_vtable): Always call import_export_vtable.
(prepare_fresh_vtable): Ditto.
(add_virtual_function): Don't bother setting TREE_ADDRESSABLE.
Thu Feb 16 03:28:49 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* class.c (finish_struct): Use TYPE_{MIN,MAX}_VALUE to determine
...
...
gcc/cp/Makefile.in
View file @
e3417fcd
...
...
@@ -196,12 +196,12 @@ parse.o : $(PARSE_C) $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h lex.h
$(PARSE_H)
:
$(PARSE_C)
$(PARSE_C)
:
$(srcdir)/parse.y
@
echo
expect 1
shift
/reduce confict and 3
4
reduce/reduce conflicts.
@
echo
expect 1
shift
/reduce confict and 3
9
reduce/reduce conflicts.
cd
$(srcdir)
;
$(BISON)
$(BISONFLAGS)
-d
-o
parse.c parse.y
cd
$(srcdir)
;
grep
'^#define[ ]*YYEMPTY'
parse.c
>>
parse.h
#$(PARSE_C) $(PARSE_H) : stamp-parse ; @true
#stamp-parse: $(srcdir)/parse.y
# @echo expect 1 shift/reduce confict and 3
4
reduce/reduce conflicts.
# @echo expect 1 shift/reduce confict and 3
9
reduce/reduce conflicts.
# $(BISON) $(BISONFLAGS) -d $(srcdir)/parse.y
# grep '^#define[ ]*YYEMPTY' y.tab.c >>y.tab.h
# $(srcdir)/../move-if-change y.tab.c $(PARSE_C)
...
...
gcc/cp/class.c
View file @
e3417fcd
...
...
@@ -478,8 +478,7 @@ build_vfn_ref (ptr_to_instptr, instance, idx)
vtbl
=
build_indirect_ref
(
build_vfield_ref
(
instance
,
basetype
),
NULL_PTR
);
}
if
(
!
flag_vtable_thunks
)
assemble_external
(
vtbl
);
assemble_external
(
vtbl
);
aref
=
build_array_ref
(
vtbl
,
idx
);
/* Save the intermediate result in a SAVE_EXPR so we don't have to
...
...
@@ -552,8 +551,7 @@ build_vtable (binfo, type)
#endif
/* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */
if
(
!
flag_vtable_thunks
)
import_export_vtable
(
decl
,
type
);
import_export_vtable
(
decl
,
type
,
0
);
IDENTIFIER_GLOBAL_VALUE
(
name
)
=
decl
=
pushdecl_top_level
(
decl
);
/* Initialize the association list for this type, based
...
...
@@ -699,8 +697,7 @@ prepare_fresh_vtable (binfo, for_type)
#endif
/* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */
if
(
!
flag_vtable_thunks
)
import_export_vtable
(
new_decl
,
for_type
);
import_export_vtable
(
new_decl
,
for_type
,
0
);
if
(
TREE_VIA_VIRTUAL
(
binfo
))
my_friendly_assert
(
binfo
==
binfo_member
(
BINFO_TYPE
(
binfo
),
...
...
@@ -803,9 +800,6 @@ add_virtual_function (pending_virtuals, has_virtual, fndecl, t)
fndecl
);
#endif
if
(
!
flag_vtable_thunks
)
TREE_ADDRESSABLE
(
fndecl
)
=
CLASSTYPE_VTABLE_NEEDS_WRITING
(
t
);
/* If the virtual function is a redefinition of a prior one,
figure out in which base class the new definition goes,
and if necessary, make a fresh virtual function table
...
...
gcc/cp/cp-tree.h
View file @
e3417fcd
...
...
@@ -954,10 +954,9 @@ struct lang_decl_flags
unsigned
saved_inline
:
1
;
unsigned
use_template
:
2
;
unsigned
interface_known
:
1
;
unsigned
declared_static
:
1
;
unsigned
nonconverting
:
1
;
unsigned
dummy
:
5
;
unsigned
dummy
:
6
;
tree
access
;
tree
context
;
...
...
@@ -1131,7 +1130,7 @@ struct lang_decl
#if 0
/* Same, but tells if this field is private in current context. */
#define DECL_PRIVATE(NODE) (
DECL_LANG_FLAG_5 (NODE)
)
#define DECL_PRIVATE(NODE) (
FOO
)
/* Same, but tells if this field is private in current context. */
#define DECL_PROTECTED(NODE) (DECL_LANG_FLAG_6 (NODE))
...
...
@@ -1337,8 +1336,7 @@ struct lang_decl
(CLASSTYPE_USE_TEMPLATE(NODE) = 3)
/* We know what we're doing with this decl now. */
#define DECL_INTERFACE_KNOWN(NODE) \
(DECL_LANG_SPECIFIC (NODE)->decl_flags.interface_known)
#define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
/* This decl was declared to have internal linkage. */
#define DECL_DECLARED_STATIC(NODE) \
...
...
gcc/cp/decl2.c
View file @
e3417fcd
...
...
@@ -144,10 +144,8 @@ int warn_implicit = 1;
int
warn_ctor_dtor_privacy
=
1
;
/* True if we want to implement vtbvales using "thunks".
The default is off now, but will be on later.
The default is off now, but will be on later.
*/
Also causes output of vtables to be controlled by whether
we seen the class's first non-inline virtual function. */
int
flag_vtable_thunks
;
/* Nonzero means give string constants the type `const char *'
...
...
@@ -2466,23 +2464,61 @@ mark_vtable_entries (decl)
it's public in this file or in another one. */
void
import_export_vtable
(
decl
,
type
)
tree
decl
,
type
;
import_export_vtable
(
decl
,
type
,
final
)
tree
decl
,
type
;
int
final
;
{
if
(
write_virtuals
>=
2
||
CLASSTYPE_TEMPLATE_INSTANTIATION
(
type
))
{
if
(
CLASSTYPE_INTERFACE_KNOWN
(
type
))
{
TREE_PUBLIC
(
decl
)
=
1
;
DECL_EXTERNAL
(
decl
)
=
!
CLASSTYPE_VTABLE_NEEDS_WRITING
(
type
);
}
}
else
if
(
write_virtuals
!=
0
)
if
(
DECL_INTERFACE_KNOWN
(
decl
))
return
;
/* +e0 or +e1 */
if
(
write_virtuals
<
2
&&
write_virtuals
!=
0
)
{
TREE_PUBLIC
(
decl
)
=
1
;
if
(
write_virtuals
<
0
)
DECL_EXTERNAL
(
decl
)
=
1
;
DECL_INTERFACE_KNOWN
(
decl
)
=
1
;
}
else
if
(
CLASSTYPE_INTERFACE_KNOWN
(
type
))
{
TREE_PUBLIC
(
decl
)
=
1
;
DECL_EXTERNAL
(
decl
)
=
!
CLASSTYPE_VTABLE_NEEDS_WRITING
(
type
);
DECL_INTERFACE_KNOWN
(
decl
)
=
1
;
}
else
{
/* We can only do this optimization if we have real non-inline
virtual functions in our class, or if we come from a template. */
int
found
=
CLASSTYPE_TEMPLATE_INSTANTIATION
(
type
);
if
(
!
found
&&
!
final
)
{
/* This check only works before the method definitions are seen,
since DECL_INLINE may get bashed. */
tree
method
;
for
(
method
=
CLASSTYPE_METHODS
(
type
);
method
!=
NULL_TREE
;
method
=
DECL_NEXT_METHOD
(
method
))
if
(
DECL_VINDEX
(
method
)
!=
NULL_TREE
&&
!
DECL_INLINE
(
method
)
&&
!
DECL_ABSTRACT_VIRTUAL_P
(
method
))
{
found
=
1
;
break
;
}
}
if
(
final
||
!
found
)
{
TREE_PUBLIC
(
decl
)
=
0
;
DECL_EXTERNAL
(
decl
)
=
0
;
DECL_INTERFACE_KNOWN
(
decl
)
=
1
;
}
else
{
TREE_PUBLIC
(
decl
)
=
1
;
DECL_EXTERNAL
(
decl
)
=
1
;
DECL_INTERFACE_KNOWN
(
decl
)
=
0
;
}
}
}
...
...
@@ -2506,9 +2542,8 @@ finish_prevtable_vardecl (prev, vars)
{
tree
ctype
=
DECL_CONTEXT
(
vars
);
import_export_template
(
ctype
);
import_export_vtable
(
vars
,
ctype
);
if
(
CLASSTYPE_INTERFACE_UNKNOWN
(
ctype
))
if
(
CLASSTYPE_INTERFACE_UNKNOWN
(
ctype
)
&&
TYPE_VIRTUAL_P
(
ctype
)
)
{
tree
method
;
for
(
method
=
CLASSTYPE_METHODS
(
ctype
);
method
!=
NULL_TREE
;
...
...
@@ -2520,13 +2555,13 @@ finish_prevtable_vardecl (prev, vars)
SET_CLASSTYPE_INTERFACE_KNOWN
(
ctype
);
CLASSTYPE_VTABLE_NEEDS_WRITING
(
ctype
)
=
!
DECL_EXTERNAL
(
method
);
CLASSTYPE_INTERFACE_ONLY
(
ctype
)
=
DECL_EXTERNAL
(
method
);
TREE_PUBLIC
(
vars
)
=
1
;
DECL_EXTERNAL
(
vars
)
=
DECL_EXTERNAL
(
method
);
break
;
}
}
}
import_export_vtable
(
vars
,
ctype
,
1
);
if
(
write_virtuals
>=
0
&&
!
DECL_EXTERNAL
(
vars
)
&&
(
TREE_PUBLIC
(
vars
)
||
TREE_USED
(
vars
)))
{
...
...
@@ -2549,9 +2584,8 @@ finish_vtable_vardecl (prev, vars)
{
tree
ctype
=
DECL_CONTEXT
(
vars
);
import_export_template
(
ctype
);
import_export_vtable
(
vars
,
ctype
);
if
(
CLASSTYPE_INTERFACE_UNKNOWN
(
ctype
))
if
(
CLASSTYPE_INTERFACE_UNKNOWN
(
ctype
)
&&
TYPE_VIRTUAL_P
(
ctype
)
)
{
tree
method
;
for
(
method
=
CLASSTYPE_METHODS
(
ctype
);
method
!=
NULL_TREE
;
...
...
@@ -2563,8 +2597,6 @@ finish_vtable_vardecl (prev, vars)
SET_CLASSTYPE_INTERFACE_KNOWN
(
ctype
);
CLASSTYPE_VTABLE_NEEDS_WRITING
(
ctype
)
=
!
DECL_EXTERNAL
(
method
);
CLASSTYPE_INTERFACE_ONLY
(
ctype
)
=
DECL_EXTERNAL
(
method
);
TREE_PUBLIC
(
vars
)
=
1
;
DECL_EXTERNAL
(
vars
)
=
DECL_EXTERNAL
(
method
);
if
(
flag_rtti
)
cp_warning
(
"compiler error: rtti entry for `%T' decided too late"
,
ctype
);
break
;
...
...
@@ -2572,6 +2604,8 @@ finish_vtable_vardecl (prev, vars)
}
}
import_export_vtable
(
vars
,
ctype
,
1
);
if
(
write_virtuals
>=
0
&&
!
DECL_EXTERNAL
(
vars
)
&&
(
TREE_PUBLIC
(
vars
)
||
TREE_USED
(
vars
)))
{
...
...
@@ -2612,7 +2646,7 @@ finish_vtable_vardecl (prev, vars)
rest_of_decl_compilation
(
vars
,
NULL_PTR
,
1
,
1
);
}
else
if
(
TREE_USED
(
vars
)
&&
flag_vtable_thunks
)
else
if
(
TREE_USED
(
vars
))
assemble_external
(
vars
);
/* We know that PREV must be non-zero here. */
TREE_CHAIN
(
prev
)
=
TREE_CHAIN
(
vars
);
...
...
@@ -3230,8 +3264,11 @@ tree
reparse_decl_as_expr
(
type
,
decl
)
tree
type
,
decl
;
{
decl
=
build_tree_list
(
NULL_TREE
,
reparse_decl_as_expr1
(
decl
));
return
build_functional_cast
(
type
,
decl
);
decl
=
reparse_decl_as_expr1
(
decl
);
if
(
type
)
return
build_functional_cast
(
type
,
build_tree_list
(
NULL_TREE
,
decl
));
else
return
decl
;
}
/* This is something of the form `int (*a)' that has turned out to be a
...
...
gcc/cp/init.c
View file @
e3417fcd
...
...
@@ -730,8 +730,7 @@ expand_virtual_init (binfo, decl)
vtype
=
DECL_CONTEXT
(
CLASSTYPE_VFIELD
(
type
));
vtype_binfo
=
get_binfo
(
vtype
,
TREE_TYPE
(
TREE_TYPE
(
decl
)),
0
);
vtbl
=
BINFO_VTABLE
(
binfo_value
(
DECL_FIELD_CONTEXT
(
CLASSTYPE_VFIELD
(
type
)),
binfo
));
if
(
!
flag_vtable_thunks
)
assemble_external
(
vtbl
);
assemble_external
(
vtbl
);
TREE_USED
(
vtbl
)
=
1
;
vtbl
=
build1
(
ADDR_EXPR
,
TYPE_POINTER_TO
(
TREE_TYPE
(
vtbl
)),
vtbl
);
decl
=
convert_pointer_to_real
(
vtype_binfo
,
decl
);
...
...
@@ -3093,6 +3092,7 @@ build_new (placement, decl, init, use_global_new)
rval
=
build
(
COMPOUND_EXPR
,
TREE_TYPE
(
rval
),
build_modify_expr
(
deref
,
NOP_EXPR
,
init
),
rval
);
TREE_NO_UNUSED_WARNING
(
rval
)
=
1
;
TREE_SIDE_EFFECTS
(
rval
)
=
1
;
TREE_CALLS_NEW
(
rval
)
=
1
;
}
...
...
gcc/cp/parse.y
View file @
e3417fcd
This diff is collapsed.
Click to expand it.
gcc/cp/typeck.c
View file @
e3417fcd
...
...
@@ -2723,8 +2723,9 @@ build_binary_op (code, arg1, arg2, convert_p)
if
(
convert_p
)
{
args
[
0
]
=
default_conversion
(
args
[
0
]);
args
[
1
]
=
default_conversion
(
args
[
1
]);
tree
args_save
[
2
];
args
[
0
]
=
args_save
[
0
]
=
default_conversion
(
args
[
0
]);
args
[
1
]
=
args_save
[
1
]
=
default_conversion
(
args
[
1
]);
if
(
type_unknown_p
(
args
[
0
]))
{
...
...
@@ -2780,6 +2781,11 @@ build_binary_op (code, arg1, arg2, convert_p)
error
(
"ambiguous pointer conversion"
);
args
[
convert_index
]
=
try
;
}
if
(
args
[
0
]
==
args_save
[
0
])
args
[
0
]
=
arg1
;
if
(
args
[
1
]
==
args_save
[
1
])
args
[
1
]
=
arg2
;
}
return
build_binary_op_nodefault
(
code
,
args
[
0
],
args
[
1
],
code
);
}
...
...
@@ -3457,19 +3463,34 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
if
(
short_compare
&&
extra_warnings
)
{
int
op0_signed
=
!
TREE_UNSIGNED
(
TREE_TYPE
(
orig_op0
));
int
op1_signed
=
!
TREE_UNSIGNED
(
TREE_TYPE
(
orig_op1
));
tree
comp_type
=
TREE_TYPE
(
op0
);
int
unsignedp0
,
unsignedp1
;
tree
primop0
=
get_narrower
(
op0
,
&
unsignedp0
);
tree
primop1
=
get_narrower
(
op1
,
&
unsignedp1
);
/* Warn if signed and unsigned are being compared in a size larger
than their original size, as this will always fail. */
if
(
unsignedp0
!=
unsignedp1
&&
(
TYPE_PRECISION
(
TREE_TYPE
(
primop0
))
<
TYPE_PRECISION
(
result_type
))
&&
(
TYPE_PRECISION
(
TREE_TYPE
(
primop1
))
<
TYPE_PRECISION
(
result_type
)))
warning
(
"comparison between promoted unsigned and signed"
);
/* Give warnings for comparisons between signed and unsigned
quantities that may fail. Do not warn if the signed quantity
is an unsuffixed integer literal (or some static constant
expression involving such literals) and it is positive.
Do not warn if the comparison is being done in a signed type,
since the signed type will only be chosen if it can represent
all the values of the unsigned type. */
/* Do the checking based on the original operand trees, so that
casts will be considered, but default promotions won't be. */
if
(
TREE_UNSIGNED
(
comp_type
)
&&
((
op0_signed
&&
(
TREE_CODE
(
op0
)
!=
INTEGER_CST
||
(
TREE_CODE
(
op0
)
==
INTEGER_CST
&&
INT_CST_LT
(
op0
,
integer_zero_node
))))
||
(
op1_signed
&&
(
TREE_CODE
(
op1
)
!=
INTEGER_CST
||
(
TREE_CODE
(
op1
)
==
INTEGER_CST
&&
INT_CST_LT
(
op1
,
integer_zero_node
))))))
warning
(
"comparison between signed and unsigned"
);
/* Warn if two unsigned values are being compared in a size
larger than their original size, and one (and only one) is the
...
...
@@ -3509,7 +3530,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
}
bits
=
TYPE_PRECISION
(
TREE_TYPE
(
primop
));
if
(
bits
<
TYPE_PRECISION
(
result
_type
)
if
(
bits
<
TYPE_PRECISION
(
comp
_type
)
&&
bits
<
HOST_BITS_PER_LONG
&&
unsignedp
)
{
mask
=
(
~
(
HOST_WIDE_INT
)
0
)
<<
bits
;
...
...
@@ -3519,9 +3540,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
}
else
if
(
unsignedp0
&&
unsignedp1
&&
(
TYPE_PRECISION
(
TREE_TYPE
(
primop0
))
<
TYPE_PRECISION
(
result
_type
))
<
TYPE_PRECISION
(
comp
_type
))
&&
(
TYPE_PRECISION
(
TREE_TYPE
(
primop1
))
<
TYPE_PRECISION
(
result
_type
)))
<
TYPE_PRECISION
(
comp
_type
)))
warning
(
"comparison of promoted ~unsigned with unsigned"
);
}
}
...
...
@@ -4120,15 +4141,6 @@ build_unary_op (code, xarg, noconvert)
TREE_OPERAND
(
arg
,
1
),
1
);
}
/* For &(++foo), we are really taking the address of the variable
being acted upon by the increment/decrement operator. ARM $5.3.1
However, according to ARM $5.2.5, we don't allow postfix ++ and
--, since the prefix operators return lvalues, but the postfix
operators do not. */
if
(
TREE_CODE
(
arg
)
==
PREINCREMENT_EXPR
||
TREE_CODE
(
arg
)
==
PREDECREMENT_EXPR
)
arg
=
TREE_OPERAND
(
arg
,
0
);
/* Uninstantiated types are all functions. Taking the
address of a function is a no-op, so just return the
argument. */
...
...
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