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
8ef376a9
Commit
8ef376a9
authored
Jan 16, 1996
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(convert_for_assignment): Don't automatically convert from a union
member to the union. From-SVN: r11015
parent
96f158f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
78 deletions
+0
-78
gcc/c-typeck.c
+0
-78
No files found.
gcc/c-typeck.c
View file @
8ef376a9
...
...
@@ -3996,84 +3996,6 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
||
coder
==
COMPLEX_TYPE
))
return
convert_and_check
(
type
,
rhs
);
/* Conversion to a union from its member types. */
else
if
(
codel
==
UNION_TYPE
)
{
tree
memb_types
;
for
(
memb_types
=
TYPE_FIELDS
(
type
);
memb_types
;
memb_types
=
TREE_CHAIN
(
memb_types
))
{
if
(
comptypes
(
TREE_TYPE
(
memb_types
),
TREE_TYPE
(
rhs
)))
{
if
(
pedantic
&&
!
(
fundecl
!=
0
&&
DECL_IN_SYSTEM_HEADER
(
fundecl
)))
pedwarn
(
"ANSI C prohibits argument conversion to union type"
);
return
build1
(
NOP_EXPR
,
type
,
rhs
);
}
else
if
(
coder
==
POINTER_TYPE
&&
TREE_CODE
(
TREE_TYPE
(
memb_types
))
==
POINTER_TYPE
)
{
tree
memb_type
=
TREE_TYPE
(
memb_types
);
register
tree
ttl
=
TREE_TYPE
(
memb_type
);
register
tree
ttr
=
TREE_TYPE
(
rhstype
);
/* Any non-function converts to a [const][volatile] void *
and vice versa; otherwise, targets must be the same.
Meanwhile, the lhs target must have all the qualifiers of
the rhs. */
if
(
TYPE_MAIN_VARIANT
(
ttl
)
==
void_type_node
||
TYPE_MAIN_VARIANT
(
ttr
)
==
void_type_node
||
comp_target_types
(
memb_type
,
rhstype
))
{
/* Const and volatile mean something different for function
types, so the usual warnings are not appropriate. */
if
(
TREE_CODE
(
ttr
)
!=
FUNCTION_TYPE
||
TREE_CODE
(
ttl
)
!=
FUNCTION_TYPE
)
{
if
(
!
TYPE_READONLY
(
ttl
)
&&
TYPE_READONLY
(
ttr
))
warn_for_assignment
(
"%s discards `const' from pointer target type"
,
get_spelling
(
errtype
),
funname
,
parmnum
);
if
(
!
TYPE_VOLATILE
(
ttl
)
&&
TYPE_VOLATILE
(
ttr
))
warn_for_assignment
(
"%s discards `volatile' from pointer target type"
,
get_spelling
(
errtype
),
funname
,
parmnum
);
}
else
{
/* Because const and volatile on functions are
restrictions that say the function will not do
certain things, it is okay to use a const or volatile
function where an ordinary one is wanted, but not
vice-versa. */
if
(
TYPE_READONLY
(
ttl
)
&&
!
TYPE_READONLY
(
ttr
))
warn_for_assignment
(
"%s makes `const *' function pointer from non-const"
,
get_spelling
(
errtype
),
funname
,
parmnum
);
if
(
TYPE_VOLATILE
(
ttl
)
&&
!
TYPE_VOLATILE
(
ttr
))
warn_for_assignment
(
"%s makes `volatile *' function pointer from non-volatile"
,
get_spelling
(
errtype
),
funname
,
parmnum
);
}
if
(
pedantic
&&
!
(
fundecl
!=
0
&&
DECL_IN_SYSTEM_HEADER
(
fundecl
)))
pedwarn
(
"ANSI C prohibits argument conversion to union type"
);
return
build1
(
NOP_EXPR
,
type
,
rhs
);
}
}
/* Can convert integer zero to any pointer type. */
else
if
(
TREE_CODE
(
TREE_TYPE
(
memb_types
))
==
POINTER_TYPE
&&
(
integer_zerop
(
rhs
)
||
(
TREE_CODE
(
rhs
)
==
NOP_EXPR
&&
integer_zerop
(
TREE_OPERAND
(
rhs
,
0
)))))
return
build1
(
NOP_EXPR
,
type
,
null_pointer_node
);
}
}
/* Conversions among pointers */
else
if
(
codel
==
POINTER_TYPE
&&
coder
==
POINTER_TYPE
)
{
...
...
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