[all-commits] [llvm/llvm-project] c65186: [clang] Improve -Wdeclaration-after-statement

Marco Elver via All-commits all-commits at lists.llvm.org
Thu Jan 20 10:57:28 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c65186c89f35b7b599c41183def666a2bde62ddd
      https://github.com/llvm/llvm-project/commit/c65186c89f35b7b599c41183def666a2bde62ddd
  Author: Marco Elver <elver at google.com>
  Date:   2022-01-20 (Thu, 20 Jan 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaStmt.cpp
    M clang/test/Sema/warn-mixed-decls.c

  Log Message:
  -----------
  [clang] Improve -Wdeclaration-after-statement

With 118f966b46cf, Clang matches GCC's behaviour and allows enabling
-Wdeclaration-after-statement with C99 and later.

However, the check for mixing declarations and code is not a constant time
algorithm, and therefore should be guarded with Diags.isIgnored().

Furthermore, improve test coverage with: non-pedantic C89 with the
warning; C11 with the warning; and when using -Wall.

Finally, mention the changed behaviour in ReleaseNotes.rst.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D117232




More information about the All-commits mailing list