[PATCH] D114787: [clang][PR51931] Enable `-Wdeclaration-after-statement` for all C versions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 5 06:29:41 PST 2022


aaron.ballman added a comment.

In D114787#3218382 <https://reviews.llvm.org/D114787#3218382>, @zero9178 wrote:

> In D114787#3188735 <https://reviews.llvm.org/D114787#3188735>, @aaron.ballman wrote:
>
>> https://reviews.llvm.org/D115094 is a review for doing effectively the same fix. Can you coordinate with the other patch author to determine who will drive this fix?
>
> I sent an email to the author on December 13th but have yet to hear back from them. Should we move forward with this version of the patch then?

I'd like to give a little bit more time (and another ping) only because of the recent holiday season, but I think we don't need to wait too much longer. I'm still digging out from under my pile of reviews, so I'd not be surprised if others are in a similar boat.

How about we proceed with this patch if there's no response by Mon Jan 10?

In the meantime, I have some minor feedback.



================
Comment at: clang/test/Sema/warn-mixed-decls.c:1-4
+/* RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -pedantic %s
+ */
+/* RUN: %clang_cc1 -fsyntax-only -verify -std=c99 -Wdeclaration-after-statement %s
+ */
----------------
I'd also like to see RUN lines for when we expect the diagnostic to not be enabled:
```
/* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c99 %s */
/* RUN: %clang_cc1 -fsyntax-only -verify=none -x c++ %s */
/* RUN: %clang_cc1 -fsyntax-only -verify=none -x c++ -Wdeclaration-after-statement %s */

/* none-no-diagnostics */
```
I should note that the last RUN line will give different behavior between Clang and GCC: https://godbolt.org/z/o1PKo7dhM, but I think that's a more general issue that doesn't need to be addressed in this patch. (We don't have a way to flag a diagnostic as requiring a particular language mode.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114787/new/

https://reviews.llvm.org/D114787



More information about the cfe-commits mailing list