From 94fbd5d797830e5262f7328cde198acdfad73927 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Christophe=20L=C3=A9chenet?=
 <jean-christophe.lechenet@cea.fr>
Date: Thu, 21 Dec 2017 17:50:56 +0100
Subject: [PATCH] WIP

---
 src/kernel_internals/parsing/cparser.mly | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/kernel_internals/parsing/cparser.mly b/src/kernel_internals/parsing/cparser.mly
index 1d8a1be287b..45cfda11593 100644
--- a/src/kernel_internals/parsing/cparser.mly
+++ b/src/kernel_internals/parsing/cparser.mly
@@ -1030,6 +1030,11 @@ ghost_parameter_opt:
 |   ghost_parameter     { }
 ;
 
+(* For functions, the case where there is no parameter is treated in isolation,
+   because then we do not need the "lexer hack". Must we do the same here ?
+   It seems it does not make sense to add 0 ghost parameters, but with this
+   rule it is authorized by the grammar (but can be thrown afterwards by frama-c)
+*)
 ghost_parameter:
   LGHOST parameter_list_startscope rest_par_list RPAREN RGHOST { }
 ;
@@ -1230,10 +1235,10 @@ direct_decl: /* (* ISO 6.7.5 *) */
                                    { let (n, decl) = $1 in
                                      let (attrs, size) = $3 in
                                      (n, ARRAY(decl, attrs, size)) }
-|   direct_decl LPAREN RPAREN {
+|   direct_decl LPAREN RPAREN ghost_parameter_opt {
    let (n,decl) = $1 in (n, PROTO(decl,[],false))
   }
-|   direct_decl parameter_list_startscope rest_par_list RPAREN
+|   direct_decl parameter_list_startscope rest_par_list RPAREN ghost_parameter_opt
                                    { let (n, decl) = $1 in
                                      let (params, isva) = $3 in
                                      !Lexerhack.pop_context ();
-- 
GitLab