mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* include/ruby/ruby.h (PRI_LL_PREFIX): format type specifier for
LONG_LONG may vary on platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8a7d063c1f
commit
fe9f1e8cf8
3 changed files with 49 additions and 23 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Nov 11 20:49:48 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* include/ruby/ruby.h (PRI_LL_PREFIX): format type specifier for
|
||||
LONG_LONG may vary on platforms.
|
||||
|
||||
Thu Nov 11 20:45:23 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in (SYMBOL_PREFIX): separate from EXPORT_PREFIX.
|
||||
|
|
44
configure.in
44
configure.in
|
@ -582,6 +582,36 @@ RUBY_CHECK_SIZEOF(float)
|
|||
RUBY_CHECK_SIZEOF(double)
|
||||
RUBY_CHECK_SIZEOF(time_t, [long "long long"], [], [@%:@include <time.h>])
|
||||
|
||||
AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [
|
||||
AC_CACHE_CHECK([for printf prefix for $1], [rb_cv_pri_prefix_]AS_TR_SH($1),
|
||||
[rb_cv_pri_prefix_]AS_TR_SH($1)=[NONE]
|
||||
for pri in $2; do
|
||||
RUBY_WERROR_FLAG(AC_TRY_COMPILE(
|
||||
[@%:@include <stdio.h>
|
||||
@%:@include <stddef.h>
|
||||
@%:@ifdef __GNUC__
|
||||
@%:@define PRINTF_ARGS(decl, string_index, first_to_check) \
|
||||
decl __attribute__((format(printf, string_index, first_to_check)))
|
||||
@%:@else
|
||||
@%:@define PRINTF_ARGS(decl, string_index, first_to_check) decl
|
||||
@%:@endif
|
||||
PRINTF_ARGS(void test_sprintf(const char*, ...), 1, 2);],
|
||||
[printf("%]${pri}[d", (]$1[)42);
|
||||
test_sprintf("%]${pri}[d", (]$1[)42);],
|
||||
[rb_cv_pri_prefix_]AS_TR_SH($1)[=[$pri]; break]))
|
||||
done)
|
||||
if test "[$rb_cv_pri_prefix_]AS_TR_SH($1)" != NONE; then
|
||||
AC_DEFINE_UNQUOTED([PRI_]m4_ifval($3,$3,AS_TR_CPP(m4_bpatsubst([$1],[_t$])))[_PREFIX],
|
||||
"[$rb_cv_pri_prefix_]AS_TR_SH($1)")
|
||||
fi
|
||||
])
|
||||
|
||||
if test "x$ac_cv_type_long_long" = xyes; then
|
||||
RUBY_CHECK_PRINTF_PREFIX(long long, ll I64, LL)
|
||||
elif test "x$ac_cv_type___int64" = xyes; then
|
||||
RUBY_CHECK_PRINTF_PREFIX(__int64, ll I64, LL)
|
||||
fi
|
||||
|
||||
dnl RUBY_REPLACE_TYPE [typename] [default type] [macro type] [included]
|
||||
AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
|
||||
AC_CHECK_TYPE([$1], [n=[$1]], [n=[$2]], [$4])
|
||||
|
@ -623,7 +653,7 @@ AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
|
|||
AC_DEFINE_UNQUOTED([$3]2NUM[(v)], [${rb_cv_[$1]_convertible}2NUM(v)])
|
||||
AC_DEFINE_UNQUOTED(NUM2[$3][(v)], [NUM2${rb_cv_[$1]_convertible}(v)])
|
||||
AC_DEFINE_UNQUOTED(PRI_[$3]_PREFIX,
|
||||
["`echo ${rb_cv_[$1]_convertible} | sed ['s/^U//;s/[^L].*//;y/L/l/']`"])
|
||||
[PRI_`echo ${rb_cv_[$1]_convertible} | sed ['s/^U//']`_PREFIX])
|
||||
])
|
||||
RUBY_REPLACE_TYPE(pid_t, int, PIDT)
|
||||
RUBY_REPLACE_TYPE(uid_t, int, UIDT)
|
||||
|
@ -1081,18 +1111,6 @@ RUBY_CHECK_SIZEOF(rlim_t, [int long "long long"], [], [
|
|||
#include <stdio.h>
|
||||
])
|
||||
|
||||
AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [
|
||||
AC_CACHE_CHECK([printf prefix for $1], rb_cv_pri_prefix_[$1],
|
||||
RUBY_WERROR_FLAG(AC_TRY_COMPILE(
|
||||
[@%:@include <stdio.h>],
|
||||
[printf("%]$2[d", sizeof(long));],
|
||||
[rb_cv_pri_prefix_[$1]=[$2]],
|
||||
[rb_cv_pri_prefix_[$1]=[NONE]])))
|
||||
if test "$rb_cv_pri_prefix_[$1]" != NONE; then
|
||||
AC_DEFINE_UNQUOTED([PRI_]AS_TR_CPP(m4_bpatsubst([$1],[_t$]))[_PREFIX], "$rb_cv_pri_prefix_[$1]")
|
||||
fi
|
||||
])
|
||||
|
||||
AC_TYPE_SIZE_T
|
||||
RUBY_CHECK_SIZEOF(size_t, [int long void*], [], [@%:@include <sys/types.h>])
|
||||
RUBY_CHECK_SIZEOF(ptrdiff_t, size_t, [], [@%:@include <stddef.h>])
|
||||
|
|
|
@ -101,7 +101,7 @@ typedef unsigned LONG_LONG ID;
|
|||
# define SIGNED_VALUE LONG_LONG
|
||||
# define LONG_LONG_VALUE 1
|
||||
# define SIZEOF_VALUE SIZEOF_LONG_LONG
|
||||
# define PRI_VALUE_PREFIX "ll"
|
||||
# define PRI_VALUE_PREFIX PRI_LL_PREFIX
|
||||
#else
|
||||
# error ---->> ruby requires sizeof(void*) == sizeof(long) to be compiled. <<----
|
||||
#endif
|
||||
|
@ -113,6 +113,13 @@ typedef char ruby_check_sizeof_long_long[SIZEOF_LONG_LONG == sizeof(LONG_LONG) ?
|
|||
#endif
|
||||
typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
|
||||
|
||||
#ifndef PRI_INT_PREFIX
|
||||
#define PRI_INT_PREFIX ""
|
||||
#endif
|
||||
#ifndef PRI_LONG_PREFIX
|
||||
#define PRI_LONG_PREFIX "l"
|
||||
#endif
|
||||
|
||||
#if defined PRIdPTR && !defined PRI_VALUE_PREFIX
|
||||
#define PRIdVALUE PRIdPTR
|
||||
#define PRIiVALUE PRIiPTR
|
||||
|
@ -138,19 +145,17 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
|
|||
# elif SIZEOF_TIME_T == SIZEOF_LONG
|
||||
# define PRI_TIMET_PREFIX "l"
|
||||
# elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
|
||||
# define PRI_TIMET_PREFIX "ll"
|
||||
# define PRI_TIMET_PREFIX PRI_LL_PREFIX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined PRI_PTRDIFF_PREFIX
|
||||
#elif defined PRIdPTR
|
||||
# define PRI_PTRDIFF_PREFIX "t"
|
||||
#elif SIZEOF_PTRDIFF_T == SIZEOF_INT
|
||||
# define PRI_PTRDIFF_PREFIX
|
||||
# define PRI_PTRDIFF_PREFIX ""
|
||||
#elif SIZEOF_PTRDIFF_T == SIZEOF_LONG
|
||||
# define PRI_PTRDIFF_PREFIX "l"
|
||||
#elif SIZEOF_PTRDIFF_T == SIZEOF_LONG_LONG
|
||||
# define PRI_PTRDIFF_PREFIX "ll"
|
||||
# define PRI_PTRDIFF_PREFIX PRI_LL_PREFIX
|
||||
#endif
|
||||
#define PRIdPTRDIFF PRI_PTRDIFF_PREFIX"d"
|
||||
#define PRIiPTRDIFF PRI_PTRDIFF_PREFIX"i"
|
||||
|
@ -160,14 +165,12 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
|
|||
#define PRIXPTRDIFF PRI_PTRDIFF_PREFIX"X"
|
||||
|
||||
#if defined PRI_SIZE_PREFIX
|
||||
#elif defined PRIdPTR
|
||||
# define PRI_SIZE_PREFIX "z"
|
||||
#elif SIZEOF_SIZE_T == SIZEOF_INT
|
||||
# define PRI_SIZE_PREFIX
|
||||
# define PRI_SIZE_PREFIX ""
|
||||
#elif SIZEOF_SIZE_T == SIZEOF_LONG
|
||||
# define PRI_SIZE_PREFIX "l"
|
||||
#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
|
||||
# define PRI_SIZE_PREFIX "ll"
|
||||
# define PRI_SIZE_PREFIX PRI_LL_PREFIX
|
||||
#endif
|
||||
#define PRIdSIZE PRI_SIZE_PREFIX"d"
|
||||
#define PRIiSIZE PRI_SIZE_PREFIX"i"
|
||||
|
|
Loading…
Add table
Reference in a new issue