Closed zhuyaliang closed 9 months ago
Compile warnings can appear using meson
build
src/gpm-phone.c:394:18: warning: format '%i' expects argument of type 'int', but argument 4 has type 'guint' {aka 'unsigned int'} [-Wformat=]
Hmm, normally i use auto-tools and i don't see the warnings with --enable-compile-warnings=maximum
. So compiler flags are different in meson :/
Also with meson setup build -Dprefix=/usr -Dwarning_level=everything
i don't see this warning.
Ok, i see the warnings now.
I could confirm most of warnings with
export CFLAGS='-Wsign-compare -Wformat-signedness -Wformat=2 -Wswitch-default -Wcast-function-type -Wdeclaration-after-statement'
./autogen.sh --enable-compile-warnings=maximum
But not all. It's really difficult to review for me when cflags are different with auto-tools and meson. It took me several hours to understand why you want to change parts of the code.
This looks like at some point in the history of this code (presumably not when it was first written...) signed and unsigned integers got mixed up. Yes, this should be fixed.
@zhuyaliang Can you please post warnings cflags for next future PR if it so huge again? This will make reviewers life easier
Anyone else want to review this or is it ready to go?
I tested it again on my notebook and power management and brightness function are working. Let's merge it.
I found only a few warnings in previous builds but for most changes i do not see any warning. Eg. where do you see
data type format error
?