xref: /llvm-project/clang-tools-extra/test/clang-tidy/checkers/readability/magic-numbers-bitfields.cpp (revision e8a3ddafe063c970df9c23e803812369abde4c82)
1 // RUN: %check_clang_tidy %s readability-magic-numbers %t \
2 // RUN: -config='{CheckOptions: \
3 // RUN:  {readability-magic-numbers.IgnoredIntegerValues: "1;2;10;100;"}}' \
4 // RUN: --
5 
6 struct HardwareGateway {
7    /*
8     * The configuration suppresses the warnings for the bitfields...
9     */
10    unsigned int Some: 5;
11    unsigned int Bits: 7;
12    unsigned int: 7;
13    unsigned int: 0;
14    unsigned int Rest: 13;
15 
16    /*
17     * ... but other fields trigger the warning.
18     */
19    unsigned int Another[3];
20    // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 3 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
21 };
22 
23