This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g-socket.adb error


Thomas Quinot wrote:
* Laurent GUERBY, 2009-07-04 :

Apparently no one has hit this case.  RTEMS does
not have two error codes that g-socket.adb
maps back. From s-oscons.ads:

ESHUTDOWN : constant := -1; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := -1; -- Socket type not supported


This results in a compilation error in g-socket.adb
in the switch since they both have the same value:

g-socket.adb:1775:15: duplication of choice value at line 1773

I really wonder how nobody stumbled on this in the past since this code has been essentially untouched for a very long time. Is it really the case that both ESHUTDOWN and ESOCKTNOSUPPORT are undefined in RTEMS (as in, has this been checked manually in errno.h, and can't proper definitions be given there???)

Just above the case there is already one case of duplicate
error code handled by an explicit "if" instead of "case":

      if EAGAIN /= EWOULDBLOCK and then Error_Value = EAGAIN then
         return Resource_Temporarily_Unavailable;
      end if;

I guess moving from case to if would be an appropriate way to fix
this RTEMS issue (assuming this is the only conflict), Thomas is in Cc.

I'm not very happy with this proposal, since the chain of IF statements would be much less efficient than the CASE (which currently generates an indexed jump). What we could do would be to build an array mapping errno to Error_Type values at initialization time, and then index that array (however that means we'd have to know the maximum range of errnos).

It got tripped because newlib-cvs has been reworked and
a number of errno's conditionalized as Linux specific.  I was
enabling the ones which were also used by RTEMS via
the BSD TCP/IP stack.

Some were not used by RTEMS so I left them turned off.

Or alternatively we could assign distinct junk invalid values to
ESHUTDOWN and ESOCKNOTSUPPORT in s-oscons-tmplt.c (eg -1 and -2,
instead of -1 for both).

I don't care particularly what the solution is. Whatever
you think is best. :)

Thomas.



--
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
  Support Available             (256) 722-9985



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]