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
81a55c6c
Commit
81a55c6c
authored
Oct 18, 1993
by
Richard Stallman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(digest_init): If traditional, allow unbraced scalar
to initialize the first element of an aggregate. From-SVN: r5795
parent
733484b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
gcc/c-typeck.c
+32
-0
No files found.
gcc/c-typeck.c
View file @
81a55c6c
...
@@ -4607,6 +4607,38 @@ digest_init (type, init, require_constant, constructor_constant)
...
@@ -4607,6 +4607,38 @@ digest_init (type, init, require_constant, constructor_constant)
return
error_mark_node
;
return
error_mark_node
;
}
}
/* Traditionally, you can write struct foo x = 0;
and it initializes the first element of x to 0. */
if
(
flag_traditional
)
{
tree
top
=
0
,
prev
=
0
;
while
(
TREE_CODE
(
type
)
==
RECORD_TYPE
||
TREE_CODE
(
type
)
==
ARRAY_TYPE
||
TREE_CODE
(
type
)
==
QUAL_UNION_TYPE
||
TREE_CODE
(
type
)
==
UNION_TYPE
)
{
tree
temp
=
build
(
CONSTRUCTOR
,
type
,
NULL_TREE
,
NULL_TREE
);
if
(
prev
==
0
)
top
=
temp
;
else
TREE_OPERAND
(
prev
,
1
)
=
build_tree_list
(
NULL_TREE
,
temp
);
prev
=
temp
;
if
(
TREE_CODE
(
type
)
==
ARRAY_TYPE
)
type
=
TREE_TYPE
(
type
);
else
if
(
TYPE_FIELDS
(
type
))
type
=
TREE_TYPE
(
TYPE_FIELDS
(
type
));
else
{
error_init
(
"invalid initializer%s"
,
" for `%s'"
,
NULL
);
return
error_mark_node
;
}
}
TREE_OPERAND
(
prev
,
1
)
=
build_tree_list
(
NULL_TREE
,
digest_init
(
type
,
init
,
require_constant
,
constructor_constant
));
return
top
;
}
error_init
(
"invalid initializer%s"
,
" for `%s'"
,
NULL
);
error_init
(
"invalid initializer%s"
,
" for `%s'"
,
NULL
);
return
error_mark_node
;
return
error_mark_node
;
}
}
...
...
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