[PATCH] D150394: [OpenMP 5.2] Deprecate MINUS (-) operator on reduction clauses

Fazlay Rabbi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 17 10:29:01 PDT 2023


mdfazlay added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:10487-10488
   "a reduction list item with incomplete type %0">;
+def err_omp_reduction_minus_type : Error<
+  "a reduction list item with minus(-) operator is not supported">;
+def warn_omp_minus_in_reduction_deprecated : Warning<
----------------
ABataev wrote:
> We already have message for unsupported reduction identifier. Better to modify switch in static bool actOnOMPReductionKindClause function and check if OpenMP > 52, set BOK to BO_Comma, if incoming OOK is OO_Minus. In this case it will be automatically diagnosed for OpenMP>52 as not allowed reduction identifier.
BTW, I think we need to remove minus (-) from the incorrect reduction identifier error message once OpenMP 6.0 becomes official. Please take a look at the following output:

```
$ cat test.c
void foo() {
  int a = 0 ;
#pragma omp parallel reduction(-:a)
  ;
}
```
```
> clang -fopenmp -fopenmp-version=60 test.c -c
test.c:3:32: error: incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'
#pragma omp parallel reduction(-:a)
                               ^
1 error generated.
```


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

https://reviews.llvm.org/D150394



More information about the cfe-commits mailing list