base: change bitunion default constructor to default
Current implementation prevents customers from performing zero
initialize on BitUnion class. Customers would get unexpected results
when writing `BitUnion{}`. Changing the default constructor to default
can solve this issue.
After changing the default constructor, the test failed with unused
variable. I also change one with zero initializer and make the other
with maybe_unused label.
```
tests/build/ARM/base/bitunion.test.cc:133:14: error: 'emptySixteen' defined but not used [-Werror=unused-variable]
133 | EmptySixteen emptySixteen;
| ^~~~~~~~~~~~
tests/build/ARM/base/bitunion.test.cc:132:16: error: 'emptyThirtyTwo' defined but not used [-Werror=unused-variable]
132 | EmptyThirtyTwo emptyThirtyTwo;
| ^~~~~~~~~~~~~~
```
Change-Id: Icbed36b3fa6751cbda63e84443eaab6d865d9bd6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57730
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -261,7 +261,7 @@ namespace bitfield_backend
|
||||
|
||||
BitUnionOperators(const BitUnionOperators &) = default;
|
||||
|
||||
BitUnionOperators() {}
|
||||
BitUnionOperators() = default;
|
||||
|
||||
//Conversion operators.
|
||||
operator const typename Base::__StorageType () const
|
||||
|
||||
@@ -129,8 +129,8 @@ containingFunc(uint64_t init_val, uint64_t fieldVal)
|
||||
// Declare these as global so g++ doesn't ignore them. Initialize them in
|
||||
// various ways.
|
||||
EmptySixtyFour emptySixtyFour = 0;
|
||||
EmptyThirtyTwo emptyThirtyTwo;
|
||||
EmptySixteen emptySixteen;
|
||||
EmptyThirtyTwo emptyThirtyTwo{};
|
||||
[[maybe_unused]] EmptySixteen emptySixteen;
|
||||
EmptyEight emptyEight(0);
|
||||
|
||||
class BitUnionData : public testing::Test
|
||||
|
||||
Reference in New Issue
Block a user