Description
A previous attempt at re-enabling -Wformat
showed that there were LOTS of instances of this warning throughout the codebase. Simply re-applying that patch and doing an arm64 defconfig, I experienced 236 unique instances of this warning. Similar to @kees ' work enabling -Wvla
, I'd like to find and fix all of these, then re-send the patch re-enabling the warning.
Assuming these aren't false positives, I think the only tricky cases we may encounter may come from config dependent types. ex.
#ifdef CONFIG_FOO
int bar = 0;
#else
float bar = 0;
#endif
printk("bar: %d\n"); // warning: format specifies type 'int' but the argument has type 'float' [-Wformat]
which can be fixed via:
+prink("bar: "
+#ifdef CONFIG_FOO
+ "%d"
+#else
+ "%f"
+#endif
+ "\n");
-printk("bar: %d\n");
(or whatever maintainers prefer). I don't expect many of those cases, but maybe I'm mistaken.
Also (meta), usually we file individual issues, but maybe it's better to use this one lone issue to track all the instances? (not sure; open to thoughts).
Also, let's find a way to split the work? And keep each other cc'ed when sending patches? (we should probably set up a mailing list to always cc for patches related to Clang Built Linux)