Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp728660ybl; Wed, 28 Aug 2019 04:34:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqypqJh/tGMG9+D9hci1c+w6fSQnaY/7Uln8Bmu/bkhXjUvabgI8EPo0sZGsj24g3Iw+XcyG X-Received: by 2002:a17:902:aa8a:: with SMTP id d10mr2822578plr.265.1566992088642; Wed, 28 Aug 2019 04:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566992088; cv=none; d=google.com; s=arc-20160816; b=vGvkCL+j0xWcQowxTPBqLTsAwAmGxfhU28iN1C3xjrjz1RGayJRmBRYdDzh90AHFxk OdD9D6pElRo6AzSKKyPp8f6qxUKP9oGtitMdhnKjsF/KAafy6pozqJ2JFFdyLQFPcH/c gvbg4HvF02BeHqGztCER29AIkbgJV6l0hW3Hlv0Hx8q+zRXODUWZl3hkMGccVsbvqKp9 vqWqCwIVjU8kl8pg0SgcuzbMFlDzl7LT8JVLiIDca1LE2XVdrEcHGGJDKle6xxOg5D9x w+Sj71uKtT8M8o6olYtaaDujN/Uy6yk/0i/EgUH8Y3zY/yMrznZMICEmJuTkYDmVG9PY w2aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=W4k922k9zeV+KfQfiJqR2N+91jdNw1/Jjb4KIs5vjPQ=; b=rI5mIrjRUQq2KSmbA79Ex0sbiTRD+c1Pje9E6sKXiF9/MNBG1vc1/4LGO6vFql0zL8 WeLTjMWWctKy5jZGFTp/C455KcUytj9cMNyL3r5k0ddsvLa3YnXLIx0PrjKF8VKvvjeR SOHfnQemKe6JLhyGnyqmDgiR6bzceN4zbxlRfLOmqRGfhMdZtxxNvEDynkrMbk70Oywa mtOYRL5BUSJitMcILYfPquxD3jStAb9LEtvtWwAVYSRj69ZrzppbpEchlB9wecr/wRUm hIncCGcZJ4/x2OeqYsj0aFsR/qe+k1hFttF31icfQsSXnjQqEwoKiTW19QD3iZaESTwD HOxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=YorixTSY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a63si1753613pla.381.2019.08.28.04.34.32; Wed, 28 Aug 2019 04:34:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=YorixTSY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726408AbfH1Ldg (ORCPT + 99 others); Wed, 28 Aug 2019 07:33:36 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:37068 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbfH1Ldg (ORCPT ); Wed, 28 Aug 2019 07:33:36 -0400 Received: by mail-lf1-f67.google.com with SMTP id w67so1860128lff.4 for ; Wed, 28 Aug 2019 04:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=W4k922k9zeV+KfQfiJqR2N+91jdNw1/Jjb4KIs5vjPQ=; b=YorixTSYr0MhSCMW5HCOletixEn6/tOCf5UL+8sbNzlPEuMgChbvkGL2EH1dxfcCts MgKWJt/de/ny6cL0qu7LpJ5U1DQnoAZIDuArTGyINHElseqALQhXqW8QMF2z56eGkZni Ee3ktj55pxMJMfgsAmHdbvC/6t5xHpFWW++7E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=W4k922k9zeV+KfQfiJqR2N+91jdNw1/Jjb4KIs5vjPQ=; b=msL5gmiPKKR9AsYyUk5ToP1zpRkA/poaBLSM4saocxcePyuBF1O6757vTvFcRiF6OY IVUaiYne5ZPF4aT5GDs3suEcyOTMbX/SCRflG3O9JXiWs6wdl2n2SP0G4K6s6YbRG+xU dfAwjuMWGHWNVTL1QSlTS87pZstsEoRF5Hyk+kcgBbklSbuGU4m3Us5rJ64DeBFslR2v A/sVnmrsEFylvlWyi/AX0q/hJQuA0N/5jXuDtYj/lcQ9Ji1bJZW7BcZlPFDHoAt4yH6W pZImaI3Ly+b/lbFF9/OSbGqi6THzs4uxzlYpT0oj+n9xa4RA/wvM6JP6FzdDb50t+rFo wU3A== X-Gm-Message-State: APjAAAXk/5KlddvwQyn8bcBKEFMiTf+O48kRBUWCdBM/8h145hEcGNwG m/maCxzG12RnT+ZPcgyq/wZoRg== X-Received: by 2002:ac2:5a5b:: with SMTP id r27mr2291210lfn.69.1566992014318; Wed, 28 Aug 2019 04:33:34 -0700 (PDT) Received: from [172.16.11.28] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id v15sm764768lfg.19.2019.08.28.04.33.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Aug 2019 04:33:33 -0700 (PDT) Subject: Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage To: Julia Lawall , Denis Efremov Cc: Joe Perches , cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org, Gilles Muller , Nicolas Palix , Michal Marek References: <20190825130536.14683-1-efremov@linux.com> <88f6e48e-1230-9488-a973-397f4e6dfbb5@linux.com> <4E9DDF9E-C883-44F0-A3F4-CD49284DB60D@lip6.fr> From: Rasmus Villemoes Message-ID: <95c32d19-eb4d-a214-6332-038610ec3dbd@rasmusvillemoes.dk> Date: Wed, 28 Aug 2019 13:33:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <4E9DDF9E-C883-44F0-A3F4-CD49284DB60D@lip6.fr> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/08/2019 21.19, Julia Lawall wrote: > > >> On 26 Aug 2019, at 02:59, Denis Efremov wrote: >> >> >> >>> On 25.08.2019 19:37, Joe Perches wrote: >>>> On Sun, 2019-08-25 at 16:05 +0300, Denis Efremov wrote: >>>> This patch adds coccinelle script for detecting !likely and !unlikely >>>> usage. It's better to use unlikely instead of !likely and vice versa. >>> >>> Please explain _why_ is it better in the changelog. >>> >> >> In my naive understanding the negation (!) before the likely/unlikely >> could confuse the compiler > > As a human I am confused. Is !likely(x) equivalent to x or !x? #undef likely #undef unlikely #define likely(x) (x) #define unlikely(x) (x) should be a semantic no-op. So changing !likely(x) to unlikely(x) is completely wrong. If anything, !likely(x) can be transformed to unlikely(!x). Rasmus