Hi, On 2026-02-16 13:36:02 +0900, Michael Paquier wrote: > On Fri, Feb 13, 2026 at 05:14:01PM -0500, Andres Freund wrote: > > I think now that we rely on C11, we actually could also forward-declare enum > > typedefs. That would allow us to avoid including > > worker_internal.h. Unfortunately I think C++ might throw a wrench in the mix > > for that - IIUC it only allows forward declaring enums when using 'enum > > class', but I don't think we can rely on that. I think the best solution > > would be to move the typedef to a more suitable header, but baring that, I > > guess just passing an int would do. > > > > -extern void pgstat_report_subscription_error(Oid subid, > > - LogicalRepWorkerType wtype); > > +extern void pgstat_report_subscription_error(Oid subid, int wtype); > > FWIW, I like some type enforcements when it comes to such report > routines. That avoids some careless assignments.
In theory I agree (I after all did suggest moving the typedef to a better header). However, the type enforcement argument IMO is somewhat bogus, as C doesn't really have strong enum types, therefore you can just pass pretty random stuff. I do wish C enums could be stronger... > This is usually a sign of header refactoring to me, where the "light" > declarations ought to be moved into an independent header that can be fed > back to other places, like this one. An enum declaration or a set of > constants can be usually worth a split if their knowledge gets a lot across > the tree. That's just to say that while I agree about reducing the header > footprint, I don't find the result presented here to be the best thing we > can do. I literally wrote that it isn't the best solution in the quoted portion above and suggested moving the typedef to a different header? I was hoping the author of the code would do that... Greetings, Andres Freund
