Re: examples/loadables/getconf.c

2012-10-05 Thread Eric Blake
On 10/05/2012 10:50 AM, Eric Blake wrote: >> and are the two main headers that are this >> explicit about various macros being suitable for use in preprocessor >> arithmetic, and preprocessor arithmetic cannot use casts or sizeof. > > And I think this is a bug in POSIX Never mind. I wasn't lo

Re: examples/loadables/getconf.c

2012-10-05 Thread Eric Blake
On 10/05/2012 10:17 AM, Eric Blake wrote: > On 10/05/2012 10:06 AM, Andreas Schwab wrote: >> Chet Ramey writes: >> >>> Why would you say there's a restriction against using casts or sizeof in >>> a macro like this? >> >> Because it must expand to a valid preprocessor expression. > > C99 5.2.4.2.1

Re: examples/loadables/getconf.c

2012-10-05 Thread Eric Blake
On 10/05/2012 10:06 AM, Andreas Schwab wrote: > Chet Ramey writes: > >> Why would you say there's a restriction against using casts or sizeof in >> a macro like this? > > Because it must expand to a valid preprocessor expression. C99 5.2.4.2.1 Sizes of integer types 1. The values given below

Re: examples/loadables/getconf.c

2012-10-05 Thread Andreas Schwab
Chet Ramey writes: > Why would you say there's a restriction against using casts or sizeof in > a macro like this? Because it must expand to a valid preprocessor expression. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4

Re: examples/loadables/getconf.c

2012-10-05 Thread Chet Ramey
On 10/5/12 11:27 AM, Greg Wooledge wrote: > On Fri, Oct 05, 2012 at 05:20:23PM +0200, Andreas Schwab wrote: >> Greg Wooledge writes: >> >>> Line 1209 says: >>> # if (ULLONG_MAX != LLONG_MAX) >>> >>> LLONG_MAX expands to: >>> ((long long int) (~ (long long int) 0 - ((long long int) ((! ((long long

Re: examples/loadables/getconf.c

2012-10-05 Thread Greg Wooledge
On Fri, Oct 05, 2012 at 05:20:23PM +0200, Andreas Schwab wrote: > Greg Wooledge writes: > > > Line 1209 says: > > # if (ULLONG_MAX != LLONG_MAX) > > > > LLONG_MAX expands to: > > ((long long int) (~ (long long int) 0 - ((long long int) ((! ((long long > > int) 0 < (long long int) -1)) ? ~ (long

Re: examples/loadables/getconf.c

2012-10-05 Thread Andreas Schwab
Greg Wooledge writes: > Line 1209 says: > # if (ULLONG_MAX != LLONG_MAX) > > LLONG_MAX expands to: > ((long long int) (~ (long long int) 0 - ((long long int) ((! ((long long int) > 0 < (long long int) -1)) ? ~ (long long int) 0 << (sizeof (long long int) * 8 > - 1) : (long long int) 0 Tha

examples/loadables/getconf.c

2012-10-05 Thread Greg Wooledge
I've been staring at this for way too long now and I can't figure it out. imadev:/var/tmp/bash/bash-4.2/examples/loadables$ make /net/appl/gcc-3.3/bin/gcc -fpic -DHAVE_CONFIG_H -DSHELL -DHPUX -g -O2 -I. -I.. -I../.. -I../../lib -I../../builtins -I../../include -I/var/tmp/bash/bash-4.2 -I/var/tmp

loadable support for HP-UX 10 (bash 4.2)

2012-10-05 Thread Greg Wooledge
Here's an updated version of a patch I did a few years ago to add loadable support for bash under HP-UX 10. The previous patch was for bash 4.0. This one has been updated for bash 4.2. It is fundamentally the same patch, just with different context and line numbers and stuff, so that it applies c