From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B90D7C2BA1A for ; Fri, 24 Apr 2020 09:20:02 +0000 (UTC) Received: from isis.lip6.fr (isis.lip6.fr [132.227.60.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5412320724 for ; Fri, 24 Apr 2020 09:20:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UqWFA3do" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5412320724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=cocci-bounces@systeme.lip6.fr Received: from systeme.lip6.fr (systeme.lip6.fr [132.227.104.7]) by isis.lip6.fr (8.15.2/8.15.2) with ESMTP id 03O9JnuQ017639; Fri, 24 Apr 2020 11:19:49 +0200 (CEST) Received: from systeme.lip6.fr (systeme.lip6.fr [127.0.0.1]) by systeme.lip6.fr (Postfix) with ESMTP id 930CA7827; Fri, 24 Apr 2020 11:19:49 +0200 (CEST) Received: from isis.lip6.fr (isis.lip6.fr [132.227.60.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by systeme.lip6.fr (Postfix) with ESMTPS id DC84C7815 for ; Fri, 24 Apr 2020 11:19:47 +0200 (CEST) Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20:0:0:0:643]) by isis.lip6.fr (8.15.2/8.15.2) with ESMTPS id 03O9JkfC004033 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 24 Apr 2020 11:19:47 +0200 (CEST) Received: by mail-pl1-x643.google.com with SMTP id n24so3516356plp.13 for ; Fri, 24 Apr 2020 02:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gizKFLeio6xSmx+G91gCimKHKkf3599LU8n16yE+du8=; b=UqWFA3douIO/fgITtYxg2R/cIziV1Tbk32BkHJYRWETt6gqEZWdXFDCDAJfIYE2EUe byWd3TZlLOHMrAeiPSHz32HrfEefSm1gBDMbPurbfpFBHsXLT/ufN1+c7bA9EFZ0QueE y+f6VBLAyKDCkTqRSeeP2XiH2FTxcR3oZlfqE7zlPMTwfbzNik3O85LRqWNzkDcOAEAB V+3IvVckZSmRJAP4w5mMOD7kx9bx+lCq5rbUqQjRPK0hMwYOtTMIshBzjNWXGrjd2UQN 2ItZqTKOy9chwIywxGDU8vB30zJLsdobCWhh5gVh/16vscMuu8s/Ye9FQU8T/uVUqZ4L U+6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gizKFLeio6xSmx+G91gCimKHKkf3599LU8n16yE+du8=; b=n9hMkD+I2Y1XImbRGoYD4Ii2U3Z74N0SENE2SsmgZeraQZWNZE0374md7vHNwjyRyW LsdbOzr2yZvRECa6yeNDe3Pw+HEa1RaOY9pM19X7lx9F5GZHPvIIrCLvKRdaQJOGzxxo 9TrF/ySwb+K8tgUFNT7hNbz9Sop2VEZAM5xR9WXw8YnYBoisfGHqsFNyCNxpx8jKb3Sh pUZEZXWEJWWAGwbNbhTEGPA23+GBfUDAdsUlgd5E+iGOFdafwXP/+5SZ47/rpSsCx1MX UOgEgCjoCxa95yQLLfrPw95Lj9acDXnUHc9w3cjzIjFfLGhLAiNVnUkBqKLAyDQqHwUa 8vSg== X-Gm-Message-State: AGi0PuavxI95mlzjXRotMAA7AApkNCMPP2Bvzr/kITZ4yHIRkVJg5i0d IGnmdo5RTP8CAbHGxRwsVl+CznZG1yo= X-Google-Smtp-Source: APiQypJm+eCxBFA7MaZ+yB13bdyTh7OHcGsbL19Z8y+Ep3r/hcs5VcvZkwmqOpbS9/EzKkAcY7kl1A== X-Received: by 2002:a17:90a:7301:: with SMTP id m1mr5047746pjk.162.1587719985305; Fri, 24 Apr 2020 02:19:45 -0700 (PDT) Received: from localhost.localdomain ([1.38.216.60]) by smtp.gmail.com with ESMTPSA id c80sm5043933pfb.82.2020.04.24.02.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 02:19:44 -0700 (PDT) From: Jaskaran Singh To: cocci@systeme.lip6.fr Date: Fri, 24 Apr 2020 14:47:56 +0530 Message-Id: <20200424091801.13871-21-jaskaransingh7654321@gmail.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200424091801.13871-1-jaskaransingh7654321@gmail.com> References: <20200424091801.13871-1-jaskaransingh7654321@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, Sender e-mail whitelisted, not delayed by milter-greylist-4.4.3 (isis.lip6.fr [132.227.60.2]); Fri, 24 Apr 2020 11:19:49 +0200 (CEST) X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-4.4.3 (isis.lip6.fr [IPv6:2001:660:3302:283c:0:0:0:2]); Fri, 24 Apr 2020 11:19:47 +0200 (CEST) X-Scanned-By: MIMEDefang 2.78 on 132.227.60.2 X-Scanned-By: MIMEDefang 2.78 Cc: linux-kernel-mentees@lists.linuxfoundation.org Subject: [Cocci] [RFC PATCH 20/25] parsing_c: parser: Place parameter attributes in C AST X-BeenThere: cocci@systeme.lip6.fr X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: cocci-bounces@systeme.lip6.fr Errors-To: cocci-bounces@systeme.lip6.fr Parameter attributes are needed so as to not break the nocast test case when attributes are fully supported. Add parameter attributes to the C AST. Signed-off-by: Jaskaran Singh --- parsing_c/parser_c.mly | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/parsing_c/parser_c.mly b/parsing_c/parser_c.mly index 0c3da206..aedde179 100644 --- a/parsing_c/parser_c.mly +++ b/parsing_c/parser_c.mly @@ -857,7 +857,7 @@ new_argument: { let ty = addTypeD ($1,nullDecl) in let ((returnType,hasreg), iihasreg) = fixDeclSpecForParam ty in Right (ArgType { p_namei = None; p_type = returnType; - p_register = hasreg, iihasreg; + p_register = hasreg, iihasreg; p_attr = []; } ) } | new_argument TOCro expr TCCro @@ -1447,23 +1447,28 @@ parameter_decl2: { p_namei = Some name; p_type = mk_ty NoType []; p_register = (false, []); + p_attr = []; } } | decl_spec declaratorp { LP.kr_impossible(); let ((returnType,hasreg),iihasreg) = fixDeclSpecForParam (snd $1) in - let (name, ftyp) = $2 in + let attrs = (fst $1) @ (fst $2) in + let (name, ftyp) = snd $2 in { p_namei = Some (name); p_type = ftyp returnType; p_register = (hasreg, iihasreg); + p_attr = attrs; } } | decl_spec abstract_declaratorp { LP.kr_impossible(); let ((returnType,hasreg), iihasreg) = fixDeclSpecForParam (snd $1) in + let attrs = (fst $1) @ (fst $2) in { p_namei = None; p_type = (snd $2) returnType; p_register = hasreg, iihasreg; + p_attr = attrs; } } | decl_spec @@ -1472,6 +1477,7 @@ parameter_decl2: { p_namei = None; p_type = returnType; p_register = hasreg, iihasreg; + p_attr = fst $1; } } @@ -1484,11 +1490,11 @@ parameter_decl: parameter_decl2 { et "param" (); $1 } declaratorp: | declarator { let (attr,dec) = $1 in (* attr gets ignored *) - LP.add_ident (str_of_name (fst dec)); dec } + LP.add_ident (str_of_name (fst dec)); attr, dec } /*(* gccext: *)*/ | declarator attributes { let (attr,dec) = $1 in (* attr gets ignored *) - LP.add_ident (str_of_name (fst dec)); dec } + LP.add_ident (str_of_name (fst dec)); attr, dec } abstract_declaratorp: | abstract_declarator { $1 } -- 2.21.1 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci