(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
attr-copy.c
       1  /* PR middle-end/81824 - Warn for missing attributes with function aliases
       2     Exercise error handling for attribute copy.
       3     { dg-do compile }
       4     { dg-require-alias "" }
       5     { dg-options "-O2 -Wall" } */
       6  
       7  #define ATTR(list)   __attribute__ (list)
       8  
       9  /* Verify incorrect numbers of arguments.  */
      10  ATTR ((copy)) void
      11  fno_args (void);              /* { dg-error "wrong number of arguments specified for .copy. attribute" } */
      12  
      13  ATTR ((copy ())) void
      14  fno_args2 (void);             /* { dg-error "wrong number of arguments specified for .copy. attribute" } */
      15  
      16  ATTR ((copy (fno_args, fno_args))) void
      17  fmlti_args (void);            /* { dg-error "wrong number of arguments specified for .copy. attribute" } */
      18  
      19  /* Verify that referencing an undeclared symbol is rejected with an error.  */
      20  
      21  ATTR ((copy (foobar)))        /* { dg-error ".foobar. undeclared" } */
      22  void fundeclared (void);
      23  
      24  /* Verify that using a string argument triggers a descriptive error
      25     (given attributes like alias and weakref using a string is a likely
      26     mistake).  */
      27  
      28  ATTR ((copy ("foobar")))
      29  void fstring (void);          /* { dg-error ".copy. attribute argument cannot be a string" } */
      30  
      31  /* Ditto for an integer.  */
      32  
      33  ATTR ((copy (123)))
      34  void fnumber (void);          /* { dg-error ".copy. attribute argument cannot be a constant arithmetic expression" } */