From b2f3063cae5cd5997a89717d91fdec06c5041620 Mon Sep 17 00:00:00 2001 From: normal Date: Mon, 24 Feb 2014 03:38:14 +0000 Subject: time: rearrange+pack vtm and time_object structs struct time_object shrinks from 88 to 46 bytes on my 64-bit system. * configure.in: use -Wno-packed-bitfield-compat for GCC 4.4+ use __attribute__((packed)) if available * timev.h: shrink and pack struct vtm * time.c: pack struct time_object and adjust/introduce helpers [ruby-core:60794] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- configure.in | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'configure.in') diff --git a/configure.in b/configure.in index ae93ea9642..8d7bfba55e 100644 --- a/configure.in +++ b/configure.in @@ -746,6 +746,7 @@ if test "$GCC:${warnflags+set}:no" = yes::no; then -Werror=implicit-function-declaration \ -Werror=division-by-zero \ -Werror=deprecated-declarations \ + -Wno-packed-bitfield-compat \ $extra_warning \ ; do if test "$particular_werror_flags" != yes; then @@ -1271,6 +1272,15 @@ RUBY_CHECK_SIZEOF(double) RUBY_CHECK_SIZEOF(time_t, [long "long long"], [], [@%:@include ]) RUBY_CHECK_SIZEOF(clock_t, [], [], [@%:@include ]) +AC_CACHE_CHECK(packed struct attribute, rb_cv_packed_struct, + [AC_TRY_COMPILE([struct { int a; } __attribute__((packed));], [], + [rb_cv_packed_struct=yes], [rb_cv_packed_struct=no])]) +if test "$rb_cv_packed_struct" = yes; then + AC_DEFINE_UNQUOTED(PACKED_STRUCT, __attribute__((packed))) +else + AC_DEFINE_UNQUOTED(PACKED_STRUCT,) +fi + 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] -- cgit v1.2.3