summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/plugin/pragma_plugin-test-1.C
blob: 3c084208b71c9fb8fc4e6dbd25a35382eba0c6fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// { dg-warning "Callback to register pragmas" "" { target *-*-* } 0 }

int some_func (int c);

#pragma GCCPLUGIN sayhello "here" // { dg-warning "'pragma GCCPLUGIN sayhello' outside of function: here" }

int some_func (const char* s)
{
#pragma GCCPLUGIN sayhello "at start" // { dg-warning "'pragma GCCPLUGIN sayhello' from function 'some_func': at start" }

#define DO_PRAGMA(x) _Pragma(#x)
  if (!s)
    {
      DO_PRAGMA(GCCPLUGIN sayhello "in block"); // { dg-warning "'pragma GCCPLUGIN sayhello' from function 'some_func': in block" }
      return 0;
    }
  return 1;
}