aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2013-01-02 21:12:03 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2013-01-02 21:12:03 +0000
commitee3d9f0be3d2080abb1cf76d7d327a044791b22a (patch)
tree01f43969a1609c3dda34a3a31db21878ba97fd30
parent55d3f944be7052a12c5e36528e84fc399cac5f75 (diff)
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
-rw-r--r--test/Sema/warn-type-safety-mpi-hdf5.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/Sema/warn-type-safety-mpi-hdf5.c b/test/Sema/warn-type-safety-mpi-hdf5.c
index 8c50cb24bb..1a9c5b0772 100644
--- a/test/Sema/warn-type-safety-mpi-hdf5.c
+++ b/test/Sema/warn-type-safety-mpi-hdf5.c
@@ -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;