Skip to content

Commit 06f66cf

Browse files
committed
Support platforms where strtoll/strtoull are spelled __strtoll/__strtoull.
Ancient HPUX, for one, does this. We hadn't noticed due to the lack of regression tests that required a working strtoll. (I was slightly tempted to remove the other historical spelling, strto[u]q, since it seems we have no buildfarm members testing that case. But I refrained.) Discussion: https://postgr.es/m/151935568942.1461.14623890240535309745@wrigleys.postgresql.org
1 parent a622812 commit 06f66cf

File tree

5 files changed

+39
-28
lines changed

5 files changed

+39
-28
lines changed

configure

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15710,7 +15710,7 @@ $as_echo "#define HAVE_INT_OPTRESET 1" >>confdefs.h
1571015710

1571115711
fi
1571215712

15713-
for ac_func in strtoll strtoq
15713+
for ac_func in strtoll __strtoll strtoq
1571415714
do :
1571515715
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
1571615716
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -15722,7 +15722,7 @@ _ACEOF
1572215722
fi
1572315723
done
1572415724

15725-
for ac_func in strtoull strtouq
15725+
for ac_func in strtoull __strtoull strtouq
1572615726
do :
1572715727
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
1572815728
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

configure.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,8 +1749,8 @@ if test x"$pgac_cv_var_int_optreset" = x"yes"; then
17491749
AC_DEFINE(HAVE_INT_OPTRESET, 1, [Define to 1 if you have the global variable 'int optreset'.])
17501750
fi
17511751

1752-
AC_CHECK_FUNCS([strtoll strtoq], [break])
1753-
AC_CHECK_FUNCS([strtoull strtouq], [break])
1752+
AC_CHECK_FUNCS([strtoll __strtoll strtoq], [break])
1753+
AC_CHECK_FUNCS([strtoull __strtoull strtouq], [break])
17541754
# strto[u]ll may exist but not be declared
17551755
AC_CHECK_DECLS([strtoll, strtoull])
17561756

src/include/c.h

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,13 +1096,40 @@ extern int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_p
10961096
extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
10971097
#endif
10981098

1099-
#if defined(HAVE_LONG_LONG_INT) && defined(HAVE_STRTOLL) && !HAVE_DECL_STRTOLL
1099+
#if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC
1100+
extern int fdatasync(int fildes);
1101+
#endif
1102+
1103+
#ifdef HAVE_LONG_LONG_INT
1104+
/* Older platforms may provide strto[u]ll functionality under other names */
1105+
#if !defined(HAVE_STRTOLL) && defined(HAVE___STRTOLL)
1106+
#define strtoll __strtoll
1107+
#define HAVE_STRTOLL 1
1108+
#endif
1109+
1110+
#if !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
1111+
#define strtoll strtoq
1112+
#define HAVE_STRTOLL 1
1113+
#endif
1114+
1115+
#if !defined(HAVE_STRTOULL) && defined(HAVE___STRTOULL)
1116+
#define strtoull __strtoull
1117+
#define HAVE_STRTOULL 1
1118+
#endif
1119+
1120+
#if !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ)
1121+
#define strtoull strtouq
1122+
#define HAVE_STRTOULL 1
1123+
#endif
1124+
1125+
#if defined(HAVE_STRTOLL) && !HAVE_DECL_STRTOLL
11001126
extern long long strtoll(const char *str, char **endptr, int base);
11011127
#endif
11021128

1103-
#if defined(HAVE_LONG_LONG_INT) && defined(HAVE_STRTOULL) && !HAVE_DECL_STRTOULL
1129+
#if defined(HAVE_STRTOULL) && !HAVE_DECL_STRTOULL
11041130
extern unsigned long long strtoull(const char *str, char **endptr, int base);
11051131
#endif
1132+
#endif /* HAVE_LONG_LONG_INT */
11061133

11071134
#if !defined(HAVE_MEMMOVE) && !defined(memmove)
11081135
#define memmove(d, s, c) bcopy(s, d, c)
@@ -1140,22 +1167,6 @@ extern unsigned long long strtoull(const char *str, char **endptr, int base);
11401167
#define siglongjmp longjmp
11411168
#endif
11421169

1143-
#if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC
1144-
extern int fdatasync(int fildes);
1145-
#endif
1146-
1147-
/* If strtoq() exists, rename it to the more standard strtoll() */
1148-
#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
1149-
#define strtoll strtoq
1150-
#define HAVE_STRTOLL 1
1151-
#endif
1152-
1153-
/* If strtouq() exists, rename it to the more standard strtoull() */
1154-
#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ)
1155-
#define strtoull strtouq
1156-
#define HAVE_STRTOULL 1
1157-
#endif
1158-
11591170
/* EXEC_BACKEND defines */
11601171
#ifdef EXEC_BACKEND
11611172
#define NON_EXEC_STATIC

src/include/pg_config.h.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,12 @@
750750
/* Define to 1 if your compiler understands __VA_ARGS__ in macros. */
751751
#undef HAVE__VA_ARGS
752752

753+
/* Define to 1 if you have the `__strtoll' function. */
754+
#undef HAVE___STRTOLL
755+
756+
/* Define to 1 if you have the `__strtoull' function. */
757+
#undef HAVE___STRTOULL
758+
753759
/* Define to the appropriate snprintf length modifier for 64-bit ints. */
754760
#undef INT64_MODIFIER
755761

src/include/pg_config.h.win32

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,6 @@
401401
#endif
402402
#endif
403403

404-
/* Define to 1 if you have the `strtoq' function. */
405-
/* #undef HAVE_STRTOQ */
406-
407404
/* Define to 1 if you have the `strtoull' function. */
408405
#ifdef HAVE_LONG_LONG_INT_64
409406
#define HAVE_STRTOULL 1
@@ -413,9 +410,6 @@
413410
#endif
414411
#endif
415412

416-
/* Define to 1 if you have the `strtouq' function. */
417-
/* #undef HAVE_STRTOUQ */
418-
419413
/* Define to 1 if the system has the type `struct addrinfo'. */
420414
#if (_MSC_VER > 1200)
421415
#define HAVE_STRUCT_ADDRINFO 1

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy