diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-04-06 06:49:45 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-04-06 06:49:45 -0700 |
commit | d104ccf947c66035850048e044e76a4dfb4dec7f (patch) | |
tree | af6b37a204776559b469bb748f3a8dde04674fad /lib.c | |
parent | 9e4be16274554d469b64e5b240b04fe8549f8a1f (diff) | |
download | txr-d104ccf947c66035850048e044e76a4dfb4dec7f.tar.gz txr-d104ccf947c66035850048e044e76a4dfb4dec7f.tar.bz2 txr-d104ccf947c66035850048e044e76a4dfb4dec7f.zip |
warning cleanup: GNU C++ initializer warnings.
This is the eight and final round of an effort to enable
GCC's -Wextra option. The C++ compiler, with -Wextra,
doesn't like C's universal struct initializer { 0 },
individually complaining about all the remaining members
not being initialized. What works in C++ is the { }
initializer. Conditional definition to the rescue.
* lib.h (all_zero_init): New macro which expands to
{ } under C++, and { 0 } under C.
* lib.c (make_time_impl, epoch_tm, time_string_meth,
time_parse_meth): Use all_zero_init.
* parser.c (prime_parser): Likewise.
* socket.c (sock_mark_connected): Likewise.
* sysif.c (fcntl_wrap): Likewise.
* termios.c (encode_speeds, decode_speeds): Likewise.
* configure (diag_flags): Add -Wextra.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -12437,7 +12437,7 @@ static val make_time_impl(time_t (*pmktime)(struct tm *), val hour, val minute, val second, val isdst) { - struct tm local = { 0 }; + struct tm local = all_zero_init; time_t time; time_fields_to_tm(&local, year, month, day, @@ -12458,7 +12458,7 @@ val make_time(val year, val month, val day, static struct tm epoch_tm(void) { - struct tm ep = { 0 }; + struct tm ep = all_zero_init; ep.tm_year = 70; ep.tm_mday = 1; return ep; @@ -12560,7 +12560,7 @@ static val time_meth(val utc_p, val time_struct) static val time_string_meth(val time_struct, val format) { - struct tm tms = { 0 }; + struct tm tms = all_zero_init; time_struct_to_tm(&tms, time_struct, t); char buffer[512] = ""; char *fmt = utf8_dup_to(c_str(format)); @@ -12577,7 +12577,7 @@ static val time_string_meth(val time_struct, val format) static val time_parse_meth(val time_struct, val format, val string) { - struct tm tms = { 0 }; + struct tm tms = all_zero_init; time_struct_to_tm(&tms, time_struct, nil); val ret = nil; |