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
739d15ab
Commit
739d15ab
authored
Feb 27, 1994
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(finish_decl, finish_function): Issue warning for large objects, if
requested. From-SVN: r6653
parent
b51e9c62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
gcc/c-decl.c
+42
-0
No files found.
gcc/c-decl.c
View file @
739d15ab
...
...
@@ -3589,6 +3589,23 @@ finish_decl (decl, init, asmspec_tree)
}
}
/* If requested, warn about definitions of large data objects. */
if
(
warn_larger_than
&&
(
TREE_CODE
(
decl
)
==
VAR_DECL
||
TREE_CODE
(
decl
)
==
PARM_DECL
)
&&
!
DECL_EXTERNAL
(
decl
))
{
register
tree
decl_size
=
DECL_SIZE
(
decl
);
if
(
decl_size
&&
TREE_CODE
(
decl_size
)
==
INTEGER_CST
)
{
unsigned
units
=
TREE_INT_CST_LOW
(
decl_size
)
/
BITS_PER_UNIT
;
if
(
units
>
larger_than_size
)
warning_with_decl
(
decl
,
"size of `%s' is %u bytes"
,
units
);
}
}
#if 0
/* Resume permanent allocation, if not within a function. */
/* The corresponding push_obstacks_nochange is in start_decl,
...
...
@@ -6499,6 +6516,31 @@ finish_function (nested)
&&
current_function_returns_value
&&
current_function_returns_null
)
warning
(
"this function may return with or without a value"
);
/* If requested, warn about function definitions where the function will
return a value (usually of some struct or union type) which itself will
take up a lot of stack space. */
if
(
warn_larger_than
&&
!
DECL_EXTERNAL
(
fndecl
)
&&
TREE_TYPE
(
fndecl
))
{
register
tree
ret_type
=
TREE_TYPE
(
TREE_TYPE
(
fndecl
));
if
(
ret_type
)
{
register
tree
ret_type_size
=
TYPE_SIZE
(
ret_type
);
if
(
TREE_CODE
(
ret_type_size
)
==
INTEGER_CST
)
{
unsigned
units
=
TREE_INT_CST_LOW
(
ret_type_size
)
/
BITS_PER_UNIT
;
if
(
units
>
larger_than_size
)
warning_with_decl
(
fndecl
,
"size of return value of `%s' is %u bytes"
,
units
);
}
}
}
/* Free all the tree nodes making up this function. */
/* Switch back to allocating nodes permanently
until we start another function. */
...
...
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