[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-13 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment. Thanks for the extra test case! > Do you see an obvious fix? If not, please revert while investigating. Obvious fix landed in 66fa2847a775dda27ddcac3832769441727db42f Repository: rG LLVM

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-12 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment. Serge, this diagnostic doesn't handle non-type template parameters correctly in some cases. Here's an example derived from a real code: https://gcc.godbolt.org/z/cvP8od5c6 template struct T { static void F(int a[8 * K]); }; template void T::F(int a[8 * K])

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-08 Thread serge via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGcc5b77273af3: [clang] Introduce -Warray-parameter (authored by serge-sans-paille). Changed prior to commit: https://reviews.llvm.org/D128449?vs=44

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-08 Thread serge via Phabricator via cfe-commits
serge-sans-paille added inline comments. Comment at: clang/lib/Sema/SemaDecl.cpp:3213 +static bool EquivalentArrayTypes(QualType Old, QualType New, + ASTContext const &Ctx) { + aaron.ballman wrote: > East const? MONSTEROUS! ;-) (We

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM, thank you for the new diagnostic! Comment at: clang/lib/Sema/SemaDecl.cpp:3213 +static bool EquivalentArrayTypes(QualType Old, QualType New, +

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-07 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 442844. serge-sans-paille marked an inline comment as done. serge-sans-paille added a comment. Take review into account. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128449/new/ https://reviews.llvm.org/D128449 Files: clang/docs/Releas

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-05 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/docs/ReleaseNotes.rst:324-326 +- Added the ``-Warray-parameter`` warning. It detects function redefinition, + where different definition involve argument type that decay to the same + pointer type from different array types

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-04 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 442084. serge-sans-paille added a comment. Fix handling of `ConstantArrayType`, thanks @aaron.ballman for the hint. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128449/new/ https://reviews.llvm.org/D128449 Files: clang/docs/ReleaseNote

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-01 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaDecl.cpp:3216 + (Ty->isVariableArrayType() && +cast(Ty)->getSizeModifier() == +ArrayType::ArraySizeModifier::Star); I forgot about this gotcha -- arrays are

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-06-30 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 441530. serge-sans-paille added a comment. Extra test CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128449/new/ https://reviews.llvm.org/D128449 Files: clang/docs/ReleaseNotes.rst clang/include/clang/Basic/DiagnosticGroups.td clang/

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-06-27 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added inline comments. Comment at: clang/test/Sema/array-parameter.c:17 + +void f5(int a[restrict 2]); +void f5(int a[2]); // no warning Since we are covering `static`, `const` and `restict` we should also cover `volatile` for completeness. CHANGES SIN

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-06-27 Thread serge via Phabricator via cfe-commits
serge-sans-paille added inline comments. Comment at: clang/test/Sema/array-parameter.c:2 +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -Warray-parameter -verify %s + +void f0(int a[]); aaron.ballman wrote: > aaron.ballman wrote: > > I'd like to s

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-06-27 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 440352. serge-sans-paille marked 3 inline comments as done. serge-sans-paille added a comment. Take review into account + add C++ test file. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128449/new/ https://reviews.llvm.org/D128449 Files:

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-06-24 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaDecl.cpp:3220 + + // `type[]` is equivalent to `type *` and `type[*]` + if (NoSizeInfo(Old) && NoSizeInfo(New)) Comment at: clang/lib/Sema/SemaDecl.cpp:3224 + + // Don't tr

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-06-24 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 439718. serge-sans-paille added a comment. Take review into account : rework indentation, style cleaning and be more accurate about bounds reporting CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128449/new/ https://reviews.llvm.org/D12844

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-06-23 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Thanks for working on this! Comment at: clang/lib/Sema/SemaDecl.cpp:49 #include "llvm/ADT/Triple.h" +#include "llvm/Support/raw_ostream.h" #include Is this new include necessary? Comment at: clang/lib/Sema/Se

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-06-23 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 439435. serge-sans-paille added a comment. Activate `-Warray-parameter` on `-Wmost` but disable it by default CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128449/new/ https://reviews.llvm.org/D128449 Files: clang/docs/ReleaseNotes.rst

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-06-23 Thread serge via Phabricator via cfe-commits
serge-sans-paille created this revision. serge-sans-paille added reviewers: RKSimon, aaron.ballman, tstellar. Herald added a project: All. serge-sans-paille requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. This warning exist in GCC[0] and wa