kbuild: Disable -Wpointer-to-enum-cast
Subsystems (3)
PATCH 1/1 kbuild: Disable -Wpointer-to-enum-cast
Clang's -Wpointer-to-int-cast deviates from GCC in that it warns when casting to enums. The kernel does this in certain places, such as device tree matches to set the version of the device being used, which allows the kernel to avoid using a gigantic union.
https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L428
https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L402
https://elixir.bootlin.com/linux/v5.5.8/source/include/linux/mod_devicetable.h#L264
To avoid a ton of false positive warnings, disable this particular part of the warning, which has been split off into a separate diagnostic so that the entire warning does not need to be turned off for clang.
--- Makefile | 4 ++++ 1 file changed, 4 insertions(+)
Makefile +4 -0
@@ -748,6 +748,10 @@ KBUILD_CFLAGS += -Wno-tautological-compare # source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 KBUILD_CFLAGS += -mno-global-merge +# clang's -Wpointer-to-int-cast warns when casting to enums, which does not match GCC. +# Disable that part of the warning because it is very noisy across the kernel and does +# not point out any real bugs. +KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) else # These warnings generated too much noise in a regular build.
Signature · 1 line
2.25.1
Hi Nathan,
Quoted 27 lines · Nathan Chancellor
Clang's -Wpointer-to-int-cast deviates from GCC in that it warns when casting to enums. The kernel does this in certain places, such as device tree matches to set the version of the device being used, which allows the kernel to avoid using a gigantic union.
https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L428
https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L402
https://elixir.bootlin.com/linux/v5.5.8/source/include/linux/mod_devicetable.h#L264To avoid a ton of false positive warnings, disable this particular part of the warning, which has been split off into a separate diagnostic so that the entire warning does not need to be turned off for clang.
Signed-off-by Nathan Chancellor <[email protected]>--- Makefile | 4 ++++ 1 file changed, 4 insertions(+)Makefile +0
-0
Makefile KBUILD_CFLAGS += -Wno-tautological-compare · line 755
Quoted 8 lines
Makefile +4
-0@@ -748,6 +748,10 @@ KBUILD_CFLAGS += -Wno-tautological-compare # source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 KBUILD_CFLAGS += -mno-global-merge +# clang's -Wpointer-to-int-cast warns when casting to enums, which does not match GCC. +# Disable that part of the warning because it is very noisy across the kernel and does +# not point out any real bugs. +KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) else
I'd rather want to fix all the call-sites (97 drivers?) instead of having -Wno-pointer-to-enum-cast forever.
If it is tedious to fix them all for now, can we add it into scripts/Makefile.extrawarn so that this is disabled by default, but shows up with W=1 builds?
(When we fix most of them, we will be able to make it a real warning.)
What do you think?
Thanks.
Quoted 8 lines
Makefile +0
-1# These warnings generated too much noise in a regular build. --2.25.1
--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200308073400.23398-1-natechancellor%40gmail.com.
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 36 lines · Masahiro Yamada
Hi Nathan,
Quoted 32 lines · Nathan Chancellor
Clang's -Wpointer-to-int-cast deviates from GCC in that it warns when casting to enums. The kernel does this in certain places, such as device tree matches to set the version of the device being used, which allows the kernel to avoid using a gigantic union.
https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L428
https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L402
https://elixir.bootlin.com/linux/v5.5.8/source/include/linux/mod_devicetable.h#L264To avoid a ton of false positive warnings, disable this particular part of the warning, which has been split off into a separate diagnostic so that the entire warning does not need to be turned off for clang.
Signed-off-by Nathan Chancellor <[email protected]>--- Makefile | 4 ++++ 1 file changed, 4 insertions(+)Makefile +2
-0@@ -748,6 +748,10 @@ KBUILD_CFLAGS += -Wno-tautological-compare # source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 KBUILD_CFLAGS += -mno-global-merge +# clang's -Wpointer-to-int-cast warns when casting to enums, which does not match GCC. +# Disable that part of the warning because it is very noisy across the kernel and does
Quoted 8 lines
Makefile KBUILD_CFLAGS += -Wno-tautological-compare · line 755
Quoted 3 lines
Makefile +2
-0+# not point out any real bugs. +KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) elseI'd rather want to fix all the call-sites (97 drivers?) instead of having -Wno-pointer-to-enum-cast forever.
Yes, there are 97 unique warnings across my builds, which are mainly arm, arm64, and x86_64 defconfig/allmodconfig/allyesconfig:
https://github.com/ClangBuiltLinux/linux/issues/887#issuecomment-587938406
Quoted 3 lines
If it is tedious to fix them all for now, can we add it into
scripts/Makefile.extrawarnso that this is disabled by default, but shows up with W=1 builds?
Sure, I can send v2 to do that but I think that sending 97 patches just casting the small values (usually less than twenty) to unsigned long then to the enum is rather frivolous. I audited at least ten to fifteen of these call sites when creating the clang patch and they are all basically false positives.
I believe Nick discussed this with some other developers off list, maybe he has some other feedback to give. I'll wait to send a v2 until tomorrow in case anyone else has further comments.
Quoted 7 lines
(When we fix most of them, we will be able to make it a real warning.)
What do you think?
Thanks.
Cheers,
Nathan
From: Nathan Chancellor
Quoted 1 line
Sent: 10 March 2020 01:26
...
Quoted 5 lines
Sure, I can send v2 to do that but I think that sending 97 patches just casting the small values (usually less than twenty) to unsigned long then to the enum is rather frivolous. I audited at least ten to fifteen of these call sites when creating the clang patch and they are all basically false positives.
Such casts just make the code hard to read. If misused casts can hide horrid bugs. IMHO sprinkling the code with casts just to remove compiler warnings will bite back one day.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Quoted 10 lines · David Laight
From: Nathan Chancellor
Quoted 1 line
Sent: 10 March 2020 01:26
...
Quoted 5 lines
Sure, I can send v2 to do that but I think that sending 97 patches just casting the small values (usually less than twenty) to unsigned long then to the enum is rather frivolous. I audited at least ten to fifteen of these call sites when creating the clang patch and they are all basically false positives.
Quoted 5 lines
Such casts just make the code hard to read. If misused casts can hide horrid bugs. IMHO sprinkling the code with casts just to remove compiler warnings will bite back one day.
I agree that too much casts make the code hard to read, but irrespective of this patch, there is no difference in the fact that we need a cast to convert (const void *) to a non-pointer value.
The difference is whether we use
(uintptr_t) or (enum foo).
If we want to avoid casts completely,
we could use union in struct of_device_id
although this might be rejected.
FWIW:
drivers/ata/ahci_brcm.c +6 -6
@@ -415,11 +415,11 @@ static struct scsi_host_template ahci_platform_sht = { };static const struct of_device_id ahci_of_match[] = { - {.compatible ="brcm,bcm7425-ahci" , .data = (void *)BRCM_SATA_BCM7425 }, - {.compatible ="brcm,bcm7445-ahci" , .data = (void *)BRCM_SATA_BCM7445 }, - {.compatible ="brcm,bcm63138-ahci" , .data = (void *)BRCM_SATA_BCM7445 }, - {.compatible ="brcm,bcm-nsp-ahci" , .data = (void *)BRCM_SATA_NSP }, - {.compatible ="brcm,bcm7216-ahci" , .data = (void *)BRCM_SATA_BCM7216 }, + {.compatible ="brcm,bcm7425-ahci" , .data2 =BRCM_SATA_BCM7425 }, + {.compatible ="brcm,bcm7445-ahci" , .data2 =BRCM_SATA_BCM7445 }, + {.compatible ="brcm,bcm63138-ahci" , .data2 =BRCM_SATA_BCM7445 }, + {.compatible ="brcm,bcm-nsp-ahci" , .data2 =BRCM_SATA_NSP }, + {.compatible ="brcm,bcm7216-ahci" , .data2 =BRCM_SATA_BCM7216 }, {}, };MODULE_DEVICE_TABLE (of, ahci_of_match);
@@ -442,7 +442,7 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (!of_id)return -ENODEV ; - priv->version = (enum brcm_ahci_version )of_id->data; + priv->version = of_id->data2; priv->dev = dev; res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"top-ctrl" );
include/linux/mod_devicetable.h +4 -1
@@ -261,7 +261,10 @@ struct of_device_id {char name[32 ];char type[32 ];char compatible[128 ]; -const void *data; +union { +const void *data; +unsigned long data2; + }; };/* VIO */
Signature · 2 lines
Best Regards Masahiro Yamada
+ Saravana, who I spoke to briefly about this.
Quoted 81 lines · Masahiro Yamada
Quoted 10 lines · David Laight
From: Nathan Chancellor
Quoted 1 line
Sent: 10 March 2020 01:26
...
Quoted 5 lines
Sure, I can send v2 to do that but I think that sending 97 patches just casting the small values (usually less than twenty) to unsigned long then to the enum is rather frivolous. I audited at least ten to fifteen of these call sites when creating the clang patch and they are all basically false positives.
Quoted 5 lines
Such casts just make the code hard to read. If misused casts can hide horrid bugs. IMHO sprinkling the code with casts just to remove compiler warnings will bite back one day.
I agree that too much casts make the code hard to read, but irrespective of this patch, there is no difference in the fact that we need a cast to convert (const void *) to a non-pointer value.
The difference is whether we use
(uintptr_t) or (enum foo).If we want to avoid casts completely,
we could use union in structof_device_id
although this might be rejected.FWIW:
drivers/ata/ahci_brcm.c +6
-6@@ -415,11 +415,11 @@ static struct scsi_host_template ahci_platform_sht = { };static const struct of_device_id ahci_of_match[] = { - {.compatible ="brcm,bcm7425-ahci" , .data = (void *)BRCM_SATA_BCM7425 }, - {.compatible ="brcm,bcm7445-ahci" , .data = (void *)BRCM_SATA_BCM7445 }, - {.compatible ="brcm,bcm63138-ahci" , .data = (void *)BRCM_SATA_BCM7445 }, - {.compatible ="brcm,bcm-nsp-ahci" , .data = (void *)BRCM_SATA_NSP }, - {.compatible ="brcm,bcm7216-ahci" , .data = (void *)BRCM_SATA_BCM7216 }, + {.compatible ="brcm,bcm7425-ahci" , .data2 =BRCM_SATA_BCM7425 }, + {.compatible ="brcm,bcm7445-ahci" , .data2 =BRCM_SATA_BCM7445 }, + {.compatible ="brcm,bcm63138-ahci" , .data2 =BRCM_SATA_BCM7445 }, + {.compatible ="brcm,bcm-nsp-ahci" , .data2 =BRCM_SATA_NSP }, + {.compatible ="brcm,bcm7216-ahci" , .data2 =BRCM_SATA_BCM7216 }, {}, };MODULE_DEVICE_TABLE (of, ahci_of_match);@@ -442,7 +442,7 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (!of_id)return -ENODEV ; - priv->version = (enum brcm_ahci_version )of_id->data; + priv->version = of_id->data2; priv->dev = dev; res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"top-ctrl" );include/linux/mod_devicetable.h +4
-1@@ -261,7 +261,10 @@ struct of_device_id {char name[32 ];char type[32 ];char compatible[128 ]; -const void *data; +union { +const void *data; +unsigned long data2; + }; };
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 37 lines · Nick Desaulniers
+ Saravana, who I spoke to briefly about this.
Quoted 32 lines · Masahiro Yamada
Quoted 10 lines · David Laight
From: Nathan Chancellor
Quoted 1 line
Sent: 10 March 2020 01:26
...
Quoted 5 lines
Sure, I can send v2 to do that but I think that sending 97 patches just casting the small values (usually less than twenty) to unsigned long then to the enum is rather frivolous. I audited at least ten to fifteen of these call sites when creating the clang patch and they are all basically false positives.
Quoted 5 lines
Such casts just make the code hard to read. If misused casts can hide horrid bugs. IMHO sprinkling the code with casts just to remove compiler warnings will bite back one day.
I agree that too much casts make the code hard to read, but irrespective of this patch, there is no difference in the fact that we need a cast to convert (const void *) to a non-pointer value.
The difference is whether we use
(uintptr_t) or (enum foo).If we want to avoid casts completely,
we could use union in structof_device_id
although this might be rejected.
The union like you suggested might fly. Maybe the new field data_ulong or data_u32 might work and even help non-enum non-pointer values to be stored in this directly too without needing the casting that's needed today.
I still don't get why the compiler can't be smarter about this. If the enum would fit inside the pointer, why not leave that alone and throw a warning only when the enum really can overflow the pointer field?
Quoted 33 lines
Quoted 33 lines
FWIW:
drivers/ata/ahci_brcm.c +6
-6@@ -415,11 +415,11 @@ static struct scsi_host_template ahci_platform_sht = { };static const struct of_device_id ahci_of_match[] = { - {.compatible ="brcm,bcm7425-ahci" , .data = (void *)BRCM_SATA_BCM7425 }, - {.compatible ="brcm,bcm7445-ahci" , .data = (void *)BRCM_SATA_BCM7445 }, - {.compatible ="brcm,bcm63138-ahci" , .data = (void *)BRCM_SATA_BCM7445 }, - {.compatible ="brcm,bcm-nsp-ahci" , .data = (void *)BRCM_SATA_NSP }, - {.compatible ="brcm,bcm7216-ahci" , .data = (void *)BRCM_SATA_BCM7216 }, + {.compatible ="brcm,bcm7425-ahci" , .data2 =BRCM_SATA_BCM7425 }, + {.compatible ="brcm,bcm7445-ahci" , .data2 =BRCM_SATA_BCM7445 }, + {.compatible ="brcm,bcm63138-ahci" , .data2 =BRCM_SATA_BCM7445 }, + {.compatible ="brcm,bcm-nsp-ahci" , .data2 =BRCM_SATA_NSP }, + {.compatible ="brcm,bcm7216-ahci" , .data2 =BRCM_SATA_BCM7216 }, {}, };MODULE_DEVICE_TABLE (of, ahci_of_match);@@ -442,7 +442,7 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (!of_id)return -ENODEV ; - priv->version = (enum brcm_ahci_version )of_id->data; + priv->version = of_id->data2; priv->dev = dev;
Quoted 16 lines
Quoted 6 lines
drivers/ata/ahci_brcm.c +0
-0res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"top-ctrl" );include/linux/mod_devicetable.h +0
-0include/linux/mod_devicetable.h struct of_device_id { · line 269
Quoted 10 lines
include/linux/mod_devicetable.h +4
-1@@ -261,7 +261,10 @@ struct of_device_id {char name[32 ];char type[32 ];char compatible[128 ]; -const void *data; +union { +const void *data; +unsigned long data2; + }; };
I've never (or long since forgotten) consciously declared a union without a name and directly accessed it's fields. If this compiles, this seems reasonable.
-Saravana
Quoted 16 lines · Masahiro Yamada
Quoted 9 lines · David Laight
From: Nathan Chancellor
Quoted 1 line
Sent: 10 March 2020 01:26
...
Quoted 5 lines
Sure, I can send v2 to do that but I think that sending 97 patches just casting the small values (usually less than twenty) to unsigned long then to the enum is rather frivolous. I audited at least ten to fifteen of these call sites when creating the clang patch and they are all basically false positives.
Quoted 5 lines
Such casts just make the code hard to read. If misused casts can hide horrid bugs. IMHO sprinkling the code with casts just to remove compiler warnings will bite back one day.
Quoted 7 lines
I agree that too much casts make the code hard to read, but irrespective of this patch, there is no difference in the fact that we need a cast to convert (const void *) to a non-pointer value.
The difference is whether we use
(uintptr_t) or (enum foo).
or hide it altogether in a macro like cast_to
#define cast_to(type, val) \ etc...
where cast_to could do the appropriate
intermediate cast if type is an enum
and sizeof(tupeof val) is larger than int
Sasha Levin
maintainerHi
[This is an automated email]
This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v5.5.8, v5.4.24, v4.19.108, v4.14.172, v4.9.215, v4.4.215.
v5.5.8: Build OK!
v5.4.24: Build OK!
v4.19.108: Failed to apply! Possible dependencies:
076f421da5d4 ("kbuild: replace cc-name test with CONFIG_CC_IS_CLANG") a1494304346a ("kbuild: add all Clang-specific flags unconditionally")
v4.14.172: Failed to apply! Possible dependencies:
076f421da5d4 ("kbuild: replace cc-name test with CONFIG_CC_IS_CLANG") a1494304346a ("kbuild: add all Clang-specific flags unconditionally") c6d6f4c55f5c ("MIPS: Always specify -EB or -EL when using clang") ee67855ecd9d ("MIPS: vdso: Allow clang's --target flag in VDSO cflags")
v4.9.215: Failed to apply! Possible dependencies:
076f421da5d4 ("kbuild: replace cc-name test with CONFIG_CC_IS_CLANG") 0e5e7f5e9700 ("powerpc/64: Reclaim CPU_FTR_SUBCORE")
1421dc6d4829 ("powerpc/kbuild: Use flags variables rather than overriding LD/CC/AS") 250122baed29 ("powerpc64/module: Tighten detection of mcount call sites with -mprofile-kernel") 2a056f58fd33 ("powerpc: consolidate -mno-sched-epilog into FTRACE flags") 3a849815a136 ("powerpc/book3s64: Always build for power4 or later") 43c9127d94d6 ("powerpc: Add option to use thin archives")
471d7ff8b51b ("powerpc/64s: Remove POWER4 support")
5a61ef74f269 ("powerpc/64s: Support new device tree binding for discovering CPU features") 6977f95e63b9 ("powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer") 73aca179d78e ("powerpc/modules: Fix crashes by adding CONFIG_RELOCATABLE to vermagic") 951eedebcdea ("powerpc/64: Handle linker stubs in low .text code")
a1494304346a ("kbuild: add all Clang-specific flags unconditionally") a73657ea19ae ("powerpc/64: Add GENERIC_CPU support for little endian") abba759796f9 ("powerpc/kbuild: move -mprofile-kernel check to Kconfig") b40b2386bce9 ("powerpc/Makefile: Fix ld version check with 64-bit LE-only toolchain") b71c9ffb1405 ("powerpc: Add arch/powerpc/tools directory")
baa25b571a16 ("powerpc/64: Do not link crtsavres.o in vmlinux")
badf436f6fa5 ("powerpc/Makefiles: Convert ifeq to ifdef where possible") c0d64cf9fefd ("powerpc: Use feature bit for RTC presence rather than timebase presence") c1807e3f8466 ("powerpc/64: Free up CPU_FTR_ICSWX")
c6d6f4c55f5c ("MIPS: Always specify -EB or -EL when using clang")
cf43d3b26452 ("powerpc: Enable pkey subsystem")
ee67855ecd9d ("MIPS: vdso: Allow clang's --target flag in VDSO cflags") efe0160cfd40 ("powerpc/64: Linker on-demand sfpr functions for modules") f188d0524d7e ("powerpc: Use the new post-link pass to check relocations")
v4.4.215: Failed to apply! Possible dependencies:
076f421da5d4 ("kbuild: replace cc-name test with CONFIG_CC_IS_CLANG") 07e45c120c9c ("powerpc: Don't disable kernel FP/VMX/VSX MSR bits on context switch") 152d523e6307 ("powerpc: Create context switch helpers save_sprs() and restore_sprs()") 20dbe6706206 ("powerpc: Call restore_sprs() before _switch()")
2a056f58fd33 ("powerpc: consolidate -mno-sched-epilog into FTRACE flags") 3f3b5dc14c25 ("powerpc/pseries: PACA save area fix for general exception vs MCE") 579e633e764e ("powerpc: create flush_all_to_thread()")
57f266497d81 ("powerpc: Use gas sections for arranging exception vectors") 6977f95e63b9 ("powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer") 70fe3d980f5f ("powerpc: Restore FPU/VEC/VSX if previously used")
8c50b72a3b4f ("powerpc/ftrace: Add Kconfig & Make glue for mprofile-kernel") 951eedebcdea ("powerpc/64: Handle linker stubs in low .text code") a1494304346a ("kbuild: add all Clang-specific flags unconditionally") a74599a50419 ("powerpc/pseries: PACA save area fix for MCE vs MCE") abba759796f9 ("powerpc/kbuild: move -mprofile-kernel check to Kconfig") c208505900b2 ("powerpc: create giveup_all()")
c6d6f4c55f5c ("MIPS: Always specify -EB or -EL when using clang")
caca285e5ab4 ("powerpc/mm/radix: Use STD_MMU_64 to properly isolate hash related code") d1e1cf2e38de ("powerpc: clean up asm/switch_to.h")
d8d42b0511fe ("powerpc/64: Do load of PACAKBASE in LOAD_HANDLER")
ee67855ecd9d ("MIPS: vdso: Allow clang's --target flag in VDSO cflags") f0f558b131db ("powerpc/mm: Preserve CFAR value on SLB miss caused by access to bogus address") f3d885ccba85 ("powerpc: Rearrange __switch_to()")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Signature · 2 lines
Thanks Sasha
Quoted 75 lines · Sasha Levin
Hi
[This is an automated email]
This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v5.5.8, v5.4.24, v4.19.108, v4.14.172, v4.9.215, v4.4.215.
v5.5.8: Build OK!
v5.4.24: Build OK!
v4.19.108: Failed to apply! Possible dependencies:
076f421da5d4("kbuild: replace cc-name test withCONFIG_CC_IS_CLANG")a1494304346a("kbuild: add all Clang-specific flags unconditionally")v4.14.172: Failed to apply! Possible dependencies:
076f421da5d4("kbuild: replace cc-name test withCONFIG_CC_IS_CLANG")a1494304346a("kbuild: add all Clang-specific flags unconditionally")c6d6f4c55f5c("MIPS: Always specify -EB or -EL when using clang")ee67855ecd9d("MIPS: vdso: Allow clang's --target flag in VDSO cflags")v4.9.215: Failed to apply! Possible dependencies:
076f421da5d4("kbuild: replace cc-name test withCONFIG_CC_IS_CLANG")0e5e7f5e9700("powerpc/64: ReclaimCPU_FTR_SUBCORE")
1421dc6d4829("powerpc/kbuild: Use flags variables rather than overriding LD/CC/AS")250122baed29("powerpc64/module: Tighten detection of mcount call sites with -mprofile-kernel")2a056f58fd33("powerpc: consolidate -mno-sched-epilog into FTRACE flags")3a849815a136("powerpc/book3s64: Always build for power4 or later")43c9127d94d6("powerpc: Add option to use thin archives")
471d7ff8b51b("powerpc/64s: Remove POWER4 support")
5a61ef74f269("powerpc/64s: Support new device tree binding for discovering CPU features")6977f95e63b9("powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer")73aca179d78e("powerpc/modules: Fix crashes by addingCONFIG_RELOCATABLEto vermagic")951eedebcdea("powerpc/64: Handle linker stubs in low .text code")
a1494304346a("kbuild: add all Clang-specific flags unconditionally")a73657ea19ae("powerpc/64: AddGENERIC_CPUsupport for little endian")abba759796f9("powerpc/kbuild: move -mprofile-kernel check toKconfig")b40b2386bce9("powerpc/Makefile: Fix ld version check with 64-bit LE-only toolchain")b71c9ffb1405("powerpc: Addarch/powerpc/toolsdirectory")
baa25b571a16("powerpc/64: Do not link crtsavres.o in vmlinux")
badf436f6fa5("powerpc/Makefiles: Convert ifeq to ifdef where possible")c0d64cf9fefd("powerpc: Use feature bit for RTC presence rather than timebase presence")c1807e3f8466("powerpc/64: Free upCPU_FTR_ICSWX")
c6d6f4c55f5c("MIPS: Always specify -EB or -EL when using clang")
cf43d3b26452("powerpc: Enable pkey subsystem")
ee67855ecd9d("MIPS: vdso: Allow clang's --target flag in VDSO cflags")efe0160cfd40("powerpc/64: Linker on-demand sfpr functions for modules")f188d0524d7e("powerpc: Use the new post-link pass to check relocations")v4.4.215: Failed to apply! Possible dependencies:
076f421da5d4("kbuild: replace cc-name test withCONFIG_CC_IS_CLANG")07e45c120c9c("powerpc: Don't disable kernel FP/VMX/VSX MSR bits on context switch")152d523e6307("powerpc: Create context switch helperssave_sprs()andrestore_sprs()")20dbe6706206("powerpc: Callrestore_sprs()before_switch()")
2a056f58fd33("powerpc: consolidate -mno-sched-epilog into FTRACE flags")3f3b5dc14c25("powerpc/pseries: PACA save area fix for general exception vs MCE")579e633e764e("powerpc: createflush_all_to_thread()")
57f266497d81("powerpc: Use gas sections for arranging exception vectors")6977f95e63b9("powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer")70fe3d980f5f("powerpc: Restore FPU/VEC/VSX if previously used")
8c50b72a3b4f("powerpc/ftrace: AddKconfig& Make glue for mprofile-kernel")951eedebcdea("powerpc/64: Handle linker stubs in low .text code")a1494304346a("kbuild: add all Clang-specific flags unconditionally")a74599a50419("powerpc/pseries: PACA save area fix for MCE vs MCE")abba759796f9("powerpc/kbuild: move -mprofile-kernel check toKconfig")c208505900b2("powerpc: creategiveup_all()")
c6d6f4c55f5c("MIPS: Always specify -EB or -EL when using clang")
caca285e5ab4("powerpc/mm/radix: UseSTD_MMU_64to properly isolate hash related code")d1e1cf2e38de("powerpc: clean upasm/switch_to.h")
d8d42b0511fe("powerpc/64: Do load of PACAKBASE inLOAD_HANDLER")
ee67855ecd9d("MIPS: vdso: Allow clang's --target flag in VDSO cflags")f0f558b131db("powerpc/mm: Preserve CFAR value on SLB miss caused by access to bogus address")f3d885ccba85("powerpc: Rearrange__switch_to()")
Quoted 7 lines
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Signature · 2 lines
Thanks Sasha
Hi Sasha,
If/when this patch hits mainline and I get the rejected emails from Greg, I will send a manual backport.
Cheers,
Nathan
PATCH v2 1/1 kbuild: Disable -Wpointer-to-enum-cast
In reply to Nathan ChancellorClang's -Wpointer-to-int-cast deviates from GCC in that it warns when casting to enums. The kernel does this in certain places, such as device tree matches to set the version of the device being used, which allows the kernel to avoid using a gigantic union.
https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L428
https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L402
https://elixir.bootlin.com/linux/v5.5.8/source/include/linux/mod_devicetable.h#L264
To avoid a ton of false positive warnings, disable this particular part of the warning, which has been split off into a separate diagnostic so that the entire warning does not need to be turned off for clang. It will be visible under W=1 in case people want to go about fixing these easily and enabling the warning treewide.
---
v1 -> v2:
* Move under scripts/Makefile.extrawarn, as requested by Masahiro
scripts/Makefile.extrawarn | 1 + 1 file changed, 1 insertion(+)
scripts/Makefile.extrawarn +1 -0
@@ -48,6 +48,7 @@ KBUILD_CFLAGS += -Wno-initializer-overrides KBUILD_CFLAGS += -Wno-format KBUILD_CFLAGS += -Wno-sign-compare KBUILD_CFLAGS += -Wno-format-zero-length +KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) endif endif
Signature · 1 line
2.26.0.rc1
Quoted 16 lines · Nathan Chancellor
Clang's -Wpointer-to-int-cast deviates from GCC in that it warns when casting to enums. The kernel does this in certain places, such as device tree matches to set the version of the device being used, which allows the kernel to avoid using a gigantic union.
https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L428
https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L402
https://elixir.bootlin.com/linux/v5.5.8/source/include/linux/mod_devicetable.h#L264To avoid a ton of false positive warnings, disable this particular part of the warning, which has been split off into a separate diagnostic so that the entire warning does not need to be turned off for clang. It will be visible under W=1 in case people want to go about fixing these easily and enabling the warning treewide.
Quoted 5 lines
Signed-off-by Nathan Chancellor <[email protected]>---
Applied to linux-kbuild.
Thanks.
Quoted 27 lines
v1 -> v2:
* Move under
scripts/Makefile.extrawarn, as requested by Masahiroscripts/Makefile.extrawarn | 1 + 1 file changed, 1 insertion(+)scripts/Makefile.extrawarn +1
-1@@ -48,6 +48,7 @@ KBUILD_CFLAGS += -Wno-initializer-overrides KBUILD_CFLAGS += -Wno-format KBUILD_CFLAGS += -Wno-sign-compare KBUILD_CFLAGS += -Wno-format-zero-length +KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) endif endif --2.26.0.rc1
--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200311194121.38047-1-natechancellor%40gmail.com.
Signature · 2 lines
Best Regards Masahiro Yamada