[PATCH] D123235: [OpenMP] atomic compare fail : Parser & AST support

Sunil K via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 8 03:11:31 PST 2023


koops added inline comments.


================
Comment at: clang/lib/Basic/OpenMPKinds.cpp:450
+    case OMPC_unknown:
+    default:
+      return "unknown";
----------------
uabelho wrote:
> Adding "default:" here silences the warning.
> But looks like @ABataev commented on something similar earlier and said that's not recommended?
I agree but, I am 


================
Comment at: clang/lib/Basic/OpenMPKinds.cpp:450
+    case OMPC_unknown:
+    default:
+      return "unknown";
----------------
koops wrote:
> uabelho wrote:
> > Adding "default:" here silences the warning.
> > But looks like @ABataev commented on something similar earlier and said that's not recommended?
> I agree but, I am 
Alexey was referring to 

```the -Wswitch warning won’t fire when new elements are added to that enumeration. To help avoid adding these kinds of defaults, Clang has the warning -Wcovered-switch-default which is off by default but turned on when building LLVM with a version of Clang that supports the warning```

in the standards document. In this particular case this has been taken care of by using the macro 

```
#define OPENMP_ATOMIC_FAIL_MODIFIER(Name)
case OMPC_##Name:
```

which covers all cases added to the enum.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123235/new/

https://reviews.llvm.org/D123235



More information about the cfe-commits mailing list