release/22.x: [Sema] Fix format-strings test on AIX (#180566)#182755
Open
llvmbot wants to merge 1 commit intollvm:release/22.xfrom
Open
release/22.x: [Sema] Fix format-strings test on AIX (#180566)#182755llvmbot wants to merge 1 commit intollvm:release/22.xfrom
llvmbot wants to merge 1 commit intollvm:release/22.xfrom
Conversation
Simplify the conditional compilation and skip the problematic warnings only on 32-bit Arm. (cherry picked from commit 8f37bf6)
Member
Author
|
@azhan92 What do you think about merging this PR to the release branch? |
Member
Author
|
@llvm/pr-subscribers-clang Author: None (llvmbot) ChangesBackport 8f37bf6 Requested by: @amy-kwan Full diff: https://github.com/llvm/llvm-project/pull/182755.diff 1 Files Affected:
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'}}
|
mgorny
requested changes
Feb 23, 2026
Member
mgorny
left a comment
There was a problem hiding this comment.
This change introduced regressions, see #180566 (comment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport 8f37bf6
Requested by: @amy-kwan