From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web12.25134.1595441139014720163 for ; Wed, 22 Jul 2020 11:05:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=n9qLByNG; spf=pass (domain: nuviainc.com, ip: 209.85.221.65, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f65.google.com with SMTP id 88so2788650wrh.3 for ; Wed, 22 Jul 2020 11:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=N3jmV7gEi8bwGUFEPG/zbh2oiDjPjaw2Wjg43CBW/gQ=; b=n9qLByNGJKCmLEhobRhHva0RhpaCeLfAno45VQ3hS9qy8G/6jsXEcQK2/fu5lxwDji r7W/X8bKk0ujAzwPXWvgJFuUW8uM0snv2pYj6nObnSkPezhkl1hyqQujqFD88B9aPZAs 2RK9mbEk6KfTXgYig+nXjpisVgeDb6Pk/FYZlcunHjT4C/y7hpIfFWPEwGetERCI/IHC eLL2rv7qSlulpArzt3R0rUpGknA9SX3PSD7DMWx7T3jSOvGb8GkKzPPZEeYHzc527hCV 4bhhtSfR6slFzh9BnbnwhfhuM5Mzc+5s2oR2NMpFN7LIWkW/UbKW63PjDuqtvAo1txF+ dabQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=N3jmV7gEi8bwGUFEPG/zbh2oiDjPjaw2Wjg43CBW/gQ=; b=Lu1p4h1nY/WZ0FxAEZSMXV7IYaLfgMF4ba/ys6VLWJtZixFUK24iDDcQ/44/7VHnzd GGL2msSlP6z8TxcG8xlBgwydWjXjHBkh4sS5xyNl/MnKDia/RrnZ7GVzAqnZclvHjpsN ANI0xS11SMjyEiDnU1UDCTlMmJWcts9x1qN++/V89rU//EEyWNRm5TEYtftvEsLy9+hT q4jChdn3LgzhC6vM92Vpcw/7C9NWpy/AZk2kZ/2O8JnEGo10Z9rJAcP8vHcgJ8ZJzGV/ 8x9lJzvGxA/1X4pj4ctEHs/0tsOehT+Ba/09p/MECbIQ6fvvANsrCKX2fzlGLcTAYRMx +iQg== X-Gm-Message-State: AOAM530qmKa/NhHI4EycIxQyf6p+UE3jXc0HUrdnS/QpaDnl3++ERB8A YMLRLckxfB+74E2AwfyXFQoysYuzayt+B0jKrrsniVZGtR0Mf/YOc+44TXRmA6EEVJjtBepnyY7 BH2NWMcwYVOL6DCG+hF7lC0gLvOsw0U523SKaVBdccGNrLfxEKU4iwcCPYkbE0/HGgw== X-Google-Smtp-Source: ABdhPJxmPQGtInToUyz9b5n1AR7wj3HzgWQm1hih9boNKISVBPhqoD5XmeQJBsfVUvBvhIfbzfoG9w== X-Received: by 2002:a5d:42c9:: with SMTP id t9mr752101wrr.38.1595441137115; Wed, 22 Jul 2020 11:05:37 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id k126sm530816wmf.3.2020.07.22.11.05.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 11:05:36 -0700 (PDT) Date: Wed, 22 Jul 2020 19:05:34 +0100 From: "Leif Lindholm" To: devel@edk2.groups.io, bob.c.feng@intel.com Cc: PierreGondois , "Gao, Liming" , tomas@nuviainc.com Subject: Re: [edk2-devel] [PATCH V2 1/2] BaseTools: Add gcc flag to warn on void* pointer arithmetic Message-ID: <20200722180534.GG1337@vanye> References: <20200707083522.138944-1-pierre.gondois@arm.com> <20200707083522.138944-2-pierre.gondois@arm.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Bob, This patch also breaks about half of the ARM/AARCH64 platforms in edk2-platforms. I agree it should go in at a later stage, but for now, can we please revert it? Regards, Leif On Mon, Jul 20, 2020 at 04:10:27 +0000, Bob Feng wrote: > Reviewed-by: Bob Feng > > > -----Original Message----- > From: PierreGondois > Sent: Tuesday, July 7, 2020 4:35 PM > To: devel@edk2.groups.io > Cc: Pierre Gondois ; Feng, Bob C ; Gao, Liming ; tomas.pilar@arm.com; nd@arm.com > Subject: [PATCH V2 1/2] BaseTools: Add gcc flag to warn on void* pointer arithmetic > > From: Pierre Gondois > > By default, gcc allows void* pointer arithmetic. > This is a GCC extension. > However: > - the C reference manual states that void* > pointer "cannot be operands of addition > or subtraction operators". Cf s5.3.1 > "Generic Pointers"; > - Visual studio compiler treat such operation as > an error. > > To prevent such pointer arithmetic, the "-Wpointer-arith" > flag should be set for all GCC versions. > > The "-Wpointer-arith" allows to: > "Warn about anything that depends on the "size of" > a function type or of void. GNU C assigns these > types a size of 1, for convenience in calculations > with void * pointers and pointers to functions." > > This flag is available since GCC2.95.3 which came out in 2001. > > Signed-off-by: Pierre Gondois > --- > > The changes can be seen at: https://github.com/PierreARM/edk2/commits/831_Add_gcc_flag_warning_v2 > > Notes: > v1: > - Add "-Wpointer-arith" gcc flag. [Pierre] > v2: > - Only add the flag for ARM and AARCH64. [Tomas] > > BaseTools/Conf/tools_def.template | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template > index 8aeb8a2a6417e41c5660cda5066f52adc8cc3089..397b011ba38f97f81f314f8641ac8bb95d5a2197 100755 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -1,7 +1,7 @@ > # > # Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# Portions copyright (c) 2011 - 2019, ARM Ltd. All rights reserved.
> +# Portions copyright (c) 2011 - 2020, ARM Ltd. All rights > +reserved.
> # Copyright (c) 2015, Hewlett-Packard Development Company, L.P.
# (C) Copyright 2020, Hewlett Packard Enterprise Development LP
# Copyright (c) Microsoft Corporation > @@ -1921,9 +1921,9 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N > DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common > DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe > DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe > -DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie > +DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -Wpointer-arith -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie > DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access > -DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18 > +DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -Wpointer-arith -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18 > DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align -mgeneral-regs-only > DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie > DEFINE GCC_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' > > > >