diff options
author | Simon Josefsson <simon@josefsson.org> | 2009-05-13 15:41:50 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2009-05-13 15:41:50 +0200 |
commit | bda7cc8921bf2814b4cb9a43fee74b8444d128d1 (patch) | |
tree | 51c1a65a3369c5f422277c8faac9e9a09cacc989 | |
parent | e150f6c1d6d16ccd10396994e124c83b42540111 (diff) | |
download | gnutls-bda7cc8921bf2814b4cb9a43fee74b8444d128d1.tar.gz |
Update gnulib files.
-rw-r--r-- | gl/alignof.h | 8 | ||||
-rw-r--r-- | gl/m4/gnulib-comp.m4 | 1 | ||||
-rw-r--r-- | gl/tests/Makefile.am | 9 | ||||
-rw-r--r-- | gl/tests/test-alignof.c | 51 | ||||
-rw-r--r-- | lib/gl/alignof.h | 8 | ||||
-rw-r--r-- | lib/gl/m4/gnulib-comp.m4 | 1 | ||||
-rw-r--r-- | lib/gl/tests/Makefile.am | 9 | ||||
-rw-r--r-- | lib/gl/tests/test-alignof.c | 51 | ||||
-rw-r--r-- | maint.mk | 4 |
9 files changed, 124 insertions, 18 deletions
diff --git a/gl/alignof.h b/gl/alignof.h index b16ea28874..896382b0f2 100644 --- a/gl/alignof.h +++ b/gl/alignof.h @@ -26,14 +26,6 @@ #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 diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index df5963f79d..42ad7b2500 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -485,6 +485,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/wchar_t.m4 m4/wint_t.m4 m4/xsize.m4 + tests/test-alignof.c tests/test-alloca-opt.c tests/test-arpa_inet.c tests/test-c-ctype.c diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am index 421303a3a8..a37a580ca7 100644 --- a/gl/tests/Makefile.am +++ b/gl/tests/Makefile.am @@ -42,6 +42,15 @@ libtests_a_DEPENDENCIES = $(gltests_LIBOBJS) EXTRA_libtests_a_SOURCES = AM_LIBTOOLFLAGS = --preserve-dup-deps +## begin gnulib module alignof-tests + +TESTS += test-alignof +check_PROGRAMS += test-alignof + +EXTRA_DIST += test-alignof.c + +## end gnulib module alignof-tests + ## begin gnulib module alloca-opt-tests TESTS += test-alloca-opt diff --git a/gl/tests/test-alignof.c b/gl/tests/test-alignof.c new file mode 100644 index 0000000000..851cbf0924 --- /dev/null +++ b/gl/tests/test-alignof.c @@ -0,0 +1,51 @@ +/* Test of <alignof.h>. + Copyright (C) 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 of the License, 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, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2009. */ + +#include <config.h> + +#include <alignof.h> + +#include <stddef.h> + +#include "verify.h" + +typedef struct { char a[1]; } struct1; +typedef struct { char a[2]; } struct2; +typedef struct { char a[3]; } struct3; +typedef struct { char a[4]; } struct4; + +#define CHECK(type) \ + typedef struct { char slot1; type slot2; } type##_helper; \ + verify (alignof (type) == offsetof (type##_helper, slot2)); + +CHECK (char) +CHECK (short) +CHECK (int) +CHECK (long) +CHECK (float) +CHECK (double) +CHECK (struct1) +CHECK (struct2) +CHECK (struct3) +CHECK (struct4) + +int +main () +{ + return 0; +} diff --git a/lib/gl/alignof.h b/lib/gl/alignof.h index 6502e3340b..13e9d54c6d 100644 --- a/lib/gl/alignof.h +++ b/lib/gl/alignof.h @@ -26,14 +26,6 @@ #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 diff --git a/lib/gl/m4/gnulib-comp.m4 b/lib/gl/m4/gnulib-comp.m4 index 9f3f51f6df..5679e9d415 100644 --- a/lib/gl/m4/gnulib-comp.m4 +++ b/lib/gl/m4/gnulib-comp.m4 @@ -358,6 +358,7 @@ AC_DEFUN([lgl_FILE_LIST], [ m4/wchar_t.m4 m4/wint_t.m4 m4/xsize.m4 + tests/test-alignof.c tests/test-alloca-opt.c tests/test-byteswap.c tests/test-c-ctype.c diff --git a/lib/gl/tests/Makefile.am b/lib/gl/tests/Makefile.am index c6791747fa..ca8f78073e 100644 --- a/lib/gl/tests/Makefile.am +++ b/lib/gl/tests/Makefile.am @@ -42,6 +42,15 @@ libtests_a_DEPENDENCIES = $(lgltests_LIBOBJS) EXTRA_libtests_a_SOURCES = AM_LIBTOOLFLAGS = --preserve-dup-deps +## begin gnulib module alignof-tests + +TESTS += test-alignof +check_PROGRAMS += test-alignof + +EXTRA_DIST += test-alignof.c + +## end gnulib module alignof-tests + ## begin gnulib module alloca-opt-tests TESTS += test-alloca-opt diff --git a/lib/gl/tests/test-alignof.c b/lib/gl/tests/test-alignof.c new file mode 100644 index 0000000000..851cbf0924 --- /dev/null +++ b/lib/gl/tests/test-alignof.c @@ -0,0 +1,51 @@ +/* Test of <alignof.h>. + Copyright (C) 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 of the License, 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, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2009. */ + +#include <config.h> + +#include <alignof.h> + +#include <stddef.h> + +#include "verify.h" + +typedef struct { char a[1]; } struct1; +typedef struct { char a[2]; } struct2; +typedef struct { char a[3]; } struct3; +typedef struct { char a[4]; } struct4; + +#define CHECK(type) \ + typedef struct { char slot1; type slot2; } type##_helper; \ + verify (alignof (type) == offsetof (type##_helper, slot2)); + +CHECK (char) +CHECK (short) +CHECK (int) +CHECK (long) +CHECK (float) +CHECK (double) +CHECK (struct1) +CHECK (struct2) +CHECK (struct3) +CHECK (struct4) + +int +main () +{ + return 0; +} @@ -114,7 +114,7 @@ define _prohibit_regexp endef sc_avoid_if_before_free: - @$(build_aux)/useless-if-before-free \ + @$(build_aux)/useless-if-before-free \ $(useless_free_options) \ $$($(VC_LIST_EXCEPT) | grep -v useless-if-before-free) && \ { echo '$(ME): found useless "if" before "free" above' 1>&2; \ @@ -642,7 +642,7 @@ gnulib-version = $$(cd $(gnulib_dir) && git describe) bootstrap-tools ?= autoconf,automake,gnulib announcement: NEWS ChangeLog $(rel-files) - @$(build_aux)/announce-gen \ + @$(build_aux)/announce-gen \ --release-type=$(RELEASE_TYPE) \ --package=$(PACKAGE) \ --prev=$(PREV_VERSION) \ |