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

Commit4ffd790

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 parent4ca4924 commit4ffd790

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
@@ -13408,6 +13408,28 @@ _ACEOF
1340813408
fi
1340913409
done
1341013410

13411+
# strto[u]ll may exist but not be declared
13412+
ac_fn_c_check_decl"$LINENO""strtoll""ac_cv_have_decl_strtoll""$ac_includes_default"
13413+
iftest"x$ac_cv_have_decl_strtoll" = xyes;then:
13414+
ac_have_decl=1
13415+
else
13416+
ac_have_decl=0
13417+
fi
13418+
13419+
cat>>confdefs.h<<_ACEOF
13420+
#define HAVE_DECL_STRTOLL$ac_have_decl
13421+
_ACEOF
13422+
ac_fn_c_check_decl"$LINENO""strtoull""ac_cv_have_decl_strtoull""$ac_includes_default"
13423+
iftest"x$ac_cv_have_decl_strtoull" = xyes;then:
13424+
ac_have_decl=1
13425+
else
13426+
ac_have_decl=0
13427+
fi
13428+
13429+
cat>>confdefs.h<<_ACEOF
13430+
#define HAVE_DECL_STRTOULL$ac_have_decl
13431+
_ACEOF
13432+
1341113433

1341213434
# Lastly, restore full LIBS list and check for readline/libedit symbols
1341313435
LIBS="$LIBS_including_readline"

‎configure.in

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

16871687
AC_CHECK_FUNCS([strtoll strtoq], [break])
16881688
AC_CHECK_FUNCS([strtoull strtouq], [break])
1689+
# strto[u]ll may exist but not be declared
1690+
AC_CHECK_DECLS([strtoll, strtoull])
16891691

16901692
# Lastly, restore full LIBS list and check for readline/libedit symbols
16911693
LIBS="$LIBS_including_readline"

‎src/include/c.h

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

1059+
#if defined(HAVE_LONG_LONG_INT)&& defined(HAVE_STRTOLL)&& !HAVE_DECL_STRTOLL
1060+
externlong longstrtoll(constchar*str,char**endptr,intbase);
1061+
#endif
1062+
1063+
#if defined(HAVE_LONG_LONG_INT)&& defined(HAVE_STRTOULL)&& !HAVE_DECL_STRTOULL
1064+
externunsigned long longstrtoull(constchar*str,char**endptr,intbase);
1065+
#endif
1066+
10591067
#if !defined(HAVE_MEMMOVE)&& !defined(memmove)
10601068
#definememmove(d,s,c)bcopy(s, d, c)
10611069
#endif

‎src/include/pg_config.h.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@
144144
don't. */
145145
#undef HAVE_DECL_STRLCPY
146146

147+
/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
148+
don't. */
149+
#undef HAVE_DECL_STRTOLL
150+
151+
/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
152+
don't. */
153+
#undef HAVE_DECL_STRTOULL
154+
147155
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
148156
don't. */
149157
#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
@@ -96,6 +96,14 @@
9696
don't. */
9797
#define HAVE_DECL_SNPRINTF 1
9898

99+
/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
100+
don't. */
101+
#define HAVE_DECL_STRTOLL 1
102+
103+
/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
104+
don't. */
105+
#define HAVE_DECL_STRTOULL 1
106+
99107
/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
100108
don't. */
101109
#define HAVE_DECL_VSNPRINTF 1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp