Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit922a8fa

Browse files
committed
Simplify gettimeofday() fallback logic.
There's no known supported system needing 1 argument gettimeofday()support. The test for it was added a long time ago (92c6bf9). Remove.Until now we tested whether a gettimeofday() fallback is needed whentargetting windows. Which lead to the odd result that HAVE_GETTIMEOFDAY onlybeing defined when targetting MinGW (which has gettimeofday() since at least2007). As the fallback is specific to msvc, remove the configure code andrename src/port/gettimeofday.c to src/port/win32gettimeofday.c.While at it, also remove the definition of struct timezone, a forwarddeclaration of the struct is sufficient.Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us>Reviewed-By: Thomas Munro <thomas.munro@gmail.com>Discussion:https://postgr.es/m/20220806000311.ywx65iuchvj4qn2k@awork3.anarazel.de
1 parent6c1c9f8 commit922a8fa

File tree

9 files changed

+9
-103
lines changed

9 files changed

+9
-103
lines changed

‎config/c-library.m4

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,6 @@ AC_DEFUN([PGAC_STRUCT_TIMEZONE],
3737
])# PGAC_STRUCT_TIMEZONE
3838

3939

40-
# PGAC_FUNC_GETTIMEOFDAY_1ARG
41-
# ---------------------------
42-
# Check if gettimeofday() has only one arguments. (Normal is two.)
43-
# If so, define GETTIMEOFDAY_1ARG.
44-
AC_DEFUN([PGAC_FUNC_GETTIMEOFDAY_1ARG],
45-
[AC_CACHE_CHECK(whethergettimeofdaytakesonlyoneargument,
46-
pgac_cv_func_gettimeofday_1arg,
47-
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/time.h>],
48-
[struct timeval *tp;
49-
struct timezone *tzp;
50-
gettimeofday(tp,tzp);])],
51-
[pgac_cv_func_gettimeofday_1arg=no],
52-
[pgac_cv_func_gettimeofday_1arg=yes])])
53-
if test x"$pgac_cv_func_gettimeofday_1arg" = xyes ; then
54-
AC_DEFINE(GETTIMEOFDAY_1ARG,1,
55-
[Define to 1 if gettimeofday() takes only 1 argument.])
56-
fi
57-
AH_VERBATIM(GETTIMEOFDAY_1ARG_,
58-
[@%:@ifdef GETTIMEOFDAY_1ARG
59-
@%:@ define gettimeofday(a,b) gettimeofday(a)
60-
@%:@endif])dnl
61-
])# PGAC_FUNC_GETTIMEOFDAY_1ARG
62-
63-
6440
# PGAC_FUNC_STRERROR_R_INT
6541
# ---------------------------
6642
# Check if strerror_r() returns int (POSIX) rather than char * (GNU libc).

‎configure

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15945,39 +15945,6 @@ if test x"$pgac_cv_var_int_timezone" = xyes ; then
1594515945
$as_echo "#define HAVE_INT_TIMEZONE 1" >>confdefs.h
1594615946

1594715947
fi
15948-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday takes only one argument" >&5
15949-
$as_echo_n "checking whether gettimeofday takes only one argument... " >&6; }
15950-
if ${pgac_cv_func_gettimeofday_1arg+:} false; then :
15951-
$as_echo_n "(cached) " >&6
15952-
else
15953-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15954-
/* end confdefs.h. */
15955-
#include <sys/time.h>
15956-
int
15957-
main ()
15958-
{
15959-
struct timeval *tp;
15960-
struct timezone *tzp;
15961-
gettimeofday(tp,tzp);
15962-
;
15963-
return 0;
15964-
}
15965-
_ACEOF
15966-
if ac_fn_c_try_compile "$LINENO"; then :
15967-
pgac_cv_func_gettimeofday_1arg=no
15968-
else
15969-
pgac_cv_func_gettimeofday_1arg=yes
15970-
fi
15971-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15972-
fi
15973-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_func_gettimeofday_1arg" >&5
15974-
$as_echo "$pgac_cv_func_gettimeofday_1arg" >&6; }
15975-
if test x"$pgac_cv_func_gettimeofday_1arg" = xyes ; then
15976-
15977-
$as_echo "#define GETTIMEOFDAY_1ARG 1" >>confdefs.h
15978-
15979-
fi
15980-
1598115948
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wcstombs_l declaration" >&5
1598215949
$as_echo_n "checking for wcstombs_l declaration... " >&6; }
1598315950
if ${pgac_cv_func_wcstombs_l+:} false; then :
@@ -16909,20 +16876,6 @@ _ACEOF
1690916876
fi
1691016877
done
1691116878

16912-
ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday"
16913-
if test "x$ac_cv_func_gettimeofday" = xyes; then :
16914-
$as_echo "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h
16915-
16916-
else
16917-
case " $LIBOBJS " in
16918-
*" gettimeofday.$ac_objext "* ) ;;
16919-
*) LIBOBJS="$LIBOBJS gettimeofday.$ac_objext"
16920-
;;
16921-
esac
16922-
16923-
fi
16924-
16925-
1692616879
case " $LIBOBJS " in
1692716880
*" dirmod.$ac_objext "* ) ;;
1692816881
*) LIBOBJS="$LIBOBJS dirmod.$ac_objext"

‎configure.ac

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,6 @@ fi
17791779
##
17801780

