Skip to content

Commit 7f3af7c

Browse files
author
git apple-llvm automerger
committed
Merge commit '73ed2153beb5' from llvm.org/main into next
2 parents 15ae40f + 73ed215 commit 7f3af7c

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ Modified Compiler Flags
251251
f3 *c = (f3 *)x;
252252
}
253253
254+
- Carved out ``-Wformat`` warning about scoped enums into a subwarning and
255+
make it controlled by ``-Wformat-pedantic``. Fixes #GH88595.
254256

255257
Removed Compiler Flags
256258
-------------------------

clang/lib/Sema/SemaChecking.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12913,10 +12913,15 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS,
1291312913
// In this case, the expression could be printed using a different
1291412914
// specifier, but we've decided that the specifier is probably correct
1291512915
// and we should cast instead. Just use the normal warning message.
12916+
12917+
unsigned Diag =
12918+
IsScopedEnum
12919+
? diag::warn_format_conversion_argument_type_mismatch_pedantic
12920+
: diag::warn_format_conversion_argument_type_mismatch;
12921+
1291612922
EmitFormatDiagnostic(
12917-
S.PDiag(diag::warn_format_conversion_argument_type_mismatch)
12918-
<< AT.getRepresentativeTypeName(S.Context) << ExprTy << IsEnum
12919-
<< E->getSourceRange(),
12923+
S.PDiag(Diag) << AT.getRepresentativeTypeName(S.Context) << ExprTy
12924+
<< IsEnum << E->getSourceRange(),
1292012925
E->getBeginLoc(), /*IsStringLocation*/ false, SpecRange, Hints);
1292112926
}
1292212927
}

clang/test/FixIt/format-darwin-enum-class.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -verify -Wformat %s
2-
// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -fdiagnostics-parseable-fixits -Wformat %s 2>&1 | FileCheck %s
1+
// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -verify -Wformat-pedantic %s
2+
// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -fdiagnostics-parseable-fixits -Wformat-pedantic %s 2>&1 | FileCheck %s
33

44
extern "C" int printf(const char * restrict, ...);
55

clang/test/FixIt/format.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
// RUN: %clang_cc1 -fsyntax-only -verify -Wformat %s
2-
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -Wformat %s 2>&1 | FileCheck %s
1+
// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-pedantic %s
2+
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -Wformat-pedantic %s 2>&1 | FileCheck %s
3+
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -Wformat %s -verify=okay
4+
// okay-no-diagnostics
35

46
extern "C" int printf(const char *, ...);
57
#define LOG(...) printf(__VA_ARGS__)

clang/test/SemaCXX/format-strings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks %s
1+
// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -Wformat-pedantic -fblocks %s
22
// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks -std=c++98 %s
3-
// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -fblocks -std=c++11 %s
3+
// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -Wformat-non-iso -Wformat-pedantic -fblocks -std=c++11 %s
44

55
#include <stdarg.h>
66

0 commit comments

Comments
 (0)