1  /* Test OpenACC 'routine' with 'nohost' clause, invalid use.  */
       2  
       3  #pragma acc routine /* { dg-note {\.\.\. without 'nohost' clause near to here} } */
       4  int THREE_1(void)
       5  {
       6    return 3;
       7  }
       8  
       9  #pragma acc routine (THREE_1) \
      10    nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*THREE_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      11  
      12  #pragma acc routine \
      13    nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*THREE_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      14  extern int THREE_1(void);
      15  
      16  
      17  #pragma acc routine /* { dg-note {\.\.\. without 'nohost' clause near to here} } */
      18  extern void NOTHING_1(void);
      19  
      20  #pragma acc routine (NOTHING_1) \
      21    nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      22  
      23  void NOTHING_1(void)
      24  {
      25  }
      26  
      27  #pragma acc routine \
      28    nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      29  extern void NOTHING_1(void);
      30  
      31  #pragma acc routine (NOTHING_1) \
      32    nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      33  
      34  
      35  extern float ADD_1(float, float);
      36  
      37  #pragma acc routine (ADD_1) /* { dg-note {\.\.\. without 'nohost' clause near to here} } */
      38  
      39  float ADD_1(float x, float y)
      40  {
      41    return x + y;
      42  }
      43  
      44  #pragma acc routine \
      45    nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*ADD_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      46  extern float ADD_1(float, float);
      47  
      48  #pragma acc routine (ADD_1) \
      49    nohost /* { dg-error {incompatible 'nohost' clause when applying '#pragma acc routine' to '[^']*ADD_1[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      50  
      51  
      52  /* The same again, but with/without nohost reversed.  */
      53  
      54  #pragma acc routine \
      55    nohost /* { dg-note {\.\.\. with 'nohost' clause here} } */
      56  int THREE_2(void)
      57  {
      58    return 3;
      59  }
      60  
      61  #pragma acc routine (THREE_2) /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*THREE_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      62  
      63  #pragma acc routine /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*THREE_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      64  extern int THREE_2(void);
      65  
      66  
      67  #pragma acc routine \
      68    nohost /* { dg-note {\.\.\. with 'nohost' clause here} } */
      69  extern void NOTHING_2(void);
      70  
      71  #pragma acc routine (NOTHING_2) /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      72  
      73  void NOTHING_2(void)
      74  {
      75  }
      76  
      77  #pragma acc routine /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      78  extern void NOTHING_2(void);
      79  
      80  #pragma acc routine (NOTHING_2) /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*NOTHING_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      81  
      82  
      83  extern float ADD_2(float, float);
      84  
      85  #pragma acc routine (ADD_2) \
      86    nohost /* { dg-note {\.\.\. with 'nohost' clause here} } */
      87  
      88  float ADD_2(float x, float y)
      89  {
      90    return x + y;
      91  }
      92  
      93  #pragma acc routine /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*ADD_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */
      94  extern float ADD_2(float, float);
      95  
      96  #pragma acc routine (ADD_2) /* { dg-error {missing 'nohost' clause when applying '#pragma acc routine' to '[^']*ADD_2[^']*', which has already been marked with an OpenACC 'routine' directive} } */