Skip to content

Commit

Permalink
Update gnulib files.
Browse files Browse the repository at this point in the history
  • Loading branch information
jas4711 committed Apr 21, 2010
1 parent d153ee5 commit 742c311
Show file tree
Hide file tree
Showing 17 changed files with 121 additions and 73 deletions.
2 changes: 1 addition & 1 deletion gl/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 <netdb.h> when the system
# doesn't have one that works with the given compiler.
Expand Down
31 changes: 2 additions & 29 deletions gl/m4/gnulib-comp.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sys/ioctl.h>]],
[[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
Expand Down Expand Up @@ -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
Expand Down
38 changes: 38 additions & 0 deletions gl/m4/ioctl.m4
Original file line number Diff line number Diff line change
@@ -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 <sys/ioctl.h>]],
[[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
])
12 changes: 1 addition & 11 deletions gl/m4/netdb_h.m4
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 <netdb.h>
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],
Expand Down
3 changes: 3 additions & 0 deletions gl/stdbool.in.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */

Expand Down
3 changes: 2 additions & 1 deletion gl/tests/test-lseek.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 -- [email protected]
Expand Down
3 changes: 2 additions & 1 deletion gl/tests/test-select-in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions gl/tests/test-stdbool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdbool.h>. */
#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>, 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. */
Expand Down
1 change: 1 addition & 0 deletions gl/tests/test-stdint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdint.h>

#include "verify.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/gl/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 <netdb.h> when the system
# doesn't have one that works with the given compiler.
Expand Down
12 changes: 1 addition & 11 deletions lib/gl/m4/netdb_h.m4
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 <netdb.h>
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],
Expand Down
26 changes: 24 additions & 2 deletions lib/gl/m4/visibility.m4
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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])
Expand Down
3 changes: 3 additions & 0 deletions lib/gl/stdbool.in.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */

Expand Down
5 changes: 3 additions & 2 deletions lib/gl/tests/test-stdbool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdbool.h>. */
#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>, 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. */
Expand Down
1 change: 1 addition & 0 deletions lib/gl/tests/test-stdint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdint.h>

#include "verify.h"
Expand Down
20 changes: 20 additions & 0 deletions lib/gl/tests/test-vasprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
27 changes: 15 additions & 12 deletions maint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)' \
Expand Down

0 comments on commit 742c311

Please sign in to comment.