[PATCH] D27038: [XRay][compiler-rt] XRay Flight Data Recorder Mode

Serge Rogatch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 06:12:21 PST 2017


rSerge added inline comments.


================
Comment at: lib/xray/xray_fdr_logging.h:37
+  // A MetadataRecord must always have a type of 1.
+  RecordType Type : 1;
+
----------------
dberris wrote:
> pelikan wrote:
> > In file included from /home/pelikan/src/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging.cc:17:0:
> > /home/pelikan/src/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging.h:37:21: warning: ‘__xray::MetadataRecord::Type’ is too small to hold all values of ‘enum class __xray::RecordType’
> >    RecordType Type : 1;
> >                      ^
> > /home/pelikan/src/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging.h:48:28: warning: ‘__xray::MetadataRecord::RecordKind’ is too small to hold all values of ‘enum class __xray::MetadataRecord::RecordKinds’
> >    RecordKinds RecordKind : 7; // Use 7 bits to identify this record type.
> >                             ^
> > /home/pelikan/src/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging.h:56:21: warning: ‘__xray::FunctionRecord::Type’ is too small to hold all values of ‘enum class __xray::RecordType’
> >    RecordType Type : 1;
> >                      ^
> > /home/pelikan/src/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging.h:62:28: warning: ‘__xray::FunctionRecord::RecordKind’ is too small to hold all values of ‘enum class __xray::FunctionRecord::RecordKinds’
> >    RecordKinds RecordKind : 3;
> > 
> > Is this a gcc (6.3.0 used) bug?
> Unsure whether this is a bug, but that's a good question. RecordType is an enum class whose base is an unsigned 8-bit integral type -- and only has two values. 1 bit ought to be enough, no?
Does the warning disappear if the integer values for enum members are specified explicitly?


https://reviews.llvm.org/D27038





More information about the llvm-commits mailing list