> > +def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all > > intermediate " > > + "pointers const qualified to be safe">, InGroup<CastQual>, > > DefaultIgnore; > > > > I think this is overstating the point; there are safe casts that do not > have 'const' added in all intermediate points. It's a bit awkward, but we > could use something like this: > > "cast from pointer to %0 to pointer to non-const type %1 is not > const-correct; storing a value through the resulting pointer may make the > original pointer point to an object that is not of type %0" Well, I modelled the warning on gcc, which warns like this:
warning: to be safe all intermediate pointers in cast from 'int **' to 'const int **' must be 'const' qualified [-Wcast-qual] What you suggest is a bit too long and I personally think that most people will have to google what it means anyway. Maybe we can just keep my original warning text but just change "have" to "should" ? Opinions? > Also, can you give this diagnostic a better name, like > warn_cast_qual_indirect or warn_cast_qual_non_const_intermediate? Sure. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
