Thread

  1. Macro From Hell

    David Hartwig <daybee@bellatlantic.net> — 1998-09-07T22:04:32Z

    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
    
    
    
    
  2. Re: [HACKERS] Macro From Hell

    Bruce Momjian <maillist@candle.pha.pa.us> — 1998-09-08T07:15:17Z

    > 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)
    
    
  3. Re: [HACKERS] Macro From Hell

    Thomas Lockhart <lockhart@alumni.caltech.edu> — 1998-09-08T14:20:01Z

    > > ((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
    
    
  4. Re: [HACKERS] Macro From Hell

    David Hartwig <daveh@insightdist.com> — 1998-09-08T14:49:58Z

    
    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.
    
    
    
  5. Re: [HACKERS] Macro From Hell

    Bruce Momjian <maillist@candle.pha.pa.us> — 1998-09-08T15:40:16Z

    > > > ((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)
    
    
  6. Re: [HACKERS] Macro From Hell

    Bruce Momjian <maillist@candle.pha.pa.us> — 1998-09-08T15:44:22Z

    > > 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)
    
    
  7. Re: [HACKERS] Macro From Hell

    David Hartwig <daveh@insightdist.com> — 1998-09-08T17:13:48Z

    
    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)
             ^^^^^^^^
    
    
    
  8. Re: [HACKERS] Macro From Hell

    David Gould <dg@informix.com> — 1998-09-08T18:17:32Z

    > 
    > 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. -
    
    
    
  9. Re: [HACKERS] Macro From Hell

    Bruce Momjian <maillist@candle.pha.pa.us> — 1998-09-08T22:18:40Z

    > 
    > 
    > 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)