Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of W{,void-}pointer-to-int-cast from ToT clang #887

Closed
nathanchance opened this issue Feb 17, 2020 · 15 comments
Closed

Lots of W{,void-}pointer-to-int-cast from ToT clang #887

nathanchance opened this issue Feb 17, 2020 · 15 comments
Assignees
Labels
[BUG] linux A bug that should be fixed in the mainline kernel. [BUG] llvm (main) A bug in an unreleased version of LLVM (this label is appropriate for regressions) [FIXED][LINUX] 5.6 This bug was fixed in Linux 5.6

Comments

@nathanchance
Copy link
Member

There are a lot of new instances of the warning in the kernel, which appears to be due to a semantic difference between GCC and clang. I've commented on the Phabricator post about this to see what they say, I'd like not to send a bunch of patches like I did with -Wmisleading-indentation.

https://reviews.llvm.org/D72231#1878528

@nathanchance nathanchance added the [BUG] llvm (main) A bug in an unreleased version of LLVM (this label is appropriate for regressions) label Feb 17, 2020
@nathanchance
Copy link
Member Author

Well they at least agreed to remove the _Bool conversion warnings but the enum ones are still plentiful (97 unique warnings by my count) so this is going to be fun :(

      4 drivers/ata/ahci_brcm.c:445:18: warning: cast to smaller integer type 'enum brcm_ahci_version' from 'const void *' [-Wvoid-pointer-to-int-cast]
      5 drivers/ata/ahci_imx.c:1065:18: warning: cast to smaller integer type 'enum ahci_imx_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      5 drivers/ata/ahci_qoriq.c:277:21: warning: cast to smaller integer type 'enum ahci_qoriq_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      5 drivers/ata/ahci_xgene.c:792:14: warning: cast to smaller integer type 'enum xgene_ahci_version' from 'const void *' [-Wvoid-pointer-to-int-cast]
      5 drivers/ata/sata_rcar.c:905:15: warning: cast to smaller integer type 'enum sata_rcar_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      9 drivers/char/ipmi/ipmi_si_platform.c:274:15: warning: cast to smaller integer type 'enum si_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/crypto/exynos-rng.c:280:14: warning: cast to smaller integer type 'enum exynos_prng_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/crypto/inside-secure/safexcel.c:1692:18: warning: cast to smaller integer type 'enum safexcel_eip_version' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/devfreq/event/exynos-ppmu.c:523:21: warning: cast to smaller integer type 'enum exynos_ppmu_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/dma/mmp_tdma.c:640:10: warning: cast to smaller integer type 'enum mmp_tdma_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      9 drivers/dma/qcom/hidma.c:750:8: warning: cast to smaller integer type 'enum hidma_cap' from 'const void *' [-Wvoid-pointer-to-int-cast]
      9 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c:1112:19: warning: cast to smaller integer type 'enum adv7511_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      9 drivers/gpu/drm/lima/lima_drv.c:283:13: warning: cast to smaller integer type 'enum lima_gpu_id' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/gpu/drm/mediatek/mtk_drm_drv.c:465:15: warning: cast to smaller integer type 'enum mtk_ddp_comp_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      9 drivers/gpu/drm/pl111/pl111_versatile.c:325:24: warning: cast to smaller integer type 'enum versatile_clcd' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/gpu/drm/tiny/repaper.c:1009:11: warning: cast to smaller integer type 'enum repaper_model' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/ad7418.c:255:16: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/ads7828.c:141:10: warning: cast to smaller integer type 'enum ads7828_chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/adt7475.c:1486:10: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      5 drivers/hwmon/ina2xx.c:445:10: warning: cast to smaller integer type 'enum ina2xx_ids' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/lm63.c:1107:16: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/lm75.c:555:10: warning: cast to smaller integer type 'enum lm75_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/lm85.c:1560:16: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      5 drivers/hwmon/lm90.c:1780:16: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/max6697.c:612:16: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/pmbus/ibm-cffps.c:484:8: warning: cast to smaller integer type 'enum versions' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/pmbus/max20730.c:322:13: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/pmbus/tps53679.c:194:13: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/pmbus/ucd9000.c:524:10: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/pmbus/ucd9200.c:107:10: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/hwmon/tmp513.c:725:14: warning: cast to smaller integer type 'enum tmp51x_ids' from 'const void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/i2c/busses/i2c-bcm-iproc.c:902:3: warning: cast to smaller integer type 'enum bcm_iproc_i2c_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/i2c/busses/i2c-pxa.c:1227:15: warning: cast to smaller integer type 'enum pxa_i2c_types' from 'const void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/i2c/busses/i2c-rcar.c:945:18: warning: cast to smaller integer type 'enum rcar_i2c_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/iio/accel/bma180.c:825:10: warning: cast to smaller integer type 'enum chip_ids' from 'const void *' [-Wvoid-pointer-to-int-cast]
      2 drivers/iio/adc/ina2xx-adc.c:974:10: warning: cast to smaller integer type 'enum ina2xx_ids' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/iio/adc/rcar-gyroadc.c:513:16: warning: cast to smaller integer type 'enum rcar_gyroadc_model' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/iio/adc/ti-ads1015.c:947:9: warning: cast to smaller integer type 'enum chip_ids' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/iio/dac/mcp4725.c:402:14: warning: cast to smaller integer type 'enum chip_id' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c:144:15: warning: cast to smaller integer type 'enum inv_devices' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/iio/magnetometer/ak8975.c:878:13: warning: cast to smaller integer type 'enum asahi_compass_chipset' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/input/touchscreen/mms114.c:453:15: warning: cast to smaller integer type 'enum mms_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/media/dvb-core/dvb_frontend.c:2534:7: warning: cast to smaller integer type 'enum fe_sec_mini_cmd' from 'void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/media/dvb-core/dvb_frontend.c:2543:13: warning: cast to smaller integer type 'enum fe_sec_tone_mode' from 'void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/media/dvb-core/dvb_frontend.c:2544:19: warning: cast to smaller integer type 'enum fe_sec_tone_mode' from 'void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/media/dvb-core/dvb_frontend.c:2553:9: warning: cast to smaller integer type 'enum fe_sec_voltage' from 'void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/media/dvb-core/dvb_frontend.c:2554:22: warning: cast to smaller integer type 'enum fe_sec_voltage' from 'void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/media/platform/mtk-mdp/mtk_mdp_core.c:139:15: warning: cast to smaller integer type 'enum mtk_mdp_comp_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      9 drivers/mfd/hi6421-pmic-core.c:63:9: warning: cast to smaller integer type 'enum hi6421_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/mfd/lp87565.c:73:23: warning: cast to smaller integer type 'enum lp87565_device_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/mfd/max14577.c:409:5: warning: cast to smaller integer type 'enum maxim_device_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/mfd/mxs-lradc.c:145:15: warning: cast to smaller integer type 'enum mxs_lradc_id' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/mfd/stmpe-i2c.c:89:13: warning: cast to smaller integer type 'enum stmpe_partnum' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/mfd/tc3589x.c:343:13: warning: cast to smaller integer type 'enum tc3589x_version' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/mfd/wm831x-i2c.c:39:10: warning: cast to smaller integer type 'enum wm831x_parent' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/mfd/wm831x-spi.c:36:10: warning: cast to smaller integer type 'enum wm831x_parent' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/mfd/wm8994-core.c:639:19: warning: cast to smaller integer type 'enum wm8994_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      5 drivers/mtd/maps/physmap-versatile.c:208:25: warning: cast to smaller integer type 'enum versatile_flashprot' from 'const void *' [-Wvoid-pointer-to-int-cast]
      5 drivers/mtd/nand/raw/vf610_nfc.c:856:17: warning: cast to smaller integer type 'enum vf610_nfc_variant' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/mux/adgs1408.c:62:12: warning: cast to smaller integer type 'enum adgs1408_chip_id' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/net/can/spi/hi311x.c:874:17: warning: cast to smaller integer type 'enum hi3110_model' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/net/can/spi/mcp251x.c:1073:17: warning: cast to smaller integer type 'enum mcp251x_model' from 'const void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/net/ethernet/apm/xgene/xgene_enet_main.c:2042:20: warning: cast to smaller integer type 'enum xgene_enet_id' from 'const void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/net/ethernet/marvell/mvmdio.c:284:9: warning: cast to smaller integer type 'enum orion_mdio_bus_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/net/ethernet/ni/nixge.c:1257:12: warning: cast to smaller integer type 'enum nixge_version' from 'const void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/net/ethernet/renesas/ravb_main.c:2021:12: warning: cast to smaller integer type 'enum ravb_chip_id' from 'const void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/net/phy/mdio-xgene.c:337:13: warning: cast to smaller integer type 'enum xgene_mdio_id' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/net/wireless/ath/ath10k/ahb.c:751:11: warning: cast to smaller integer type 'enum ath10k_hw_rev' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/net/wireless/ath/ath11k/ahb.c:918:15: warning: cast to smaller integer type 'enum ath11k_hw_rev' from 'const void *' [-Wvoid-pointer-to-int-cast]
      5 drivers/pci/controller/pcie-iproc-platform.c:56:15: warning: cast to smaller integer type 'enum iproc_pcie_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/phy/broadcom/phy-bcm-ns-usb3.c:217:17: warning: cast to smaller integer type 'enum bcm_ns_family' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/phy/broadcom/phy-bcm-ns-usb3.c:324:17: warning: cast to smaller integer type 'enum bcm_ns_family' from 'const void *' [-Wvoid-pointer-to-int-cast]
      9 drivers/phy/broadcom/phy-bcm-sr-usb.c:370:13: warning: cast to smaller integer type 'enum bcm_usb_phy_version' from 'const void *' [-Wvoid-pointer-to-int-cast]
      9 drivers/phy/broadcom/phy-brcm-sata.c:767:19: warning: cast to smaller integer type 'enum brcm_sata_phy_version' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/phy/marvell/phy-pxa-usb.c:300:26: warning: cast to smaller integer type 'enum pxa_usb_phy_version' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/phy/ti/phy-j721e-wiz.c:782:14: warning: cast to smaller integer type 'enum wiz_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      2 drivers/platform/x86/hp-wmi.c:323:24: warning: cast to smaller integer type 'enum hp_wmi_radio' from 'void *' [-Wvoid-pointer-to-int-cast]
      5 drivers/power/reset/vexpress-poweroff.c:124:10: warning: cast to smaller integer type 'enum vexpress_reset_func' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/power/supply/ltc2941-battery-gauge.c:476:13: warning: cast to smaller integer type 'enum ltc294x_id' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/regulator/lp872x.c:876:5: warning: cast to smaller integer type 'enum lp872x_regulator_id' from 'void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/regulator/ltc3589.c:398:22: warning: cast to smaller integer type 'enum ltc3589_variant' from 'const void *' [-Wvoid-pointer-to-int-cast]
      9 drivers/reset/hisilicon/hi6220_reset.c:107:9: warning: cast to smaller integer type 'enum hi6220_reset_ctrl_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/rtc/rtc-ds1307.c:1605:18: warning: cast to smaller integer type 'enum ds_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/rtc/rtc-jz4740.c:320:15: warning: cast to smaller integer type 'enum jz4740_rtc_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      4 drivers/rtc/rtc-mxc.c:325:20: warning: cast to smaller integer type 'enum imx_rtc_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/rtc/rtc-rs5c372.c:651:19: warning: cast to smaller integer type 'enum rtc_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      6 drivers/rtc/rtc-rv8803.c:545:18: warning: cast to smaller integer type 'enum rv8803_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/scsi/fcoe/fcoe_transport.c:863:27: warning: cast to smaller integer type 'enum fip_mode' from 'void *' [-Wvoid-pointer-to-int-cast]
      8 drivers/soc/renesas/rmobile-sysc.c:206:22: warning: cast to smaller integer type 'enum pd_types' from 'const void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/spi/spi-pxa2xx.c:1547:10: warning: cast to smaller integer type 'enum pxa_ssp_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/spi/spi-sc18is602.c:266:12: warning: cast to smaller integer type 'enum chips' from 'const void *' [-Wvoid-pointer-to-int-cast]
      7 drivers/thermal/samsung/exynos_tmu.c:897:14: warning: cast to smaller integer type 'enum soc_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
     14 mm/rmap.c:1369:25: warning: cast to smaller integer type 'enum ttu_flags' from 'void *' [-Wvoid-pointer-to-int-cast]
      8 sound/soc/codecs/rt5677.c:5582:19: warning: cast to smaller integer type 'enum rt5677_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 sound/soc/codecs/wm8904.c:2197:21: warning: cast to smaller integer type 'enum wm8904_type' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 sound/soc/jz4740/jz4740-i2s.c:504:3: warning: cast to smaller integer type 'enum jz47xx_i2s_version' from 'const void *' [-Wvoid-pointer-to-int-cast]
      8 sound/soc/rockchip/rockchip_pdm.c:490:18: warning: cast to smaller integer type 'enum rk_pdm_version' from 'const void *' [-Wvoid-pointer-to-int-cast]

I'll get cracking on these soon.

@nathanchance nathanchance added [BUG] linux A bug that should be fixed in the mainline kernel. and removed [BUG] llvm (main) A bug in an unreleased version of LLVM (this label is appropriate for regressions) labels Feb 18, 2020
@nickdesaulniers
Copy link
Member

Why would you cast a void* to an enum? Is there a commonly used macro that's doing this?

@nathanchance
Copy link
Member Author

No. It looks like most of these warnings are from drivers sticking certain values into a void *data member in certain structs like of_device_id, since any driver supporting device tree can use it so you cannot just have a generic enum for that.

https://elixir.bootlin.com/linux/v5.5.4/source/drivers/ata/ahci_brcm.c#L428

https://elixir.bootlin.com/linux/v5.5.4/source/drivers/ata/ahci_brcm.c#L402

https://elixir.bootlin.com/linux/v5.5.4/source/include/linux/mod_devicetable.h#L264

@m-gupta
Copy link

m-gupta commented Mar 5, 2020

@nathanchance did you manage to look at the warnings? We have started hitting them with our ToT LLVM builds as well in Chrome OS.

@nathanchance
Copy link
Member Author

I think the general consensus is that the kernel is not going to change these sites to work around the warning and LLVM does not want to match GCC exactly so we need a separate diagnostic like -W{void,}-pointer-to-enum-cast, which would be default on, which we can then disable for the kernel.

https://godbolt.org/z/ahf79P

I want to try and tackle this myself as it would be my first major contribution to clang but unfortunately, I am a little time starved right now. If someone else wants to implement that ahead of me, please feel free.

@m-gupta
Copy link

m-gupta commented Mar 5, 2020

@nathanchance
Copy link
Member Author

Alright, that wasn't too hard: ClangBuiltLinux/llvm-project@4fd4438

I'll throw it up on Phabricator tomorrow, let me know if there are any general comments towards the approach or nitpicks on the patch itself.

cc @davidbolvansky since you seem active in the Sema space (and you commented on the original patch).

@nickdesaulniers nickdesaulniers added the [PATCH] Exists There is a patch that fixes this issue label Mar 6, 2020
@nathanchance
Copy link
Member Author

LLVM patch submitted: https://reviews.llvm.org/D75758

Tested with the following diff for the kernel: https://gist.github.com/767cccf4d093c1342e1994083518815e

@m-gupta
Copy link

m-gupta commented Mar 6, 2020

Thanks, I was planning to work on it as first thing this morning but @nathanchance beat me to it :).

