summaryrefslogtreecommitdiff
path: root/libobjc
diff options
context:
space:
mode:
authortbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-02 04:11:07 +0000
committertbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-02 04:11:07 +0000
commit9ea9539044cf52b5286446864683cb18051561e2 (patch)
treefee646565688a42fe976a306924b04532245ff8c /libobjc
parent47239e3ff6478d3e282851de628efb9a28a1d856 (diff)
downloadlinaro-gcc-9ea9539044cf52b5286446864683cb18051561e2.tar.gz
linaro-gcc-9ea9539044cf52b5286446864683cb18051561e2.tar.bz2
linaro-gcc-9ea9539044cf52b5286446864683cb18051561e2.zip
fixup libobjc usage of PCC_BITFIELD_TYPE_MATTERS
libobjc/ChangeLog: 2015-05-01 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * acinclude.m4: Include bitfields.m4. * config.h.in: Regenerate. * configure: Likewise. * configure.ac: Invoke gt_BITFIELD_TYPE_MATTERS. * encoding.c: Check HAVE_BITFIELD_TYPE_MATTERS. config/ChangeLog: 2015-05-01 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * bitfields.m4: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222715 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc')
-rw-r--r--libobjc/acinclude.m41
-rw-r--r--libobjc/config.h.in3
-rwxr-xr-xlibobjc/configure38
-rw-r--r--libobjc/configure.ac2
-rw-r--r--libobjc/encoding.c3
5 files changed, 46 insertions, 1 deletions
diff --git a/libobjc/acinclude.m4 b/libobjc/acinclude.m4
index bf78dbec8e0..4193018d584 100644
--- a/libobjc/acinclude.m4
+++ b/libobjc/acinclude.m4
@@ -12,6 +12,7 @@ m4_include(../config/acx.m4)
m4_include(../config/no-executables.m4)
m4_include(../config/enable.m4)
m4_include(../config/tls.m4)
+m4_include(../config/bitfields.m4)
m4_include(../libtool.m4)
dnl The lines below arrange for aclocal not to bring an installed
diff --git a/libobjc/config.h.in b/libobjc/config.h.in
index c055e7c1909..20d1fcaf329 100644
--- a/libobjc/config.h.in
+++ b/libobjc/config.h.in
@@ -1,5 +1,8 @@
/* config.h.in. Generated from configure.ac by autoheader. */
+/* Define if the type of bitfields effects alignment. */
+#undef HAVE_BITFIELD_TYPE_MATTERS
+
/* Define to 1 if the target assembler supports thread-local storage. */
#undef HAVE_CC_TLS
diff --git a/libobjc/configure b/libobjc/configure
index 642eb9cc5f2..0547f913a6b 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -11530,6 +11530,44 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_exception_model_name" >&5
$as_echo "$ac_exception_model_name" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the type of bitfields matters" >&5
+$as_echo_n "checking if the type of bitfields matters... " >&6; }
+if test "${gt_cv_bitfield_type_matters+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+struct foo1 { char x; char :0; char y; };
+struct foo2 { char x; int :0; char y; };
+int foo1test[ sizeof (struct foo1) == 2 ? 1 : -1 ];
+int foo2test[ sizeof (struct foo2) == 5 ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gt_cv_bitfield_type_matters=yes
+else
+ gt_cv_bitfield_type_matters=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_bitfield_type_matters" >&5
+$as_echo "$gt_cv_bitfield_type_matters" >&6; }
+ if test $gt_cv_bitfield_type_matters = yes; then
+
+$as_echo "#define HAVE_BITFIELD_TYPE_MATTERS 1" >>confdefs.h
+
+ fi
+
+
# ------
# Output
# ------
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index c794a80b518..2d88519f644 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -266,6 +266,8 @@ fi
AC_LANG_POP(C)
AC_MSG_RESULT($ac_exception_model_name)
+gt_BITFIELD_TYPE_MATTERS
+
# ------
# Output
# ------
diff --git a/libobjc/encoding.c b/libobjc/encoding.c
index 20ace465916..abb61454097 100644
--- a/libobjc/encoding.c
+++ b/libobjc/encoding.c
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* FIXME: This file contains functions that will abort the entire
program if they fail. Is that really needed ? */
+#include "config.h"
#include "objc-private/common.h"
#include "objc-private/error.h"
#include "tconfig.h"
@@ -1167,7 +1168,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
/* Record must have at least as much alignment as any field.
Otherwise, the alignment of the field within the record
is meaningless. */
-#if !PCC_BITFIELD_TYPE_MATTERS
+#ifndef HAVE_BITFIELD_TYPE_MATTERS
layout->record_align = MAX (layout->record_align, desired_align);
#else /* PCC_BITFIELD_TYPE_MATTERS */
if (*type == _C_BFLD)