aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cleanup.ml
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-05-15 07:27:56 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-05-15 07:27:56 +0000
commitb30f9ce6a87e94b34c1420323e445c07eee8305e (patch)
treeda5f7a1b52ed61b4dda6d01b8c1a71193279601e /cparser/Cleanup.ml
parentedc00e0c90a5598f653add89f42a095d8ee1b629 (diff)
downloadcompcert-kvx-b30f9ce6a87e94b34c1420323e445c07eee8305e.tar.gz
compcert-kvx-b30f9ce6a87e94b34c1420323e445c07eee8305e.zip
- Re-added support for "__func__" identifier as per ISO C99.
- Support for empty structs and unions - Better handling of "extern" and "extern inline" function definitions. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2493 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser/Cleanup.ml')
-rw-r--r--cparser/Cleanup.ml13
1 files changed, 9 insertions, 4 deletions
diff --git a/cparser/Cleanup.ml b/cparser/Cleanup.ml
index 1d771ed4..09595a13 100644
--- a/cparser/Cleanup.ml
+++ b/cparser/Cleanup.ml
@@ -119,13 +119,20 @@ let visible_decl (sto, id, ty, init) =
sto = Storage_default &&
match ty with TFun _ -> false | _ -> true
+let visible_fundef f =
+ match f.fd_storage with
+ | Storage_default -> not f.fd_inline
+ | Storage_extern -> true
+ | Storage_static -> false
+ | Storage_register -> assert false
+
let rec add_init_globdecls accu = function
| [] -> accu
| g :: rem ->
match g.gdesc with
| Gdecl decl when visible_decl decl ->
add_decl decl; add_init_globdecls accu rem
- | Gfundef f when f.fd_storage = Storage_default && not f.fd_inline ->
+ | Gfundef f when visible_fundef f ->
add_fundef f; add_init_globdecls accu rem
| Gdecl _ | Gfundef _ | Gcompositedef _ | Gtypedef _ | Genumdef _ ->
(* Keep for later iterations *)
@@ -178,9 +185,7 @@ 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 && not f.fd_inline)
- || needed f.fd_name
+ | Gfundef f -> visible_fundef f || needed f.fd_name
| Gcompositedecl(_, id, _) -> needed id
| Gcompositedef(_, id, _, flds) -> needed id
| Gtypedef(id, ty) -> needed id