diff options
author | Simon Josefsson <simon@josefsson.org> | 2009-05-08 17:08:01 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2009-05-08 17:08:01 +0200 |
commit | 8e30da4186271d17a742c45945f4fb0995f13b51 (patch) | |
tree | bc927c717f8f5eb8f2735e26101b87c9c2a62637 | |
parent | b8367670a839e3b6bfceef3d11bca8e04faa85e6 (diff) | |
download | gnutls-8e30da4186271d17a742c45945f4fb0995f13b51.tar.gz |
Update gnulib files.
-rw-r--r-- | gl/Makefile.am | 3 | ||||
-rw-r--r-- | gl/alignof.h | 41 | ||||
-rw-r--r-- | lib/gl/Makefile.am | 3 |
3 files changed, 43 insertions, 4 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am index 4fd6aba83c..ac033757d7 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -50,8 +50,7 @@ EXTRA_libgnu_la_SOURCES += accept.c ## begin gnulib module alignof - -EXTRA_DIST += alignof.h +libgnu_la_SOURCES += alignof.h ## end gnulib module alignof diff --git a/gl/alignof.h b/gl/alignof.h new file mode 100644 index 0000000000..b16ea28874 --- /dev/null +++ b/gl/alignof.h @@ -0,0 +1,41 @@ +/* Determine alignment of types. + Copyright (C) 2003-2004, 2006, 2009 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _ALIGNOF_H +#define _ALIGNOF_H + +#include <stddef.h> + +/* Determine the alignment of a type at compile time. */ +#if defined __GNUC__ +# define alignof __alignof__ +#elif defined __cplusplus + template <class type> struct alignof_helper { char __slot1; type __slot2; }; +# define alignof(type) offsetof (alignof_helper<type>, __slot2) +#elif defined __hpux + /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof + values. */ +# define alignof(type) (sizeof (type) <= 4 ? 4 : 8) +#elif defined _AIX + /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof + values. */ +# define alignof(type) (sizeof (type) <= 4 ? 4 : 8) +#else +# define alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) +#endif + +#endif /* _ALIGNOF_H */ diff --git a/lib/gl/Makefile.am b/lib/gl/Makefile.am index 9a3565800d..4b8a95ccb3 100644 --- a/lib/gl/Makefile.am +++ b/lib/gl/Makefile.am @@ -41,8 +41,7 @@ liblgnu_la_LDFLAGS = $(AM_LDFLAGS) ## begin gnulib module alignof - -EXTRA_DIST += alignof.h +liblgnu_la_SOURCES += alignof.h ## end gnulib module alignof |