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

Remove compilation warning fix data type format error #394

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

zhuyaliang
Copy link
Member

No description provided.

@raveit65
Copy link
Member

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 ?

@zhuyaliang
Copy link
Member Author

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=]

@raveit65
Copy link
Member

raveit65 commented Oct 30, 2023

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.

@raveit65
Copy link
Member

Ok, i see the warnings now.

@raveit65
Copy link
Member

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.

@lukefromdc
Copy link
Member

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.

Copy link
Member

@lukefromdc lukefromdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an all-in-one for a variety of code issues, builds and installs fine here. Looking at the code I see fixes for mixing signed and unsigned integers in debug messages, a prototype warning fix, and a style fix in gpm_applet_create_popup where we declare four variables together instead of two at the start and two later inline.

Looks like a good code cleanup to me, and doing this as an all-in-one means fewer PR's to deal with at the expensive of one more complex review, which is fine by me.

Copy link
Member

@raveit65 raveit65 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes are looking good to me.
m-p-m runs fine on desktop machine.
Not tested on my notebook with full battery, brightness an power-management support as i do not run 1.27 on this device.

@raveit65
Copy link
Member

raveit65 commented Nov 1, 2023

@zhuyaliang
Can you please post warnings cflags for next future PR if it so huge again?
This will make reviewers life easier

@lukefromdc
Copy link
Member

Anyone else want to review this or is it ready to go?

@raveit65
Copy link
Member

raveit65 commented Nov 6, 2023

I tested it again on my notebook and power management and brightness function are working.
Let's merge it.

@raveit65 raveit65 merged commit 688ec2f into master Nov 6, 2023
1 check passed
@raveit65 raveit65 deleted the fix-warning branch November 6, 2023 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants