(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
declspec-8.c
       1  /* Test declaration specifiers.  Test checks on storage class
       2     specifiers and function specifiers in empty declarations.  */
       3  /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
       4  /* { dg-do compile } */
       5  /* { dg-options "" } */
       6  
       7  /* The constraints on storage class specifiers and function specifiers
       8     must be met for empty declarations where they are useless.  Thus
       9     there may be only one storage class specifier (C90 6.5.1, C99
      10     6.7.1#2) and "inline" must not be used because the declaration is
      11     not that of an identifier for a function (C99 6.7.4#1), and
      12     "register" and "auto" must not be used at file scope (C90 6.7, C99
      13     6.9#2).  */
      14  
      15  static static struct s; /* { dg-error "duplicate 'static'" } */
      16  /* { dg-warning "useless storage class specifier in empty declaration" "static static" { target *-*-* } .-1 } */
      17  
      18  static extern struct t; /* { dg-error "multiple storage classes in declaration specifiers" } */
      19  /* { dg-warning "useless storage class specifier in empty declaration" "static extern" { target *-*-* } .-1 } */
      20  
      21  inline union u; /* { dg-error "'inline' in empty declaration" } */
      22  
      23  auto struct v; /* { dg-error "'auto' in file-scope empty declaration" } */
      24  
      25  register struct w; /* { dg-error "'register' in file-scope empty declaration" } */
      26  
      27  void
      28  f (void)
      29  {
      30    auto union p; /* { dg-warning "useless storage class specifier in empty declaration" } */
      31    register struct q; /* { dg-warning "useless storage class specifier in empty declaration" } */
      32  }