fix windows contrib compile warnings for redefined macros

Started by Andrew Dunstanalmost 22 years ago5 messagespatches
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

This patch fixes contrib so that it compiles under windows without
warnings about redefines for min, max, V_UNKNOWN and IDIGNORE

cheers

andrew

Attachments:

contribclean.patchtext/x-patch; name=contribclean.patchDownload+13-4
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: fix windows contrib compile warnings for redefined macros

Andrew Dunstan <andrew@dunslane.net> writes:

This patch fixes contrib so that it compiles under windows without
warnings about redefines for min, max, V_UNKNOWN and IDIGNORE

Surely this is wrong. You might be able to assume that Windows'
definitions for min/max are the same as what this code is expecting,
but it's a lot bigger stretch to assume that for the other ones.
(Does tsearch2 still *work* after you change it this way??)

The right thing for the min/max macros is to get rid of them anyway,
and use the Min/Max macros from c.h.

regards, tom lane

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#2)
Re: fix windows contrib compile warnings for redefined

Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.net> writes:

This patch fixes contrib so that it compiles under windows without
warnings about redefines for min, max, V_UNKNOWN and IDIGNORE

Surely this is wrong. You might be able to assume that Windows'
definitions for min/max are the same as what this code is expecting,

I checked and they are, fairly much character for character I think.

but it's a lot bigger stretch to assume that for the other ones.

I didn't. In one case (IDIGNORE) I changed the name of the macro to
avoid the conflict, and in the other (V_UKNOWN) I removed the Windows
def which has no applicability in that context (the Windows version
comes from oleauto.h). Both of these cases occur in .c files and have
no effects outside these files.

(Does tsearch2 still *work* after you change it this way??)

I don't know, because (as you know) tsearch2 is currently busted at the
link stage on Windows, and I don't know how to fix it - I was hoping
someone would have jumped on that by now. But by analysis it should not
have changed the behaviour at all.

The right thing for the min/max macros is to get rid of them anyway,
and use the Min/Max macros from c.h.

That's a fair point. I'll look at that.

cheers

andrew

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#3)
Re: fix windows contrib compile warnings for redefined macros

Andrew Dunstan <andrew@dunslane.net> writes:

The right thing for the min/max macros is to get rid of them anyway,
and use the Min/Max macros from c.h.

That's a fair point. I'll look at that.

Actually I'm in the middle of doing that myself, so don't worry about
it.

regards, tom lane

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#3)
Re: fix windows contrib compile warnings for redefined

Andrew Dunstan <andrew@dunslane.net> writes:

I didn't. In one case (IDIGNORE) I changed the name of the macro to
avoid the conflict, and in the other (V_UKNOWN) I removed the Windows
def which has no applicability in that context (the Windows version
comes from oleauto.h). Both of these cases occur in .c files and have
no effects outside these files.

I hadn't checked closely enough --- you're right these are ok.
Patch applied (and yes, tsearch2 does still work for me...)

regards, tom lane