linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Jaskaran Singh <jaskaransingh7654321@gmail.com>
To: cocci@systeme.lip6.fr
Cc: julia.lawall@inria.fr, jaskaransingh7654321@gmail.com,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: [Linux-kernel-mentees] [PATCH 2/4] parsing_c: parser: Use end_attributes_opt in decl2
Date: Mon,  8 Jun 2020 17:50:35 +0530	[thread overview]
Message-ID: <20200608122037.28019-3-jaskaransingh7654321@gmail.com> (raw)
In-Reply-To: <20200608122037.28019-1-jaskaransingh7654321@gmail.com>

The decl2 rule has redundant code caused by additional productions for
end attributes. Use end_attributes_opt to resolve this.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
---
 parsing_c/parser_c.mly | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/parsing_c/parser_c.mly b/parsing_c/parser_c.mly
index 78407844..ebb3b327 100644
--- a/parsing_c/parser_c.mly
+++ b/parsing_c/parser_c.mly
@@ -1560,18 +1560,7 @@ abstract_declaratort:
 /*(*************************************************************************)*/
 
 decl2:
- | decl_spec TPtVirg
-     { function local ->
-       let (returnType,storage) = fixDeclSpecForDecl (snd $1) in
-       let iistart = Ast_c.fakeInfo () in
-       DeclList ([{v_namei = None; v_type = returnType;
-                   v_storage = unwrap storage; v_local = local;
-                   v_attr = fst $1; v_endattr = Ast_c.noattr;
-                   v_type_bis = ref None;
-                },[]],
-                ($2::iistart::snd storage))
-     }
- | decl_spec end_attributes TPtVirg
+ | decl_spec end_attributes_opt TPtVirg
      { function local ->
        let (returnType,storage) = fixDeclSpecForDecl (snd $1) in
        let iistart = Ast_c.fakeInfo () in
@@ -1605,18 +1594,7 @@ decl2:
      }
  /*(* cppext: *)*/
 
- | storage_const_opt TMacroDecl TOPar argument_list TCPar TPtVirg
-     { function _ ->
-       match $1 with
-	 Some (sto,stoii) ->
-	   MacroDecl
-             ((sto, fst $2, $4, [], true),
-              (snd $2::$3::$5::$6::fakeInfo()::stoii))
-       | None ->
-	   MacroDecl
-             ((NoSto, fst $2, $4, [], true), [snd $2;$3;$5;$6;fakeInfo()]) }
-
- | storage_const_opt TMacroDecl TOPar argument_list TCPar end_attributes
+ | storage_const_opt TMacroDecl TOPar argument_list TCPar end_attributes_opt
    TPtVirg
      { function _ ->
        match $1 with
-- 
2.21.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  parent reply	other threads:[~2020-06-08 12:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 12:20 [Linux-kernel-mentees] [PATCH 0/4] parsing_c: parser: Add end_attributes_opt rule Jaskaran Singh
2020-06-08 12:20 ` [Linux-kernel-mentees] [PATCH 1/4] " Jaskaran Singh
2020-06-08 12:20 ` Jaskaran Singh [this message]
2020-06-08 12:20 ` [Linux-kernel-mentees] [PATCH 3/4] parsing_c: parser: Use end_attributes_opt in field_declaration Jaskaran Singh
2020-06-08 12:20 ` [Linux-kernel-mentees] [PATCH 4/4] parsing_c: parser: Use end_attributes_opt in cpp_other Jaskaran Singh
2020-06-09 10:00 ` [Linux-kernel-mentees] [PATCH 0/4] parsing_c: parser: Add end_attributes_opt rule Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200608122037.28019-3-jaskaransingh7654321@gmail.com \
    --to=jaskaransingh7654321@gmail.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).