[llvm-branch-commits] [clang] release/22.x: [Sema] Fix format-strings test on AIX (#180566) (PR #182755)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Feb 22 09:00:43 PST 2026
https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/182755
Backport 8f37bf6b10e11b81032a16be711c58dda9fa0d8e
Requested by: @amy-kwan
>From 436e98d399c30edb15bdffbd2155f90754f1cf04 Mon Sep 17 00:00:00 2001
From: Leandro Lupori <leandro.lupori at linaro.org>
Date: Mon, 9 Feb 2026 18:42:22 -0300
Subject: [PATCH] [Sema] Fix format-strings test on AIX (#180566)
Simplify the conditional compilation and skip the problematic warnings
only on 32-bit Arm.
(cherry picked from commit 8f37bf6b10e11b81032a16be711c58dda9fa0d8e)
---
clang/test/Sema/format-strings.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index 3a2c2701cfcfc..07bac7095ee82 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -3,12 +3,10 @@
// RUN: %clang_cc1 -fblocks -fsyntax-only -verify -Wformat-nonliteral -isystem %S/Inputs -triple=x86_64-unknown-fuchsia %s
// RUN: %clang_cc1 -fblocks -fsyntax-only -verify -Wformat-nonliteral -isystem %S/Inputs -triple=x86_64-linux-android %s
-#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#define __need_wint_t
#include <stddef.h> // For wint_t and wchar_t
-#include <stdint.h>
typedef struct _FILE FILE;
int fprintf(FILE *, const char *restrict, ...);
@@ -988,14 +986,11 @@ void test_promotion(void) {
void test_bool(_Bool b, _Bool* bp)
{
-#if SIZE_MAX != UINT_MAX
+#ifndef __arm__
printf("%zu", b); // expected-warning-re{{format specifies type 'size_t' (aka '{{.+}}') but the argument has type '_Bool'}}
-#else
- printf("%zu", b); // no-warning
-#endif
-#if PTRDIFF_MAX != INT_MAX
printf("%td", b); // expected-warning-re{{format specifies type 'ptrdiff_t' (aka '{{.+}}') but the argument has type '_Bool'}}
#else
+ printf("%zu", b); // no-warning
printf("%td", b); // no-warning
#endif
printf("%jd", b); // expected-warning-re{{format specifies type 'intmax_t' (aka '{{.+}}') but the argument has type '_Bool'}}
More information about the llvm-branch-commits
mailing list