Closed chrisBosse closed 4 months ago
Linux kernel switched from C89 to C11/GNU11 since 5.18 [1],
and gcc parameter "-Wdeclaration-after-statement" was dropped since 6.5 [2].
Would it be better to tell gcc to use C11/GNU11 standard and not to warn about the declarations after statement?
diff --git a/Makefile b/Makefile
index e059897..fdcb71f 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@ ifeq ("","$(wildcard MOK.der)")
NO_SKIP_SIGN := y
endif
-EXTRA_CFLAGS += -O2
+EXTRA_CFLAGS += -O2 -std=gnu11 -Wno-declaration-after-statement
ifeq ($(CONFIG_PCI), y)
EXTRA_CFLAGS += -DCONFIG_RTW88_8822BE=1
EXTRA_CFLAGS += -DCONFIG_RTW88_8821CE=1
[1]. https://github.com/torvalds/linux/commit/e8c07082a810fbb9db303a2b66b66b8d7e588b53 [2]. https://github.com/torvalds/linux/commit/b5ec6fd286dfa466f64cb0e56ed768092d0342ae
I would rather change the CFLAGS than the code.
Confirmed both @a5a5aa555oo 's flag additions are necessary and sufficient to eliminate compiler warnings.
@dubhater , I am new here. I am grateful for the driver. I defer to experience.
Shall I close this PR?
@chrisBosse You could replace your commit with what @a5a5aa555oo suggested? @a5a5aa555oo Or will you open a pull request?
@chrisBosse Could you fix this issue when you have time? thank you very much!~
Done.
Best to squash these commits, or I can open a new, clean pull request.
Merged, thank you!
I suspect latest
gcc
version implements stricter checking.My system is a Debian Linux Mint 21:
Errors: