warnings about auto importing sys_errlist / sys_nerr on Cygwin

Jay jay.krell@cornell.edu
Tue Sep 2 22:27:00 GMT 2008


Hi Ian, I don't think so, and I think it does.

From memory, the code reads:

  /* hide declaration of sys_errlist so ours doesn't conflict with it, like regarding const */  
   #ifdef HAVE_SYS_ERRLIST
  #define sys_errlist foo_syserrlist
  #endif
  #include  /* stdio, errno, stdlib, or such */  
   #ifdef HAVE_SYS_ERRLIST  
  #undef sys_errlist  
  #endif 

  char** sys_errlist;

That isn't it entirely. It also decided between char** sys_errlist and char* sys_errlist[].
That might be though that ifndef HAVE_SYS_ERRLIST, it provides its own, char**, whereas
if HAVE_SYS_ERRLIST, it uses char*[].

Another fix might be to remove the declaration of sys_errlist entirely here,
like if all relevant systems now declare it.

However, is there a scenario of building without headers? Really?
 Like inhibit-libc? 
 Or that is kind of bogus? 

I mean, specifically..this is a larger question, but aren't the scenarios covered by:
 building native upon an already working system -- just use /usr/include  
 building cross for a system that already is up and working -- require /usr/local//sys-root,
   copied from that system
 building cross for a new never before run system -- require hand authored sys-root 

I mean, you know, providing a sys-root can be a bit of a pain, but maybe it is the one and only way?
There shall be no workarounds for lack of a sys-root?
(Ok, granted, the old with-headers and with-libs is ok, just a slightly different sys-root mechanism).

Oh, and yes I understand "free standing" "embedded" systems may be generally bereft
of headers and libs, but they probably don't try to provide such a "rich" libiberty either.

I understand that special casing cygwin like I did is not best, not scalable.
You want as much "portable" code as possible.
But my patience for autoconf and sh is limited. And this fix is temptingly easy.
Still, this is why I suggest removing the whole block.
Could be every has sys_errlist, and everyone declares it in a reasonably common place.
??

 - Jay


> To: jay.krell@cornell.edu
> CC: gcc-patches@gcc.gnu.org
> Subject: Re: warnings about auto importing sys_errlist / sys_nerr on Cygwin
> From: iant@google.com
> Date: Tue, 2 Sep 2008 09:55:56 -0700
>
> Jay  writes:
>
>> $ diff -u /src/gcc.orig/libiberty/strerror.c /src/gcc/libiberty/strerror.c
>> --- /src/gcc.orig/libiberty/strerror.c 2005-03-27 18:28:01.000000000 -0700
>> +++ /src/gcc/libiberty/strerror.c 2008-09-02 01:56:27.724250000 -0700
>> @@ -4,6 +4,7 @@
>>
>> #include "config.h"
>>
>> +#ifndef __CYGWIN__
>> #ifdef HAVE_SYS_ERRLIST
>> /* Note that errno.h (not sure what OS) or stdio.h (BSD 4.4, at least)
>> might declare sys_errlist in a way that the compiler might consider
>
> Would it work to arrange to have cygwin, or whatever else is affected,
> define HAVE_SYS_ERRLIST?
>
> Ian



More information about the Gcc-patches mailing list