| 1 |
// RUN: %check_clang_tidy %s modernize-macro-to-enum %t |
| 2 |
|
| 3 |
// C requires enum values to fit into an int. |
| 4 |
#define TOO_BIG1 1L |
| 5 |
#define TOO_BIG2 1UL |
| 6 |
#define TOO_BIG3 1LL |
| 7 |
#define TOO_BIG4 1ULL |
| 8 |
|
| 9 |
// C forbids comma operator in initializing expressions. |
| 10 |
#define BAD_OP 1, 2 |
| 11 |
|
| 12 |
#define SIZE_OK1 1 |
| 13 |
#define SIZE_OK2 1U |
| 14 |
// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: replace macro with enum [modernize-macro-to-enum] |
| 15 |
// CHECK-MESSAGES: :[[@LINE-3]]:9: warning: macro 'SIZE_OK1' defines an integral constant; prefer an enum instead |
| 16 |
// CHECK-MESSAGES: :[[@LINE-3]]:9: warning: macro 'SIZE_OK2' defines an integral constant; prefer an enum instead |