GNU bug report logs -
#75755
feature/igc: Missing IGC_CHECK_RES?
Previous Next
Full log
View this message in rfc822 format
"Pip Cet" <pipcet <at> protonmail.com> writes:
> "Stefan Kangas" <stefankangas <at> gmail.com> writes:
>
>> Gerd, do you remember why you didn't add CHECK_RES here? Was there a
>> reason for that or just an oversight?
>
> My mistake (c6a3eb01f7acf9ccd00b38e0ef2ab05164e48635). Please fix, or
> I'll do it in a bit.
Fixed. Thanks again. Checked the other mps calls, but what I found is
only this:
static const char *
mps_res_to_string (mps_res_t res)
{
switch (res)
{
#define RES_CASE(prefix, id, doc) \
case prefix##id: \
return #prefix #id " " doc;
_mps_RES_ENUM (RES_CASE, MPS_RES_);
#undef RES_CASE
default:
return NULL;
}
}
It would be nice if we could settle on just one function to convert
mps_t to a string, and use it consistently.
My preference would be to add this code before result_string:
/* Define a named enumeration containing all cases that the integer type
mps_res_t is known to cover. */
enum mps_res_enum
{
_mps_RES_ENUM (RES_CASE, MPS_RES_)
};
#undef RES_CASE
then cast to that type in our switch statement, which would remain
explicit, exhaustive, and default-free.
That way, we get warnings if the enum is extended.
Pip
This bug report was last modified 163 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.