[PATCH] D125814: Fix strict prototype diagnostic wording for definitions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 10:22:20 PDT 2022


aaron.ballman created this revision.
aaron.ballman added reviewers: jyknight, dexonsmith.
Herald added a project: All.
aaron.ballman requested review of this revision.
Herald added a project: clang.

Post-commit feedback on https://reviews.llvm.org/D122895 pointed out that the diagnostic wording for some code was using "declaration" in a confusing way, such as:

  int foo(); // warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x
  
  int foo(int arg) { // warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x
    return 5;
  }

This patch addresses the confusion in two ways. First, it updates the warning text to be specific about a function *with* a prototype. But that pointed out that we had a note which was perhaps not carrying its weight in terms of conveying useful information to the user. In all of the situations we'd issue the note, we already issue a warning with basically the same text as the note, so the note comes across as overly chatty. The note has been removed and we're leaning a bit more heavily on the prior diagnostic pointing out the previous problematic declaration in that case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125814

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/warn-deprecated-non-prototype.c
  clang/test/Sema/warn-strict-prototypes.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125814.430109.patch
Type: text/x-patch
Size: 9751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220517/57e37c1a/attachment.bin>


More information about the cfe-commits mailing list