summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure2
-rw-r--r--lib.c8
-rw-r--r--lib.h6
-rw-r--r--parser.c2
-rw-r--r--socket.c2
-rw-r--r--sysif.c2
-rw-r--r--termios.c4
7 files changed, 16 insertions, 10 deletions
diff --git a/configure b/configure
index 250cb772..a2000b51 100755
--- a/configure
+++ b/configure
@@ -134,7 +134,7 @@ yacc_is_newer_bison=
nm='$(cross)$(tool_prefix)nm'
opt_flags='-O2 -fno-stack-protector'
lang_flags='-ansi -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200112 -D_GNU_SOURCE'
-diag_flags='-Wall -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=strict-prototypes'
+diag_flags='-Wall -Wextra -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=strict-prototypes'
debug_flags=-g
debug_only_flags=-DTXR_DEBUG
debug_also=
diff --git a/lib.c b/lib.c
index 6fae0008..871c1131 100644
--- a/lib.c
+++ b/lib.c
@@ -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;
diff --git a/lib.h b/lib.h
index b4e2554f..f039568f 100644
--- a/lib.h
+++ b/lib.h
@@ -1298,3 +1298,9 @@ loc list_collect_revappend(loc ptail, val obj);
#define static_forward(decl) static decl
#define static_def(def) static def
#endif
+
+#ifdef __cplusplus
+#define all_zero_init { }
+#else
+#define all_zero_init { 0 }
+#endif
diff --git a/parser.c b/parser.c
index c6699988..992e9719 100644
--- a/parser.c
+++ b/parser.c
@@ -206,7 +206,7 @@ val parser_set_lineno(val self, val stream, val lineno)
void prime_parser(parser_t *p, val name, enum prime_parser prim)
{
- struct yy_token sec_tok = { 0 };
+ struct yy_token sec_tok = all_zero_init;
switch (prim) {
case prime_lisp:
diff --git a/socket.c b/socket.c
index 25477de4..35ef7220 100644
--- a/socket.c
+++ b/socket.c
@@ -819,7 +819,7 @@ static val sock_mark_connected(val sock)
if (sfd) {
val family = sock_family(sock);
- struct sockaddr_storage sa = { 0 };
+ struct sockaddr_storage sa = all_zero_init;
socklen_t salen = sizeof sa;
(void) getpeername(c_num(sfd), coerce(struct sockaddr *, &sa), &salen);
diff --git a/sysif.c b/sysif.c
index a3b3ff91..6b646d9c 100644
--- a/sysif.c
+++ b/sysif.c
@@ -889,7 +889,7 @@ static val fcntl_wrap(val fd_in, val cmd_in, val arg_in)
if (missingp(arg_in)) {
errno = EINVAL;
} else {
- struct flock fl = { 0 };
+ struct flock fl = all_zero_init;
flock_pack(self, arg_in, &fl);
res = fcntl(fd, cmd, &fl);
if (cmd == F_GETLK)
diff --git a/termios.c b/termios.c
index 6179f2b5..5d7b26b0 100644
--- a/termios.c
+++ b/termios.c
@@ -337,7 +337,7 @@ static val tcflow_wrap(val action, val stream)
static val encode_speeds(val termios)
{
- struct termios tio = { 0 };
+ struct termios tio = all_zero_init;
tio.c_iflag = c_num(slot(termios, iflag_s));
tio.c_cflag = c_num(slot(termios, cflag_s));
@@ -351,7 +351,7 @@ static val encode_speeds(val termios)
static val decode_speeds(val termios)
{
- struct termios tio = { 0 };
+ struct termios tio = all_zero_init;
tio.c_cflag = c_num(slot(termios, cflag_s));
tio.c_iflag = c_num(slot(termios, iflag_s));