WIP: guc enums - Mailing list pgsql-patches

From Magnus Hagander
Subject WIP: guc enums
Date
Msg-id 20080304132506.GH17216@svr2.hagander.net
Whole thread Raw
Responses Re: WIP: guc enums  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
List pgsql-patches
Attached is my first work at implementing GUC enums. It's not done yet,
obviously, but I did hit a problem that I need to ask about. So I'll just
send what I have now for comments.

The patch only converts a couple of the potential enum variables to the new
type, mainly as a proof of concept. But already I hit the problem twice -
the variable that holds the value of the guc enum is a C enum itself, which
gives a compiler warning when I pass a pointer to it for
config_enum.variable. (in this case, Log_error_verbosity and log_statement
are enums and have the problem, but client_min_messages, log_min_messages
and log_min_error_statement are already int and don't have it)

On my platform (linux x86) it works fine when I just cast this to (int *),
but I'm unsure if that's going to be safe on other platforms. I had some
indication that it's probably not?

And if not, the only way I know to do it is to change the C level enums to
be an int and use #define:s instead of what's there now. If that's
required, is that an acceptable change in order to implement this? If not,
any better ideas on how to do it?

And finally, please let me know if I seem to be off on a completely wrong
track with this :-)

//Magnus

Attachment

pgsql-patches by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] Show INHERIT in \du
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Show INHERIT in \du