1 // Tkane from https://en.cppreference.com/w/cpp/language/attributes 2 [[gnu::always_inline]] [[gnu::hot]] [[gnu::const]] [[nodiscard]] 3 inline int f(); // declare f with four attributes 4 5 [[gnu::always_inline, gnu::const, gnu::hot, nodiscard]] 6 int g(); // same as above, but uses a single attr specifier that contains four attributes 7 8 // C++17: 9 [[using gnu : const, always_inline, hot]] [[nodiscard]] 10 int h[[gnu::always_inline]](); // an attribute may appear in multiple specifiers 11 i()12int i() { return 0; } 13 j(int k)14[ [ deprecated ] ] int j(int k) { 15 switch(k) 16 { 17 case 1: 18 [[fallthrough]]; 19 case 2: 20 [[likely]] 21 return 3; 22 } 23 24 int v1; 25 26 return -1; 27 } 28 29 /* Taken from issue #2364 opened by andrejlevkovitch. */ 30 31 void foo(); 32 main(int argc,char * argv[])33int main([[maybe_unused]]int argc, [[maybe_unused]]char *argv[]) { 34 int alpha; 35 int bravo; 36 int charlie; 37 38 return 0; 39 } 40