Re: Cleaning up historical portability baggage

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cleaning up historical portability baggage
Date: 2022-08-06 23:08:27
Message-ID: 148623.1659827307@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> Thanks. Next in my quest for reducing autoconf vs meson pg_config.h
> differences is GETTIMEOFDAY stuff.

I just noticed that this could be simplified:

#ifdef _MSC_VER
struct timezone;
/* Last parameter not used */
extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
#endif

because what POSIX actually says is

int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

and

If tzp is not a null pointer, the behavior is unspecified.

Indeed, we never call it with anything but a null tzp value,
nor does our Windows fallback implementation do anything with tzp.

So ISTM we should drop the bogus "struct timezone;" and declare
this parameter as "void *tzp".

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2022-08-06 23:09:24 Re: failing to build preproc.c on solaris with sun studio
Previous Message Justin Pryzby 2022-08-06 22:51:55 Re: Making autovacuum logs indicate if insert-based threshold was the triggering condition