lwfinger / rtl8852au

303 stars 75 forks source link

Build error : fallthrough #59

Open biopsin opened 1 year ago

biopsin commented 1 year ago

Hi, regards to changes in https://github.com/lwfinger/rtl8852au/commit/803fc788749ffce6c3b8f8362d359e5689fa6a7c

ioctl_cfg80211.c  CC [M]  /var/lib/dkms/8852au/20230905/build/os_dep/linux/rtw_android.o
In file included from /var/lib/dkms/8852au/20230905/build/include/drv_types.h:23,
                 from /var/lib/dkms/8852au/20230905/build/os_dep/linux/ioctl_cfg80211.c:17:
/var/lib/dkms/8852au/20230905/build/os_dep/linux/ioctl_cfg80211.c: In function 'rtw_get_chbwoff_from_cfg80211_chan_def':
/var/lib/dkms/8852au/20230905/build/include/drv_conf.h:54:22: error: expected expression before 'do'
   54 | #define fallthrough (do {} while(0))
      |                      ^~
/var/lib/dkms/8852au/20230905/build/os_dep/linux/ioctl_cfg80211.c:6270:17: note: in expansion of macro 'fallthrough'
 6270 |                 fallthrough;
      |                 ^~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:303: /var/lib/dkms/8852au/20230905/build/os_dep/linux/ioctl_cfg80211.o] Error 1
make[2]: *** Waiting for unfinished jobs....
razvanphp commented 10 months ago

had the same on kernel 4.9, asked ChatGPT and this is the fix, worked for me:


--- a/include/drv_conf.h
+++ b/include/drv_conf.h
@@ -51,7 +51,7 @@
 #endif

 #if !defined(fallthrough)
-#define fallthrough (do {} while(0))
+#define fallthrough __attribute__((fallthrough))
 #endif

 #ifdef CONFIG_RTW_ANDROID
biopsin commented 10 months ago

@razvanphp mind creating a PR so a human can review it? not that I dont trust you but I have trust issues with chatgpt and alike that randomly steals code from projects and tries to guess a solution.