Thread

Commits

  1. Remove unnecessary (and wrong) forward declaration.

  1. tableam.h fails cpluspluscheck

    Tom Lane <tgl@sss.pgh.pa.us> — 2019-05-30T18:01:00Z

    Using Apple's clang as c++ compiler:
    
    In file included from /tmp/cpluspluscheck.KejiIw/test.cpp:3:
    ./src/include/access/tableam.h:144:16: error: typedef redefinition with different types ('void (*)(Relation, HeapTuple, Datum *, bool *, bool, void *)' (aka 'void (*)(RelationData *, HeapTupleData *, unsigned long *, bool *, bool, void *)') vs 'IndexBuildCallback')
    typedef void (*IndexBuildCallback) (Relation index,
                   ^
    ./src/include/access/tableam.h:36:8: note: previous definition is here
    struct IndexBuildCallback;
           ^
    
    (there are some cascading errors, but this is the important one)
    
    Kinda looks like you can't get away with using "struct" on a forward
    declaration of something that is not actually a struct type.
    
    			regards, tom lane
    
    
    
    
  2. Re: tableam.h fails cpluspluscheck

    Andres Freund <andres@anarazel.de> — 2019-05-30T20:47:05Z

    Hi,
    
    On 2019-05-30 14:01:00 -0400, Tom Lane wrote:
    > Using Apple's clang as c++ compiler:
    > 
    > In file included from /tmp/cpluspluscheck.KejiIw/test.cpp:3:
    > ./src/include/access/tableam.h:144:16: error: typedef redefinition with different types ('void (*)(Relation, HeapTuple, Datum *, bool *, bool, void *)' (aka 'void (*)(RelationData *, HeapTupleData *, unsigned long *, bool *, bool, void *)') vs 'IndexBuildCallback')
    > typedef void (*IndexBuildCallback) (Relation index,
    >                ^
    > ./src/include/access/tableam.h:36:8: note: previous definition is here
    > struct IndexBuildCallback;
    >        ^
    > 
    > (there are some cascading errors, but this is the important one)
    > 
    > Kinda looks like you can't get away with using "struct" on a forward
    > declaration of something that is not actually a struct type.
    
    Ugh. Odd that only C++ compilers complain. I just removed the typedef,
    it's not needed anymore (it used to be neccessary before moving
    IndexBuildCallback's definition to tableam.h - but was wrong then too,
    just cpluspluscheck didn't notice).
    
    Pushed the obvious fix.
    
    Greetings,
    
    Andres Freund
    
    
    
    
  3. Re: tableam.h fails cpluspluscheck

    Tom Lane <tgl@sss.pgh.pa.us> — 2019-05-31T13:57:31Z

    Andres Freund <andres@anarazel.de> writes:
    > On 2019-05-30 14:01:00 -0400, Tom Lane wrote:
    >> Kinda looks like you can't get away with using "struct" on a forward
    >> declaration of something that is not actually a struct type.
    
    > Ugh. Odd that only C++ compilers complain. I just removed the typedef,
    > it's not needed anymore (it used to be neccessary before moving
    > IndexBuildCallback's definition to tableam.h - but was wrong then too,
    > just cpluspluscheck didn't notice).
    
    Cool, thanks.
    
    			regards, tom lane