xref: /netbsd-src/external/gpl3/gcc/dist/config/bitfields.m4 (revision f9a78e0e885f664fa1b5fd1637673b39c1aa53b3)
1*f9a78e0eSmrgdnl Copyright (C) 2015 Free Software Foundation, Inc.
2*f9a78e0eSmrgdnl This file is free software, distributed under the terms of the GNU
3*f9a78e0eSmrgdnl General Public License.  As a special exception to the GNU General
4*f9a78e0eSmrgdnl Public License, this file may be distributed as part of a program
5*f9a78e0eSmrgdnl that contains a configuration script generated by Autoconf, under
6*f9a78e0eSmrgdnl the same distribution terms as the rest of that program.
7*f9a78e0eSmrg
8*f9a78e0eSmrg# Define HAVE_BITFIELD_TYPE_MATTERS if the type of bitfields effects their
9*f9a78e0eSmrg# alignment.
10*f9a78e0eSmrg
11*f9a78e0eSmrgAC_DEFUN([gt_BITFIELD_TYPE_MATTERS],
12*f9a78e0eSmrg[
13*f9a78e0eSmrg  AC_CACHE_CHECK([if the type of bitfields matters], gt_cv_bitfield_type_matters,
14*f9a78e0eSmrg  [
15*f9a78e0eSmrg    AC_TRY_COMPILE(
16*f9a78e0eSmrg      [struct foo1 { char x; char y:1; char z; };
17*f9a78e0eSmrgstruct foo2 { char x; long long int y:1; char z; };
18*f9a78e0eSmrgint foo1test[ sizeof (struct foo1) < sizeof (struct foo2) ? 1 : -1 ]; ],
19*f9a78e0eSmrg      [], gt_cv_bitfield_type_matters=yes, gt_cv_bitfield_type_matters=no)
20*f9a78e0eSmrg  ])
21*f9a78e0eSmrg  if test $gt_cv_bitfield_type_matters = yes; then
22*f9a78e0eSmrg    AC_DEFINE(HAVE_BITFIELD_TYPE_MATTERS, 1,
23*f9a78e0eSmrg      [Define if the type of bitfields effects alignment.])
24*f9a78e0eSmrg  fi
25*f9a78e0eSmrg])
26