]> granicus.if.org Git - clang/commitdiff
[Driver] Conform warn_drv_object_size_disabled_O0 to DefaultWarnNoError
authorVedant Kumar <vsk@apple.com>
Thu, 12 Jul 2018 19:53:15 +0000 (19:53 +0000)
committerVedant Kumar <vsk@apple.com>
Thu, 12 Jul 2018 19:53:15 +0000 (19:53 +0000)
This diagnostic triggers when -fsanitize=object-size is explicitly
specified but will be a no-op (i.e, at -O0).

This diagnostic should not fail a -Werror build because it's just an
explanatory note to the user. It's not always actionable.

For example, a user may not be able to simply disable object-size,
because they want it enabled in optimized builds.

rdar://42128447

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336937 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticDriverKinds.td
test/Driver/fsanitize-object-size.c

index 5526ad4bd5cd690e174b60bf39116eeddaafedde..a6be0595e1ae90ba4da48e11d55b8db43d40abba 100644 (file)
@@ -273,7 +273,7 @@ def warn_drv_disabling_vptr_no_rtti_default : Warning<
   InGroup<AutoDisableVptrSanitizer>;
 def warn_drv_object_size_disabled_O0 : Warning<
   "the object size sanitizer has no effect at -O0, but is explicitly enabled: %0">,
-  InGroup<InvalidCommandLineArgument>;
+  InGroup<InvalidCommandLineArgument>, DefaultWarnNoWerror;
 
 def note_drv_command_failed_diag_msg : Note<
   "diagnostic msg: %0">;
index b96221e0fd43ea56015d8123cbe677780a45f910..50c67838df39a4cba063d094506878c0f94ee773 100644 (file)
@@ -2,8 +2,9 @@
 //
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size %s -O0 -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=null,object-size %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-OSIZE
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-OSIZE-NO-WARNING
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=null,object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE
+// RUN: %clang -target x86_64-linux-gnu -Werror -fsanitize=null,object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE-NO-WARNING
 
 // Check that the object size check is enabled at other optimization levels.
 //