Skip to content

Commit

Permalink
Correct some confused diagnostic terminology
Browse files Browse the repository at this point in the history
Attributes accept arguments, not parameters, so we should report that
the duplicate attribute arguments don't match.
  • Loading branch information
AaronBallman committed Feb 4, 2021
1 parent ae7e842 commit cd2f65b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -9621,7 +9621,7 @@ def warn_duplicate_attribute_exact : Warning<
"attribute %0 is already applied">, InGroup<IgnoredAttributes>;

def warn_duplicate_attribute : Warning<
"attribute %0 is already applied with different parameters">,
"attribute %0 is already applied with different arguments">,
InGroup<IgnoredAttributes>;

def warn_sync_fetch_and_nand_semantics_change : Warning<
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Sema/attr-min-vector-width.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ void f(void) __attribute__((__min_vector_width__(i))); /* expected-error {{'__mi

void f2(void) __attribute__((__min_vector_width__(128)));

void f3(void) __attribute__((__min_vector_width__(128), __min_vector_width__(256))); /* expected-warning {{attribute '__min_vector_width__' is already applied with different parameters}} */
void f3(void) __attribute__((__min_vector_width__(128), __min_vector_width__(256))); /* expected-warning {{attribute '__min_vector_width__' is already applied with different arguments}} */

void f4(void) __attribute__((__min_vector_width__())); /* expected-error {{'__min_vector_width__' attribute takes one argument}} */

Expand Down
6 changes: 3 additions & 3 deletions clang/test/SemaOpenCL/invalid-kernel-attrs.cl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ kernel __attribute__((vec_type_hint(void))) void kernel3() {} //expected-error{{

kernel __attribute__((vec_type_hint(bool))) void kernel4() {} //expected-error{{a non-vector or non-vectorizable scalar type is an invalid argument to attribute 'vec_type_hint'}}

kernel __attribute__((vec_type_hint(int))) __attribute__((vec_type_hint(float))) void kernel5() {} //expected-warning{{attribute 'vec_type_hint' is already applied with different parameters}}
kernel __attribute__((vec_type_hint(int))) __attribute__((vec_type_hint(float))) void kernel5() {} //expected-warning{{attribute 'vec_type_hint' is already applied with different arguments}}

kernel __attribute__((work_group_size_hint(8,16,32,4))) void kernel6() {} //expected-error{{'work_group_size_hint' attribute requires exactly 3 arguments}}

kernel __attribute__((work_group_size_hint(1,2,3))) __attribute__((work_group_size_hint(3,2,1))) void kernel7() {} //expected-warning{{attribute 'work_group_size_hint' is already applied with different parameters}}
kernel __attribute__((work_group_size_hint(1,2,3))) __attribute__((work_group_size_hint(3,2,1))) void kernel7() {} //expected-warning{{attribute 'work_group_size_hint' is already applied with different arguments}}

__attribute__((reqd_work_group_size(8,16,32))) void kernel8(){} // expected-error {{attribute 'reqd_work_group_size' can only be applied to an OpenCL kernel}}

Expand All @@ -36,7 +36,7 @@ kernel __attribute__((reqd_work_group_size(0,1,2))) void kernel13(){} // expecte

__attribute__((intel_reqd_sub_group_size(8))) void kernel14(){} // expected-error {{attribute 'intel_reqd_sub_group_size' can only be applied to an OpenCL kernel}}
kernel __attribute__((intel_reqd_sub_group_size(0))) void kernel15(){} // expected-error {{'intel_reqd_sub_group_size' attribute must be greater than 0}}
kernel __attribute__((intel_reqd_sub_group_size(8))) __attribute__((intel_reqd_sub_group_size(16))) void kernel16() {} //expected-warning{{attribute 'intel_reqd_sub_group_size' is already applied with different parameters}}
kernel __attribute__((intel_reqd_sub_group_size(8))) __attribute__((intel_reqd_sub_group_size(16))) void kernel16() {} //expected-warning{{attribute 'intel_reqd_sub_group_size' is already applied with different arguments}}

__kernel __attribute__((work_group_size_hint(8,-16,32))) void neg1() {} //expected-error{{'work_group_size_hint' attribute requires a non-negative integral compile time constant expression}}
__kernel __attribute__((reqd_work_group_size(8,16,-32))) void neg2(){} // expected-error{{'reqd_work_group_size' attribute requires a non-negative integral compile time constant expression}}
Expand Down

0 comments on commit cd2f65b

Please sign in to comment.