readability-magic-numbers-bitfields.cpp 655 Bytes
// 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]
};