[all-commits] [llvm/llvm-project] 118f96: [clang][#51931] Enable `-Wdeclaration-after-statem...

zero9178 via All-commits all-commits at lists.llvm.org
Wed Jan 12 09:22:01 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 118f966b46cfb60897b56a9878e1c68fd0e2afa4
      https://github.com/llvm/llvm-project/commit/118f966b46cfb60897b56a9878e1c68fd0e2afa4
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2022-01-12 (Wed, 12 Jan 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaStmt.cpp
    A clang/test/Sema/warn-mixed-decls.c

  Log Message:
  -----------
  [clang][#51931] Enable `-Wdeclaration-after-statement` for all C versions

-Wdeclaration-after-statement currently only outputs an diagnostic if the user is compiling in C versions older than C99, even if the warning was explicitly requested by the user.
This patch makes the warning also available in later C versions. If the C version is C99 or later it is simply a normal warning that is disabled by default (as it is valid C99) and has to be enabled by users. In older versions it remains an extension warning, and therefore affected by -pedantic.

The above behaviour also matches GCCs behaviour.

Fixes https://bugs.llvm.org/show_bug.cgi?id=51931

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




More information about the All-commits mailing list