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

Commitc964c21

Browse files
committed
Arrange to supply declarations for strtoll/strtoull if needed.
Buildfarm member dromedary is still unhappy about the recently-addedecpg "long long" tests. The reason turns out to be that it includes"-ansi" in its CFLAGS, and in their infinite wisdom Apple have decidedto hide the declarations of strtoll/strtoull in C89-compliant builds.(I find it pretty curious that they hide those function declarationswhen you can nonetheless declare a "long long" variable, but anywaythat is their behavior, both on dromedary's obsolete macOS version andthe newest and shiniest.) As a result, gcc assumes these functionsreturn "int", leading naturally to wrong results.(Looking at dromedary's past build results, it's evident that thisproblem also breaks pg_strtouint64() on 32-bit platforms; but weevidently have no regression tests that exercise that function withvalues above 32 bits.)To fix, supply declarations for these functions when the platformprovides the functions but not the declarations, using the same typeof mechanism as we use for some other similar cases.Discussion:https://postgr.es/m/151935568942.1461.14623890240535309745@wrigleys.postgresql.org
1 parente55a551 commitc964c21

File tree

5 files changed

+48
-0
lines changed

5 files changed

+48
-0
lines changed

‎configure

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13915,6 +13915,28 @@ _ACEOF
1391513915
fi
1391613916
done
1391713917

13918+
# strto[u]ll may exist but not be declared
13919+
ac_fn_c_check_decl"$LINENO""strtoll""ac_cv_have_decl_strtoll""$ac_includes_default"
13920+
iftest"x$ac_cv_have_decl_strtoll" = xyes;then:
13921+
ac_have_decl=1
13922+
else
13923+
ac_have_decl=0
13924+
fi
13925+
13926+
cat>>confdefs.h<<_ACEOF
13927+
#define HAVE_DECL_STRTOLL$ac_have_decl
13928+
_ACEOF
13929+
ac_fn_c_check_decl"$LINENO""strtoull""ac_cv_have_decl_strtoull""$ac_includes_default"
13930+
iftest"x$ac_cv_have_decl_strtoull" = xyes;then:
13931+
ac_have_decl=1
13932+
else
13933+
ac_have_decl=0
13934+
fi
13935+
13936+
cat>>confdefs.h<<_ACEOF
13937+
#define HAVE_DECL_STRTOULL$ac_have_decl
13938+
_ACEOF
13939+
1391813940

1391913941
iftest"$with_icu" = yes;then
1392013942
ac_save_CPPFLAGS=$CPPFLAGS

‎configure.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,8 @@ fi
16591659

16601660
AC_CHECK_FUNCS([strtoll strtoq], [break])
16611661
AC_CHECK_FUNCS([strtoull strtouq], [break])
1662+
# strto[u]ll may exist but not be declared
1663+
AC_CHECK_DECLS([strtoll, strtoull])
16621664

16631665
if test "$with_icu" = yes; then
16641666
ac_save_CPPFLAGS=$CPPFLAGS

‎src/include/c.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,14 @@ extern intsnprintf(char *str, size_t count, const char *fmt,...) pg_attribute_p
10761076
externintvsnprintf(char*str,size_tcount,constchar*fmt,va_listargs);
10771077
#endif
10781078

1079+
#if defined(HAVE_LONG_LONG_INT)&& defined(HAVE_STRTOLL)&& !HAVE_DECL_STRTOLL
1080+
externlong longstrtoll(constchar*str,char**endptr,intbase);
1081+
#endif
1082+
1083+
#if defined(HAVE_LONG_LONG_INT)&& defined(HAVE_STRTOULL)&& !HAVE_DECL_STRTOULL
1084+
externunsigned long longstrtoull(constchar*str,char**endptr,intbase);
1085+
#endif
1086+
10791087
#if !defined(HAVE_MEMMOVE)&& !defined(memmove)
10801088
#definememmove(d,s,c)bcopy(s, d, c)
10811089
#endif

‎src/include/pg_config.h.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@
150150
don't. */
151151
#undef HAVE_DECL_STRLCPY
152152

153+
/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
154+
don't. */
155+
#undef HAVE_DECL_STRTOLL
156+
157+
/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
158+
don't. */
159+
#undef HAVE_DECL_STRTOULL
160+
153161
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
154162
don't. */
155163
#undef HAVE_DECL_SYS_SIGLIST

‎src/include/pg_config.h.win32

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@
102102
don't. */
103103
#define HAVE_DECL_SNPRINTF 1
104104

105+
/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
106+
don't. */
107+
#define HAVE_DECL_STRTOLL 1
108+
109+
/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
110+
don't. */
111+
#define HAVE_DECL_STRTOULL 1
112+
105113
/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
106114
don't. */
107115
#define HAVE_DECL_VSNPRINTF 1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp