[PATCH] D117232: [clang] Respect -Wdeclaration-after-statement with C99 or later

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 20 07:07:45 PST 2022


aaron.ballman added a comment.

Can you also add a release note about the change?



================
Comment at: clang/test/Sema/warn-mixed-decls-code.c:1-3
+// RUN: %clang_cc1 -std=c89 -fsyntax-only -verify -Wall -Wno-comment -DSILENCE %s
+// RUN: %clang_cc1 -std=c99 -fsyntax-only -verify -Wall -pedantic -DSILENCE %s
+// RUN: %clang_cc1 -std=c11 -fsyntax-only -verify -Wall -pedantic -DSILENCE %s
----------------



================
Comment at: clang/test/Sema/warn-mixed-decls-code.c:7
+// RUN: %clang_cc1 -std=c99 -fsyntax-only -verify -Wdeclaration-after-statement %s
+// RUN: %clang_cc1 -std=c11 -fsyntax-only -verify -Wdeclaration-after-statement %s
+
----------------



================
Comment at: clang/test/Sema/warn-mixed-decls-code.c:9-11
+#ifdef SILENCE
+  // expected-no-diagnostics
+#endif
----------------



================
Comment at: clang/test/Sema/warn-mixed-decls-code.c:18-21
+  int b;
+#ifndef SILENCE
+  // expected-warning at -2 {{mixing declarations and code}}
+#endif
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117232



More information about the cfe-commits mailing list