Add a production for macro declaration end attributes. This parses the
following C code from Linux v5.6-rc7:

  arch/x86/kernel/nmi_selftest.c:

        static DECLARE_BITMAP(nmi_ipi_mask, NR_CPUS) __initdata;

Signed-off-by: Jaskaran Singh <[email protected]>
---
 parsing_c/parser_c.mly | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/parsing_c/parser_c.mly b/parsing_c/parser_c.mly
index 3412c34e..71e58e5b 100644
--- a/parsing_c/parser_c.mly
+++ b/parsing_c/parser_c.mly
@@ -1576,15 +1576,16 @@ decl2:
      }
  /*(* cppext: *)*/
 
- | storage_const_opt TMacroDecl TOPar argument_list TCPar TPtVirg
+ | storage_const_opt TMacroDecl TOPar argument_list TCPar end_attributes_opt
+   TPtVirg
      { function _ ->
        match $1 with
         Some (sto,stoii) ->
           MacroDecl
-            ((sto, fst $2, $4, true), (snd $2::$3::$5::$6::fakeInfo()::stoii))
+            ((sto, fst $2, $4, true), (snd $2::$3::$5::$7::fakeInfo()::stoii))
        | None ->
           MacroDecl
-            ((NoSto, fst $2, $4, true), [snd $2;$3;$5;$6;fakeInfo()]) }
+            ((NoSto, fst $2, $4, true), [snd $2;$3;$5;$7;fakeInfo()]) }
 
  | storage_const_opt
      TMacroDecl TOPar argument_list TCPar teq initialize TPtVirg
-- 
2.21.1

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to