(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
attr-alloc_size-13.c
       1  /* PR c/78666 - conflicting attribute alloc_size accepted
       2     { dg-do compile }
       3     { dg-options "-Wall" } */
       4  
       5  #define A(...) __attribute__ ((alloc_size (__VA_ARGS__)))
       6  
       7  A (1) char* f2_1 (int, int);
       8  A (1) A (1) char* f2_1 (int, int);
       9  
      10  A (1) char* f2_1 (int, int);            // { dg-message "previous declaration here" }
      11  
      12  A (2) char* f2_1 (int, int);            // { dg-warning "ignoring attribute 'alloc_size \\\(2\\\)' because it conflicts with previous 'alloc_size \\\(1\\\)'" }
      13  
      14  
      15  A (2) char* f2_2 (int, int);
      16  A (2) char* f2_2 (int, int);            // { dg-message "previous declaration here" }
      17  
      18  A (1) char* f2_2 (int, int);            // { dg-warning "ignoring attribute 'alloc_size \\\(1\\\)' because it conflicts with previous 'alloc_size \\\(2\\\)'" }
      19  
      20  
      21  A (1) char* f3_1 (int, int, int);
      22  A (1) char* f3_1 (int, int, int);       // { dg-message "previous declaration here" }
      23  
      24  A (2) char* f3_1 (int, int, int);       // { dg-warning "ignoring attribute 'alloc_size \\\(2\\\)' because it conflicts with previous 'alloc_size \\\(1\\\)'" }
      25  A (3) char* f3_1 (int, int, int);       // { dg-warning "ignoring attribute 'alloc_size \\\(3\\\)' because it conflicts with previous 'alloc_size \\\(1\\\)'" }
      26  A (1, 2) char* f3_1 (int, int, int);    // { dg-warning "ignoring attribute 'alloc_size \\\(1, 2\\\)' because it conflicts with previous 'alloc_size \\\(1\\\)'" }
      27  A (1, 3) char* f3_1 (int, int, int);    // { dg-warning "ignoring attribute 'alloc_size \\\(1, 3\\\)' because it conflicts with previous 'alloc_size \\\(1\\\)'" }
      28  
      29  
      30  typedef A (2, 3) char* F3_2_3 (int, int, int);
      31  typedef A (2, 3) char* F3_2_3 (int, int, int);
      32  typedef A (2, 3) A (2, 3) char* F3_2_3 (int, int, int);
      33  
      34  typedef A (1) char* F3_2_3 (int, int, int);   // { dg-warning "ignoring attribute 'alloc_size \\\(1\\\)' because it conflicts with previous 'alloc_size \\\(2, 3\\\)'" }