summaryrefslogtreecommitdiff
path: root/cparser
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-03-07 17:49:18 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-03-07 17:49:18 +0000
commitc24a652789e15b33153c1d90c6869eb6e6e28040 (patch)
treee5e5aa2767fe098e3b23f82091ff6d60b0c6d8f2 /cparser
parent6a8503115a9952dc793d15d0ea9033b68b30aae6 (diff)
Handling of builtins, continued.
PrintCsyntax, PrintAsm: improve printing of float literals. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1284 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser')
-rw-r--r--cparser/Builtins.ml8
-rw-r--r--cparser/Builtins.mli1
-rw-r--r--cparser/Makefile4
3 files changed, 9 insertions, 4 deletions
diff --git a/cparser/Builtins.ml b/cparser/Builtins.ml
index 020452f..8eb1abf 100644
--- a/cparser/Builtins.ml
+++ b/cparser/Builtins.ml
@@ -20,14 +20,17 @@ open Cutil
let env = ref Env.empty
let idents = ref []
+let decls = ref []
let environment () = !env
let identifiers () = !idents
+let declarations () = List.rev !decls
let add_typedef (s, ty) =
let (id, env') = Env.enter_typedef !env s ty in
env := env';
- idents := id :: !idents
+ idents := id :: !idents;
+ decls := {gdesc = Gtypedef(id, ty); gloc = no_loc} :: !decls
let add_function (s, (res, args, va)) =
let ty =
@@ -36,7 +39,8 @@ let add_function (s, (res, args, va)) =
va, []) in
let (id, env') = Env.enter_ident !env s Storage_extern ty in
env := env';
- idents := id :: !idents
+ idents := id :: !idents;
+ decls := {gdesc = Gdecl(Storage_extern, id, ty, None); gloc = no_loc} :: !decls
type t = {
typedefs: (string * C.typ) list;
diff --git a/cparser/Builtins.mli b/cparser/Builtins.mli
index be0d941..7f9d78a 100644
--- a/cparser/Builtins.mli
+++ b/cparser/Builtins.mli
@@ -15,6 +15,7 @@
val environment: unit -> Env.t
val identifiers: unit -> C.ident list
+val declarations: unit -> C.globdecl list
type t = {
typedefs: (string * C.typ) list;
diff --git a/cparser/Makefile b/cparser/Makefile
index df1d604..837bda8 100644
--- a/cparser/Makefile
+++ b/cparser/Makefile
@@ -11,9 +11,9 @@ INTFS=C.mli
SRCS=Errors.ml Cabs.ml Cabshelper.ml Parse_aux.ml Parser.ml Lexer.ml \
Machine.ml \
- Env.ml Cprint.ml Cutil.ml Ceval.ml Cleanup.ml \
+ Env.ml Cprint.ml Cutil.ml Ceval.ml \
Builtins.ml GCC.ml \
- Elab.ml Rename.ml \
+ Cleanup.ml Elab.ml Rename.ml \
Transform.ml \
Unblock.ml SimplExpr.ml AddCasts.ml StructByValue.ml StructAssign.ml \
Bitfields.ml \