diff options
author | François Pottier <francois.pottier@inria.fr> | 2015-10-23 12:59:47 +0200 |
---|---|---|
committer | François Pottier <francois.pottier@inria.fr> | 2015-10-23 12:59:47 +0200 |
commit | e5d2a949f0e5cd5f1ddaece41a03f65ac1e3836e (patch) | |
tree | 4aa17fdee5ee531590342da2d1a833d0314f5c79 | |
parent | e9ea9da494eeabfc459e7ba43f9f5ccb9a48dcf1 (diff) | |
download | compcert-e5d2a949f0e5cd5f1ddaece41a03f65ac1e3836e.tar.gz compcert-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).
-rw-r--r-- | cparser/pre_parser.mly | 9 |
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 |