From ed89498c4f76eb7ba4c20325b51cf059d7b4cf62 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@openairinterface.org> Date: Thu, 18 Apr 2024 00:39:46 +0200 Subject: [PATCH] Use standard C initializer list syntax Fix clang warning warning: use of GNU old-style field designator extension [-Wgnu-designator] --- common/utils/T/DOC/T/howto_new_trace.patch | 2 +- common/utils/T/tracer/enb.c | 2 +- common/utils/T/tracer/event.c | 2 +- common/utils/T/tracer/extract.c | 2 +- common/utils/T/tracer/extract_config.c | 2 +- common/utils/T/tracer/extract_input_subframe.c | 2 +- common/utils/T/tracer/extract_output_subframe.c | 2 +- common/utils/T/tracer/gnb.c | 2 +- common/utils/T/tracer/hacks/dump_nack_signal.c | 2 +- common/utils/T/tracer/hacks/multi-rru-clean.c | 2 +- common/utils/T/tracer/hacks/time_meas.c | 2 +- common/utils/T/tracer/logger/textlog.c | 8 ++++---- common/utils/T/tracer/macpdu2wireshark.c | 2 +- common/utils/T/tracer/multi.c | 4 ++-- common/utils/T/tracer/record.c | 2 +- common/utils/T/tracer/replay.c | 2 +- common/utils/T/tracer/textlog.c | 2 +- common/utils/T/tracer/to_vcd.c | 2 +- common/utils/T/tracer/ue.c | 2 +- common/utils/T/tracer/vcd.c | 2 +- common/utils/T/tracer/view/ticktime.c | 3 +-- common/utils/T/tracer/view/time.c | 3 +-- 22 files changed, 26 insertions(+), 28 deletions(-) diff --git a/common/utils/T/DOC/T/howto_new_trace.patch b/common/utils/T/DOC/T/howto_new_trace.patch index 47bbc661382..86dfe5d23cf 100644 --- a/common/utils/T/DOC/T/howto_new_trace.patch +++ b/common/utils/T/DOC/T/howto_new_trace.patch @@ -164,7 +164,7 @@ index 0000000000..00baf34774 + } + + /* a buffer needed to receive events from the nr-softmodem */ -+ OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; ++ OBUF ebuf = { .osize = 0, .omaxsize = 0, .obuf = NULL }; + + /* read events */ + while (1) { diff --git a/common/utils/T/tracer/enb.c b/common/utils/T/tracer/enb.c index 9a4751b67ee..5bb1cb87e2d 100644 --- a/common/utils/T/tracer/enb.c +++ b/common/utils/T/tracer/enb.c @@ -874,7 +874,7 @@ int main(int n, char **v) if (pthread_mutex_init(&enb_data.lock, NULL)) abort(); setup_event_selector(g, database, is_on, is_on_changed, &enb_data); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; restart: clear_remote_config(); diff --git a/common/utils/T/tracer/event.c b/common/utils/T/tracer/event.c index 41da5c08237..a5d04166d49 100644 --- a/common/utils/T/tracer/event.c +++ b/common/utils/T/tracer/event.c @@ -49,7 +49,7 @@ again: #endif read_error: - return (event){type: -1}; + return (event){.type = -1}; } #ifdef T_SEND_TIME diff --git a/common/utils/T/tracer/extract.c b/common/utils/T/tracer/extract.c index fe3177b74a0..445b166f09b 100644 --- a/common/utils/T/tracer/extract.c +++ b/common/utils/T/tracer/extract.c @@ -113,7 +113,7 @@ int main(int n, char **v) found = 0; - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; while (1) { event e; diff --git a/common/utils/T/tracer/extract_config.c b/common/utils/T/tracer/extract_config.c index a26c52aeda2..b908e60a83e 100644 --- a/common/utils/T/tracer/extract_config.c +++ b/common/utils/T/tracer/extract_config.c @@ -36,7 +36,7 @@ int main(int n, char **v) in = fopen(input_filename, "r"); if (in == NULL) { perror(input_filename); abort(); } - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; while (1) { int type; diff --git a/common/utils/T/tracer/extract_input_subframe.c b/common/utils/T/tracer/extract_input_subframe.c index 78bc288df15..c4116953db8 100644 --- a/common/utils/T/tracer/extract_input_subframe.c +++ b/common/utils/T/tracer/extract_input_subframe.c @@ -104,7 +104,7 @@ err: fd = open(file, O_RDONLY); if (fd == -1) { perror(file); exit(1); } - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; /* get wanted frame/subframe */ while (1) { diff --git a/common/utils/T/tracer/extract_output_subframe.c b/common/utils/T/tracer/extract_output_subframe.c index 5c5abb768e2..226f6d7a2eb 100644 --- a/common/utils/T/tracer/extract_output_subframe.c +++ b/common/utils/T/tracer/extract_output_subframe.c @@ -101,7 +101,7 @@ err: int last_subframe = -1; int subframe_written = 0; - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; while (1) { event e; diff --git a/common/utils/T/tracer/gnb.c b/common/utils/T/tracer/gnb.c index a2953cb00d7..22567492f88 100644 --- a/common/utils/T/tracer/gnb.c +++ b/common/utils/T/tracer/gnb.c @@ -265,7 +265,7 @@ int main(int n, char **v) gnb_main_gui(&eg, g, h, database, &gnb_data); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; restart: clear_remote_config(); diff --git a/common/utils/T/tracer/hacks/dump_nack_signal.c b/common/utils/T/tracer/hacks/dump_nack_signal.c index 02825202fb1..f50e8a761a4 100644 --- a/common/utils/T/tracer/hacks/dump_nack_signal.c +++ b/common/utils/T/tracer/hacks/dump_nack_signal.c @@ -85,7 +85,7 @@ int main(int n, char **v) { socket_send(socket, is_on, number_of_events * sizeof(int)) == -1) abort(); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; char dump[10][T_BUFFER_MAX]; event dump_ev[10]; FILE *z = fopen("/tmp/dd", "w"); diff --git a/common/utils/T/tracer/hacks/multi-rru-clean.c b/common/utils/T/tracer/hacks/multi-rru-clean.c index fd94253fb0f..ec7c8f9d1bb 100644 --- a/common/utils/T/tracer/hacks/multi-rru-clean.c +++ b/common/utils/T/tracer/hacks/multi-rru-clean.c @@ -145,7 +145,7 @@ int main(int n, char **v) clear_cache(number_of_tags, cache); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; while (1) { int type; diff --git a/common/utils/T/tracer/hacks/time_meas.c b/common/utils/T/tracer/hacks/time_meas.c index 408189cd80c..ae38dcd1772 100644 --- a/common/utils/T/tracer/hacks/time_meas.c +++ b/common/utils/T/tracer/hacks/time_meas.c @@ -86,7 +86,7 @@ int main(int n, char **v) socket_send(socket, is_on, number_of_events * sizeof(int)) == -1) abort(); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; while (1) { event e; diff --git a/common/utils/T/tracer/logger/textlog.c b/common/utils/T/tracer/logger/textlog.c index 76f920e1e2e..8217c2b9818 100644 --- a/common/utils/T/tracer/logger/textlog.c +++ b/common/utils/T/tracer/logger/textlog.c @@ -131,7 +131,7 @@ static struct chunk next_chunk(char **s, database_event_format f) cur++; *s = cur; if (find_argument(name, f, &it, &event_arg) == 0) goto error; - return (struct chunk){type:C_ARG_NAME, s:name, it:it, event_arg:event_arg}; + return (struct chunk){.type = C_ARG_NAME, .s = name, .it = it, .event_arg = event_arg}; } /* { } is name of event (anything in between is smashed) */ @@ -143,7 +143,7 @@ static struct chunk next_chunk(char **s, database_event_format f) *cur = 0; cur++; *s = cur; - return (struct chunk){type:C_EVENT_NAME}; + return (struct chunk){.type = C_EVENT_NAME}; } /* anything but [ and { is raw string */ @@ -151,10 +151,10 @@ static struct chunk next_chunk(char **s, database_event_format f) name = cur; while (*cur && *cur != '[' && *cur != '{') cur++; *s = cur; - return (struct chunk){type:C_STRING, s:name}; + return (struct chunk){.type = C_STRING, .s = name}; error: - return (struct chunk){type:C_ERROR}; + return (struct chunk){.type = C_ERROR}; } logger *new_textlog(event_handler *h, void *database, diff --git a/common/utils/T/tracer/macpdu2wireshark.c b/common/utils/T/tracer/macpdu2wireshark.c index cfa90a24db6..d7c4b23b516 100644 --- a/common/utils/T/tracer/macpdu2wireshark.c +++ b/common/utils/T/tracer/macpdu2wireshark.c @@ -808,7 +808,7 @@ int main(int n, char **v) d.to.sin_port = htons(port); d.to.sin_addr.s_addr = inet_addr(ip); new_thread(receiver, &d); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; /* read messages */ while (1) { diff --git a/common/utils/T/tracer/multi.c b/common/utils/T/tracer/multi.c index 73fadc37d34..0b2e48ec7a8 100644 --- a/common/utils/T/tracer/multi.c +++ b/common/utils/T/tracer/multi.c @@ -52,7 +52,7 @@ int send_messages_txt(int s, char *T_messages_txt, int T_messages_txt_len) /* TODO: be careful, we use internal T stuff, to rewrite? */ T_LOCAL_size = 0; T_HEADER(T_ID(-1)); - T_PUT_buffer(1, ((T_buffer){addr:(src), length:(send_size)})); + T_PUT_buffer(1, ((T_buffer){.addr = src, .length = send_size})); if (socket_send(s, &T_LOCAL_size, 4) == -1) return -1; if (socket_send(s, buf, T_LOCAL_size) == -1) return -1; src += send_size; @@ -242,7 +242,7 @@ int main(int n, char **v) /* create listener socket */ l = create_listen_socket("0.0.0.0", local_port); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; current_nfd = 0; diff --git a/common/utils/T/tracer/record.c b/common/utils/T/tracer/record.c index e4c059a5ca2..9e3c4c41a34 100644 --- a/common/utils/T/tracer/record.c +++ b/common/utils/T/tracer/record.c @@ -123,7 +123,7 @@ int main(int n, char **v) if (signal(SIGINT, force_stop) == SIG_ERR) abort(); if (signal(SIGTSTP, force_stop) == SIG_ERR) abort(); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; /* read messages */ while (run) { diff --git a/common/utils/T/tracer/replay.c b/common/utils/T/tracer/replay.c index c199a668d58..d9a505520a4 100644 --- a/common/utils/T/tracer/replay.c +++ b/common/utils/T/tracer/replay.c @@ -136,7 +136,7 @@ int main(int n, char **v) new_thread(get_message_thread, &socket); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; while (1) { int type; diff --git a/common/utils/T/tracer/textlog.c b/common/utils/T/tracer/textlog.c index 6ead65d87a0..0a4d2e555c8 100644 --- a/common/utils/T/tracer/textlog.c +++ b/common/utils/T/tracer/textlog.c @@ -130,7 +130,7 @@ int main(int n, char **v) /* send the first message - activate selected traces */ activate_traces(socket, is_on, number_of_events); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; /* read messages */ while (1) { diff --git a/common/utils/T/tracer/to_vcd.c b/common/utils/T/tracer/to_vcd.c index be3c8391158..6458443394d 100644 --- a/common/utils/T/tracer/to_vcd.c +++ b/common/utils/T/tracer/to_vcd.c @@ -366,7 +366,7 @@ int main(int n, char **v) if (signal(SIGINT, force_stop) == SIG_ERR) abort(); if (signal(SIGTSTP, force_stop) == SIG_ERR) abort(); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; /* read messages */ while (run) { diff --git a/common/utils/T/tracer/ue.c b/common/utils/T/tracer/ue.c index 31584e02153..b28f83b0f28 100644 --- a/common/utils/T/tracer/ue.c +++ b/common/utils/T/tracer/ue.c @@ -758,7 +758,7 @@ int main(int n, char **v) if (pthread_mutex_init(&ue_data.lock, NULL)) abort(); setup_event_selector(g, database, is_on, is_on_changed, &ue_data); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; restart: clear_remote_config(); diff --git a/common/utils/T/tracer/vcd.c b/common/utils/T/tracer/vcd.c index c57798c4c45..e62fc046eb7 100644 --- a/common/utils/T/tracer/vcd.c +++ b/common/utils/T/tracer/vcd.c @@ -187,7 +187,7 @@ int main(int n, char **v) /* send the first message - activate selected traces */ is_on_changed(&vcd_data); - OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL }; + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; /* read messages */ while (1) { diff --git a/common/utils/T/tracer/view/ticktime.c b/common/utils/T/tracer/view/ticktime.c index 1e1c7352a07..7fa13e4d7a3 100644 --- a/common/utils/T/tracer/view/ticktime.c +++ b/common/utils/T/tracer/view/ticktime.c @@ -129,8 +129,7 @@ static void *ticktime_thread(void *_this) pixel_length = this->pixel_length; if (this->autoscroll) { - tnext = time_add(this->latest_time, - (struct timespec){tv_sec:0,tv_nsec:1}); + tnext = time_add(this->latest_time, (struct timespec){.tv_sec = 0, .tv_nsec = 1}); tstart = time_sub(tnext, nano_to_time(pixel_length * width)); this->start_time = tstart; } else { diff --git a/common/utils/T/tracer/view/time.c b/common/utils/T/tracer/view/time.c index 287e7b1c7be..18fc02e4d75 100644 --- a/common/utils/T/tracer/view/time.c +++ b/common/utils/T/tracer/view/time.c @@ -122,8 +122,7 @@ static void *time_thread(void *_this) pixel_length = this->pixel_length; if (this->autoscroll) { - tnext = time_add(this->latest_time, - (struct timespec){tv_sec:0,tv_nsec:1}); + tnext = time_add(this->latest_time, (struct timespec){.tv_sec = 0, .tv_nsec = 1}); tstart = time_sub(tnext, nano_to_time(pixel_length * width)); this->start_time = tstart; } else { -- GitLab