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
6b2bd61e
Commit
6b2bd61e
authored
May 02, 1994
by
Per Bothner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't write out static consts now, unless we need them.
From-SVN: r7194
parent
e6b538e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
gcc/toplev.c
+25
-6
No files found.
gcc/toplev.c
View file @
6b2bd61e
...
@@ -2274,14 +2274,33 @@ compile_file (name)
...
@@ -2274,14 +2274,33 @@ compile_file (name)
if
(
TREE_CODE
(
decl
)
==
VAR_DECL
&&
TREE_STATIC
(
decl
)
if
(
TREE_CODE
(
decl
)
==
VAR_DECL
&&
TREE_STATIC
(
decl
)
&&
!
TREE_ASM_WRITTEN
(
decl
))
&&
!
TREE_ASM_WRITTEN
(
decl
))
{
{
/* Don't write out static consts, unless we used them.
/* Don't write out static consts, unless we still need them.
(This used to write them out only if the address was
taken, but that was wrong; if the variable was simply
We also keep static consts if not optimizing (for debugging).
referred to, it still needs to exist or else it will
??? They might be better written into the debug information.
be undefined in the linker.) */
This is possible when using DWARF.
A language processor that wants static constants to be always
written out (even if it is not used) is responsible for
calling rest_of_decl_compilation itself. E.g. the C front-end
calls rest_of_decl_compilation from finish_decl.
One motivation for this is that is conventional in some
environments to write things like:
static const char rcsid[] = "... version string ...";
intending to force the string to be in the executable.
A language processor that would prefer to have unneeded
static constants "optimized away" would just defer writing
them out until here. E.g. C++ does this, because static
constants are often defined in header files.
??? A tempting alternative (for both C and C++) would be
to force a constant to be written if and only if it is
defined in a main file, as opposed to an include file. */
if
(
!
TREE_READONLY
(
decl
)
if
(
!
TREE_READONLY
(
decl
)
||
TREE_PUBLIC
(
decl
)
||
TREE_PUBLIC
(
decl
)
||
TREE_USED
(
decl
)
||
!
optimize
||
TREE_ADDRESSABLE
(
decl
)
||
TREE_ADDRESSABLE
(
decl
)
||
TREE_ADDRESSABLE
(
DECL_ASSEMBLER_NAME
(
decl
)))
||
TREE_ADDRESSABLE
(
DECL_ASSEMBLER_NAME
(
decl
)))
rest_of_decl_compilation
(
decl
,
NULL_PTR
,
1
,
1
);
rest_of_decl_compilation
(
decl
,
NULL_PTR
,
1
,
1
);
...
...
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