[cfe-commits] r171412 - /cfe/trunk/test/Sema/warn-type-safety-mpi-hdf5.c
Dmitri Gribenko
gribozavr at gmail.com
Wed Jan 2 13:12:03 PST 2013
Author: gribozavr
Date: Wed Jan 2 15:12:03 2013
New Revision: 171412
URL: http://llvm.org/viewvc/llvm-project?rev=171412&view=rev
Log:
Type safety attributes: add tests for enumerations (users are actually doing
this, ensure we don't regress)
Modified:
cfe/trunk/test/Sema/warn-type-safety-mpi-hdf5.c
Modified: cfe/trunk/test/Sema/warn-type-safety-mpi-hdf5.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-type-safety-mpi-hdf5.c?rev=171412&r1=171411&r2=171412&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-type-safety-mpi-hdf5.c (original)
+++ cfe/trunk/test/Sema/warn-type-safety-mpi-hdf5.c Wed Jan 2 15:12:03 2013
@@ -201,10 +201,14 @@
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 @@
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;
More information about the cfe-commits
mailing list