mirror of https://github.com/microsoft/clang.git
Type safety attributes: add tests for enumerations (users are actually doing
this, ensure we don't regress) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171412 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
55d3f944be
commit
ee3d9f0be3
|
@ -201,10 +201,14 @@ MPI_Datatype my_s1_datatype __attribute__(( type_tag_for_datatype(mpi,struct S1)
|
|||
struct S2 { int a; int b; };
|
||||
MPI_Datatype my_s2_datatype __attribute__(( type_tag_for_datatype(mpi,struct S2) ));
|
||||
|
||||
enum E1 { Foo };
|
||||
MPI_Datatype my_e1_datatype __attribute__(( type_tag_for_datatype(mpi,enum E1) ));
|
||||
|
||||
void test_user_types(int *int_buf,
|
||||
long *long_buf,
|
||||
struct S1 *s1_buf,
|
||||
struct S2 *s2_buf)
|
||||
struct S2 *s2_buf,
|
||||
enum E1 *e1_buf)
|
||||
{
|
||||
MPI_Send(int_buf, 1, my_int_datatype); // no-warning
|
||||
MPI_Send(long_buf, 1, my_int_datatype); // expected-warning {{argument type 'long *' doesn't match specified 'mpi' type tag that requires 'int *'}}
|
||||
|
@ -214,6 +218,10 @@ void test_user_types(int *int_buf,
|
|||
|
||||
MPI_Send(long_buf, 1, my_s1_datatype); // expected-warning {{argument type 'long *' doesn't match specified 'mpi' type tag that requires 'struct S1 *'}}
|
||||
MPI_Send(s1_buf, 1, MPI_INT); // expected-warning {{argument type 'struct S1 *' doesn't match specified 'mpi' type tag that requires 'int *'}}
|
||||
|
||||
MPI_Send(e1_buf, 1, my_e1_datatype); // no-warning
|
||||
MPI_Send(e1_buf, 1, MPI_INT); // expected-warning {{argument type 'enum E1 *' doesn't match specified 'mpi' type tag that requires 'int *'}}
|
||||
MPI_Send(int_buf, 1, my_e1_datatype); // expected-warning {{argument type 'int *' doesn't match specified 'mpi' type tag that requires 'enum E1 *'}}
|
||||
}
|
||||
|
||||
MPI_Datatype my_unknown_datatype;
|
||||
|
|
Loading…
Reference in New Issue