aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/pre_parser.mly
diff options
context:
space:
mode:
authorFrançois Pottier <francois.pottier@inria.fr>2015-10-23 12:59:47 +0200
committerFrançois Pottier <francois.pottier@inria.fr>2015-10-23 12:59:47 +0200
commite5d2a949f0e5cd5f1ddaece41a03f65ac1e3836e (patch)
tree4aa17fdee5ee531590342da2d1a833d0314f5c79 /cparser/pre_parser.mly
parente9ea9da494eeabfc459e7ba43f9f5ccb9a48dcf1 (diff)
downloadcompcert-kvx-e5d2a949f0e5cd5f1ddaece41a03f65ac1e3836e.tar.gz
compcert-kvx-e5d2a949f0e5cd5f1ddaece41a03f65ac1e3836e.zip
Removed the two uses of $syntaxerror in a semantic action.
For the first one, this is fine; the error is caught by a type check later on. For the second one, it is temporary. More thought is needed about the syntax of K&R functions anyway, as Jacques-Henri and I discovered that it is currently broken (it mis-interprets some function definitions).
Diffstat (limited to 'cparser/pre_parser.mly')
-rw-r--r--cparser/pre_parser.mly9
1 files changed, 7 insertions, 2 deletions
diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly
index f3bfb9e8..96cf0de7 100644
--- a/cparser/pre_parser.mly
+++ b/cparser/pre_parser.mly
@@ -870,14 +870,19 @@ function_definition_begin:
| declaration_specifiers(declaration(external_declaration))
ilist(pointer1) x=direct_declarator
{ match x with
- | (_, None) -> $syntaxerror
+ | (_, None) -> !open_context()
+ (* this case does not make sense, but we let it pass anyway;
+ this error will be caught later on by a type check *)
| (i, Some restore_fun) -> restore_fun ()
}
| declaration_specifiers(declaration(external_declaration))
ilist(pointer1) x=direct_declarator
LPAREN params=identifier_list RPAREN open_context declaration_list
{ match x with
- | (_, Some _) -> $syntaxerror
+ | (i, Some _) -> declare_varname i
+ (* this case does not make sense; the syntax of K&R
+ declarators is broken anyway, Jacques-Henri should
+ propose a fix soon *)
| (i, None) ->
declare_varname i;
List.iter declare_varname params