Skip to content

Commit fe467c2

Browse files
GaryWLdouglasbagnall
authored andcommitted
heimdal build clang 20: compile lex generated code
The lex/flex generated code in the heimdal build triggers: strict-prototype and implicit-fallthrough errors Rather that blanket disabling the warnings, try to disable them only when compiling lex/flex generated code Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Thu May 29 00:19:50 UTC 2025 on atb-devel-224
1 parent b473ad7 commit fe467c2

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

third_party/heimdal_build/wscript_build

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,16 @@ def HEIMDAL_BINARY(binname, source,
295295
install_path = None,
296296
install = install)
297297

298+
def HEIMDAL_LEX_CFLAGS():
299+
lex_cflags = []
300+
if bld.CONFIG_SET('HEIMDAL_UNPICKY_WNO_STRICT_OVERFLOW_CFLAGS'):
301+
lex_cflags.append('-Wno-strict-overflow')
302+
if bld.CONFIG_SET('HEIMDAL_LEX_WNO_STRICT_PROTOTYPES_CFLAGS'):
303+
lex_cflags.append('-Wno-error=strict-prototypes')
304+
if bld.CONFIG_SET('HEIMDAL_LEX_WNO_IMPLICIT_FALLTHROUGH_CFLAGS'):
305+
lex_cflags.append('-Wno-error=implicit-fallthrough')
306+
return lex_cflags
307+
298308

299309
if not bld.CONFIG_SET('USING_SYSTEM_ROKEN'):
300310

@@ -1009,7 +1019,7 @@ if not bld.CONFIG_SET("USING_SYSTEM_HX509"):
10091019
HEIMDAL_HX509_OBJH_SOURCE + ' lib/hx509/sel-lex.l lib/hx509/sel-gram.y',
10101020
includes='../heimdal/lib/hx509',
10111021
deps='roken com_err asn1 hcrypto asn1 HEIMDAL_OCSP_ASN1 HEIMDAL_PKCS8_ASN1 HEIMDAL_PKCS9_ASN1 HEIMDAL_PKCS12_ASN1 HEIMDAL_PKCS10_ASN1 wind heimbase',
1012-
cflags=bld.env.HEIMDAL_UNPICKY_WNO_STRICT_OVERFLOW_CFLAGS,
1022+
cflags=' '.join(HEIMDAL_LEX_CFLAGS()),
10131023
version_script='lib/hx509/version-script.map',
10141024
)
10151025

@@ -1086,7 +1096,7 @@ if not bld.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'):
10861096
'lib/asn1/gen.c',
10871097
includes='../heimdal/lib/asn1',
10881098
group='hostcc_build_main',
1089-
cflags=bld.env.HEIMDAL_UNPICKY_WNO_STRICT_OVERFLOW_CFLAGS,
1099+
cflags=HEIMDAL_LEX_CFLAGS(),
10901100
deps='ROKEN_HOSTCC HEIMBASE_HOSTCC',
10911101
use_global_deps=False,
10921102
use_hostcc=True)
@@ -1104,11 +1114,13 @@ if not bld.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'):
11041114
group='hostcc_build_main',
11051115
deps='ROKEN_HOSTCC HEIMBASE_HOSTCC LIBREPLACE_HOSTCC HEIMDAL_VERS_HOSTCC '
11061116
'HEIMDAL_ASN1_GEN_HOSTCC',
1107-
install=False
1117+
install=False,
1118+
cflags=' '.join(HEIMDAL_LEX_CFLAGS())
11081119
)
11091120
bld.env['ASN1_COMPILE'] = os.path.join(bld.bldnode.parent.abspath(), 'asn1_compile')
11101121

11111122

1123+
11121124
if not bld.CONFIG_SET('USING_SYSTEM_COMPILE_ET'):
11131125
HEIMDAL_BINARY('compile_et',
11141126
'lib/com_err/parse.y lib/com_err/lex.l lib/com_err/compile_et.c',
@@ -1117,7 +1129,8 @@ if not bld.CONFIG_SET('USING_SYSTEM_COMPILE_ET'):
11171129
includes='../heimdal/lib/com_err',
11181130
group='hostcc_base_build_main',
11191131
deps='ROKEN_HOSTCC LIBREPLACE_HOSTCC HEIMDAL_VERS_HOSTCC',
1120-
install=False
1132+
install=False,
1133+
cflags=' '.join(HEIMDAL_LEX_CFLAGS())
11211134
)
11221135
bld.env['COMPILE_ET'] = os.path.join(bld.bldnode.parent.abspath(), 'compile_et')
11231136

third_party/heimdal_build/wscript_configure

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ heimdal_no_error_flags = ['-Wno-error=cast-qual',
7979
'-Wno-error=discarded-qualifiers',
8080
'-Wno-error=old-style-definition',
8181
'-Wno-error=unused-result',
82-
'-Wno-error=implicit-fallthrough',
83-
'-Wno-error=strict-prototypes',
8482
'-Wno-error=unused-variable'
8583
]
8684
for flag in heimdal_no_error_flags:
@@ -96,6 +94,14 @@ conf.ADD_NAMED_CFLAGS('HEIMDAL_UNPICKY_WNO_FREE_NOHEAP_OBJECT_CFLAGS',
9694
'-Wno-error=free-nonheap-object',
9795
testflags=True)
9896

97+
conf.ADD_NAMED_CFLAGS('HEIMDAL_LEX_WNO_IMPLICIT_FALLTHROUGH_CFLAGS',
98+
'-Wno-error=implicit-fallthrough',
99+
testflags=True)
100+
101+
conf.ADD_NAMED_CFLAGS('HEIMDAL_LEX_WNO_STRICT_PROTOTYPES_CFLAGS',
102+
'-Wno-error=strict-prototypes',
103+
testflags=True)
104+
99105
if len(bld.env.HEIMDAL_NO_ERROR_CFLAGS) == len(heimdal_no_error_flags):
100106
Logs.info("Most warnings in Heimdal code will "
101107
"error due to -Werror (good)")

0 commit comments

Comments
 (0)