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

Warning in 0.18.1: no previous prototype for 'nsec_to_clock_t' [-Wmissing-prototypes] #2142

Closed
hhoffstaette opened this issue Nov 2, 2024 · 1 comment · Fixed by #2143
Closed
Labels
kind/bug Something isn't working

Comments

@hhoffstaette
Copy link
Contributor

hhoffstaette commented Nov 2, 2024

Describe the bug

NOT a bug, just a warning I caught which might turn into a build error depending on how the compiler feels on a particular day or config:

/usr/bin/x86_64-pc-linux-gnu-gcc-14 -Wp,-MMD,/tmp/portage/dev-debug/scap-driver-0.18.1/work/libs-0.18.1_build/driver/src/.ppm_cputime.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -march=native -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -O2 -fno-allow-store-data-races -fstack-protector -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -fmin-function-alignment=16 -fstrict-flex-arrays=3 -fno-strict-overflow -fno-stack-check -fconserve-stack -Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wmissing-declarations -Wmissing-prototypes -Wframe-larger-than=2048 -Wno-main -Wno-dangling-pointer -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-overflow -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wenum-conversion -Wextra -Wunused -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-packed-not-aligned -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-override-init -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -Wno-unused-parameter -g -gz=zstd -DHAS_ACCESS_OK_2 -DHAS_CLASS_CREATE_1 -DHAS_DEVNODE_ARG1_CONST  -DMODULE  -DKBUILD_BASENAME='"ppm_cputime"' -DKBUILD_MODNAME='"scap"' -D__KBUILD_MODNAME=kmod_scap -c -o /tmp/portage/dev-debug/scap-driver-0.18.1/work/libs-0.18.1_build/driver/src/ppm_cputime.o /tmp/portage/dev-debug/scap-driver-0.18.1/work/libs-0.18.1_build/driver/src/ppm_cputime.c   ; ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --orc --static-call --uaccess   --module /tmp/portage/dev-debug/scap-driver-0.18.1/work/libs-0.18.1_build/driver/src/ppm_cputime.o
/tmp/portage/dev-debug/scap-driver-0.18.1/work/libs-0.18.1_build/driver/src/ppm_cputime.c:342:10: warning: no previous prototype for 'nsec_to_clock_t' [-Wmissing-prototypes]
  342 | uint64_t nsec_to_clock_t(uint64_t x) {
      |          ^~~~~~~~~~~~~~~

As far as I can see nsec_to_clock_t is only used in driver/main.c, so maybe it would be better to move it there and make it static. Alternatively conjure up a prototype in some common header. As it turns out it's in <linux/jiffies.h> already.

How to reproduce it

Should reproduce with any build using -Wmissing-prototypes.

Expected behaviour

No warnings.

Environment

  • OS:

Gentoo

  • Kernel:

Linux 6.11.6-rc

  • Installation method:

Build from source package (Gentoo ebuild).

Additional context

It seems I missed this in the previous release cycle - sorry!

@hhoffstaette
Copy link
Contributor Author

Since nsec_to_clock_t already has a prototype in jiffies.h I found it easiest to just include it. 😅
No more warning, builds & works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
1 participant