(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
pointer-to-fn1.c
       1  /* PR c++/106937 */
       2  /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
       3  /* { dg-options "-fcf-protection" } */
       4  /* { dg-additional-options "-std=c++11 -fpermissive" { target c++ } } */
       5  /* Test printing a pointer to function with attribute.  */
       6  
       7  __attribute__((nocf_check)) typedef void (*FPA1)();
       8  [[gnu::nocf_check]] typedef void (*FPA2)(int);
       9  typedef void (*FP1)();
      10  typedef void (*FP2)(int);
      11  
      12  void
      13  g (FP1 f1, FP2 f2)
      14  {
      15    FPA1 p1 = f1; // { dg-warning {aka 'void \(__attribute__\(\(nocf_check\)\) \*\)\(\)'} }
      16    FPA2 p2 = f2; // { dg-warning {aka 'void \(\*\)\(int\) \[\[gnu::nocf_check\]\]'} }
      17    FP1 p3 = p1; // { dg-warning {aka 'void \(__attribute__\(\(nocf_check\)\) \*\)\(\)'} }
      18    FP2 p4 = p2; // { dg-warning {aka 'void \(\*\)\(int\) \[\[gnu::nocf_check\]\]'} }
      19  }