Skip to content

Minor makefile/compiler fixups targeting Clang/LLVM#35

Merged
Gnarus-G merged 3 commits intoGnarus-G:mainfrom
MCPO-Spartan-117:clang-fixups
Dec 4, 2024
Merged

Minor makefile/compiler fixups targeting Clang/LLVM#35
Gnarus-G merged 3 commits intoGnarus-G:mainfrom
MCPO-Spartan-117:clang-fixups

Conversation

@MCPO-Spartan-117
Copy link
Copy Markdown
Contributor

Some fixes to allow for Clang/LLVM and remove warnings for Clang.

  1. Check CC variable from the shell for clang to set CC(from shell) and LLVM variables, may separate to allow other CCs, and remove tabs.
  2. Remove static from FIXEDPT_ZERO for inline functions (it's a const anyway, so static doesn't seem to make sense).
  3. Mark default with fallthrough attribute to silence warning, seems to be compatible with GCC and silence its warning.

Log without fixes.

chief@Master /tmp/git/maccel 
>  LLVM=1 make 
make CC=clang EXTRA_CFLAGS= -C /lib/modules/`uname -r`/build M=`pwd`/driver
make[1]: Entering directory '/usr/src/linux-git'
  CC [M]  /tmp/git/maccel/driver/maccel.o
In file included from /tmp/git/maccel/driver/maccel.c:1:
In file included from /tmp/git/maccel/driver/./input_handler.h:1:
In file included from /tmp/git/maccel/driver/././accelk.h:4:
/tmp/git/maccel/driver/././accel.h:31:21: warning: static variable 'FIXEDPT_ZERO' is used in an inline function with external linkage [-Wstatic-in-inline]
   31 |   if (input_speed > FIXEDPT_ZERO) {
      |                     ^
/tmp/git/maccel/driver/././accel.h:14:22: note: 'FIXEDPT_ZERO' declared here
   14 | static const fixedpt FIXEDPT_ZERO = fixedpt_rconst(0.0);
      |                      ^
/tmp/git/maccel/driver/././accel.h:42:27: warning: static variable 'FIXEDPT_ZERO' is used in an inline function with external linkage [-Wstatic-in-inline]
   42 |   if (param_output_cap != FIXEDPT_ZERO && sens > output_cap) {
      |                           ^
/tmp/git/maccel/driver/././accel.h:14:22: note: 'FIXEDPT_ZERO' declared here
   14 | static const fixedpt FIXEDPT_ZERO = fixedpt_rconst(0.0);
      |                      ^
In file included from /tmp/git/maccel/driver/maccel.c:2:
/tmp/git/maccel/driver/./usbmouse.h:52:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
   52 |   default:
      |   ^
/tmp/git/maccel/driver/./usbmouse.h:52:3: note: insert '__attribute__((fallthrough));' to silence this warning
   52 |   default:
      |   ^
      |   __attribute__((fallthrough)); 
/tmp/git/maccel/driver/./usbmouse.h:52:3: note: insert 'break;' to avoid fall-through
   52 |   default:
      |   ^
      |   break; 
3 warnings generated.
  MODPOST /tmp/git/maccel/driver/Module.symvers
  CC [M]  /tmp/git/maccel/driver/maccel.mod.o
  LD [M]  /tmp/git/maccel/driver/maccel.ko
make[1]: Leaving directory '/usr/src/linux-git'

Log with fixes.

chief@Master /tmp/git/maccel 
>  CC=clang make            
make CC=clang EXTRA_CFLAGS= -C /lib/modules/`uname -r`/build M=`pwd`/driver
make[1]: Entering directory '/usr/src/linux-git'
  CC [M]  /tmp/git/maccel/driver/maccel.o
  MODPOST /tmp/git/maccel/driver/Module.symvers
  CC [M]  /tmp/git/maccel/driver/maccel.mod.o
  LD [M]  /tmp/git/maccel/driver/maccel.ko
make[1]: Leaving directory '/usr/src/linux-git'

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
maccel ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 1, 2024 7:34am

@Gnarus-G
Copy link
Copy Markdown
Owner

Gnarus-G commented Dec 4, 2024

@MCPO-Spartan-117 I am catching this late, but I really appreciate you for the PR.

@Gnarus-G Gnarus-G self-assigned this Dec 4, 2024
@Gnarus-G Gnarus-G added bug Something isn't working enhancement New feature or request good first issue Good for newcomers labels Dec 4, 2024
@Gnarus-G Gnarus-G merged commit 41c8d55 into Gnarus-G:main Dec 4, 2024
@MCPO-Spartan-117 MCPO-Spartan-117 deleted the clang-fixups branch December 5, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants