diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-03-01 17:05:00 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-03-01 17:05:00 +0100 |
commit | 25e8f23cc4ab9e504cc4876e889f4515d2cf1f67 (patch) | |
tree | 63c4600a1cb57a5079889f12c109ffefe41a631b /libextra/gl | |
parent | 967e52827e03baeea653a467f68f5896e9e6526a (diff) | |
download | gnutls-25e8f23cc4ab9e504cc4876e889f4515d2cf1f67.tar.gz |
Updated gnulib.
Diffstat (limited to 'libextra/gl')
-rw-r--r-- | libextra/gl/gnulib.mk | 25 | ||||
-rw-r--r-- | libextra/gl/hmac-md5.c | 5 | ||||
-rw-r--r-- | libextra/gl/hmac.h | 5 | ||||
-rw-r--r-- | libextra/gl/m4/00gnulib.m4 | 2 | ||||
-rw-r--r-- | libextra/gl/m4/extensions.m4 | 6 | ||||
-rw-r--r-- | libextra/gl/m4/gnulib-cache.m4 | 2 | ||||
-rw-r--r-- | libextra/gl/m4/gnulib-common.m4 | 10 | ||||
-rw-r--r-- | libextra/gl/m4/gnulib-comp.m4 | 6 | ||||
-rw-r--r-- | libextra/gl/m4/gnulib-tool.m4 | 2 | ||||
-rw-r--r-- | libextra/gl/m4/ld-output-def.m4 | 2 | ||||
-rw-r--r-- | libextra/gl/m4/ld-version-script.m4 | 17 | ||||
-rw-r--r-- | libextra/gl/m4/lib-ld.m4 | 2 | ||||
-rw-r--r-- | libextra/gl/m4/lib-link.m4 | 2 | ||||
-rw-r--r-- | libextra/gl/m4/lib-prefix.m4 | 2 | ||||
-rw-r--r-- | libextra/gl/m4/md5.m4 | 2 | ||||
-rw-r--r-- | libextra/gl/m4/memxor.m4 | 2 | ||||
-rw-r--r-- | libextra/gl/m4/stdalign.m4 | 51 | ||||
-rw-r--r-- | libextra/gl/md5.c | 11 | ||||
-rw-r--r-- | libextra/gl/md5.h | 7 | ||||
-rw-r--r-- | libextra/gl/memxor.c | 5 | ||||
-rw-r--r-- | libextra/gl/memxor.h | 5 | ||||
-rw-r--r-- | libextra/gl/stdalign.in.h | 90 |
22 files changed, 216 insertions, 45 deletions
diff --git a/libextra/gl/gnulib.mk b/libextra/gl/gnulib.mk index 1dee17723e..98d92898d2 100644 --- a/libextra/gl/gnulib.mk +++ b/libextra/gl/gnulib.mk @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2011 Free Software Foundation, Inc. +# Copyright (C) 2002-2012 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -66,6 +66,29 @@ EXTRA_DIST += memxor.h ## end gnulib module memxor +## begin gnulib module stdalign + +BUILT_SOURCES += $(STDALIGN_H) + +# We need the following in order to create <stdalign.h> when the system +# doesn't have one that works. +if GL_GENERATE_STDALIGN_H +stdalign.h: stdalign.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/stdalign.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +stdalign.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += stdalign.h stdalign.h-t + +EXTRA_DIST += stdalign.in.h + +## end gnulib module stdalign + mostlyclean-local: mostlyclean-generic @for dir in '' $(MOSTLYCLEANDIRS); do \ diff --git a/libextra/gl/hmac-md5.c b/libextra/gl/hmac-md5.c index eed16573ba..eb05b1995d 100644 --- a/libextra/gl/hmac-md5.c +++ b/libextra/gl/hmac-md5.c @@ -1,5 +1,5 @@ /* hmac-md5.c -- hashed message authentication codes - Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2012 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 @@ -12,8 +12,7 @@ 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. */ + along with this program; if not, see <http://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson. */ diff --git a/libextra/gl/hmac.h b/libextra/gl/hmac.h index 67cb72e7e4..4bb0a74b90 100644 --- a/libextra/gl/hmac.h +++ b/libextra/gl/hmac.h @@ -1,5 +1,5 @@ /* hmac.h -- hashed message authentication codes - Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2012 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 @@ -12,8 +12,7 @@ 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. */ + along with this program; if not, see <http://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson. */ diff --git a/libextra/gl/m4/00gnulib.m4 b/libextra/gl/m4/00gnulib.m4 index 7feed46694..d978cb898c 100644 --- a/libextra/gl/m4/00gnulib.m4 +++ b/libextra/gl/m4/00gnulib.m4 @@ -1,5 +1,5 @@ # 00gnulib.m4 serial 2 -dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/libextra/gl/m4/extensions.m4 b/libextra/gl/m4/extensions.m4 index 22156e068c..0bfaef6f90 100644 --- a/libextra/gl/m4/extensions.m4 +++ b/libextra/gl/m4/extensions.m4 @@ -1,7 +1,7 @@ -# serial 10 -*- Autoconf -*- +# serial 11 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006-2012 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -43,7 +43,7 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) if test "$MINIX" = yes; then AC_DEFINE([_POSIX_SOURCE], [1], - [Define to 1 if you need to in order for `stat' and other + [Define to 1 if you need to in order for 'stat' and other things to work.]) AC_DEFINE([_POSIX_1_SOURCE], [2], [Define to 2 if the system does not provide POSIX.1 features diff --git a/libextra/gl/m4/gnulib-cache.m4 b/libextra/gl/m4/gnulib-cache.m4 index 261dfdfbfc..bad68b01f9 100644 --- a/libextra/gl/m4/gnulib-cache.m4 +++ b/libextra/gl/m4/gnulib-cache.m4 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2011 Free Software Foundation, Inc. +# Copyright (C) 2002-2012 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/libextra/gl/m4/gnulib-common.m4 b/libextra/gl/m4/gnulib-common.m4 index 7d83299959..ae4d25483c 100644 --- a/libextra/gl/m4/gnulib-common.m4 +++ b/libextra/gl/m4/gnulib-common.m4 @@ -1,5 +1,5 @@ -# gnulib-common.m4 serial 31 -dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. +# gnulib-common.m4 serial 32 +dnl Copyright (C) 2007-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -13,12 +13,12 @@ AC_DEFUN([gl_COMMON], [ ]) AC_DEFUN([gl_COMMON_BODY], [ AH_VERBATIM([_Noreturn], -[/* The _Noreturn keyword of draft C1X. */ +[/* The _Noreturn keyword of C11. */ #ifndef _Noreturn # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ || 0x5110 <= __SUNPRO_C) # define _Noreturn __attribute__ ((__noreturn__)) -# elif 1200 <= _MSC_VER +# elif defined _MSC_VER && 1200 <= _MSC_VER # define _Noreturn __declspec (noreturn) # else # define _Noreturn @@ -224,7 +224,7 @@ m4_ifndef([AS_VAR_IF], # - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options # to CC twice # <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00431.html>. -# - AC_PROG_CC_STDC is likely to change when C1X is an ISO standard. +# - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard. AC_DEFUN([gl_PROG_CC_C99], [ dnl Change that version number to the minimum Autoconf version that supports diff --git a/libextra/gl/m4/gnulib-comp.m4 b/libextra/gl/m4/gnulib-comp.m4 index 707948ed9d..d8ea91acd0 100644 --- a/libextra/gl/m4/gnulib-comp.m4 +++ b/libextra/gl/m4/gnulib-comp.m4 @@ -1,5 +1,5 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2011 Free Software Foundation, Inc. +# Copyright (C) 2002-2012 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,6 +46,7 @@ AC_DEFUN([xgl_EARLY], # Code from module lib-msvc-compat: # Code from module lib-symbol-versions: # Code from module memxor: + # Code from module stdalign: ]) # This macro should be invoked from ./configure.ac, in the section @@ -66,6 +67,7 @@ gl_MD5 gl_LD_OUTPUT_DEF gl_LD_VERSION_SCRIPT gl_MEMXOR +gl_STDALIGN_H # End of code from modules m4_ifval(xgl_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([xgl_LIBSOURCES_DIR])[ || @@ -209,6 +211,7 @@ AC_DEFUN([xgl_FILE_LIST], [ lib/md5.h lib/memxor.c lib/memxor.h + lib/stdalign.in.h m4/00gnulib.m4 m4/extensions.m4 m4/gnulib-common.m4 @@ -219,4 +222,5 @@ AC_DEFUN([xgl_FILE_LIST], [ m4/lib-prefix.m4 m4/md5.m4 m4/memxor.m4 + m4/stdalign.m4 ]) diff --git a/libextra/gl/m4/gnulib-tool.m4 b/libextra/gl/m4/gnulib-tool.m4 index ed41e9d415..a09ffc1d1a 100644 --- a/libextra/gl/m4/gnulib-tool.m4 +++ b/libextra/gl/m4/gnulib-tool.m4 @@ -1,5 +1,5 @@ # gnulib-tool.m4 serial 2 -dnl Copyright (C) 2004-2005, 2009-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2005, 2009-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/libextra/gl/m4/ld-output-def.m4 b/libextra/gl/m4/ld-output-def.m4 index 2169f51510..35116843b0 100644 --- a/libextra/gl/m4/ld-output-def.m4 +++ b/libextra/gl/m4/ld-output-def.m4 @@ -1,5 +1,5 @@ # ld-output-def.m4 serial 2 -dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/libextra/gl/m4/ld-version-script.m4 b/libextra/gl/m4/ld-version-script.m4 index aec2f41c1e..5ed93efdbb 100644 --- a/libextra/gl/m4/ld-version-script.m4 +++ b/libextra/gl/m4/ld-version-script.m4 @@ -1,5 +1,5 @@ -# ld-version-script.m4 serial 2 -dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. +# ld-version-script.m4 serial 3 +dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -26,6 +26,12 @@ AC_DEFUN([gl_LD_VERSION_SCRIPT], save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" cat > conftest.map <<EOF +foo +EOF + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + [accepts_syntax_errors=yes], [accepts_syntax_errors=no]) + if test "$accepts_syntax_errors" = no; then + cat > conftest.map <<EOF VERS_1 { global: sym; }; @@ -34,8 +40,11 @@ VERS_2 { global: sym; } VERS_1; EOF - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [have_ld_version_script=yes], [have_ld_version_script=no]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + [have_ld_version_script=yes], [have_ld_version_script=no]) + else + have_ld_version_script=no + fi rm -f conftest.map LDFLAGS="$save_LDFLAGS" AC_MSG_RESULT($have_ld_version_script) diff --git a/libextra/gl/m4/lib-ld.m4 b/libextra/gl/m4/lib-ld.m4 index ae003f7c59..4e1374d9bc 100644 --- a/libextra/gl/m4/lib-ld.m4 +++ b/libextra/gl/m4/lib-ld.m4 @@ -1,5 +1,5 @@ # lib-ld.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 1996-2003, 2009-2011 Free Software Foundation, Inc. +dnl Copyright (C) 1996-2003, 2009-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/libextra/gl/m4/lib-link.m4 b/libextra/gl/m4/lib-link.m4 index e7c9ba9d3d..d11b4b4350 100644 --- a/libextra/gl/m4/lib-link.m4 +++ b/libextra/gl/m4/lib-link.m4 @@ -1,5 +1,5 @@ # lib-link.m4 serial 26 (gettext-0.18.2) -dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/libextra/gl/m4/lib-prefix.m4 b/libextra/gl/m4/lib-prefix.m4 index 7e5f0bde03..007aa0532e 100644 --- a/libextra/gl/m4/lib-prefix.m4 +++ b/libextra/gl/m4/lib-prefix.m4 @@ -1,5 +1,5 @@ # lib-prefix.m4 serial 7 (gettext-0.18) -dnl Copyright (C) 2001-2005, 2008-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2005, 2008-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/libextra/gl/m4/md5.m4 b/libextra/gl/m4/md5.m4 index 4b41a85b35..e22f7bdb17 100644 --- a/libextra/gl/m4/md5.m4 +++ b/libextra/gl/m4/md5.m4 @@ -1,5 +1,5 @@ # md5.m4 serial 12 -dnl Copyright (C) 2002-2006, 2008-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2008-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/libextra/gl/m4/memxor.m4 b/libextra/gl/m4/memxor.m4 index 10c3313e85..ba68d50df9 100644 --- a/libextra/gl/m4/memxor.m4 +++ b/libextra/gl/m4/memxor.m4 @@ -1,5 +1,5 @@ # memxor.m4 serial 4 -dnl Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/libextra/gl/m4/stdalign.m4 b/libextra/gl/m4/stdalign.m4 new file mode 100644 index 0000000000..6659c9c3ec --- /dev/null +++ b/libextra/gl/m4/stdalign.m4 @@ -0,0 +1,51 @@ +# Check for stdalign.h that conforms to C11. + +dnl Copyright 2011-2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Prepare for substituting <stdalign.h> if it is not supported. + +AC_DEFUN([gl_STDALIGN_H], +[ + AC_CACHE_CHECK([for working stdalign.h], + [gl_cv_header_working_stdalign_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdalign.h> + #include <stddef.h> + + /* Test that alignof yields a result consistent with offsetof. + This catches GCC bug 52023 + <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ + #ifdef __cplusplus + template <class t> struct alignof_helper { char a; t b; }; + # define ao(type) offsetof (alignof_helper<type>, b) + #else + # define ao(type) offsetof (struct { char a; type b; }, b) + #endif + char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1]; + char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1]; + char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1]; + + /* Test _Alignas only on platforms where gnulib can help. */ + #if \ + (__GNUC__ || __IBMC__ || __IBMCPP__ \ + || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER) + int alignas (8) alignas_int = 1; + char test_alignas[_Alignof (alignas_int) == 8 ? 1 : -1]; + #endif + ]])], + [gl_cv_header_working_stdalign_h=yes], + [gl_cv_header_working_stdalign_h=no])]) + + if test $gl_cv_header_working_stdalign_h = yes; then + STDALIGN_H='' + else + STDALIGN_H='stdalign.h' + fi + + AC_SUBST([STDALIGN_H]) + AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"]) +]) diff --git a/libextra/gl/md5.c b/libextra/gl/md5.c index a4933953c7..0747e9b5ea 100644 --- a/libextra/gl/md5.c +++ b/libextra/gl/md5.c @@ -1,6 +1,6 @@ /* Functions to compute MD5 message digest of files or memory blocks. according to the definition of MD5 in RFC 1321 from April 1992. - Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2011 Free Software + Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -15,8 +15,7 @@ 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. */ + along with this program; if not, see <http://www.gnu.org/licenses/>. */ /* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */ @@ -24,7 +23,8 @@ #include "md5.h" -#include <stddef.h> +#include <stdalign.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> @@ -257,8 +257,7 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) if (len >= 64) { #if !_STRING_ARCH_unaligned -# define alignof(type) offsetof (struct { char c; type x; }, x) -# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0) +# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0) if (UNALIGNED_P (buffer)) while (len > 64) { diff --git a/libextra/gl/md5.h b/libextra/gl/md5.h index 53e6048029..75d6bce5c3 100644 --- a/libextra/gl/md5.h +++ b/libextra/gl/md5.h @@ -1,6 +1,6 @@ /* Declaration of functions and data types used for MD5 sum computing library functions. - Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2011 Free Software + Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -15,8 +15,7 @@ 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. */ + along with this program; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _MD5_H #define _MD5_H 1 @@ -73,7 +72,7 @@ struct md5_ctx /* * The following three functions are build up the low level used in - * the functions `md5_stream' and `md5_buffer'. + * the functions 'md5_stream' and 'md5_buffer'. */ /* Initialize structure containing state of computation. diff --git a/libextra/gl/memxor.c b/libextra/gl/memxor.c index 4eeebcbd56..8e1ab36de5 100644 --- a/libextra/gl/memxor.c +++ b/libextra/gl/memxor.c @@ -1,5 +1,5 @@ /* memxor.c -- perform binary exclusive OR operation of two memory blocks. - Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2012 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 @@ -12,8 +12,7 @@ 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. */ + along with this program; if not, see <http://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson. The interface was inspired by memxor in Niels Möller's Nettle. */ diff --git a/libextra/gl/memxor.h b/libextra/gl/memxor.h index dafa2cfca7..731ac36784 100644 --- a/libextra/gl/memxor.h +++ b/libextra/gl/memxor.h @@ -1,5 +1,5 @@ /* memxor.h -- perform binary exclusive OR operation on memory blocks. - Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2012 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 @@ -12,8 +12,7 @@ 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. */ + along with this program; if not, see <http://www.gnu.org/licenses/>. */ /* Written by Simon Josefsson. The interface was inspired by memxor in Niels Möller's Nettle. */ diff --git a/libextra/gl/stdalign.in.h b/libextra/gl/stdalign.in.h new file mode 100644 index 0000000000..8fba6943f6 --- /dev/null +++ b/libextra/gl/stdalign.in.h @@ -0,0 +1,90 @@ +/* A substitute for ISO C11 <stdalign.h>. + + Copyright 2011-2012 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, see <http://www.gnu.org/licenses/>. */ + +/* Written by Paul Eggert and Bruno Haible. */ + +#ifndef _GL_STDALIGN_H +#define _GL_STDALIGN_H + +/* ISO C11 <stdalign.h> for platforms that lack it. + + References: + ISO C11 (latest free draft + <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>) + sections 6.5.3.4, 6.7.5, 7.15. + C++11 (latest free draft + <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>) + section 18.10. */ + +/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment + requirement of a structure member (i.e., slot or field) that is of + type TYPE, as an integer constant expression. + + This differs from GCC's __alignof__ operator, which can yield a + better-performing alignment for an object of that type. For + example, on x86 with GCC, __alignof__ (double) and __alignof__ + (long long) are 8, whereas alignof (double) and alignof (long long) + are 4 unless the option '-malign-double' is used. + + The result cannot be used as a value for an 'enum' constant, if you + want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ +#include <stddef.h> +#if defined __cplusplus + template <class __t> struct __alignof_helper { char __a; __t __b; }; +# define _Alignof(type) offsetof (__alignof_helper<type>, __b) +#else +# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) +#endif +#define alignof _Alignof +#define __alignof_is_defined 1 + +/* alignas (A), also known as _Alignas (A), aligns a variable or type + to the alignment A, where A is an integer constant expression. For + example: + + int alignas (8) foo; + struct s { int a; int alignas (8) bar; }; + + aligns the address of FOO and the offset of BAR to be multiples of 8. + + A should be a power of two that is at least the type's alignment + and at most the implementation's alignment limit. This limit is + 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable + to MSVC through at least version 10.0, A should be an integer + constant, as MSVC does not support expressions such as 1 << 3. + To be portable to Sun C 5.11, do not align auto variables to + anything stricter than their default alignment. + + The following C11 requirements are not supported here: + + - If A is zero, alignas has no effect. + - alignas can be used multiple times; the strictest one wins. + - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). + + */ + +#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C +# define _Alignas(a) __attribute__ ((__aligned__ (a))) +#elif 1300 <= _MSC_VER +# define _Alignas(a) __declspec (align (a)) +#endif +#ifdef _Alignas +# define alignas _Alignas +# define __alignas_is_defined 1 +#endif + +#endif /* _GL_STDALIGN_H */ |