17811781
PGAC_VAR_INT_TIMEZONE
1782-
PGAC_FUNC_GETTIMEOFDAY_1ARG
17831782
PGAC_FUNC_WCSTOMBS_L
17841783

17851784
# Some versions of libedit contain strlcpy(), setproctitle(), and other
@@ -1925,7 +1924,6 @@ fi
19251924
# Win32 (really MinGW) support
19261925
if test "$PORTNAME" = "win32"; then
19271926
AC_CHECK_FUNCS(_configthreadlocale)
1928-
AC_REPLACE_FUNCS(gettimeofday)
19291927
AC_LIBOBJ(dirmod)
19301928
AC_LIBOBJ(getrusage)
19311929
AC_LIBOBJ(kill)

‎src/include/pg_config.h.in

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@
5555
(--enable-thread-safety) */
5656
#undef ENABLE_THREAD_SAFETY
5757

58-
/* Define to 1 if gettimeofday() takes only 1 argument. */
59-
#undef GETTIMEOFDAY_1ARG
60-
61-
#ifdefGETTIMEOFDAY_1ARG
62-
# definegettimeofday(a,b) gettimeofday(a)
63-
#endif
64-
6558
/* Define to 1 if you have the `append_history' function. */
6659
#undef HAVE_APPEND_HISTORY
6760

@@ -215,9 +208,6 @@
215208
/* Define to 1 if you have the `getpeerucred' function. */
216209
#undef HAVE_GETPEERUCRED
217210

218-
/* Define to 1 if you have the `gettimeofday' function. */
219-
#undef HAVE_GETTIMEOFDAY
220-
221211
/* Define to 1 if you have the <gssapi/gssapi.h> header file. */
222212
#undef HAVE_GSSAPI_GSSAPI_H
223213

‎src/include/port.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,6 @@ extern FILE *pgwin32_popen(const char *command, const char *type);
327327
#definepopen(a,b) pgwin32_popen(a,b)
328328
#definepclose(a) _pclose(a)
329329

330-
/* New versions of MingW have gettimeofday, old mingw and msvc don't */
331-
#ifndefHAVE_GETTIMEOFDAY
332-
/* Last parameter not used */
333-
externintgettimeofday(structtimeval*tp,structtimezone*tzp);
334-
#endif
335330
#else/* !WIN32 */
336331

337332
/*

‎src/include/port/win32_port.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,11 @@
179179
#defineSIGUSR130
180180
#defineSIGUSR231
181181

182-
/*
183-
* New versions of MinGW have gettimeofday() and also declare
184-
* struct timezone to support it.
185-
*/
186-
#ifndefHAVE_GETTIMEOFDAY
187-
structtimezone
188-
{
189-
inttz_minuteswest;/* Minutes west of GMT. */
190-
inttz_dsttime;/* Nonzero if DST is ever in effect. */
191-
};
182+
/* MinW has gettimeofday(), but MSVC doesn't */
183+
#ifdef_MSC_VER
184+
structtimezone;
185+
/* Last parameter not used */
186+
externintgettimeofday(structtimeval*tp,structtimezone*tzp);
192187
#endif
193188

194189
/* for setitimer in backend/port/win32/timer.c */

‎src/port/gettimeofday.crenamed to‎src/port/win32gettimeofday.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
*gettimeofday.c
2+
*win32gettimeofday.c
33
* Win32 gettimeofday() replacement
44
*
5-
* src/port/gettimeofday.c
5+
* src/port/win32gettimeofday.c
66
*
77
* Copyright (c) 2003 SRA, Inc.
88
* Copyright (c) 2003 SKC, Inc.

‎src/tools/msvc/Mkvcbuild.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ sub mkvcbuild
101101
our@pgportfiles =qw(
102102
chklocale.c explicit_bzero.c
103103
getpeereid.c getrusage.c inet_aton.c
104-
getaddrinfo.cgettimeofday.cinet_net_ntop.c kill.c open.c
104+
getaddrinfo.c inet_net_ntop.c kill.c open.c
105105
snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
106106
dirent.c getopt.c getopt_long.c
107107
preadv.c pwritev.c pg_bitutils.c
@@ -111,6 +111,7 @@ sub mkvcbuild
111111
win32dlopen.c
112112
win32env.c win32error.c
113113
win32fdatasync.c
114+
win32gettimeofday.c
114115
win32link.c
115116
win32pread.c
116117
win32pwrite.c

‎src/tools/msvc/Solution.pm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ sub GenerateFiles
220220
ENABLE_GSS=>$self->{options}->{gss} ? 1 :undef,
221221
ENABLE_NLS=>$self->{options}->{nls} ? 1 :undef,
222222
ENABLE_THREAD_SAFETY=> 1,
223-
GETTIMEOFDAY_1ARG=>undef,
224223
HAVE_APPEND_HISTORY=>undef,
225224
HAVE_ASN1_STRING_GET0_DATA=>undef,
226225
HAVE_ATOMICS=> 1,
@@ -267,7 +266,6 @@ sub GenerateFiles
267266
HAVE_GETOPT_LONG=>undef,
268267
HAVE_GETPEEREID=>undef,
269268
HAVE_GETPEERUCRED=>undef,
270-
HAVE_GETTIMEOFDAY=>undef,
271269
HAVE_GSSAPI_GSSAPI_H=>undef,
272270
HAVE_GSSAPI_H=>undef,
273271
HAVE_HMAC_CTX_FREE=>undef,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp