hroptatyr / dateutils

nifty command line date and time utilities; fast date calculations and conversion in the shell
http://www.fresse.org/dateutils/
Other
618 stars 42 forks source link

-Wmissing-field-initializers and -Wmissing-braces warnings #106

Open dmacks opened 4 years ago

dmacks commented 4 years ago

Building dateutils-0.4.6 on OS X 10.13, get a ton of this set of warnings. Here's the first such:

gcc -std=gnu11 -DHAVE_CONFIG_H -I. -I../src  -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -DDECLF=extern -DLIBDUT -I. -DLOCALE_FILE='"/sw/share/dateutils/locale"' -I/sw/include  -O3 -Wall -Wextra -Wsign-compare -Wno-char-subscripts -Wundef -Wpointer-arith -Wshadow -Wmissing-declarations -Wmissing-prototypes -Wbad-function-cast -Wcast-qual -Wcast-align -Wno-switch -Wunused-function -Wunused-variable -Wunused-parameter -Wunused-value -Wunused -fdiagnostics-show-option -Wunknown-pragmas -Wuninitialized -Wreorder -Wdeprecated -Wno-parentheses -Wstrict-aliasing   -MT libdut_a-time-core.o -MD -MP -MF .deps/libdut_a-time-core.Tpo -c -o libdut_a-time-core.o `test -f 'time-core.c' || echo './'`time-core.c
time-core.c:112:32: warning: missing field 'dur' initializer
      [-Wmissing-field-initializers]
        return (struct dt_t_s){DT_TUNK};
                                      ^
time-core.c:112:25: warning: suggest braces around initialization of subobject
      [-Wmissing-braces]
        return (struct dt_t_s){DT_TUNK};
                               ^~~~~~~
                               {      }
./time-core.h:53:18: note: expanded from macro 'DT_TUNK'
#define DT_TUNK         (dt_ttyp_t)(DT_TUNK)
                        ^~~~~~~~~~~~~~~~~~~~
hroptatyr commented 4 years ago

Hi Daniel, thanks for reporting this. I addressed this issue in cdbae22b1.