summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-12 13:40:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-12 13:40:06 +0000
commite6a317bf6c4f988fe005af271c1d40ddc9c1ae59 (patch)
tree0377db7d0b76d55f2ef7f8422171d843bc69a817 /configure.in
parent3f78d84661b61c686c9b49a51ab742fb3484b4de (diff)
configure.in: size_t must be unsigned
* configure.in (RUBY_CHECK_SIGNEDNESS): macro to check signedness of a type. * configure.in (size_t): must be unsigned. [ruby-core:57149] [Feature #8890] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in12
1 files changed, 8 insertions, 4 deletions
diff --git a/configure.in b/configure.in
index 92c9e6ef31..881449e61f 100644
--- a/configure.in
+++ b/configure.in
@@ -1213,6 +1213,11 @@ elif test "x$ac_cv_type___int64" = xyes; then
RUBY_CHECK_PRINTF_PREFIX(__int64, ll I64, LL)
fi
+dnl RUBY_CHECK_SIZEOF [typename] [if-signed] [if-unsigned] [included]
+AC_DEFUN([RUBY_CHECK_SIGNEDNESS], [dnl
+ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([$4])], [($1)-1 > 0])],
+ [$3], [$2])])
+
dnl RUBY_REPLACE_TYPE [typename] [default type] [macro type] [included]
AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
AC_CHECK_TYPE([$1],
@@ -1225,10 +1230,7 @@ AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
[*" signed "*], [ ],
[*" unsigned "*], [
u=U],
- [
- AC_COMPILE_IFELSE(
- [AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([$4])], [($n)-1 > 0])],
- [u=U])])
+ [RUBY_CHECK_SIGNEDNESS($n, [], [u=U], [$4])])
if test x"$t" = x; then
for t in "long long" long int short; do
test -n "$u" && t="unsigned $t"
@@ -1514,6 +1516,8 @@ fi
AC_TYPE_SIZE_T
+RUBY_CHECK_SIGNEDNESS(size_t, [AC_MSG_ERROR(size_t is signed)], [],
+ [@%:@include <sys/types.h>])
RUBY_CHECK_SIZEOF(size_t, [int long void*], [], [@%:@include <sys/types.h>])
RUBY_CHECK_SIZEOF(ptrdiff_t, size_t, [], [@%:@include <stddef.h>])
RUBY_CHECK_PRINTF_PREFIX(size_t, z)