Congrats on your first major LLVM contribution!

@nathanchance nathanchance added [BUG] llvm (main) A bug in an unreleased version of LLVM (this label is appropriate for regressions) [PATCH] Submitted A patch has been submitted for review and removed [PATCH] Exists There is a patch that fixes this issue labels Mar 7, 2020
nathanchance added a commit to ClangBuiltLinux/llvm-project that referenced this issue Mar 7, 2020
GCC does not warn on casts from pointers to enumerators, while clang
currently does: https://godbolt.org/z/3DFDVG

This causes a bunch of extra warnings in the Linux kernel, where
certain structs contain a void pointer to avoid using a gigantic
union for all of the various types of driver data, such as
versions.

Add a diagnostic that allows certain projects like the kernel to
disable the warning just for enums, which allows those projects to
keep full compatibility with GCC but keeps the intention of treating
casts to integers and enumerators the same by default so that other
projects have the opportunity to catch issues not noticed before (or
follow suite and disable the warning).

Link: ClangBuiltLinux/linux#887
MaskRay pushed a commit to llvm/llvm-project that referenced this issue Mar 8, 2020
GCC does not warn on casts from pointers to enumerators, while clang
currently does: https://godbolt.org/z/3DFDVG

This causes a bunch of extra warnings in the Linux kernel, where
certain structs contain a void pointer to avoid using a gigantic
union for all of the various types of driver data, such as
versions.

