[cfe-commits] [PATCH] Type safety attributes (was: Compile-time MPI_Datatype checking)

Dmitri Gribenko gribozavr at gmail.com
Sun May 27 15:55:00 CDT 2012


Hi Hal,

Thank you for the review.  I've attached updated patch.

On Sun, May 27, 2012 at 10:08 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> I would still like to remove the remaining MPI-specific things. Also, I
> think that the category tag should appear in the warning messages.

I removed all MPI-specific diagnostic texts.  Now diagnostics read:

+def warn_type_safety_type_mismatch : Warning<
+  "argument type %0 doesn't match specified %1 type tag "
+  "%select{that requires %3|}2">, InGroup<TypeSafety>;
+def warn_type_safety_pointee_type_mismatch : Warning<
+  "pointee type %0 doesn't match specified %1 type tag "
+  "%select{that requires %3|}2">, InGroup<TypeSafety>;

"that requires" part is printed if layout_compatible is not set.

> so it will print as
> pointee type foo dosen't match the specified mpi type tag
> MPI_DATATYPE_BAR.

I didn't include tag name into diagnostic text because generally clang
avoids printing things back to the user.  The diagnostic underlines
the tag source range instead.  If you think that tag needs to be
printed, I can change that.

> And finally, because I'd like it to be as easy as possible for library
> maintainers, please add an example in the documentation showing how to
> properly guard the attributes (ifdef + has_attribute).

Done.

> To the rest of the list: Can one of the clang code owners please look
> at this?

I second this.  I'd love to hear how this fits into clang.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: type-safety-attrs-v5.patch
Type: application/octet-stream
Size: 71506 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/cfe-commits/attachments/20120527/b5b81b32/attachment-0001.obj 


More information about the cfe-commits mailing list