[PATCH] D116778: [clang-tidy][clang] Don't trigger unused-parameter warnings on naked functions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 14 12:17:42 PST 2022


aaron.ballman added a comment.

CI still seems unhappy:

  Failed Tests (1):
    Clang :: Sema/warn-unused-parameters.c
   



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp:290-292
+// Do not warn on naked functions.
+[[gnu::naked]] int nakedFunction(int a, float b, const char *c) { ; }
+__attribute__((naked)) void nakedFunction(int a, int b) { ; }
----------------
Quuxplusone wrote:
> In C++, I would expect the programmer to fix the (correct) warning simply by eliminating the unused parameter names:
> ```
> [[gnu::naked]] int nakedFunction(int, float, const char *) { ; }
> __attribute__((naked)) void nakedFunction(int, int) { ; }
> ```
I wouldn't expect that consistently. I'd expect the programmer to see "unused parameter, oh, I should remove that" at least some significant percentage of the time, but with mixed results.

I think silencing the warning is a reasonable behavior in the presence of the attribute. Naked functions are pretty strange beasts to begin with.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116778/new/

https://reviews.llvm.org/D116778



More information about the cfe-commits mailing list