* 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). 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). Thomas. -- Thomas Quinot, Ph.D. ** qui...@adacore.com ** Senior Software Engineer AdaCore -- Paris, France -- New York, USA