aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-29 22:49:44 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-06-03 13:17:35 +0200
commit41f651b442fa4ef2b562573aa4da1b6a644eed76 (patch)
tree53a7db21858f232bff57de65e2a21ef3e19e944f
parent3800353ba503dc700ee3803a6fa4729f03e702ff (diff)
downloadsparse-41f651b442fa4ef2b562573aa4da1b6a644eed76.tar.gz
univ-init: set default to -Wno-universal-initializer
'{ 0 }' is the standard idiom for the universal zero initializer '{ }'. But if the '0' is taken literally, warnings can be issued, for exemple for 'using 0 as NULL pointer' or for 'using a positional initializer' when the attribute 'designated_init' is used. These warnings were not intended to be issued for this initializer and are confusing and annoying when people have to use or want to use standard code or ignore that '{ }' is fine to use with GCC, clang or Sparse. So, set sparse default to -Wno-universal-initializer, suppressing any warnings caused by using '{ 0 }' instead of '{ }'. Reference: https://lore.kernel.org/git/e6796c60-a870-e761-3b07-b680f934c537@ramsayjones.plus.com/ Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95379 Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--lib.c2
-rw-r--r--sparse.110
2 files changed, 7 insertions, 5 deletions
diff --git a/lib.c b/lib.c
index 7aca9cd0..8f071bfe 100644
--- a/lib.c
+++ b/lib.c
@@ -296,7 +296,7 @@ int Wtransparent_union = 0;
int Wtypesign = 0;
int Wundef = 0;
int Wuninitialized = 1;
-int Wuniversal_initializer = 1;
+int Wuniversal_initializer = 0;
int Wunknown_attribute = 0;
int Wvla = 1;
diff --git a/sparse.1 b/sparse.1
index 63b408e3..9a2df0a2 100644
--- a/sparse.1
+++ b/sparse.1
@@ -437,11 +437,13 @@ Sparse does not issue these warnings by default.
.
.TP
.B \-Wuniversal\-initializer
-Do not suppress warnings about 0 used to initialize a null-pointer
-when using '{ 0 }' as initializer.
+Do not suppress warnings caused by using '{ 0 }' instead of '{ }' on
+aggregate types, ignoring its special status as universal initializer.
+The concerned warnings are, for exemple, those trigered by
+\fB\-Wdesignated\-init\fR or \fB\-Wnon\-pointer\-null\fR.
-Sparse issues these warnings by default. To turn them off, use
-\fB\-Wno\-universal\-initializer\fR.
+Sparse does not issue these warnings by default, processing '{ 0 }'
+the same as '{ }'.
.
.SH MISC OPTIONS
.TP