WIP: guc enums

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: WIP: guc enums
Date: 2008-03-04 13:25:06
Message-ID: 20080304132506.GH17216@svr2.hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
guc_enum.patch text/plain 23.7 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2008-03-04 13:51:35 Re: [PATCHES] Show INHERIT in \du
Previous Message Alvaro Herrera 2008-03-04 13:19:15 Re: [PATCHES] Show INHERIT in \du