From fe467c2f8a5541ee9f651a875f6764b3a54af5d3 Mon Sep 17 00:00:00 2001 From: Gary Lockyer Date: Wed, 21 May 2025 09:21:17 +1200 Subject: [PATCH] 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 Reviewed-by: Douglas Bagnall Reviewed-by: Anoop C S Autobuild-User(master): Douglas Bagnall Autobuild-Date(master): Thu May 29 00:19:50 UTC 2025 on atb-devel-224 --- third_party/heimdal_build/wscript_build | 21 +++++++++++++++++---- third_party/heimdal_build/wscript_configure | 10 ++++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/third_party/heimdal_build/wscript_build b/third_party/heimdal_build/wscript_build index a429804ed01..801f3277f41 100644 --- a/third_party/heimdal_build/wscript_build +++ b/third_party/heimdal_build/wscript_build @@ -295,6 +295,16 @@ def HEIMDAL_BINARY(binname, source, install_path = None, install = install) +def HEIMDAL_LEX_CFLAGS(): + lex_cflags = [] + if bld.CONFIG_SET('HEIMDAL_UNPICKY_WNO_STRICT_OVERFLOW_CFLAGS'): + lex_cflags.append('-Wno-strict-overflow') + if bld.CONFIG_SET('HEIMDAL_LEX_WNO_STRICT_PROTOTYPES_CFLAGS'): + lex_cflags.append('-Wno-error=strict-prototypes') + if bld.CONFIG_SET('HEIMDAL_LEX_WNO_IMPLICIT_FALLTHROUGH_CFLAGS'): + lex_cflags.append('-Wno-error=implicit-fallthrough') + return lex_cflags + if not bld.CONFIG_SET('USING_SYSTEM_ROKEN'): @@ -1009,7 +1019,7 @@ if not bld.CONFIG_SET("USING_SYSTEM_HX509"): HEIMDAL_HX509_OBJH_SOURCE + ' lib/hx509/sel-lex.l lib/hx509/sel-gram.y', includes='../heimdal/lib/hx509', deps='roken com_err asn1 hcrypto asn1 HEIMDAL_OCSP_ASN1 HEIMDAL_PKCS8_ASN1 HEIMDAL_PKCS9_ASN1 HEIMDAL_PKCS12_ASN1 HEIMDAL_PKCS10_ASN1 wind heimbase', - cflags=bld.env.HEIMDAL_UNPICKY_WNO_STRICT_OVERFLOW_CFLAGS, + cflags=' '.join(HEIMDAL_LEX_CFLAGS()), version_script='lib/hx509/version-script.map', ) @@ -1086,7 +1096,7 @@ if not bld.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'): 'lib/asn1/gen.c', includes='../heimdal/lib/asn1', group='hostcc_build_main', - cflags=bld.env.HEIMDAL_UNPICKY_WNO_STRICT_OVERFLOW_CFLAGS, + cflags=HEIMDAL_LEX_CFLAGS(), deps='ROKEN_HOSTCC HEIMBASE_HOSTCC', use_global_deps=False, use_hostcc=True) @@ -1104,11 +1114,13 @@ if not bld.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'): group='hostcc_build_main', deps='ROKEN_HOSTCC HEIMBASE_HOSTCC LIBREPLACE_HOSTCC HEIMDAL_VERS_HOSTCC ' 'HEIMDAL_ASN1_GEN_HOSTCC', - install=False + install=False, + cflags=' '.join(HEIMDAL_LEX_CFLAGS()) ) bld.env['ASN1_COMPILE'] = os.path.join(bld.bldnode.parent.abspath(), 'asn1_compile') + if not bld.CONFIG_SET('USING_SYSTEM_COMPILE_ET'): HEIMDAL_BINARY('compile_et', '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'): includes='../heimdal/lib/com_err', group='hostcc_base_build_main', deps='ROKEN_HOSTCC LIBREPLACE_HOSTCC HEIMDAL_VERS_HOSTCC', - install=False + install=False, + cflags=' '.join(HEIMDAL_LEX_CFLAGS()) ) bld.env['COMPILE_ET'] = os.path.join(bld.bldnode.parent.abspath(), 'compile_et') diff --git a/third_party/heimdal_build/wscript_configure b/third_party/heimdal_build/wscript_configure index 89947fbf2d6..4ab8d5034a4 100644 --- a/third_party/heimdal_build/wscript_configure +++ b/third_party/heimdal_build/wscript_configure @@ -79,8 +79,6 @@ heimdal_no_error_flags = ['-Wno-error=cast-qual', '-Wno-error=discarded-qualifiers', '-Wno-error=old-style-definition', '-Wno-error=unused-result', - '-Wno-error=implicit-fallthrough', - '-Wno-error=strict-prototypes', '-Wno-error=unused-variable' ] for flag in heimdal_no_error_flags: @@ -96,6 +94,14 @@ conf.ADD_NAMED_CFLAGS('HEIMDAL_UNPICKY_WNO_FREE_NOHEAP_OBJECT_CFLAGS', '-Wno-error=free-nonheap-object', testflags=True) +conf.ADD_NAMED_CFLAGS('HEIMDAL_LEX_WNO_IMPLICIT_FALLTHROUGH_CFLAGS', + '-Wno-error=implicit-fallthrough', + testflags=True) + +conf.ADD_NAMED_CFLAGS('HEIMDAL_LEX_WNO_STRICT_PROTOTYPES_CFLAGS', + '-Wno-error=strict-prototypes', + testflags=True) + if len(bld.env.HEIMDAL_NO_ERROR_CFLAGS) == len(heimdal_no_error_flags): Logs.info("Most warnings in Heimdal code will " "error due to -Werror (good)") -- 2.47.2