8000 Fix clang warnings by sidt4 · Pull Request #842 · PackageKit/PackageKit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix clang warnings #842

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Fix clang warnings #842

wants to merge 7 commits into from

Conversation

sidt4
Copy link
Contributor
@sidt4 sidt4 commented Apr 16, 2025

Please refer commit logs.

@sidt4
Copy link
Contributor Author
sidt4 commented Apr 16, 2025

Meson output comparison (with -Dmaintainer=true)

GCC 14 CLANG 19 / 20*
Project name: PackageKit
Project version: 1.3.1
C compiler for the host machine: ccache cc (gcc 14.2.0 "cc (Debian 14.2.0-19) 14.2.0")
C linker for the host machine: cc ld.bfd 2.44
Project name: PackageKit
Project version: 1.3.1
C compiler for the host machine: clang (clang 19.1.7 "Debian clang version 19.1.7 (3)")
C linker for the host machine: clang ld.bfd 2.44
pk-gcc pk-clang

@sidt4
Copy link
Contributor Author
sidt4 commented Apr 17, 2025

* - Tested on Clang 20 too:

Project name: PackageKit
Project version: 1.3.1
C compiler for the host machine: clang-20 (clang 20.1.2 "Debian clang version 20.1.2 (1~exp1)")
C linker for the host machine: clang-20 ld.bfd 2.44

@sidt4
Copy link
Contributor Author
sidt4 commented Apr 18, 2025

With #844 merged, the FreeBSD warnings are clearly visible in https://api.cirrus-ci.com/v1/task/4722967877255168/logs/build.log.

@sidt4
Copy link
Contributor Author
sidt4 commented May 3, 2025

Above push is rebase to main.

@ximion ximion self-requested a review May 3, 2025 18:58
@sidt4
Copy link
Contributor Author
sidt4 commented May 13, 2025

I use the wide-github firefox extension, so the 2 side-by-side images above fit perfectly for easy viewing.

If it (side-by-side layout) is not recommended, please let me know, I'll use vertical spaces in future.

sidt4 added 7 commits May 20, 2025 06:23
../client/pk-console.c:1719:9: warning: missing field 'short_name' initializer [-Wmissing-field-initializers]
 1719 |                 { NULL}
      |                       ^
../client/pk-monitor.c:331:9: warning: missing field 'short_name' initializer [-Wmissing-field-initializers]
  331 |                 { NULL}
      |                       ^

G_OPTION_ENTRY_NULL was introduced in glib commit
https://gitlab.gnome.org/GNOME/glib/-/commit/2e4524cd3, which is
avaiable from 2.70. Since, 2.70 is quite old (release: 2021-09-17),
it's fine to bump glib version than copying / maintaining the macro
within PackageKit.
../lib/packagekit-glib2/pk-bitfield.c:52:8: warning: variable 'i' set but not used [-Wunused-but-set-variable]
   52 |         guint i;
      |               ^
../lib/packagekit-glib2/pk-bitfield.c:93:8: warning: variable 'i' set but not used [-Wunused-but-set-variable]
   93 |         guint i;
      |

../src/pk-scheduler.c:858:8: warning: variable 'running' set but not used [-Wunused-but-set-variable]
  858 |         guint running = 0;
      |               ^
../src/pk-scheduler.c:860:8: warning: variable 'no_commit' set but not used [-Wunused-but-set-variable]
  860 |         guint no_commit = 0;
      |               ^
[231/250] Compiling C object client/pkmon.p/pk-monitor.c.o
warning: unknown warning option '-Wclobbered' [-Wunknown-warning-option]
1 warning generated.
[238/250] Compiling C object client/pkcon.p/pk-console.c.o
warning: unknown warning option '-Wclobbered' [-Wunknown-warning-option]
1 warning generated.
[246/250] Compiling C object contrib/gstreamer-plugin/pk-gstreamer-install.p/pk-gstreamer-install.c.o
warning: unknown warning option '-Wclobbered' [-Wunknown-warning-option]
1 warning generated.
…curity flag

This should fix the following incorrect meson error:

Compiler for C supports arguments -Werror=format-security: NO

Refer: mesonbuild/meson#5790

Follow up to previous commit 6133d81d8.
Already part of default compiler flags.
GCC works fine either ways, but clang gives '-Wunused-parameter`
warnings when `-Wextra` is after '-Wno-unused-parameter' in command
line.

../client/pk-console.c:485:46: warning: unused parameter 'data' [-Wunused-parameter]
  485 | pk_console_files_cb (PkFiles *item, gpointer data)
      |                                              ^
../client/pk-console.c:833:41: warning: unused parameter 'object' [-Wunused-parameter]
  833 | pk_console_client_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
      |                                         ^
../client/pk-console.c:845:39: warning: unused parameter 'object' [-Wunused-parameter]
  845 | pk_console_task_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
      |                                       ^
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.

1 participant
0