Macro From Hell

Started by David Hartwigover 27 years ago11 messages
#1David Hartwig
daybee@bellatlantic.net

This is a very recent addition at line 664 of copy.c It will not
compile on AIX 4.1 Help!

gmake[2]: Entering directory `/gnu/postgresql-6.4f/src/backend/commands'

xlc -I../../include -I../../backend -qchars=signed -qmaxmem=8192
-qhalt=w -qsrcmsg -qcheck=divzero -I/usr/local/include -I.. -c
copy.c -o copy.o
664 | ptr = (
((attr[i]->attlen) < sizeof(int32)) ? ( ((attr[i]->attlen) == -1
) ? ( ((attr[i]->attalign) == 'd') ? (((long)(ptr) + (sizeof (double) -
1)) & ~(sizeof (double) -1)) : (((long)(ptr) + (sizeof (int)
- 1)) & ~(sizeof (int) -1)) ) : ( ((attr[i]->attlen) == sizeof(char)) ?
( (ptr) ) : ( (void)((char) 1), (((long)(ptr) + (sizeof (sh
ort) - 1)) & ~(sizeof (short) - 1)) ) ) ) : ( ((attr[i]->attlen) ==
sizeof(int32)) ? ( (((long)(ptr) + (sizeof (int) - 1)) & ~(sizeo
f (int) -1)) ) : ( (void)((char) 1), ((attr[i]->attalign) == 'd') ?
(((long)(ptr) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
: (((long)(ptr) + (sizeof (long) - 1)) & ~(sizeof (long) -1)) ) ) );

........................................................................................................................

....................................................................................................................................

.......................................................................a..........

a - 1506-226 (S) The ":" operator is not allowed between "char*" and
"unsigned long".
gmake[2]: *** [copy.o] Error 1

#2Bruce Momjian
maillist@candle.pha.pa.us
In reply to: David Hartwig (#1)
Re: [HACKERS] Macro From Hell

This is a very recent addition at line 664 of copy.c It will not
compile on AIX 4.1 Help!

gmake[2]: Entering directory `/gnu/postgresql-6.4f/src/backend/commands'

