================
@@ -12,7 +12,6 @@ int mixed() {
     x=d;
   }
 
-// expected-error@+2 {{#pragma omp nothing' cannot be an immediate 
substatement}}
----------------
alexey-bataev wrote:

@dreachem The problem is, that the compiler has no idea what to do with this 
code.
`nothing` has no associated structured block, right? If so, then this code is 
actually this:
```
if (x)
    #pragma omp nothing
f();
```
With OpenMP support, this code represents something like this:
```
if (x)
  ;
f();
```
If we disable OpenMP support, this code will be transformed into this:
```
if (x)
  f();
```
because the directive will be ignored completely.
So, having something like this:
```
if (x)
  #pragma omp nothing
```
should not be allowed, it is not correct program if OpenMP is disabled.
To make it correct, you need to have something like this:
```
if (x) {
  #pragma omp nothing
}
```
This will be correct.
The check, you're trying to remove, checks exactly for such stand-alone 
directives, which may cause troubles when OpenMP is disabled.

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

Reply via email to