yoga | Fix error about implicit conversion to bit-field

Summary:
`YGStyle` puts Yoga enums (which are signed integers by default) into bitfields: https://fburl.com/7fowlunu

Mixing signed values and bit-fields can be error-prone and it also fails to build on Windows with `clang-cl` due to `-Wbitfield-constant-conversion` warning being treated as error:

```
stderr: In file included from xplat\yoga\yoga\YGLayout.cpp:8:
In file included from xplat\yoga\yoga/Utils.h:8:
In file included from xplat\yoga\yoga/YGNode.h:13:
xplat\yoga\yoga/YGStyle.h(110,9): error: implicit truncation from 'YGAlign' to bit-field changes value from 4 to -4 [-Werror,-Wbitfield-constant-conversion]
        alignItems_(YGAlignStretch),
```

This diff fixes the problem by making all enums unsigned integers. This change can be problematic only if values of the enums are serialized somewhere. CC: David Aurelio

Reviewed By: davidaurelio

Differential Revision: D16336729

fbshipit-source-id: ee4dabd7bd1ee429e644bd322b375ec2694cc742
This commit is contained in:
Uladzislau Paulovich 2019-07-18 06:17:08 -07:00 коммит произвёл Facebook Github Bot
Родитель 341b509437
Коммит 45a4bec60c
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -102,6 +102,11 @@ public:
}
};
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wbitfield-constant-conversion"
#endif
YGStyle()
: direction_(YGDirectionInherit),
flexDirection_(YGFlexDirectionColumn),
@ -113,6 +118,11 @@ public:
flexWrap_(YGWrapNoWrap),
overflow_(YGOverflowVisible),
display_(YGDisplayFlex) {}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
~YGStyle() = default;
static constexpr int directionBit = 0;