Subject: Re: bug#75755: feature/igc: Missing IGC_CHECK_RES?

From: Eli Zaretskii <[email-masked]>
Date: Thu, 23 Jan 2025 19:47:55 +0200

> Date: Thu, 23 Jan 2025 17:17:54 +0000
> From: Pip Cet <[email-masked]>
> Cc: [email-masked], [email-masked], [email-masked], [email-masked], [email-masked], [email-masked]
> 
> "Eli Zaretskii" <[email-masked]> writes:
> 
> >> Date: Thu, 23 Jan 2025 14:34:56 +0000
> >> From: Pip Cet <[email-masked]>
> >> Cc: Stefan Kangas <[email-masked]>, [email-masked], [email-masked], [email-masked], [email-masked], [email-masked]
> >>
> >> "Eli Zaretskii" <[email-masked]> writes:
> >>
> >> > IMO, the single use of this macro is not worth of the complications
> >> > due to relying on an internal enumeration macro.  The single function
> >> > which uses this is a testing tool, which on top of that warns in its
> >> > doc string not to use it.  Introducing significant complexity and
> >> > breakage potential into Emacs due to this is IMO a tail wagging the
> >> > dog.
> >>
> >> I agree with this paragraph; it's not worth it, let's drop the code.
> >>
> >> > So I suggest that we define our own enumeration.  We could copy some
> >>
> >> Why?
> >
> > Because it's easy, and will still give us human-readable error
> > messages.
> 
> How does defining an enum give us that?  Did you mean "our own switch
> statement"?  If so, what's wrong with the one on the current branch?

We are talking past each other.  I meant the readable text that comes
with each enum value:

  #define _mps_RES_ENUM(R, X) \
    R(X, OK,            "success (always zero)") \
    R(X, FAIL,          "unspecified failure") \
    R(X, RESOURCE,      "unable to obtain resources") \
    R(X, MEMORY,        "unable to obtain memory") \
    R(X, LIMIT,         "limitation reached") \
    R(X, UNIMPL,        "unimplemented facility") \
    R(X, IO,            "system I/O error") \
    R(X, COMMIT_LIMIT,  "arena commit limit exceeded") \
    R(X, PARAM,         "illegal user parameter value")

which mps_res_to_string uses to produce a string for each value of
mps_res_t.

IOW, I was not talking about defining an enum, I was talking about
defining a text string for each value of enum.