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

Hal Finkel hfinkel at anl.gov
Sun May 27 15:31:24 PDT 2012


Dmitri,

Thanks, this is great! I'll certainly be using this locally, and I'd
love to see this in trunk. This will help our users catch bugs not only
in MPI but also in other libraries and in system calls (POSIX, etc.).
I'm now handing the review off to someone who can better speak to
clang internals.

 -Hal

On Sun, 27 May 2012 23:55:00 +0300
Dmitri Gribenko <gribozavr at gmail.com> wrote:

> 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.

Good point.

> 
> > 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
> 



-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the cfe-commits mailing list