Skip to content

Commit 4532cd8

Browse files
committed
Merge branch 'jh/struct-zero-init-with-older-clang' into maint-2.38
Work around older clang that warns against C99 zero initialization syntax for struct. * jh/struct-zero-init-with-older-clang: config.mak.dev: disable suggest braces error on old clang versions
2 parents 92cd390 + 54795d3 commit 4532cd8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

config.mak.dev

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,31 @@ DEVELOPER_CFLAGS += -Wno-missing-braces
6969
endif
7070
endif
7171

72+
# Old versions of clang complain about initializaing a
73+
# struct-within-a-struct using just "{0}" rather than "{{0}}". This
74+
# error is considered a false-positive and not worth fixing, because
75+
# new clang versions do not, so just disable it.
76+
#
77+
# The "bug" was fixed in upstream clang 9.
78+
#
79+
# Complicating this is that versions of clang released by Apple have
80+
# their own version numbers (associated with the corresponding version
81+
# of XCode) unrelated to the official clang version numbers.
82+
#
83+
# The bug was fixed in Apple clang 12.
84+
#
85+
ifneq ($(filter clang1,$(COMPILER_FEATURES)),) # if we are using clang
86+
ifeq ($(uname_S),Darwin) # if we are on darwin
87+
ifeq ($(filter clang12,$(COMPILER_FEATURES)),) # if version < 12
88+
DEVELOPER_CFLAGS += -Wno-missing-braces
89+
endif
90+
else # not darwin
91+
ifeq ($(filter clang9,$(COMPILER_FEATURES)),) # if version < 9
92+
DEVELOPER_CFLAGS += -Wno-missing-braces
93+
endif
94+
endif
95+
endif
96+
7297
# https://bugzilla.redhat.com/show_bug.cgi?id=2075786
7398
ifneq ($(filter gcc12,$(COMPILER_FEATURES)),)
7499
DEVELOPER_CFLAGS += -Wno-error=stringop-overread

0 commit comments

Comments
 (0)