Commit 1b2e71790f for openssl.org

commit 1b2e71790fcd1e72c710e46b86b1f5f90a721014
Author: Nikola Pajkovsky <nikolap@openssl.org>
Date:   Fri Nov 20 14:47:48 2026 +0100

    Configurations/10-main.conf: disable printf builtins for mingw targets

    On mingw targets GCC attaches an ms_printf format attribute
    to its printf() family builtins. mingw-w64 11 hid the builtins
    behind inline wrappers in <stdio.h>, but mingw-w64 13 declares
    the functions directly, so the builtin attribute is applied
    and C99 conversions such as %zu are diagnosed:

      apps/lib/app_params.c:70:52: error: unknown conversion type
      character 'z' in format [-Werror=format=]

    This breaks --strict-warnings builds with the mingw-w64 cross GCC 13
    and mingw-w64 13 headers, as shipped in Ubuntu 26.04, which
    the nightly mingw64 CI jobs now run on. The diagnostic is bogus,
    the calls resolve to the C99 conforming __mingw_*printf() functions.

    Pass -fno-builtin-{printf,fprintf,sprintf,snprintf} for all mingw
    targets. Format strings are still checked through the gnu_printf
    format attribute from the mingw-w64 headers.

    The mingw and mingw64 targets now add to the inherited cflags
    instead of replacing them, and mingwarm64 drops its empty cflags
    override so that it inherits them too.

    Assisted-by: Claude:claude-mythos-5-2
    Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
    Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
    Reviewed-by: Daniel Kubec <kubec@openssl.foundation>
    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    Merge-date: Fri Nov 20 14:04:15 2026
    Merged-from: https://github.com/openssl/openssl/pull/33881

diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
index b71612364b..f2b8c73fd5 100644
--- a/Configurations/10-main.conf
+++ b/Configurations/10-main.conf
@@ -1579,6 +1579,15 @@ my %targets = (
                                    release => "-O3"),
         cppflags         => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
                                     threads("-D_MT")),
+        # GCC attaches an ms_printf format attribute to its printf() family
+        # builtins on mingw targets. Since mingw-w64 13 the headers declare
+        # these functions in a way that no longer hides the builtins, so C99
+        # conversions such as %zu are diagnosed even though the functions
+        # resolve to the C99 conforming __mingw_*printf() ones. Disabling
+        # the builtins leaves the gnu_printf format attribute from the
+        # headers in effect.
+        cflags           => "-fno-builtin-printf -fno-builtin-fprintf "
+                            . "-fno-builtin-sprintf -fno-builtin-snprintf",
         lib_cppflags     => "-DL_ENDIAN",
         ex_libs          => add("-lws2_32 -lgdi32 -lcrypt32 -lbcrypt"),
         thread_scheme    => "winthreads",
@@ -1592,7 +1601,7 @@ my %targets = (
     "mingw" => {
         inherit_from     => [ "mingw-common" ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
-        cflags           => "-m32",
+        cflags           => add("-m32"),
         sys_id           => "MINGW32",
         bn_ops           => add("BN_LLONG"),
         asm_arch         => 'x86',
@@ -1611,7 +1620,7 @@ my %targets = (
         # environment. And as mingw64 is always consistent with itself,
         # Applink is never engaged and can as well be omitted.
         inherit_from     => [ "mingw-common" ],
-        cflags           => "-m64",
+        cflags           => add("-m64"),
         sys_id           => "MINGW64",
         bn_ops           => add("SIXTY_FOUR_BIT"),
         asm_arch         => 'x86_64',
@@ -1623,7 +1632,6 @@ my %targets = (

     "mingwarm64" => {
         inherit_from     => [ "mingw-common" ],
-        cflags           => "",
         sys_id           => "MINGWARM64",
         bn_ops           => add("SIXTY_FOUR_BIT"),
         asm_arch         => 'aarch64',