Mesa (main): util: Remove usage of designated initializers in timespec_test.cpp

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 9 18:00:21 UTC 2022


Module: Mesa
Branch: main
Commit: 5abf590c719af5f0311de7b5d0cc135f7e06906f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5abf590c719af5f0311de7b5d0cc135f7e06906f

Author: Yonggang Luo <luoyonggang at gmail.com>
Date:   Sat Apr  9 21:32:18 2022 +0800

util: Remove usage of designated initializers in timespec_test.cpp

As the default option for msvc 2019 does support designated initializers
```
../src/util/tests/timespec_test.cpp(302): error C7555: use of designated initializers requires at least '/std:c++20'
../src/util/tests/timespec_test.cpp(303): error C7555: use of designated initializers requires at least '/std:c++20'
../src/util/tests/timespec_test.cpp(312): error C7555: use of designated initializers requires at least '/std:c++20'
../src/util/tests/timespec_test.cpp(313): error C7555: use of designated initializers requires at least '/std:c++20'
```

Signed-off-by: Yonggang Luo <luoyonggang at gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15497>

---

 src/util/tests/timespec_test.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/tests/timespec_test.cpp b/src/util/tests/timespec_test.cpp
index 4fad1884b30..d8bf60215eb 100644
--- a/src/util/tests/timespec_test.cpp
+++ b/src/util/tests/timespec_test.cpp
@@ -298,8 +298,8 @@ TEST(timespec_test, timespec_from_proto)
 TEST(timespec_test, timespec_is_zero)
 {
    struct timespec zero = { 0 };
-   struct timespec non_zero_sec = { .tv_sec = 1, .tv_nsec = 0 };
-   struct timespec non_zero_nsec = { .tv_sec = 0, .tv_nsec = 1 };
+   struct timespec non_zero_sec = { 1, 0 };
+   struct timespec non_zero_nsec = { 0, 1 };
 
    EXPECT_TRUE(timespec_is_zero(&zero));
    EXPECT_FALSE(timespec_is_zero(&non_zero_nsec));
@@ -308,8 +308,8 @@ TEST(timespec_test, timespec_is_zero)
 
 TEST(timespec_test, timespec_eq)
 {
-   struct timespec a = { .tv_sec = 2, .tv_nsec = 1 };
-   struct timespec b = { .tv_sec = -1, .tv_nsec = 2 };
+   struct timespec a = { 2, 1 };
+   struct timespec b = { -1, 2 };
 
    EXPECT_TRUE(timespec_eq(&a, &a));
    EXPECT_TRUE(timespec_eq(&b, &b));



More information about the mesa-commit mailing list