[all-commits] [llvm/llvm-project] ccce1a: Don't trigger unused-parameter warnings on naked f...

Tommaso Bonvicini via All-commits all-commits at lists.llvm.org
Thu Jan 27 08:40:29 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ccce1a03c9ce9c3917b310097c89e39bb68527e2
      https://github.com/llvm/llvm-project/commit/ccce1a03c9ce9c3917b310097c89e39bb68527e2
  Author: MuAlphaOmegaEpsilon <tommasobonvicini at gmail.com>
  Date:   2022-01-27 (Thu, 27 Jan 2022)

  Changed paths:
    M clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
    M clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters-strict.cpp
    M clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.c
    M clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/Sema/warn-unused-parameters.c
    M clang/test/SemaCXX/warn-unused-parameters.cpp

  Log Message:
  -----------
  Don't trigger unused-parameter warnings on naked functions

This commit checks if a function is marked with the naked attribute
and, if it is, will silence the emission of any unused-parameter
warning.

Inside a naked function only the usage of basic ASM instructions is
expected. In this context the parameters can actually be used by
fetching them according to the underlying ABI. Since parameters might
be used through ASM instructions, the linter and the compiler will have
a hard time understanding if one of those is unused or not, therefore
no unused-parameter warning should ever be triggered whenever a
function is marked naked.




More information about the All-commits mailing list