(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
c2x-has-c-attribute-2.c
       1  /* Test __has_c_attribute.  Test supported attributes.  */
       2  /* { dg-do preprocess } */
       3  /* { dg-options "-std=c2x -pedantic-errors" } */
       4  
       5  #if __has_c_attribute ( nodiscard ) != 202003L
       6  #error "bad result for nodiscard"
       7  #endif
       8  
       9  #if __has_c_attribute ( __nodiscard__ ) != 202003L
      10  #error "bad result for __nodiscard__"
      11  #endif
      12  
      13  #if __has_c_attribute(maybe_unused) != 202106L
      14  #error "bad result for maybe_unused"
      15  #endif
      16  
      17  #if __has_c_attribute(__maybe_unused__) != 202106L
      18  #error "bad result for __maybe_unused__"
      19  #endif
      20  
      21  #if __has_c_attribute (deprecated) != 201904L
      22  #error "bad result for deprecated"
      23  #endif
      24  
      25  #if __has_c_attribute (__deprecated__) != 201904L
      26  #error "bad result for __deprecated__"
      27  #endif
      28  
      29  #if __has_c_attribute (fallthrough) != 201910L
      30  #error "bad result for fallthrough"
      31  #endif
      32  
      33  #if __has_c_attribute (__fallthrough__) != 201910L
      34  #error "bad result for __fallthrough__"
      35  #endif
      36  
      37  #if __has_c_attribute (noreturn) != 202202L
      38  #error "bad result for noreturn"
      39  #endif
      40  
      41  #if __has_c_attribute (__noreturn__) != 202202L
      42  #error "bad result for __noreturn__"
      43  #endif
      44  
      45  #if __has_c_attribute (_Noreturn) != 202202L
      46  #error "bad result for _Noreturn"
      47  #endif
      48  
      49  #if __has_c_attribute (___Noreturn__) != 202202L
      50  #error "bad result for ___Noreturn__"
      51  #endif
      52    
      53  /* Macros in the attribute name are expanded.  */
      54  #define foo deprecated
      55  #if __has_c_attribute (foo) != 201904L
      56  #error "bad result for foo"
      57  #endif