Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp450480pxv; Thu, 1 Jul 2021 01:44:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUFhWqh75TD7rpWqhGn6MJnMwnMxgzAxJRQAegb5F1HjmoutbdzzUJum1lS4LQet9o2a/f X-Received: by 2002:a05:6402:498:: with SMTP id k24mr34760339edv.25.1625129050254; Thu, 01 Jul 2021 01:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625129050; cv=none; d=google.com; s=arc-20160816; b=d19OE90zOlw/ZNy9G3U/TkZ8ihgA2byckA+ptsUqZ18c7Ovog0Ntn6/Tup5PMqsOj6 AE9bCi26aItnpMZ+NE/kO7+Pzl+T550NF8QVxxLplvZSl/437mey9/IWYnJMTnsxIVlD kH/gts2XyLCejbWLhouPM7Pwe3ymQSqey1PqnI4TB6CQCjRqQwtzME/Ou/jemv3yVPkV m4GkPBEz7Kb/n8+EmMhjH7P2wIag5lvZKn0aNxFSMhcK2To7lqrt5ftym6zHlg7aS8fn 3BJYPs9k/onsnzrzp7WWeaZNfLothKKf8OBBVRXhdiVDNHSyb5bBdIZoO7D+CQ/PJvOm F3Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=0eTdfuWr8OkbCJwFohOfIFTQTvzIAVPdyd1BL+jSIRo=; b=Lnbl9m/5cdoIkDaM930f4aK+YwifZAc/w9H8yngbuxOUy6FNdx4jyUw3EED18iJ3Gv B2m53P3LZ5zIv31Huo8wGfHEwlwkmZ5rCwowWS09pLX02dIp884YYeHXLwSHScDW05D4 pGDaX2IlMgxYG+aQbNMD5QirNV4xemG4A9H6Mt0P9S4IMXdW6TxDDB2zroc6bL5pNJbB cAcy4A0RXFTKLbVWDGkr/uL5k3hALG3Bie/kSIt4KFJSfVZqHXQcuCGaWkwr04MtV0Jv b9rrdm45fHllJWaVp3MNrJXIyzTyZ+RXOZ+v4evkfINdH4fMW2xnRPdRWPnwTulq4Cud S7uA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 24si22209391eja.677.2021.07.01.01.43.46; Thu, 01 Jul 2021 01:44:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235500AbhGAIoW (ORCPT + 99 others); Thu, 1 Jul 2021 04:44:22 -0400 Received: from mail-vs1-f51.google.com ([209.85.217.51]:34362 "EHLO mail-vs1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235356AbhGAIoV (ORCPT ); Thu, 1 Jul 2021 04:44:21 -0400 Received: by mail-vs1-f51.google.com with SMTP id x15so1866462vsc.1; Thu, 01 Jul 2021 01:41:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0eTdfuWr8OkbCJwFohOfIFTQTvzIAVPdyd1BL+jSIRo=; b=QJ/wPyyHekz9fdienltpiAnNmAC5OnVE7DxVT1t6xZRup8cy+GbGY/vI0KpByWBQ5d ACxPzYHzXHX6iMF/+q7tfeD44Z9/6At7bzoTM7756I4d54MyijA6Tuq0LJavCBdUgHDc Tqb7ld2d3Jg2adI9kmygh9uH+R9aL7fBrTQ65TK1Sg3sIYchNUSLs7y2uAHV+aeGnBj1 Nt9NhClBimV7/dtatpKTz2yTx12xaTXq2sSdu5S+hSVF2dWEMRwnNoYf22mvhgY4+68F 9G1hHSxa5utgpW2wASfFrLVcZPicDRCMWj53JyVyiw7bC15nPTvUr7scUkywbj2XKf5a 9OhQ== X-Gm-Message-State: AOAM531Pm18cnkAFl0hEYN6Fx+9K2Nw7W3KWI0eMa2S1Wpfd8MaFM8cn HxUqUsOrBZhFOxoseSkWBYiXO56JFAYpMvKTcQ0= X-Received: by 2002:a67:db05:: with SMTP id z5mr12484926vsj.18.1625128910205; Thu, 01 Jul 2021 01:41:50 -0700 (PDT) MIME-Version: 1.0 References: <20210627220544.8757-1-rdunlap@infradead.org> <20210627220544.8757-4-rdunlap@infradead.org> <6af41806-e715-4084-418f-4a8924d26c07@physik.fu-berlin.de> <8efd6e1d-9949-9598-9e6b-41d9b2f4ea7a@infradead.org> In-Reply-To: From: Geert Uytterhoeven Date: Thu, 1 Jul 2021 10:41:38 +0200 Message-ID: Subject: Re: [PATCH 3/3 v2] sh: fix READ/WRITE redefinition warnings To: John Paul Adrian Glaubitz Cc: Randy Dunlap , Linux Kernel Mailing List , Yoshinori Sato , Rich Felker , Linux-sh list , Takashi YOSHII , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ) Hi Adrian, On Wed, Jun 30, 2021 at 9:36 PM John Paul Adrian Glaubitz wrote: > On 6/30/21 9:33 PM, Randy Dunlap wrote: > > On 6/30/21 2:36 AM, John Paul Adrian Glaubitz wrote: > >> On 6/28/21 12:05 AM, Randy Dunlap wrote: > >>> kernel.h defines READ and WRITE, so rename the SH math-emu macros > >>> to MREAD and MWRITE. > >>> > >>> Fixes these warnings: > >>> > >>> ../arch/sh/math-emu/math.c:54: warning: "WRITE" redefined > >>> 54 | #define WRITE(d,a) ({if(put_user(d, (typeof (d) __user *)a)) return -EFAULT;}) > >>> In file included from ../arch/sh/math-emu/math.c:10: > >>> ../include/linux/kernel.h:37: note: this is the location of the previous definition > >>> 37 | #define WRITE 1 > >>> ../arch/sh/math-emu/math.c:55: warning: "READ" redefined > >>> 55 | #define READ(d,a) ({if(get_user(d, (typeof (d) __user *)a)) return -EFAULT;}) > >>> In file included from ../arch/sh/math-emu/math.c:10: > >>> ../include/linux/kernel.h:36: note: this is the location of the previous definition > >>> 36 | #define READ 0 > >>> > >>> Fixes: 4b565680d163 ("sh: math-emu support") > >>> Signed-off-by: Randy Dunlap > >>> Cc: Yoshinori Sato > >>> Cc: Rich Felker > >>> Cc: linux-sh@vger.kernel.org > >>> Cc: Takashi YOSHII > >>> Cc: John Paul Adrian Glaubitz > >>> Cc: Geert Uytterhoeven > >>> --- > >>> v2: renumber patches, otherwise no change; > >>> > >>> arch/sh/math-emu/math.c | 44 +++++++++++++++++++------------------- > >>> 1 file changed, 22 insertions(+), 22 deletions(-) > >> This one no longer applies to Linus' tree: > >> > >> glaubitz@node54:/data/home/glaubitz/linux> git am ../sh-patches-2021/\[PATCH\ 3_3\ v2\]\ sh\:\ fix\ READ_WRITE\ redefinition\ warnings.eml > >> Applying: sh: fix READ/WRITE redefinition warnings > >> error: patch failed: arch/sh/math-emu/math.c:51 > >> error: arch/sh/math-emu/math.c: patch does not apply > >> Patch failed at 0001 sh: fix READ/WRITE redefinition warnings > >> hint: Use 'git am --show-current-patch=diff' to see the failed patch > >> When you have resolved this problem, run "git am --continue". > >> If you prefer to skip this patch, run "git am --skip" instead. > >> To restore the original branch and stop patching, run "git am --abort". > >> glaubitz@node54:/data/home/glaubitz/linux> > > > > OK. Thanks for all of the testing. > > I'll report back with the other patch applied that Geert mentioned from linux-next before this one. FTR, I booted all three successfully on qemu/rts7751r2d and on physical landisk. > FWIW, there are some warnings when building the SH-7785LCR configuration: > > In file included from ./arch/sh/include/asm/hw_irq.h:6, > from ./include/linux/irq.h:591, > from ./include/asm-generic/hardirq.h:17, > from ./arch/sh/include/asm/hardirq.h:9, > from ./include/linux/hardirq.h:11, > from ./include/linux/interrupt.h:11, > from ./include/linux/serial_core.h:13, > from ./include/linux/serial_sci.h:6, > from arch/sh/kernel/cpu/sh4a/setup-sh7785.c:10: > ./include/linux/sh_intc.h:100:63: warning: division 'sizeof (void *) / sizeof (void)' does not compute the number of array elements [-Wsizeof-pointer-div] > 100 | #define _INTC_ARRAY(a) a, __same_type(a, NULL) ? 0 : sizeof(a)/sizeof(*a) > | ^ > ./include/linux/sh_intc.h:107:9: note: in expansion of macro '_INTC_ARRAY' > 107 | _INTC_ARRAY(sense_regs), _INTC_ARRAY(ack_regs), \ > | ^~~~~~~~~~~ > ./include/linux/sh_intc.h:124:15: note: in expansion of macro 'INTC_HW_DESC' > 124 | .hw = INTC_HW_DESC(vectors, groups, mask_regs, \ > | ^~~~~~~~~~~~ > arch/sh/kernel/cpu/sh4a/setup-sh7785.c:478:8: note: in expansion of macro 'DECLARE_INTC_DESC' > 478 | static DECLARE_INTC_DESC(intc_desc, "sh7785", vectors, groups, > | ^~~~~~~~~~~~~~~~~ A while ago, I had a look into fixing them, but it was non-trivial. The issue is that the macros are sometimes used with NULL pointer arrays. The __same_type() check in #define _INTC_ARRAY(a) a, __same_type(a, NULL) ? 0 : sizeof(a)/sizeof(*a) is supposed to catch that, but modern compilers seem to evaluate the non-taken branch, too, leading to the warning. Anyone with a suggestion? (CCing the multi-compiler guru) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds