I suggest avoiding "element size" because the pointed-to argument
need not be an array.  Mentioning the types should help users better
understand the problem (especially in C++ where types are often
obscured by layers of templates).  It might also be a nice touch
to add a note pointing to the declaration of the first sizeof
operand (if it's an object).


Yes, many thanks for your suggestions.

Do the new warning and info messages look right?

Sorry for not replying sooner.  The new warning looks good to
me, with just one minor nit.  For proper highlighting within
the message, the expression should be quoted in a pair of %<
and %> directives, like so:

  warning_at (stack[sp].loc, OPT_Wsizeof_pointer_div,
              "division %<sizeof (%T) / sizeof (%T)%> does "
              "not compute the number of array elements",
              type0, type1))

This way the whole quoted expression will be highlighted in
the style appropriate for quoted text.

Similarly, in the inform call, sizeof should be quoted in
the same pair of %< and %> directives.

Martin

Reply via email to