@@ -7,3 +7,15 @@ int dupe(const char *fmt, ...) __attribute__((modular_format(__modular_printf,
77int multi_dupe (const char * fmt , ...) __attribute__((modular_format (__modular_printf , "__printf" , "float" , "int" , "float" , "int" ), format (printf , 1 , 2 ))); // expected-error {{duplicate aspect 'float' in 'modular_format' attribute}} \
88 // expected-error {{duplicate aspect 'int' in 'modular_format' attribute}}
99
10+ // Test with multiple identical attributes on the same declaration.
11+ int same_attr (const char * fmt , ...) __attribute__((modular_format (__modular_printf , "__printf" , "float" ), modular_format (__modular_printf , "__printf" , "float" ), format (printf , 1 , 2 ))); // no-warning
12+
13+ // Test with multiple different attributes on the same declaration.
14+ int diff_attr (const char * fmt , ...) __attribute__((modular_format (__modular_printf , "__printf" , "float" ), format (printf , 1 , 2 ), modular_format (__modular_printf , "__printf" , "int" ))); // expected-warning {{attribute 'modular_format' is already applied with different arguments}} expected-note {{conflicting attribute is here}}
15+
16+ int diff_attr2 (const char * fmt , ...) __attribute__((modular_format (__modular_printf , "__printf" , "float" ), format (printf , 1 , 2 ), modular_format (__modular_printf , "__other" , "float" ))); // expected-warning {{attribute 'modular_format' is already applied with different arguments}} expected-note {{conflicting attribute is here}}
17+
18+ int diff_attr3 (const char * fmt , ...) __attribute__((modular_format (__modular_printf , "__printf" , "float" ), format (printf , 1 , 2 ), modular_format (__other , "__printf" , "float" ))); // expected-warning {{attribute 'modular_format' is already applied with different arguments}} expected-note {{conflicting attribute is here}}
19+
20+ // Test with same attributes but different aspect order.
21+ int diff_order (const char * fmt , ...) __attribute__((modular_format (__modular_printf , "__printf" , "float" , "int" ), format (printf , 1 , 2 ), modular_format (__modular_printf , "__printf" , "int" , "float" ))); // no-warning
0 commit comments