================
@@ -692,6 +692,13 @@ def warn_maybe_falloff_nonvoid_function : Warning<
 def warn_falloff_nonvoid_function : Warning<
   "non-void function does not return a value">,
   InGroup<ReturnType>;
+def warn_const_attr_with_pure_attr : Warning<
+  "'const' attribute imposes more restrictions, 'pure' attribute ignored">,
+  InGroup<IgnoredAttributes>;
+def warn_pure_function_returns_void : Warning<
+  "'%select{pure|const}0' attribute on function returning 'void', attribute 
ignored">,
+  InGroup<IgnoredAttributes>;
----------------
AaronBallman wrote:

```suggestion
def warn_const_attr_with_pure_attr : Warning<
  "'const' attribute imposes more restrictions; 'pure' attribute ignored">,
  InGroup<IgnoredAttributes>;
def warn_pure_function_returns_void : Warning<
  "'%select{pure|const}0' attribute on function returning 'void'; attribute 
ignored">,
  InGroup<IgnoredAttributes>;
```
minor nit for consistency with other related diagnostics.

Btw, to be explicit, I think it's reasonable that we do not reuse the usual 
"mutually exclusive attributes" functionality here because we have a very 
specific way to correct this situation whereas the usual behavior for mutual 
exclusion is that the first one wins. So adding a new diagnostic and using 
custom logic is appropriate IMO.

https://github.com/llvm/llvm-project/pull/78200
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to