@@ -157,6 +157,33 @@ void test_multiple_format_strings(const char *fmt1, const char *fmt2) {
157
157
expected-warning{{passing 'os_log' format string where 'printf' format string is expected}}
158
158
}
159
159
160
+ __attribute__((format_matches (os_log , 1 , "%{public}s" ))) // expected-note 4{{comparing with this specifier}}
161
+ void call_oslog_public (const char * fmt );
162
+
163
+ __attribute__((format_matches (os_log , 1 , "%{sensitive}s" ))) // expected-note 2{{comparing with this specifier}}
164
+ void call_oslog_sensitive (const char * fmt );
165
+
166
+ __attribute__((format_matches (os_log , 1 , "%{private}s" ))) // expected-note 2{{comparing with this specifier}}
167
+ void call_oslog_private (const char * fmt );
168
+
169
+ void test_oslog (void ) {
170
+ call_oslog_public ("%{public}s" );
171
+ call_oslog_public ("%{private}s" ); // expected-warning{{argument sensitivity is private, but it should be public}}
172
+ call_oslog_public ("%{sensitive}s" ); // expected-warning{{argument sensitivity is sensitive, but it should be public}}
173
+
174
+ call_oslog_sensitive ("%{public}s" ); // expected-warning{{argument sensitivity is public, but it should be sensitive}}
175
+ call_oslog_sensitive ("%{private}s" ); // expected-warning{{argument sensitivity is private, but it should be sensitive}}
176
+ call_oslog_sensitive ("%{sensitive}s" );
177
+
178
+ call_oslog_private ("%{public}s" ); // expected-warning{{argument sensitivity is public, but it should be private}}
179
+ call_oslog_private ("%{private}s" );
180
+ call_oslog_private ("%{sensitive}s" ); // expected-warning{{argument sensitivity is sensitive, but it should be private}}
181
+
182
+ // expected-warning@+2{{argument sensitivity is private, but it should be public}}
183
+ // expected-warning@+1{{format specifier 'i' is incompatible with 's'}}
184
+ call_oslog_public ("%{private}i" );
185
+ }
186
+
160
187
// MARK: -
161
188
void accept_value (const char * f ) __attribute__((format_matches (freebsd_kprintf , 1 , "%s%i%i" ))); // \
162
189
expected-note 3{{comparing with this specifier}} \
0 commit comments