[PATCH] D158301: Add back overriding-t-options for -m<os>-version-min diagnostic
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 18 11:32:18 PDT 2023
MaskRay created this revision.
MaskRay added reviewers: clang, arphaman, aaron.ballman, andrew.w.kaylor, hans, skan, zahiraam, dexonsmith.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This restores the -m<os>-version-min diagnostic behavior before D158137 <https://reviews.llvm.org/D158137>.
The diagnostic is more likely to be used above the threshold so that we
need to care about -Werror compatibility. Here are the primary behavior
difference:
- -Wno-overriding-t-options does not trigger -Wunknown-warning-option
- Both -Wno-overriding-t-options and -Wno-overriding-t-options can disable the -m<os>-version-min diagnostic (darwin-version.c)
overriding-t-options is not for the -ffp-model= diagnostic.
There are some uses cases (e.g. https://github.com/madgraph5/madgraph4gpu/issues/516),
but I do not want -Wno-overriding-t-options to affect -ffp-model= and
future diagnostics.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158301
Files:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Basic/DiagnosticGroups.td
clang/lib/Driver/ToolChains/Darwin.cpp
clang/test/Driver/darwin-version.c
Index: clang/test/Driver/darwin-version.c
===================================================================
--- clang/test/Driver/darwin-version.c
+++ clang/test/Driver/darwin-version.c
@@ -214,11 +214,11 @@
// RUN: %clang -target x86_64-apple-macos10.11.2 -mmacos-version-min=10.6 -c %s -### 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK-VERSION-TNO-OSV1 %s
-// CHECK-VERSION-TNO-OSV1: overriding '-mmacos-version-min=10.6' option with '-target x86_64-apple-macos10.11.2'
+// CHECK-VERSION-TNO-OSV1: overriding '-mmacos-version-min=10.6' option with '-target x86_64-apple-macos10.11.2' [-Woverriding-t-option]
// RUN: %clang -target x86_64-apple-macos -miphoneos-version-min=9.1 -c %s -### 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK-VERSION-TNO-OSV2 %s
-// CHECK-VERSION-TNO-OSV2: overriding '-miphoneos-version-min=9.1' option with '-target x86_64-apple-macos'
+// CHECK-VERSION-TNO-OSV2: overriding '-miphoneos-version-min=9.1' option with '-target x86_64-apple-macos' [-Woverriding-t-option]
// RUN: %clang -target x86_64-apple-ios -miphonesimulator-version-min=10.0 -c %s -### 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK-VERSION-TNO-OSV3 %s
Index: clang/lib/Driver/ToolChains/Darwin.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -2204,7 +2204,7 @@
std::string OSVersionArg =
OSVersionArgTarget->getAsString(Args, Opts);
std::string TargetArg = OSTarget->getAsString(Args, Opts);
- getDriver().Diag(clang::diag::warn_drv_overriding_option)
+ getDriver().Diag(clang::diag::warn_drv_overriding_t_option)
<< OSVersionArg << TargetArg;
}
}
Index: clang/include/clang/Basic/DiagnosticGroups.td
===================================================================
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -571,6 +571,8 @@
def ObjCMultipleMethodNames : DiagGroup<"objc-multiple-method-names">;
def ObjCFlexibleArray : DiagGroup<"objc-flexible-array">;
def ObjCBoxing : DiagGroup<"objc-boxing">;
+def OverridingTOption : DiagGroup<"overriding-t-option">;
+def OverridingOption : DiagGroup<"overriding-option", [OverridingTOption]>;
def CompletionHandler : DiagGroup<"completion-handler">;
def CalledOnceParameter : DiagGroup<"called-once-parameter", [CompletionHandler]>;
def OpenCLUnsupportedRGBA: DiagGroup<"opencl-unsupported-rgba">;
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -425,9 +425,13 @@
InGroup<UnsupportedABI>;
def warn_ignoring_ftabstop_value : Warning<
"ignoring invalid -ftabstop value '%0', using default value %1">;
+// Don't use warn_drv_overriding_t_option for new diagnostics.
+def warn_drv_overriding_t_option : Warning<
+ "overriding '%0' option with '%1'">,
+ InGroup<OverridingTOption>;
def warn_drv_overriding_option : Warning<
"overriding '%0' option with '%1'">,
- InGroup<DiagGroup<"overriding-option">>;
+ InGroup<OverridingOption>;
def warn_drv_treating_input_as_cxx : Warning<
"treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">,
InGroup<Deprecated>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158301.551585.patch
Type: text/x-patch
Size: 3420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230818/518d03e2/attachment-0001.bin>
More information about the cfe-commits
mailing list