Date: Fri, 21 Jun 2013 22:00:56 +0200 From: Paul Schutte <sjpschutte@...il.com> To: musl@...ts.openwall.com Subject: Re: Fix for tcsh Thanks Rich. I thought that BSDWAIT was defined in one of the standard headers. You are right about where BSDWAIT is defined, but now I am back to how should I write the "ifdef" ? I could use* !(defined(__ANDROID__) || (defined(__linux__)&& !defined(__GLIBC__)))* in the place of "if !defined(__ANDROID__)", but then things might go wrong for uclibc and other libcs. If I understand you correctly, all new implementations should use int instead of union, so above ifdef should be a workable solution. #if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) *# if !defined(__ANDROID__)* # define BSDWAIT # endif #endif /* _BSD || (IRIS4D && __STDC__) || __lucid || glibc */ Regards Paul On Fri, Jun 21, 2013 at 5:52 PM, Rich Felker <dalias@...ifal.cx> wrote: > On Fri, Jun 21, 2013 at 11:19:01AM +0200, Paul Schutte wrote: > > Good day, > > > > I just want to know what would be right approach to fixing the compile > > error in tcsh. > > > > I use the source code at > ftp://ftp.astron.com/pub/tcsh/tcsh-6.18.01.tar.gz > > > > I get the following error: > > gcc -c -g -O2 -I. -I. -D_PATH_TCSHELL='"/usr/local/bin/tcsh"' > sh.proc.c > > sh.proc.c: In function 'pchild': > > sh.proc.c:155:16: error: storage size of 'w' isn't known > > make: *** [sh.proc.o] Error 1 > > > > Those lines are: > > > > #ifdef BSDWAIT > > union wait w; > > #else /* !BSDWAIT */ > > int w; > > #endif /* !BSDWAIT */ > > > > > > If I just use > > > > //#ifdef BSDWAIT > > // union wait w; > > //#else /* !BSDWAIT */ > > int w; > > //#endif /* !BSDWAIT */ > > > > it compiles and works (for months now without an issue). > > > > > > My question really is what should the proper "ifdef" be if I want to send > > the fix to the tcsh maintainers ? > > Where is BSDWAIT defined? That's the location of the relevant ifdef. > Using "union wait" on any Linux system, glibc ones included, is wrong; > glibc just included gcc-specific hacks in the declaration of wait and > waitpid to allow them to accept "union wait *" instead of "int *" if > necessary. I suspect defined(__linux__) leads to #define BSDWAIT, in > which case this should just be fixed. > > With that said, using "union wait" at all is nonsensical. As the > standards require the argument to be int *, any modern BSD should work > fine with int *. In case there are historical ones that prototype > the functions with union wait *, it might work to simply declare "w" > as int and cast it to (void *) when passing it to the functions. > > Rich > Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.