summaryrefslogtreecommitdiff
path: root/cparser
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-10-28 09:04:55 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-10-28 09:04:55 +0000
commit8cb5ca59a2d11b851fbc25b2179d1224874ba5ec (patch)
tree0773cf46f5bd51add7697c2350a459b4b9c7737e /cparser
parent4489091cae922592f67bcc4b874856c76ca71b0c (diff)
Eliminate unreferenced inline functions
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2353 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser')
-rw-r--r--cparser/Cleanup.ml6
1 files changed, 4 insertions, 2 deletions
diff --git a/cparser/Cleanup.ml b/cparser/Cleanup.ml
index 00ff662..1d771ed 100644
--- a/cparser/Cleanup.ml
+++ b/cparser/Cleanup.ml
@@ -125,7 +125,7 @@ let rec add_init_globdecls accu = function
match g.gdesc with
| Gdecl decl when visible_decl decl ->
add_decl decl; add_init_globdecls accu rem
- | Gfundef({fd_storage = Storage_default} as f) ->
+ | Gfundef f when f.fd_storage = Storage_default && not f.fd_inline ->
add_fundef f; add_init_globdecls accu rem
| Gdecl _ | Gfundef _ | Gcompositedef _ | Gtypedef _ | Genumdef _ ->
(* Keep for later iterations *)
@@ -178,7 +178,9 @@ let rec simpl_globdecls accu = function
let need =
match g.gdesc with
| Gdecl((sto, id, ty, init) as decl) -> visible_decl decl || needed id
- | Gfundef f -> f.fd_storage = Storage_default || needed f.fd_name
+ | Gfundef f ->
+ (f.fd_storage = Storage_default && not f.fd_inline)
+ || needed f.fd_name
| Gcompositedecl(_, id, _) -> needed id
| Gcompositedef(_, id, _, flds) -> needed id
| Gtypedef(id, ty) -> needed id