aboutsummaryrefslogtreecommitdiffstats
path: root/cparser
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-06-06 19:15:37 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-06-06 19:15:37 +0200
commitf73c85e2b18017997c52a0d9478726d31a601669 (patch)
treed383b2f8a0b199f6f311e968063fbbbbc3c88ca3 /cparser
parenteb175007959e7421a783d402bcbe255f456272f3 (diff)
parentddb2c968e6c57d2117434f169471d87f643d831a (diff)
downloadcompcert-kvx-f73c85e2b18017997c52a0d9478726d31a601669.tar.gz
compcert-kvx-f73c85e2b18017997c52a0d9478726d31a601669.zip
Merge branch 'master' of https://github.com/AbsInt/CompCert into mppa-work
Diffstat (limited to 'cparser')
-rw-r--r--cparser/Elab.ml8
1 files changed, 5 insertions, 3 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml
index 9cca930d..10380152 100644
--- a/cparser/Elab.ml
+++ b/cparser/Elab.ml
@@ -836,7 +836,7 @@ and elab_type_declarator ?(fundef = false) loc env ty = function
| Cabs.PROTO(d, (params, vararg)) ->
elab_return_type loc env ty;
let (ty, a) = get_nontype_attrs env ty in
- let (params', env') = elab_parameters env params in
+ let (params', env') = elab_parameters loc env params in
(* For a function declaration (fundef = false), the scope introduced
to treat parameters ends here, so we discard the extended
environment env' returned by elab_parameters.
@@ -862,13 +862,15 @@ and elab_type_declarator ?(fundef = false) loc env ty = function
(* Elaboration of parameters in a prototype *)
-and elab_parameters env params =
+and elab_parameters loc env params =
(* Prototype introduces a new scope *)
let (vars, env) = mmap elab_parameter (Env.new_scope env) params in
(* Catch special case f(t) where t is void or a typedef to void *)
match vars with
| [ ( {C.name=""}, t) ] when is_void_type env t -> [],env
- | _ -> vars,env
+ | _ -> if List.exists (fun (id, t) -> id.C.name = "" && is_void_type env t) vars then
+ error loc "'void' must be the only parameter";
+ (vars, env)
(* Elaboration of a function parameter *)