]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
heimdal build clang 20: compile lex generated code
authorGary Lockyer <gary@catalyst.net.nz>
Tue, 20 May 2025 21:21:17 +0000 (09:21 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Thu, 29 May 2025 00:19:50 +0000 (00:19 +0000)
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

third_party/heimdal_build/wscript_build
third_party/heimdal_build/wscript_configure

index a429804ed01b24b54215334370c0aef2a89d5c93..801f3277f41c47fd210f472b7e861a957c1cff10 100644 (file)
@@ -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')
 
index 89947fbf2d65f762fdc4034a63e2853ce96f325a..4ab8d5034a4bcc48316bd5874f5ea6f9c027e34e 100644 (file)
@@ -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)")