Skip to content

Commit 1c96642

Browse files
lucvoogitster
authored andcommitted
sparse: allow '{ 0 }' to be used without warnings
In standard C, '{ 0 }' can be used as an universal zero-initializer. However, Sparse complains if this is used on a type where the first member (possibly nested) is a pointer since Sparse purposely wants to warn when '0' is used to initialize a pointer type. Legitimaly, it's desirable to be able to use '{ 0 }' as an idiom without these warnings [1,2]. To allow this, an option have now been added to Sparse: 537e3e2dae univ-init: conditionally accept { 0 } without warnings So, add this option to the SPARSE_FLAGS variable. Note: The option have just been added to Sparse. So, to benefit now from this patch it's needed to use the latest Sparse source from kernel.org. The option will simply be ignored by older versions of Sparse. [1] https://lore.kernel.org/r/[email protected] [2] https://lore.kernel.org/r/[email protected] Signed-off-by: Luc Van Oostenryck <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent af6b65d commit 1c96642

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ PTHREAD_CFLAGS =
11881188

11891189
# For the 'sparse' target
11901190
SPARSE_FLAGS ?=
1191-
SP_EXTRA_FLAGS =
1191+
SP_EXTRA_FLAGS = -Wno-universal-initializer
11921192

11931193
# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
11941194
# usually result in less CPU usage at the cost of higher peak memory.

0 commit comments

Comments
 (0)