Skip to content

Commit

Permalink
Revert "Add braces in initializers for GCC 4.9 or older"
Browse files Browse the repository at this point in the history
This reverts commit 8aa2a9e.

as not all targets need braces.
  • Loading branch information
hjl-tools committed Dec 15, 2024
1 parent d4175a6 commit 20f8c5d
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion misc/tst-preadvwritev2-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ do_test_with_invalid_iov (void)
{
/* An invalid iovec buffer should trigger an invalid memory access
or an error (Linux for instance returns EFAULT). */
struct iovec iov[IOV_MAX+1] = { { 0 } };
struct iovec iov[IOV_MAX+1] = { 0 };

TEST_VERIFY (preadv2 (temp_fd, iov, IOV_MAX + 1, 0, RWF_HIPRI) == -1);
TEST_VERIFY (errno == EINVAL || errno == ENOTSUP);
Expand Down
2 changes: 1 addition & 1 deletion nss/getaddrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
unsigned int *naddrs, struct scratch_buffer *tmpbuf)
{
struct gaih_servtuple st[sizeof (gaih_inet_typeproto)
/ sizeof (struct gaih_typeproto)] = {{0}};
/ sizeof (struct gaih_typeproto)] = {0};

const char *orig_name = name;

Expand Down
4 changes: 2 additions & 2 deletions posix/tst-spawn7.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ do_test_signals (void)
{
/* Same as before, but set SIGUSR1 and SIGUSR2 to a handler different than
SIG_IGN or SIG_DFL. */
struct sigaction sa = { { 0 } };
struct sigaction sa = { 0 };
sa.sa_handler = dummy_sa_handler;
xsigaction (SIGUSR1, &sa, NULL);
xsigaction (SIGUSR2, &sa, NULL);
Expand All @@ -123,7 +123,7 @@ do_test_signals (void)

{
/* Check if SIG_IGN is keep as is. */
struct sigaction sa = { { 0 } };
struct sigaction sa = { 0 };
sa.sa_handler = SIG_IGN;
xsigaction (SIGUSR1, &sa, NULL);
xsigaction (SIGUSR2, &sa, NULL);
Expand Down
4 changes: 2 additions & 2 deletions rt/tst-timer-sigmask.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ thread_handler (union sigval sv)
static int
do_test (void)
{
struct sigevent sev = { { 0 } };
struct sigevent sev = { 0 };
sev.sigev_notify = SIGEV_THREAD;
sev.sigev_notify_function = &thread_handler;

Expand All @@ -66,7 +66,7 @@ do_test (void)

xpthread_barrier_init (&barrier, NULL, 2);

struct itimerspec trigger = { { 0 } };
struct itimerspec trigger = { 0 };
trigger.it_value.tv_nsec = 1000000;
TEST_COMPARE (timer_settime (timerid, 0, &trigger, NULL), 0);

Expand Down
2 changes: 1 addition & 1 deletion stdlib/tst-system.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ sleep_and_check_sigchld (void *closure)
sprintf (cmd, "sleep %lf" , *seconds);
TEST_COMPARE (system (cmd), 0);

sigset_t blocked = {{0}};
sigset_t blocked = {0};
TEST_COMPARE (sigprocmask (SIG_BLOCK, NULL, &blocked), 0);
TEST_COMPARE (sigismember (&blocked, SIGCHLD), 0);
return NULL;
Expand Down
4 changes: 2 additions & 2 deletions sysdeps/pthread/tst-cancel28.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ thread_handler (union sigval sv)
static int
do_test (void)
{
struct sigevent sev = { { 0 } };
struct sigevent sev = { 0 };
sev.sigev_notify = SIGEV_THREAD;
sev.sigev_notify_function = &thread_handler;

Expand All @@ -61,7 +61,7 @@ do_test (void)

xpthread_barrier_init (&barrier, NULL, 2);

struct itimerspec trigger = { { 0 } };
struct itimerspec trigger = { 0 };
trigger.it_value.tv_nsec = 1000000;
TEST_COMPARE (timer_settime (timerid, 0, &trigger, NULL), 0);

Expand Down
4 changes: 2 additions & 2 deletions sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ send_fd (const int sock, const int fd)
{
struct cmsghdr hdr;
char buf[CMSG_SPACE (sizeof (int))];
} cmsgbuf = {{0}};
} cmsgbuf = {0};
struct cmsghdr *cmsg;
struct iovec vec;
char ch = 'A';
Expand Down Expand Up @@ -92,7 +92,7 @@ recv_fd (const int sock)
{
struct cmsghdr hdr;
char buf[CMSG_SPACE(sizeof(int))];
} cmsgbuf = {{0}};
} cmsgbuf = {0};
struct cmsghdr *cmsg;
struct iovec vec;
ssize_t n;
Expand Down
4 changes: 2 additions & 2 deletions sysdeps/unix/sysv/linux/tst-socket-timestamp-compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ do_recvmsg_ancillary (bool use_multi_call, struct mmsghdr *mmhdr,
static void
do_test_large_buffer (bool mc)
{
struct mmsghdr mmhdr = { { 0 } };
struct mmsghdr mmhdr = { 0 };
/* It should be large enough for either timeval/timespec and the
64 time type as well. */

Expand Down Expand Up @@ -147,7 +147,7 @@ do_test_large_buffer (bool mc)
static void
do_test_small_buffer (bool mc)
{
struct mmsghdr mmhdr = { { 0 } };
struct mmsghdr mmhdr = { 0 };

/* Enable 32 bit timeval precision and check if no 64 bit timeval stamp
is created. */
Expand Down
13 changes: 5 additions & 8 deletions time/tst-itimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ do_test (void)
it.it_interval.tv_usec = 20;
TEST_COMPARE (setitimer (timers[i], &it, NULL), 0);

TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { { 0 } },
&it_old),
TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { 0 }, &it_old),
0);
/* ITIMER_REAL returns { 0, 0 } for single-shot timers, while
other timers returns setitimer value. */
Expand All @@ -88,8 +87,7 @@ do_test (void)
it.it_value.tv_usec = 40;
TEST_COMPARE (setitimer (timers[i], &it, NULL), 0);

TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { { 0 } },
&it_old),
TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { 0 }, &it_old),
0);
TEST_COMPARE (it.it_interval.tv_sec, it_old.it_interval.tv_sec);
if (timers[i] == ITIMER_REAL)
Expand All @@ -109,7 +107,7 @@ do_test (void)
if (support_itimer_support_time64())
{
TEST_COMPARE (setitimer (timers[i], &it, NULL), 0);
TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { { 0 } },
TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { 0 },
&it_old),
0);
/* ITIMER_REAL returns { 0, 0 } for single-sort timers, while other
Expand All @@ -136,7 +134,7 @@ do_test (void)
{
TEST_COMPARE (setitimer (timers[i], &it, NULL), 0);

TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { { 0 } },
TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { 0 },
&it_old),
0);
if (timers[i] == ITIMER_REAL)
Expand Down Expand Up @@ -171,8 +169,7 @@ do_test (void)
TEST_COMPARE (setitimer (ITIMER_REAL, &it, NULL), 0);
intr_sleep (1);
TEST_COMPARE (cnt, 3);
TEST_COMPARE (setitimer (ITIMER_REAL, &(struct itimerval) { { 0 } },
NULL), 0);
TEST_COMPARE (setitimer (ITIMER_REAL, &(struct itimerval) { 0 }, NULL), 0);

return 0;
}
Expand Down

0 comments on commit 20f8c5d

Please sign in to comment.