summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/checkers/readability-magic-numbers-bitfields.cpp
blob: 3c1fef939c63891133f0d2cd84bef26a5b043321 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// RUN: %check_clang_tidy %s readability-magic-numbers %t \
// RUN: -config='{CheckOptions: \
// RUN:  [{key: readability-magic-numbers.IgnoredIntegerValues, value: "1;2;10;100;"}]}' \
// RUN: --

struct HardwareGateway {
   /*
    * The configuration suppresses the warnings for the bitfields...
    */
   unsigned int Some: 5;
   unsigned int Bits: 7;
   unsigned int: 7;
   unsigned int: 0;
   unsigned int Rest: 13;

   /*
    * ... but other fields trigger the warning.
    */
   unsigned int Another[3];
   // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 3 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
};

OpenPOWER on IntegriCloud