(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
goacc-gomp/
pr93465-1.c
       1  #pragma omp declare target
       2  #pragma acc routine seq /* { dg-error "cannot apply '#pragma acc routine' to '\(void \)?f1\(\\(\\)\)?', which has also been marked with an OpenMP 'declare target' directive" } */
       3  void f1 (void) {}
       4  #pragma omp end declare target
       5  
       6  #pragma omp declare target
       7  void f1 (void);
       8  
       9  #pragma acc routine seq /* { dg-error "cannot apply '#pragma acc routine' to '\(void \)?f1\(\\(\\)\)?', which has also been marked with an OpenMP 'declare target' directive" } */
      10  void f1 (void);
      11  
      12  
      13  
      14  #pragma omp declare target
      15  #pragma acc routine /* { dg-error "cannot apply '#pragma acc routine' to '\(void \)?f2\(\\(\\)\)?', which has also been marked with an OpenMP 'declare target' directive" } */
      16  extern void f2 (void);
      17  #pragma omp end declare target
      18  
      19  #pragma omp declare target
      20  extern void f2 (void);
      21  #pragma omp end declare target
      22  
      23  #pragma acc routine gang /* { dg-error "cannot apply '#pragma acc routine' to '\(void \)?f2\(\\(\\)\)?', which has also been marked with an OpenMP 'declare target' directive" } */
      24  extern void f2 (void);
      25  
      26  
      27  #pragma omp declare target
      28  #pragma acc routine gang /* { dg-error "cannot apply '#pragma acc routine' to '\(void \)?f3\(\\(\\)\)?', which has also been marked with an OpenMP 'declare target' directive" } */
      29  void f3 (void);
      30  #pragma omp end declare target
      31  
      32  #pragma omp declare target
      33  void f3 (void) {}
      34  #pragma omp end declare target
      35  
      36  #pragma acc routine (f3) gang /* { dg-error "cannot apply '#pragma acc routine' to '\(void \)?f3\(\\(\\)\)?', which has also been marked with an OpenMP 'declare target' directive" } */
      37  
      38  
      39  /* Surprisingly, this diagnosis also works for '#pragma acc routine' first,
      40     followed by '#pragma omp declare target'; the latter gets applied first.  */
      41  
      42  
      43  #pragma acc routine /* { dg-error "cannot apply '#pragma acc routine' to '\(void \)?f4\(\\(\\)\)?', which has also been marked with an OpenMP 'declare target' directive" } */
      44  extern void f4 (void);
      45  
      46  #pragma omp declare target
      47  extern void f4 (void);
      48  #pragma omp end declare target
      49  
      50  
      51  #pragma acc routine gang /* { dg-error "cannot apply '#pragma acc routine' to '\(void \)?f5\(\\(\\)\)?', which has also been marked with an OpenMP 'declare target' directive" } */
      52  void f5 (void) {}
      53  
      54  #pragma omp declare target
      55  extern void f5 (void);
      56  #pragma omp end declare target