diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2022-05-26 07:52:19 -0400 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2022-05-26 08:35:56 -0400 |
commit | 681c50c62e9338afdf58ebfd663f8e3ff43439fb (patch) | |
tree | 63c404465fd7a52e510fc4068e2be4bd822b0ed0 /clang/lib/CodeGen/CodeGenModule.h | |
parent | cd5783d3e82b98bfa140853fee95170852fd3c74 (diff) | |
download | llvm-681c50c62e9338afdf58ebfd663f8e3ff43439fb.zip llvm-681c50c62e9338afdf58ebfd663f8e3ff43439fb.tar.gz llvm-681c50c62e9338afdf58ebfd663f8e3ff43439fb.tar.bz2 |
Improve the strict prototype diagnostic behavior
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;
}
And that we had other minor issues with the diagnostics being somewhat
confusing.
This patch addresses the confusion by reworking the implementation to
be a bit more simple and a bit less chatty. Specifically, it changes
the warning and note diagnostics to be able to specify "declaration" or
"definition" as appropriate, and it changes the function merging logic
so that the function without a prototype is always what gets warned on,
and the function with a prototype is sometimes what gets noted.
Additionally, when diagnosing a K&R C definition that is preceded by a
function without a prototype, we don't note the prior declaration, we
warn on it because it will also be changing behavior in C2x.
Differential Revision: https://reviews.llvm.org/D125814
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
0 files changed, 0 insertions, 0 deletions