Add a diagnostic that allows certain projects like the kernel to
disable the warning just for enums, which allows those projects to
keep full compatibility with GCC but keeps the intention of treating
casts to integers and enumerators the same by default so that other
projects have the opportunity to catch issues not noticed before (or
follow suite and disable the warning).

Link: ClangBuiltLinux/linux#887

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D75758
@nathanchance
Copy link
Member Author

@m-gupta
Copy link

m-gupta commented Mar 14, 2020

@nathanchance Do you know if the patch has been committed to stable branches?

@nathanchance
Copy link
Member Author

@m-gupta Masahiro just picked up the patch today. Not sure if he plans to send a pull request for -rc6 but if not, certainly for -rc7/final; in other words, the patch should be to mainline within a week hopefully. Once it has made it to mainline, it should be shipped to stable within a couple of weeks (depending o

If that timeline doesn't work for CrOS, here is the backported version that I will send when I get the rejected email from Greg so there should be no conflicts when stable gets merged. It applies cleanly via git am to 4.4 through 4.19. The patch as I have sent it above should apply cleanly to 5.4 and newer.

@m-gupta
Copy link

m-gupta commented Mar 14, 2020

Thanks, I was just looking for a local patch to apply to our builds. Will replace by an official commit once available.

krasCGQ pushed a commit to krasCGQ/linux that referenced this issue Mar 15, 2020
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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Albert I <kras@raphielgang.org>
SaintZ13 added a commit to SaintZ13/schwifty_kernel_op7pro_old that referenced this issue Mar 15, 2020
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.

Credit: @nathanchance
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
SaintZ13 pushed a commit to SaintZ13/schwifty_kernel_op7pro_old that referenced this issue Mar 15, 2020
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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
ruscur pushed a commit to ruscur/linux that referenced this issue Mar 16, 2020
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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
kevios12 pushed a commit to kevios12/android_kernel_samsung_universal7885 that referenced this issue Feb 16, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
bemerguy pushed a commit to bemerguy/bandido-sm8250 that referenced this issue Feb 20, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
bemerguy pushed a commit to bemerguy/bandido-sm8250 that referenced this issue Feb 20, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
pascua28 pushed a commit to pascua28/android_kernel_samsung_sm7150 that referenced this issue Feb 22, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
pascua28 pushed a commit to pascua28/android_kernel_samsung_sm7150 that referenced this issue Feb 22, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
pascua28 pushed a commit to pascua28/android_kernel_samsung_sm7150 that referenced this issue Feb 22, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
pascua28 pushed a commit to pascua28/android_kernel_samsung_sm7150 that referenced this issue Feb 22, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
pascua28 pushed a commit to pascua28/android_kernel_samsung_sm7150 that referenced this issue Feb 23, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
pascua28 pushed a commit to pascua28/android_kernel_samsung_sm7150 that referenced this issue Feb 23, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
hsyncvlk23 pushed a commit to hsyncvlk23/android_kernel-4.9 that referenced this issue Mar 21, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
ravindu755 pushed a commit to ravindu644/android_kernel_beyondx_lpos that referenced this issue Mar 23, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: John Vincent <git@tenseventyseven.cf>
ravindu644 pushed a commit to ravindu644/android_kernel_beyondx_lpos that referenced this issue Mar 23, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: John Vincent <git@tenseventyseven.cf>
LinuxGuy312 pushed a commit to LinuxGuy312/android_kernel_realme_RMX1805 that referenced this issue Mar 23, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
ravindu755 pushed a commit to ravindu644/android_kernel_beyondx_lpos that referenced this issue Mar 25, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: John Vincent <git@tenseventyseven.cf>
ghazzor pushed a commit to stufss/kernel_samsung_M215F_CVH1 that referenced this issue Mar 28, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
ghazzor pushed a commit to stufss/kernel_samsung_M215F_CVH1 that referenced this issue Mar 29, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
svoboda18 pushed a commit to svoboda18/android_blackghost_kernel that referenced this issue Apr 9, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Huawei-Dev pushed a commit to Huawei-Dev/android_kernel_huawei_hi3660 that referenced this issue Apr 11, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Huawei-Dev pushed a commit to Huawei-Dev/android_kernel_huawei_hi3660 that referenced this issue Apr 11, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
maosith pushed a commit to maosith/msm-4.19-meow that referenced this issue Apr 15, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
maosith pushed a commit to maosith/msm-4.19-meow that referenced this issue Apr 15, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
maosith pushed a commit to maosith/msm-4.19-meow that referenced this issue Apr 16, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
maosith pushed a commit to maosith/msm-4.19-meow that referenced this issue Apr 16, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
maosith pushed a commit to maosith/x1q-meow that referenced this issue Apr 30, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
maosith pushed a commit to maosith/x1q-meow that referenced this issue Apr 30, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
Huawei-Dev pushed a commit to Huawei-Dev/android_kernel_huawei_hi3660 that referenced this issue May 19, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Hussein995 pushed a commit to Hussein995/N975F that referenced this issue Jun 13, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
ata-kaner pushed a commit to ata-kaner/android_kernel_samsung_sm8250 that referenced this issue Jul 11, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
ata-kaner pushed a commit to ata-kaner/android_kernel_samsung_sm8250 that referenced this issue Jul 11, 2024
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.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
Signed-off-by: Samuel Pascua <sgpascua@ngcp.ph>
rsuntk pushed a commit to rsuntk/android_kernel_samsung_a12s that referenced this issue Jul 14, 2024
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

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. It
will be visible under W=1 in case people want to go about fixing these
easily and enabling the warning treewide.

Cc: stable@vger.kernel.org
Link: ClangBuiltLinux/linux#887
Link: llvm/llvm-project@2a41b31
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[BUG] linux A bug that should be fixed in the mainline kernel. [BUG] llvm (main) A bug in an unreleased version of LLVM (this label is appropriate for regressions) [FIXED][LINUX] 5.6 This bug was fixed in Linux 5.6
Projects
None yet
Development

No branches or pull requests

3 participants