Skip to content

Commit 5435ff2

Browse files
committed
[NFC][BoundsSafety] Unbreak BoundsSafety/Sema/check-format-arguments.c
This test was broken by llvm#166738 ``` commit 1df7b51 Author: Vladimir Vuksanovic <[email protected]> Date: Fri Dec 5 15:04:12 2025 +0100 [Sema] Suggest missing format attributes (llvm#166738) ``` It seems a different warning (`-Wmissing-format-attribute`) is emitted for the case where a non-format string argument is passed to `foo`. This new behavior seems a little confusing * There's no longer a warning about the call to `foo` not taking a string literal. * The suggested attribute conflicts with the `format` attribute that's already on bar. Dealing with this odd behavior is out-of-scope though for fixing this test case though. rdar://166071403
1 parent deb71df commit 5435ff2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/test/BoundsSafety/Sema/check-format-arguments.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
void __printflike(1, 0) foo(const char *__null_terminated, va_list);
1111

12+
// expected-note@+1{{'bar' declared here}}
1213
void __printflike(2, 3) bar(const char *__unsafe_indexable p1, const char *__unsafe_indexable p2, ...) {
1314
va_list variadicArgs;
1415
va_start(variadicArgs, p2);
@@ -18,7 +19,7 @@ void __printflike(2, 3) bar(const char *__unsafe_indexable p1, const char *__uns
1819
foo(__unsafe_forge_null_terminated(const char *, "Hello, %s!\n"), variadicArgs);
1920

2021
foo(__unsafe_forge_null_terminated(const char *, 2), variadicArgs); // expected-warning{{format string is not a string literal}}
21-
foo(__unsafe_forge_null_terminated(const char *, p1), variadicArgs); // expected-warning{{format string is not a string literal}}
22+
foo(__unsafe_forge_null_terminated(const char *, p1), variadicArgs); // expected-warning{{diagnostic behavior may be improved by adding the 'format(printf, 1, 3)' attribute to the declaration of 'bar'}}
2223

2324
va_end(variadicArgs);
2425
}

0 commit comments

Comments
 (0)