typedef struct LogicalDecodingContext

2023-03-01 Thread Peter Smith
Hi, During a recent code review, I noticed a lot of 'struct LogicalDecodingContext' usage. There are many function prototypes where the params are (for no apparent reason to me) a mixture of structs and typedef structs. AFAICT just by pre-declaring the typedef struct LogicalDecodingCo

Re: typedef struct LogicalDecodingContext

2023-03-01 Thread Tom Lane
Peter Smith writes: > AFAICT just by pre-declaring the typedef struct > LogicalDecodingContext, all of those 'struct LogicalDecodingContext' > can be culled, resulting in cleaner and more consistent function > signatures. Sadly, this is almost certainly going to cause b

Re: typedef struct LogicalDecodingContext

2023-03-01 Thread Peter Smith
On Thu, Mar 2, 2023 at 10:04 AM Tom Lane wrote: > > Peter Smith writes: > > AFAICT just by pre-declaring the typedef struct > > LogicalDecodingContext, all of those 'struct LogicalDecodingContext' > > can be culled, resulting in cleaner and more consistent

Re: typedef struct LogicalDecodingContext

2023-03-01 Thread Tom Lane
Peter Smith writes: > On Thu, Mar 2, 2023 at 10:04 AM Tom Lane wrote: >> Sadly, this is almost certainly going to cause bitching on the part of >> some compilers, because depending on the order of header inclusions >> they are going to see multiple typedefs for the same name. Redundant >> "struc

Re: typedef struct LogicalDecodingContext

2023-03-01 Thread Tom Lane
I wrote: > Peter Smith writes: >> On Thu, Mar 2, 2023 at 10:04 AM Tom Lane wrote: >>> Sadly, this is almost certainly going to cause bitching on the part of >>> some compilers, because depending on the order of header inclusions >>> they are going to see multiple typedefs for the same name. >> S

Re: typedef struct LogicalDecodingContext

2023-03-01 Thread Tom Lane
I wrote: > Maybe later versions of the C > spec clarify this, but I think duplicate typedefs are pretty > clearly not OK per C99. Further research shows that C11 allows this, but it's definitely not okay in C99, which is still our reference standard. > Perhaps with sufficiently tight warning > or

Re: typedef struct LogicalDecodingContext

2023-03-01 Thread Peter Smith
On Thu, Mar 2, 2023 at 12:40 PM Tom Lane wrote: > > I wrote: > > Peter Smith writes: > >> On Thu, Mar 2, 2023 at 10:04 AM Tom Lane wrote: > >>> Sadly, this is almost certainly going to cause bitching on the part of > >>> some compilers, because depending on the order of header inclusions > >>> t

Re: typedef struct LogicalDecodingContext

2023-03-01 Thread Tom Lane
Peter Smith writes: > Apparently, not all C99 compilers can be assumed to work using the > strict C99 rules. While googling this issue I came across a statement that clang currently defaults to C17 rules. Even relatively old compilers might default to C11. But considering how long we held on to

Re: typedef struct LogicalDecodingContext

2023-03-01 Thread Tom Lane
I wrote: > I'm a little inclined to see if I can turn on -std=gnu99 on my > clang-based buildfarm animals. I use that with gcc for my > normal development activities, but now that I see that clang > catches some things gcc doesn't ... FTR: done on sifaka and longfin. rega

Re: typedef struct LogicalDecodingContext

2023-03-02 Thread Peter Eisentraut
On 02.03.23 04:00, Tom Lane wrote: I wrote: I'm a little inclined to see if I can turn on -std=gnu99 on my clang-based buildfarm animals. I use that with gcc for my normal development activities, but now that I see that clang catches some things gcc doesn't ... FTR: done on sifaka and longfin

Re: typedef struct LogicalDecodingContext

2023-03-02 Thread Peter Eisentraut
On 02.03.23 03:46, Tom Lane wrote: Peter Smith writes: Apparently, not all C99 compilers can be assumed to work using the strict C99 rules. While googling this issue I came across a statement that clang currently defaults to C17 rules. Even relatively old compilers might default to C11. But