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

Tommaso Bonvicini via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 14 14:15:10 PST 2022


MuAlphaOmegaEpsilon added inline comments.


================
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) { ; }
----------------
aaron.ballman wrote:
> 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.
I replied to this stream with a basic comment instead of using an inline one...
I'm sorry, I just figured out how this platform works with these drafts! 


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