Re: [COMMITTERS] packing/alignment annotation for ItemPointerData redux - Mailing list pgsql-hackers

From Greg Stark
Subject Re: [COMMITTERS] packing/alignment annotation for ItemPointerData redux
Date
Msg-id CAM-w4HN1W_C0ummS1bOZtSiqEOLeLDyEbbtj_nzbarYHiDXC=g@mail.gmail.com
Whole thread Raw
In response to Re: [COMMITTERS] packing/alignment annotation for ItemPointerData redux  (Greg Stark <stark@mit.edu>)
Responses Re: [COMMITTERS] packing/alignment annotation for ItemPointerData redux  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
Ah. Here we go:

$ /usr/bin/clang-4.0 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -Wno-unused-command-line-argument -Wall -c  clang-bug.c
clang-bug.c:54:9: error: use of undeclared identifier 'BlockNumber'
        return ItemPointerGetBlockNumber(&ip);
               ^
clang-bug.c:48:2: note: expanded from macro 'ItemPointerGetBlockNumber'
        BlockIdGetBlockNumber(&(pointer)->ip_blkid) \
        ^
clang-bug.c:38:3: note: expanded from macro 'BlockIdGetBlockNumber'
        (BlockNumber) (((blockId)->bi_hi << 16) | ((uint16) (blockId)->bi_lo)) \
         ^
1 error generated.


Preprocessor output:

# 1 "clang-bug.c"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 317 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "clang-bug.c" 2





typedef unsigned short uint16;
typedef uint16 OffsetNumber;

typedef struct BlockIdData
{
 uint16 bi_hi;
 uint16 bi_lo;
} BlockIdData;


typedef struct ItemPointerData
{
 BlockIdData ip_blkid;
 OffsetNumber ip_posid;
}


__attribute__((packed))
__attribute__((aligned(2)))

ItemPointerData;

typedef ItemPointerData *ItemPointer;
# 51 "clang-bug.c"
int main() {
 ItemPointerData ip;

 return ( ( (BlockNumber) (((&(&ip)->ip_blkid)->bi_hi << 16) |
((uint16) (&(&ip)->ip_blkid)->bi_lo)) ) );
}

Attachment

pgsql-hackers by date:

Previous
From: Andreas Joseph Krogh
Date:
Subject: Re: Move pg_largeobject to a different tablespace *without* turning on system_table_mods.
Next
From: Greg Stark
Date:
Subject: Re: [COMMITTERS] packing/alignment annotation for ItemPointerData redux