xlc -I../../include -I../../backend -qchars=signed -qmaxmem=8192
-qhalt=w -qsrcmsg -qcheck=divzero -I/usr/local/include -I.. -c
copy.c -o copy.o
664 | ptr = (
((attr[i]->attlen) < sizeof(int32)) ? ( ((attr[i]->attlen) == -1
) ? ( ((attr[i]->attalign) == 'd') ? (((long)(ptr) + (sizeof (double) -
1)) & ~(sizeof (double) -1)) : (((long)(ptr) + (sizeof (int)
- 1)) & ~(sizeof (int) -1)) ) : ( ((attr[i]->attlen) == sizeof(char)) ?
( (ptr) ) : ( (void)((char) 1), (((long)(ptr) + (sizeof (sh
ort) - 1)) & ~(sizeof (short) - 1)) ) ) ) : ( ((attr[i]->attlen) ==
sizeof(int32)) ? ( (((long)(ptr) + (sizeof (int) - 1)) & ~(sizeo
f (int) -1)) ) : ( (void)((char) 1), ((attr[i]->attalign) == 'd') ?
(((long)(ptr) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
: (((long)(ptr) + (sizeof (long) - 1)) & ~(sizeof (long) -1)) ) ) );

........................................................................................................................

....................................................................................................................................

.......................................................................a..........

a - 1506-226 (S) The ":" operator is not allowed between "char*" and
"unsigned long".
gmake[2]: *** [copy.o] Error 1

Looks like I am going to have to do another DISABLE_COMPLEX_MACROS entry
for that new macro, just like heap_getattr().

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)
#3Billy G. Allie
Bill.Allie@mug.org
In reply to: Bruce Momjian (#2)
Re: [HACKERS] Macro From Hell

Bruce Momjian writes:

Looks like I am going to have to do another DISABLE_COMPLEX_MACROS entry
for that new macro, just like heap_getattr().

Please do not use the same define as the one used in heap_getattr(). The new
macro compiles fine on UnixWare 7 (and I assume UnixWare 2 and SCO OpenServer).
It may be restricted to the AIX compiler.
--
____ | Billy G. Allie | Domain....: Bill.Allie@mug.org
| /| | 7436 Hartwell | Compuserve: 76337,2061
|-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie@email.msn.com
|/ |LLIE | (313) 582-1540 |

#4Thomas G. Lockhart
lockhart@alumni.caltech.edu
In reply to: Bruce Momjian (#2)
Re: [HACKERS] Macro From Hell

((attr[i]->attlen) < sizeof(int32)) ? ( ((attr[i]->attlen) == -1
) ? ( ((attr[i]->attalign) == 'd') ? (((long)(ptr) + (sizeof
(double) -
1)) & ~(sizeof (double) -1)) : (((long)(ptr) + (sizeof (int)
- 1)) & ~(sizeof (int) -1)) ) : ( ((attr[i]->attlen) ==
sizeof(char)) ?
( (ptr) ) : ( (void)((char) 1), (((long)(ptr) + (sizeof (sh

^^^^^ should perhaps be (long)(ptr)

ort) - 1)) & ~(sizeof (short) - 1)) ) ) ) : ( ((attr[i]->attlen) ==
sizeof(int32)) ? ( (((long)(ptr) + (sizeof (int) - 1)) & ~(sizeo
f (int) -1)) ) : ( (void)((char) 1), ((attr[i]->attalign) == 'd') ?
(((long)(ptr) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
: (((long)(ptr) + (sizeof (long) - 1)) & ~(sizeof (long) -1)) ) ) );
a - 1506-226 (S) The ":" operator is not allowed between "char*" and
"unsigned long".

Looks like I am going to have to do another DISABLE_COMPLEX_MACROS
entry for that new macro, just like heap_getattr().

The error message indicates that the AIX compiler is complaining about a
type mismatch within the macro, not the length of the macro itself. Try
adding that additional coersion and see if it helps. The macro is just a
bit "thick" (OK, _really_ thick :), so there may be another place in
there provoking the complaint...

- Tom

#5David Hartwig
daveh@insightdist.com
In reply to: Bruce Momjian (#2)
Re: [HACKERS] Macro From Hell

Thomas G. Lockhart wrote:

((attr[i]->attlen) < sizeof(int32)) ? ( ((attr[i]->attlen) == -1
) ? ( ((attr[i]->attalign) == 'd') ? (((long)(ptr) + (sizeof
(double) -
1)) & ~(sizeof (double) -1)) : (((long)(ptr) + (sizeof (int)
- 1)) & ~(sizeof (int) -1)) ) : ( ((attr[i]->attlen) ==
sizeof(char)) ?
( (ptr) ) : ( (void)((char) 1), (((long)(ptr) + (sizeof (sh

^^^^^ should perhaps be (long)(ptr)

ort) - 1)) & ~(sizeof (short) - 1)) ) ) ) : ( ((attr[i]->attlen) ==
sizeof(int32)) ? ( (((long)(ptr) + (sizeof (int) - 1)) & ~(sizeo
f (int) -1)) ) : ( (void)((char) 1), ((attr[i]->attalign) == 'd') ?
(((long)(ptr) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
: (((long)(ptr) + (sizeof (long) - 1)) & ~(sizeof (long) -1)) ) ) );
a - 1506-226 (S) The ":" operator is not allowed between "char*" and
"unsigned long".

Looks like I am going to have to do another DISABLE_COMPLEX_MACROS
entry for that new macro, just like heap_getattr().

The error message indicates that the AIX compiler is complaining about a
type mismatch within the macro, not the length of the macro itself. Try
adding that additional coersion and see if it helps. The macro is just a
bit "thick" (OK, _really_ thick :), so there may be another place in
there provoking the complaint...

That is correct. I was able to do several casts to get it to work this
morning. It is hacked in for now. Basically the problem is this:

ptr = (test) ? (espression resulting in pointer) : (expression
resulting in long)

Our compiler does not like this. Bruce, I can send a patch if you like.

#6Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Billy G. Allie (#3)
Re: [HACKERS] Macro From Hell

Bruce Momjian writes:

Looks like I am going to have to do another DISABLE_COMPLEX_MACROS entry
for that new macro, just like heap_getattr().

Please do not use the same define as the one used in heap_getattr(). The new
macro compiles fine on UnixWare 7 (and I assume UnixWare 2 and SCO OpenServer).
It may be restricted to the AIX compiler.

I now realize it is the mixing of the return types for ? : that it does
not like. Will fix.

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)
#7Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Thomas G. Lockhart (#4)
Re: [HACKERS] Macro From Hell

((attr[i]->attlen) < sizeof(int32)) ? ( ((attr[i]->attlen) == -1
) ? ( ((attr[i]->attalign) == 'd') ? (((long)(ptr) + (sizeof
(double) -
1)) & ~(sizeof (double) -1)) : (((long)(ptr) + (sizeof (int)
- 1)) & ~(sizeof (int) -1)) ) : ( ((attr[i]->attlen) ==
sizeof(char)) ?
( (ptr) ) : ( (void)((char) 1), (((long)(ptr) + (sizeof (sh

^^^^^ should perhaps be (long)(ptr)

ort) - 1)) & ~(sizeof (short) - 1)) ) ) ) : ( ((attr[i]->attlen) ==
sizeof(int32)) ? ( (((long)(ptr) + (sizeof (int) - 1)) & ~(sizeo
f (int) -1)) ) : ( (void)((char) 1), ((attr[i]->attalign) == 'd') ?
(((long)(ptr) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
: (((long)(ptr) + (sizeof (long) - 1)) & ~(sizeof (long) -1)) ) ) );
a - 1506-226 (S) The ":" operator is not allowed between "char*" and
"unsigned long".

Looks like I am going to have to do another DISABLE_COMPLEX_MACROS
entry for that new macro, just like heap_getattr().

The error message indicates that the AIX compiler is complaining about a
type mismatch within the macro, not the length of the macro itself. Try
adding that additional coersion and see if it helps. The macro is just a
bit "thick" (OK, _really_ thick :), so there may be another place in
there provoking the complaint...

Fixed. Need to cast the sizeof(char) entry to long.

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)
#8Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Bruce Momjian (#2)
Re: [HACKERS] Macro From Hell

This is a very recent addition at line 664 of copy.c It will not
compile on AIX 4.1 Help!

gmake[2]: Entering directory `/gnu/postgresql-6.4f/src/backend/commands'

xlc -I../../include -I../../backend -qchars=signed -qmaxmem=8192
-qhalt=w -qsrcmsg -qcheck=divzero -I/usr/local/include -I.. -c
copy.c -o copy.o
664 | ptr = (
((attr[i]->attlen) < sizeof(int32)) ? ( ((attr[i]->attlen) == -1
) ? ( ((attr[i]->attalign) == 'd') ? (((long)(ptr) + (sizeof (double) -
1)) & ~(sizeof (double) -1)) : (((long)(ptr) + (sizeof (int)
- 1)) & ~(sizeof (int) -1)) ) : ( ((attr[i]->attlen) == sizeof(char)) ?
( (ptr) ) : ( (void)((char) 1), (((long)(ptr) + (sizeof (sh
ort) - 1)) & ~(sizeof (short) - 1)) ) ) ) : ( ((attr[i]->attlen) ==
sizeof(int32)) ? ( (((long)(ptr) + (sizeof (int) - 1)) & ~(sizeo
f (int) -1)) ) : ( (void)((char) 1), ((attr[i]->attalign) == 'd') ?
(((long)(ptr) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
: (((long)(ptr) + (sizeof (long) - 1)) & ~(sizeof (long) -1)) ) ) );

........................................................................................................................

....................................................................................................................................

.......................................................................a..........

a - 1506-226 (S) The ":" operator is not allowed between "char*" and
"unsigned long".
gmake[2]: *** [copy.o] Error 1

Looks like I am going to have to do another DISABLE_COMPLEX_MACROS entry
for that new macro, just like heap_getattr().

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
+  If your life is a hard drive,     |  (610) 353-9879(w)
+  Christ can be your backup.        |  (610) 853-3000(h)

( (long)(ptr) ) : ( (void)((char) 1), (((long)(ptr) + (sizeof (sh

^^^^^^

This was the fix. In the code it was:

((attlen) == sizeof(char)) ? \
( \
(long)(cur_offset) \
) \

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)
#9David Hartwig
daveh@insightdist.com
In reply to: Bruce Momjian (#8)
Re: [HACKERS] Macro From Hell

Bruce Momjian wrote:

This was the fix. In the code it was:

((attlen) == sizeof(char)) ? \
( \
(long)(cur_offset) \
) \

Needs one more tweak.

In backend/commands/copy.c May I suggest at line 664:

ptr = (char *)att_align(ptr, attr[i]->attlen, attr[i]->attalign)
^^^^^^^^

#10Noname
dg@informix.com
In reply to: David Hartwig (#1)
Re: [HACKERS] Macro From Hell

This is a very recent addition at line 664 of copy.c It will not
compile on AIX 4.1 Help!

gmake[2]: Entering directory `/gnu/postgresql-6.4f/src/backend/commands'

xlc -I../../include -I../../backend -qchars=signed -qmaxmem=8192
-qhalt=w -qsrcmsg -qcheck=divzero -I/usr/local/include -I.. -c
copy.c -o copy.o
664 | ptr = (
((attr[i]->attlen) < sizeof(int32)) ? ( ((attr[i]->attlen) == -1
) ? ( ((attr[i]->attalign) == 'd') ? (((long)(ptr) + (sizeof (double) -
1)) & ~(sizeof (double) -1)) : (((long)(ptr) + (sizeof (int)
- 1)) & ~(sizeof (int) -1)) ) : ( ((attr[i]->attlen) == sizeof(char)) ?
( (ptr) ) : ( (void)((char) 1), (((long)(ptr) + (sizeof (sh
ort) - 1)) & ~(sizeof (short) - 1)) ) ) ) : ( ((attr[i]->attlen) ==
sizeof(int32)) ? ( (((long)(ptr) + (sizeof (int) - 1)) & ~(sizeo
f (int) -1)) ) : ( (void)((char) 1), ((attr[i]->attalign) == 'd') ?
(((long)(ptr) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
: (((long)(ptr) + (sizeof (long) - 1)) & ~(sizeof (long) -1)) ) ) );

a - 1506-226 (S) The ":" operator is not allowed between "char*" and
"unsigned long".
gmake[2]: *** [copy.o] Error 1

This should not compile anywhere really. The trinary operator must return one
and only one type. That is for:

(condition) ? (t_result) : (f_result)

both t_result and f_result must be of the same type.

-dg

David Gould dg@informix.com 510.628.3783 or 510.305.9468
Informix Software (No, really) 300 Lakeside Drive Oakland, CA 94612
- If simplicity worked, the world would be overrun with insects. -

#11Bruce Momjian
maillist@candle.pha.pa.us
In reply to: David Hartwig (#9)
Re: [HACKERS] Macro From Hell

Bruce Momjian wrote:

This was the fix. In the code it was:

((attlen) == sizeof(char)) ? \
( \
(long)(cur_offset) \
) \

Needs one more tweak.

In backend/commands/copy.c May I suggest at line 664:

ptr = (char *)att_align(ptr, attr[i]->attlen, attr[i]->attalign)

Done.

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)