From 742c31198cc4061a13a1dc3f46cc5f9c9be2741d Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Wed, 21 Apr 2010 23:18:24 +0200 Subject: [PATCH] Update gnulib files. --- gl/Makefile.am | 2 +- gl/m4/gnulib-comp.m4 | 31 ++----------------------------- gl/m4/ioctl.m4 | 38 ++++++++++++++++++++++++++++++++++++++ gl/m4/netdb_h.m4 | 12 +----------- gl/stdbool.in.h | 3 +++ gl/tests/test-lseek.sh | 3 ++- gl/tests/test-select-in.sh | 3 ++- gl/tests/test-stdbool.c | 5 +++-- gl/tests/test-stdint.c | 1 + lib/gl/Makefile.am | 2 +- lib/gl/m4/netdb_h.m4 | 12 +----------- lib/gl/m4/visibility.m4 | 26 ++++++++++++++++++++++++-- lib/gl/stdbool.in.h | 3 +++ lib/gl/tests/test-stdbool.c | 5 +++-- lib/gl/tests/test-stdint.c | 1 + lib/gl/tests/test-vasprintf.c | 20 ++++++++++++++++++++ maint.mk | 27 +++++++++++++++------------ 17 files changed, 121 insertions(+), 73 deletions(-) create mode 100644 gl/m4/ioctl.m4 diff --git a/gl/Makefile.am b/gl/Makefile.am index 327ac12e6..b43e6bb96 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -435,7 +435,7 @@ libgnu_la_SOURCES += minmax.h ## begin gnulib module netdb -BUILT_SOURCES += $(NETDB_H) +BUILT_SOURCES += netdb.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 65fb6c6d4..387c5df1c 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -475,35 +475,7 @@ changequote([, ])dnl gl_FUNC_UNGETC_WORKS AC_C_BIGENDIAN AC_C_BIGENDIAN - AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) - if test "$ac_cv_header_winsock2_h" = yes; then - dnl Even if the 'socket' module is not used here, another part of the - dnl application may use it and pass file descriptors that refer to - dnl sockets to the ioctl() function. So enable the support for sockets. - AC_LIBOBJ([ioctl]) - gl_REPLACE_SYS_IOCTL_H - else - AC_CHECK_FUNCS([ioctl]) - dnl On glibc systems, the second parameter is 'unsigned long int request', - dnl not 'int request'. We cannot simply cast the function pointer, but - dnl instead need a wrapper. - AC_CACHE_CHECK([for ioctl with POSIX signature], - [gl_cv_func_ioctl_posix_signature], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include ]], - [[extern int ioctl (int, int, ...);]]) - ], - [gl_cv_func_ioctl_posix_signature=yes], - [gl_cv_func_ioctl_posix_signature=no]) - ]) - if test $gl_cv_func_ioctl_posix_signature != yes; then - REPLACE_IOCTL=1 - AC_LIBOBJ([ioctl]) - gl_REPLACE_SYS_IOCTL_H - fi - fi + gl_FUNC_IOCTL gl_SYS_IOCTL_MODULE_INDICATOR([ioctl]) AC_CHECK_HEADERS_ONCE([unistd.h sys/wait.h]) gt_TYPE_WCHAR_T @@ -733,6 +705,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/inet_pton.m4 m4/intmax_t.m4 m4/inttypes_h.m4 + m4/ioctl.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 diff --git a/gl/m4/ioctl.m4 b/gl/m4/ioctl.m4 new file mode 100644 index 000000000..4a0a99f16 --- /dev/null +++ b/gl/m4/ioctl.m4 @@ -0,0 +1,38 @@ +# ioctl.m4 serial 1 +dnl Copyright (C) 2008-2010 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. + +AC_DEFUN([gl_FUNC_IOCTL], +[ + AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) + AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + if test "$ac_cv_header_winsock2_h" = yes; then + dnl Even if the 'socket' module is not used here, another part of the + dnl application may use it and pass file descriptors that refer to + dnl sockets to the ioctl() function. So enable the support for sockets. + AC_LIBOBJ([ioctl]) + gl_REPLACE_SYS_IOCTL_H + else + AC_CHECK_FUNCS([ioctl]) + dnl On glibc systems, the second parameter is 'unsigned long int request', + dnl not 'int request'. We cannot simply cast the function pointer, but + dnl instead need a wrapper. + AC_CACHE_CHECK([for ioctl with POSIX signature], + [gl_cv_func_ioctl_posix_signature], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[extern int ioctl (int, int, ...);]]) + ], + [gl_cv_func_ioctl_posix_signature=yes], + [gl_cv_func_ioctl_posix_signature=no]) + ]) + if test $gl_cv_func_ioctl_posix_signature != yes; then + REPLACE_IOCTL=1 + AC_LIBOBJ([ioctl]) + gl_REPLACE_SYS_IOCTL_H + fi + fi +]) diff --git a/gl/m4/netdb_h.m4 b/gl/m4/netdb_h.m4 index 40ba8f663..e04a2d13e 100644 --- a/gl/m4/netdb_h.m4 +++ b/gl/m4/netdb_h.m4 @@ -1,4 +1,4 @@ -# netdb_h.m4 serial 7 +# netdb_h.m4 serial 8 dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,21 +10,11 @@ AC_DEFUN([gl_HEADER_NETDB], AC_CHECK_HEADERS_ONCE([netdb.h]) gl_CHECK_NEXT_HEADERS([netdb.h]) if test $ac_cv_header_netdb_h = yes; then - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ - #include - struct addrinfo a; - int b = EAI_OVERFLOW; - int c = AI_NUMERICSERV; - ]])], - [NETDB_H=''], [NETDB_H='netdb.h']) HAVE_NETDB_H=1 else - NETDB_H='netdb.h' HAVE_NETDB_H=0 fi AC_SUBST([HAVE_NETDB_H]) - AC_SUBST([NETDB_H]) ]) AC_DEFUN([gl_NETDB_MODULE_INDICATOR], diff --git a/gl/stdbool.in.h b/gl/stdbool.in.h index e2312ecb8..574c281a8 100644 --- a/gl/stdbool.in.h +++ b/gl/stdbool.in.h @@ -50,6 +50,9 @@ with this substitute. With this substitute, only the values 0 and 1 give the expected result when converted to _Bool' or 'bool'. + - C99 allows the use of (_Bool)0.0 in constant expressions, but + this substitute cannot always provide this property. + Also, it is suggested that programs use 'bool' rather than '_Bool'; this isn't required, but 'bool' is more common. */ diff --git a/gl/tests/test-lseek.sh b/gl/tests/test-lseek.sh index ae3b23e57..d5cc093e3 100755 --- a/gl/tests/test-lseek.sh +++ b/gl/tests/test-lseek.sh @@ -8,7 +8,8 @@ tmpfiles=t-lseek.tmp ./test-lseek${EXEEXT} 0 < "$srcdir/test-lseek.sh" > t-lseek.tmp || exit 1 # pipes -echo hi | ./test-lseek${EXEEXT} 1 | cat || exit 1 +: | { ./test-lseek${EXEEXT} 1; echo $? > t-lseek.tmp; } | : +test "x`cat t-lseek.tmp`" = x0 || exit 1 # closed descriptors # Doesn't work under mingw -- simon@josefsson.org diff --git a/gl/tests/test-select-in.sh b/gl/tests/test-select-in.sh index fdeb01ce8..2a8b74226 100755 --- a/gl/tests/test-select-in.sh +++ b/gl/tests/test-select-in.sh @@ -18,7 +18,8 @@ test `cat t-select-in.tmp` = "1" || exit 1 # Pipes. rm -f t-select-in.tmp -{ sleep 1; echo abc; } | ./test-select-fd${EXEEXT} r 0 t-select-in.tmp +{ sleep 1; echo abc; } | \ + { ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; cat > /dev/null; } test `cat t-select-in.tmp` = "0" || exit 1 rm -f t-select-in.tmp diff --git a/gl/tests/test-stdbool.c b/gl/tests/test-stdbool.c index 560e0e534..fcb534de4 100644 --- a/gl/tests/test-stdbool.c +++ b/gl/tests/test-stdbool.c @@ -46,11 +46,12 @@ struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; -#if 0 /* Cannot be guaranteed with gnulib's . */ +#if 0 /* Cannot be guaranteed with gnulib's , at least, +not for all compilers. */ char d[(bool) 0.5 == true ? 1 : -1]; bool e = &s; -#endif char f[(_Bool) 0.0 == false ? 1 : -1]; +#endif char g[true]; char h[sizeof (_Bool)]; #if 0 /* See above. */ diff --git a/gl/tests/test-stdint.c b/gl/tests/test-stdint.c index 9cec2e2f8..d64057a25 100644 --- a/gl/tests/test-stdint.c +++ b/gl/tests/test-stdint.c @@ -22,6 +22,7 @@ #define DO_PEDANTIC 0 #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* likewise */ #include #include "verify.h" diff --git a/lib/gl/Makefile.am b/lib/gl/Makefile.am index 3944512c3..e0ba4ebe1 100644 --- a/lib/gl/Makefile.am +++ b/lib/gl/Makefile.am @@ -265,7 +265,7 @@ liblgnu_la_SOURCES += minmax.h ## begin gnulib module netdb -BUILT_SOURCES += $(NETDB_H) +BUILT_SOURCES += netdb.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. diff --git a/lib/gl/m4/netdb_h.m4 b/lib/gl/m4/netdb_h.m4 index 40ba8f663..e04a2d13e 100644 --- a/lib/gl/m4/netdb_h.m4 +++ b/lib/gl/m4/netdb_h.m4 @@ -1,4 +1,4 @@ -# netdb_h.m4 serial 7 +# netdb_h.m4 serial 8 dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,21 +10,11 @@ AC_DEFUN([gl_HEADER_NETDB], AC_CHECK_HEADERS_ONCE([netdb.h]) gl_CHECK_NEXT_HEADERS([netdb.h]) if test $ac_cv_header_netdb_h = yes; then - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ - #include - struct addrinfo a; - int b = EAI_OVERFLOW; - int c = AI_NUMERICSERV; - ]])], - [NETDB_H=''], [NETDB_H='netdb.h']) HAVE_NETDB_H=1 else - NETDB_H='netdb.h' HAVE_NETDB_H=0 fi AC_SUBST([HAVE_NETDB_H]) - AC_SUBST([NETDB_H]) ]) AC_DEFUN([gl_NETDB_MODULE_INDICATOR], diff --git a/lib/gl/m4/visibility.m4 b/lib/gl/m4/visibility.m4 index 6d3f9c9d9..077c4765e 100644 --- a/lib/gl/m4/visibility.m4 +++ b/lib/gl/m4/visibility.m4 @@ -1,4 +1,4 @@ -# visibility.m4 serial 2 (gettext-0.18) +# visibility.m4 serial 3 (gettext-0.18) dnl Copyright (C) 2005, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -26,15 +26,37 @@ AC_DEFUN([gl_VISIBILITY], CFLAG_VISIBILITY= HAVE_VISIBILITY=0 if test -n "$GCC"; then + dnl First, check whether -Werror can be added to the command line, or + dnl whether it leads to an error because of some other option that the + dnl user has put into $CC $CFLAGS $CPPFLAGS. + AC_MSG_CHECKING([whether the -Werror option is usable]) + AC_CACHE_VAL([gl_cv_cc_vis_werror], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + AC_TRY_COMPILE([], [], + [gl_cv_cc_vis_werror=yes], + [gl_cv_cc_vis_werror=no]) + CFLAGS="$gl_save_CFLAGS"]) + AC_MSG_RESULT([$gl_cv_cc_vis_werror]) + dnl Now check whether visibility declarations are supported. AC_MSG_CHECKING([for simple visibility declarations]) AC_CACHE_VAL([gl_cv_cc_visibility], [ gl_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" + dnl We use the option -Werror and a function dummyfunc, because on some + dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning + dnl "visibility attribute not supported in this configuration; ignored" + dnl at the first function definition in every compilation unit, and we + dnl don't want to use the option in this case. + if test $gl_cv_cc_vis_werror = yes; then + CFLAGS="$CFLAGS -Werror" + fi AC_TRY_COMPILE( [extern __attribute__((__visibility__("hidden"))) int hiddenvar; extern __attribute__((__visibility__("default"))) int exportedvar; extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); - extern __attribute__((__visibility__("default"))) int exportedfunc (void);], + extern __attribute__((__visibility__("default"))) int exportedfunc (void); + void dummyfunc (void) {}], [], [gl_cv_cc_visibility=yes], [gl_cv_cc_visibility=no]) diff --git a/lib/gl/stdbool.in.h b/lib/gl/stdbool.in.h index 7db57b230..88b352004 100644 --- a/lib/gl/stdbool.in.h +++ b/lib/gl/stdbool.in.h @@ -50,6 +50,9 @@ with this substitute. With this substitute, only the values 0 and 1 give the expected result when converted to _Bool' or 'bool'. + - C99 allows the use of (_Bool)0.0 in constant expressions, but + this substitute cannot always provide this property. + Also, it is suggested that programs use 'bool' rather than '_Bool'; this isn't required, but 'bool' is more common. */ diff --git a/lib/gl/tests/test-stdbool.c b/lib/gl/tests/test-stdbool.c index 560e0e534..fcb534de4 100644 --- a/lib/gl/tests/test-stdbool.c +++ b/lib/gl/tests/test-stdbool.c @@ -46,11 +46,12 @@ struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; -#if 0 /* Cannot be guaranteed with gnulib's . */ +#if 0 /* Cannot be guaranteed with gnulib's , at least, +not for all compilers. */ char d[(bool) 0.5 == true ? 1 : -1]; bool e = &s; -#endif char f[(_Bool) 0.0 == false ? 1 : -1]; +#endif char g[true]; char h[sizeof (_Bool)]; #if 0 /* See above. */ diff --git a/lib/gl/tests/test-stdint.c b/lib/gl/tests/test-stdint.c index 9cec2e2f8..d64057a25 100644 --- a/lib/gl/tests/test-stdint.c +++ b/lib/gl/tests/test-stdint.c @@ -22,6 +22,7 @@ #define DO_PEDANTIC 0 #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* likewise */ #include #include "verify.h" diff --git a/lib/gl/tests/test-vasprintf.c b/lib/gl/tests/test-vasprintf.c index e5dc3cd3d..e5676f4a9 100644 --- a/lib/gl/tests/test-vasprintf.c +++ b/lib/gl/tests/test-vasprintf.c @@ -56,6 +56,16 @@ test_vasprintf () ASSERT (strcmp (result, "12345") == 0); free (result); } + + for (repeat = 0; repeat <= 8; repeat++) + { + char *result; + int retval = my_asprintf (&result, "%08lx", 12345); + ASSERT (retval == 8); + ASSERT (result != NULL); + ASSERT (strcmp (result, "00003039") == 0); + free (result); + } } static void @@ -72,6 +82,16 @@ test_asprintf () ASSERT (strcmp (result, "12345") == 0); free (result); } + + for (repeat = 0; repeat <= 8; repeat++) + { + char *result; + int retval = asprintf (&result, "%08lx", 12345); + ASSERT (retval == 8); + ASSERT (result != NULL); + ASSERT (strcmp (result, "00003039") == 0); + free (result); + } } int diff --git a/maint.mk b/maint.mk index 4115dbfe8..b24093b37 100644 --- a/maint.mk +++ b/maint.mk @@ -660,9 +660,10 @@ sc_GFDL_version: $(_sc_search_regexp) # Don't use Texinfo @acronym{} as it is not a good idea. +texinfo_suffix_re_ ?= \.(txi|texi(nfo)?)$$ sc_texinfo_acronym: - @prohibit='@acronym{' \ - in_vc_files='\.texi$$' \ + @prohibit='@acronym\{' \ + in_vc_files='$(texinfo_suffix_re_)' \ halt='found use of Texinfo @acronym{}' \ $(_sc_search_regexp) @@ -693,16 +694,18 @@ sc_prohibit_cvs_keyword: # perl -pi -0777 -e 's/\n\n+$/\n/' files... # detect_empty_lines_at_EOF_ = \ - foreach my $$f (@ARGV) { \ - open F, "<", $$f or (warn "failed to open $$f: $$!\n"), next; \ - my $$p = sysseek (F, -2, 2); \ - my $$c = "seek failure probably means file has < 2 bytes; ignore"; \ - my $$two; \ - defined $$p and $$p = sysread F, $$two, 2; \ - close F; \ - $$c = "ignore read failure"; \ - $$p && $$two eq "\n\n" and (print $$f), $$fail=1; \ - } END { exit defined $$fail } + foreach my $$f (@ARGV) \ + { \ + open F, "<", $$f or (warn "failed to open $$f: $$!\n"), next; \ + my $$p = sysseek (F, -2, 2); \ + my $$c = "seek failure probably means file has < 2 bytes; ignore"; \ + my $$last_two_bytes; \ + defined $$p and $$p = sysread F, $$last_two_bytes, 2; \ + close F; \ + $$c = "ignore read failure"; \ + $$p && $$last_two_bytes eq "\n\n" and (print $$f), $$fail=1; \ + } \ + END { exit defined $$fail } sc_prohibit_empty_lines_at_EOF: @perl -le '$(detect_empty_lines_at_EOF_)' $$($(VC_LIST_EXCEPT)) \ || { echo '$(ME): the above files end with empty line(s)' \ -- 2.11.4.GIT