[m-rev.] for review: improve error messages for missing foreign values in foreign_enum pragmas
Julien Fischer
jfischer at opturion.com
Tue Jun 7 21:12:48 AEST 2016
Hi Zoltan,
On Tue, 7 Jun 2016, Zoltan Somogyi wrote:
> On Tue, 7 Jun 2016 11:41:46 +1000 (AEST), Julien Fischer <jfischer at opturion.com> wrote:
>> Currently, if a foreign_enum pragma is missing cases in the constructor -
>> foreign value mapping we report that there are some missing foreign values but
>> do not list the affected constructors unless --verbose-error-messages is
>> enabled. For cases where there are a small number of missing foreign values
>> this is a bit irritating as you need to recompile to find out what they are.
>> Change the compiler so the error messsage lists upto the first 10 constructors
>> that do not have a foreign value.
>> (If --verbose-error-messages is enabled then we list all of them as before.)
>
> I haven't seen the diff; I am just replying to this part of the log message.
> Why print only the first 10 constructors without verbose error messages?
Because at some point printing them all out is going to get unwieldy. What,
for example, if instead of 10 unmapped constructors there are 200? In that
case, I think it's preferable to print out the first 10 (or whatever number we
settle on) along with a message saying there another 190 (which is what this
diff does), rather than just all of them in one gigantic error message.
> First, I think the median number of missing constructors will be less than 10
> anyway, but second, when there are more than 10 missing, why wouldn't
> the user want to know all of them at once?
I generally generate the mappings for large foreign enumerations by processing
the relevant C header file(s) in some way. The use case I have mind is that
there is some error in that process that is causing constructors to be omitted;
I don't really care about what the identity of all the unmapped constructors, I
just need enough information to debug the process generating the mapping.
> Wouldn't it be "irritating", as you say, to fix ten and then be presented
> with another batch of missing values to fix on the next compiler invocation?
The non-verbose version of the message does also mention that there are
additional unmapped constructors that it did not print, so you are not going to
be unaware that there are more (provided you read the error message).
Julien.
More information about the reviews
mailing list