This is an archive of the discontinued LLVM Phabricator instance.

Changed ResolveState to unsigned to work around noisy gcc warning
ClosedPublic

Authored by vharron on May 22 2015, 4:05 PM.

Details

Reviewers
clayborg
Summary

Fixes this warning:

warning: 'lldb_private::Type::Flags::clang_type_resolve_state' is too small to hold all values of 'lldb_private::Type::ResolveState {aka enum lldb_private::Type::ResolveStateTag}'

ResolveState    clang_type_resolve_state : 2;

This is because ResolveState is defined with a base type "unsigned",
which requires more than two bits of storage.

g++ enum.cpp -std=c++11

typedef enum ResolveStateTag : unsigned
{

eResolveStateUnresolved = 0,
eResolveStateForward    = 1,
eResolveStateLayout     = 2,
eResolveStateFull       = 3

} ResolveState;

struct foo
{

ResolveState rs : 2;

};

int main()
{

foo test;
test.rs = eResolveStateFull;

}

Diff Detail

Event Timeline

vharron updated this revision to Diff 26357.May 22 2015, 4:05 PM
vharron retitled this revision from to Changed ResolveState to unsigned to work around noisy gcc warning.
vharron updated this object.
vharron edited the test plan for this revision. (Show Details)
vharron added a reviewer: clayborg.
vharron added a subscriber: Unknown Object (MLST).

I will change this to only use "unsigned" type when compiled with gcc.

clayborg accepted this revision.May 26 2015, 3:20 PM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.May 26 2015, 3:20 PM
vharron closed this revision.May 26 2015, 9:58 PM

238283