]> granicus.if.org Git - postgresql/commitdiff
Support platforms where strtoll/strtoull are spelled __strtoll/__strtoull.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 19 May 2018 18:22:18 +0000 (14:22 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 19 May 2018 18:22:18 +0000 (14:22 -0400)
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

configure
configure.in
src/include/c.h
src/include/pg_config.h.in
src/include/pg_config.h.win32

index 6acbc6e900d6109d4112a751168891e4f99228bf..b244fc31d359fe4f91ba0f131396f927b5dc7bdc 100755 (executable)
--- a/configure
+++ b/configure
@@ -15710,7 +15710,7 @@ $as_echo "#define HAVE_INT_OPTRESET 1" >>confdefs.h
 
 fi
 
-for ac_func in strtoll strtoq
+for ac_func in strtoll __strtoll strtoq
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -15722,7 +15722,7 @@ _ACEOF
 fi
 done
 
-for ac_func in strtoull strtouq
+for ac_func in strtoull __strtoull strtouq
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index 8ea521a2177b0c76723d2b5778a624e1720967fd..8efcb89ada1063b50f421d8dfdcaecbe0b3c6679 100644 (file)
@@ -1749,8 +1749,8 @@ if test x"$pgac_cv_var_int_optreset" = x"yes"; then
   AC_DEFINE(HAVE_INT_OPTRESET, 1, [Define to 1 if you have the global variable 'int optreset'.])
 fi
 
-AC_CHECK_FUNCS([strtoll strtoq], [break])
-AC_CHECK_FUNCS([strtoull strtouq], [break])
+AC_CHECK_FUNCS([strtoll __strtoll strtoq], [break])
+AC_CHECK_FUNCS([strtoull __strtoull strtouq], [break])
 # strto[u]ll may exist but not be declared
 AC_CHECK_DECLS([strtoll, strtoull])
 
index d88db02c6de58510e2d35e2c967db917aeacd7fb..1e50103095b0555fcdb485b5acb062e96d900828 100644 (file)
@@ -1096,13 +1096,40 @@ extern int      snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_p
 extern int     vsnprintf(char *str, size_t count, const char *fmt, va_list args);
 #endif
 
-#if defined(HAVE_LONG_LONG_INT) && defined(HAVE_STRTOLL) && !HAVE_DECL_STRTOLL
+#if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC
+extern int     fdatasync(int fildes);
+#endif
+
+#ifdef HAVE_LONG_LONG_INT
+/* Older platforms may provide strto[u]ll functionality under other names */
+#if !defined(HAVE_STRTOLL) && defined(HAVE___STRTOLL)
+#define strtoll __strtoll
+#define HAVE_STRTOLL 1
+#endif
+
+#if !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
+#define strtoll strtoq
+#define HAVE_STRTOLL 1
+#endif
+
+#if !defined(HAVE_STRTOULL) && defined(HAVE___STRTOULL)
+#define strtoull __strtoull
+#define HAVE_STRTOULL 1
+#endif
+
+#if !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ)
+#define strtoull strtouq
+#define HAVE_STRTOULL 1
+#endif
+
+#if defined(HAVE_STRTOLL) && !HAVE_DECL_STRTOLL
 extern long long strtoll(const char *str, char **endptr, int base);
 #endif
 
-#if defined(HAVE_LONG_LONG_INT) && defined(HAVE_STRTOULL) && !HAVE_DECL_STRTOULL
+#if defined(HAVE_STRTOULL) && !HAVE_DECL_STRTOULL
 extern unsigned long long strtoull(const char *str, char **endptr, int base);
 #endif
+#endif                                                 /* HAVE_LONG_LONG_INT */
 
 #if !defined(HAVE_MEMMOVE) && !defined(memmove)
 #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);
 #define siglongjmp longjmp
 #endif
 
-#if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC
-extern int     fdatasync(int fildes);
-#endif
-
-/* If strtoq() exists, rename it to the more standard strtoll() */
-#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
-#define strtoll strtoq
-#define HAVE_STRTOLL 1
-#endif
-
-/* If strtouq() exists, rename it to the more standard strtoull() */
-#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ)
-#define strtoull strtouq
-#define HAVE_STRTOULL 1
-#endif
-
 /* EXEC_BACKEND defines */
 #ifdef EXEC_BACKEND
 #define NON_EXEC_STATIC
index e2ffaa28a0a5030d11c23e6671cac289572cf602..c3320f2c961e459ea23bfb157aa83c8d7269630e 100644 (file)
 /* Define to 1 if your compiler understands __VA_ARGS__ in macros. */
 #undef HAVE__VA_ARGS
 
+/* Define to 1 if you have the `__strtoll' function. */
+#undef HAVE___STRTOLL
+
+/* Define to 1 if you have the `__strtoull' function. */
+#undef HAVE___STRTOULL
+
 /* Define to the appropriate snprintf length modifier for 64-bit ints. */
 #undef INT64_MODIFIER
 
index 1a63dc4dc9a772eadb350daf8a2fae3c6cb58a2d..bf641e0c7d3f82d90016b68dc9a0a293e90820f9 100644 (file)
 #endif
 #endif
 
-/* Define to 1 if you have the `strtoq' function. */
-/* #undef HAVE_STRTOQ */
-
 /* Define to 1 if you have the `strtoull' function. */
 #ifdef HAVE_LONG_LONG_INT_64
 #define HAVE_STRTOULL 1
 #endif
 #endif
 
-/* Define to 1 if you have the `strtouq' function. */
-/* #undef HAVE_STRTOUQ */
-
 /* Define to 1 if the system has the type `struct addrinfo'. */
 #if (_MSC_VER > 1200)
 #define HAVE_STRUCT_ADDRINFO 1