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=-3.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 5DA3FC4743C for ; Wed, 23 Jun 2021 08:39:32 +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 C4C9861026 for ; Wed, 23 Jun 2021 08:39:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4C9861026 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.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 15N8dQ2w008109; Wed, 23 Jun 2021 10:39:26 +0200 (CEST) Received: from systeme.lip6.fr (systeme.lip6.fr [127.0.0.1]) by systeme.lip6.fr (Postfix) with ESMTP id F3AC04108; Wed, 23 Jun 2021 10:39:25 +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 270863783 for ; Wed, 23 Jun 2021 10:39:24 +0200 (CEST) Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20:0:0:0:336]) by isis.lip6.fr (8.15.2/8.15.2) with ESMTPS id 15N8dMWs028979 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=OK) for ; Wed, 23 Jun 2021 10:39:23 +0200 (CEST) Received: by mail-ot1-x336.google.com with SMTP id 6-20020a9d07860000b02903e83bf8f8fcso1155691oto.12 for ; Wed, 23 Jun 2021 01:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=cKsEMM1m6IdHoRNlttCJGSQn8VzJU/E6De7kSF8QtXE=; b=nAloi03RbRlHbmKYMohlQ0xxjFkLugoMNOaRT4TLLSzCgVPEWnI9qGFW0dqloytdrZ wC5VTUtbmwstRmn4HEurpz1yS5sK0s5hU673IiTlG/TLWuw5c+C4rlyR3lPgN+RNtTeW PAFvhtAyVTOruDEijP/DHV5bMSefySIQVHNOKx/OBedz8D23lXbBrWdHu4TxW4FmyVPv clnle4fcUudJU994xG2zLxxeupy31oTISeifxE4yOWDF9Y9NOsLwo1gFKnnfcfULuEw+ BOu0T6/hf4dUbK+RpwD43Fgl2XE5cQfgImzPZJabtHPw2WQDI0cg4X0UzBAXEYt4B2I5 liLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=cKsEMM1m6IdHoRNlttCJGSQn8VzJU/E6De7kSF8QtXE=; b=QSFLC0DlKRvJub8KMmyaDrqP+KSc2i24vCIqG+pRAdvCLcpK+OmEqEdEy/6sxJDw/E S7ZaiiW1e+fpqG814IJs3tXJWa0ctiyjgT6hsrF0QjdjDXsJpFvz6v2GczMYJ+fFZEWQ xuX0C3tIQ3yRM6vfq0ZLZeAehIgVRarTb3A2PNQrdYXgYzC2gXi5l+7hTXmy0pdiig8z cKM9kg0K7o/lNjvoyD00eZyff53oYKJWRsbgwwm1LCSeVzAxe0iC3FNlJL5elon6ISkA XNthm2J7BqhJ1Nqn4e7+gMwnYwhA0+XRjKDufPQbI/7jAow89XtvYcmli9ku2lhNtmoe ieAw== X-Gm-Message-State: AOAM533fUmJJzK9ODIMl3sCHmHfM35ArZlxCjgEQJM1lFA2MF3b34BFI amVwtM+qMd06Jut2EisVTjUdfrwA/Lc2q6gtxCsPk6YbJFxNYQ== X-Google-Smtp-Source: ABdhPJyqdC6RY2JF1bs1KZU0W7lRf2ujwIqpt/BBITjGShmSrxdOKLaMRt0crp4a68Fz3D+idXaHwtVJvJQzV5ldjcg= X-Received: by 2002:a05:6830:2315:: with SMTP id u21mr6931801ote.365.1624437561585; Wed, 23 Jun 2021 01:39:21 -0700 (PDT) MIME-Version: 1.0 From: Fuad Tabba Date: Wed, 23 Jun 2021 09:38:45 +0100 Message-ID: To: cocci@systeme.lip6.fr X-Greylist: Sender IP whitelisted, Sender e-mail whitelisted, not delayed by milter-greylist-4.4.3 (isis.lip6.fr [132.227.60.2]); Wed, 23 Jun 2021 10:39:27 +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]); Wed, 23 Jun 2021 10:39:23 +0200 (CEST) X-Scanned-By: MIMEDefang 2.78 on 132.227.60.2 X-Scanned-By: MIMEDefang 2.78 Subject: [Cocci] Adding a newline after a variable definition 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 Hi, I have a semantic patch that inserts a new variable definition into a function. I would like it if that variable definition is the only one in the function, then it should add a new line to separate the definition from following statements (Linux code formatting style). I thought that doing this in two steps might be easier, i.e., add the definition, then check and add a newline if a statement follows: @@ identifier x; identifier func; statement S; @@ func(...) { struct kvm_cpu_context *x = ...; + newline; S ... } The above works as expected, and it adds "newline;" after the definition of x. The thing is, is it possible to add an actual new line, as opposed to a non-whitespace string? I tried just using a + but that didn't work. Thanks! /fuad _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci