1 // RUN: %check_clang_tidy %s cppcoreguidelines-macro-usage %t -- -header-filter=.* -system-headers -- 2 3 #ifndef INCLUDE_GUARD 4 #define INCLUDE_GUARD 5 6 #define PROBLEMATIC_CONSTANT 0 7 // CHECK-MESSAGES: [[@LINE-1]]:9: warning: macro 'PROBLEMATIC_CONSTANT' used to declare a constant; consider using a 'constexpr' constant 8 9 #define PROBLEMATIC_FUNCTION(x, y) ((a) > (b) ? (a) : (b)) 10 // CHECK-MESSAGES: [[@LINE-1]]:9: warning: function-like macro 'PROBLEMATIC_FUNCTION' used; consider a 'constexpr' template function 11 12 #define PROBLEMATIC_VARIADIC(...) (__VA_ARGS__) 13 // CHECK-MESSAGES: [[@LINE-1]]:9: warning: variadic macro 'PROBLEMATIC_VARIADIC' used; consider using a 'constexpr' variadic template function 14 15 #define PROBLEMATIC_VARIADIC2(x, ...) (__VA_ARGS__) 16 // CHECK-MESSAGES: [[@LINE-1]]:9: warning: variadic macro 'PROBLEMATIC_VARIADIC2' used; consider using a 'constexpr' variadic template function 17 18 #endif 19