diff options
author | Tim Rühsen <tim.ruehsen@gmx.de> | 2018-05-18 20:31:31 +0200 |
---|---|---|
committer | Tim Rühsen <tim.ruehsen@gmx.de> | 2018-06-14 11:07:46 +0200 |
commit | 3f1dc3fe54b32b56471a3e964b840b9b46ae7e09 (patch) | |
tree | ec2dfe0d6c6e56c3482fecf0823a84c4d4235499 /gl/tests | |
parent | 0b73ac23e7e00e1bc3a0b4f1c1c21caec0c80901 (diff) | |
download | gnutls-3f1dc3fe54b32b56471a3e964b840b9b46ae7e09.tar.gz |
Add bootstrap + bootstrap.conf
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
Diffstat (limited to 'gl/tests')
78 files changed, 0 insertions, 8952 deletions
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am deleted file mode 100644 index 66a9eacb7e..0000000000 --- a/gl/tests/Makefile.am +++ /dev/null @@ -1,725 +0,0 @@ -## DO NOT EDIT! GENERATED AUTOMATICALLY! -## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2016 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 -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This file 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 file. If not, see <http://www.gnu.org/licenses/>. -# -# As a special exception to the GNU General Public License, -# this file may be distributed as part of a program that -# contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -# Generated by gnulib-tool. - -AUTOMAKE_OPTIONS = 1.9.6 foreign - -SUBDIRS = . -TESTS = -XFAIL_TESTS = -TESTS_ENVIRONMENT = -noinst_PROGRAMS = -check_PROGRAMS = -noinst_HEADERS = -noinst_LIBRARIES = -check_LIBRARIES = libtests.a -EXTRA_DIST = -BUILT_SOURCES = -SUFFIXES = -MOSTLYCLEANFILES = core *.stackdump -MOSTLYCLEANDIRS = -CLEANFILES = -DISTCLEANFILES = -MAINTAINERCLEANFILES = - -AM_CPPFLAGS = \ - -D@gltests_WITNESS@=1 \ - -I. -I$(srcdir) \ - -I../.. -I$(srcdir)/../.. \ - -I../../gl -I$(srcdir)/../../gl - -LDADD = libtests.a ../../gl/libgnu.la libtests.a $(LIBTESTS_LIBDEPS) - -libtests_a_SOURCES = -libtests_a_LIBADD = $(gltests_LIBOBJS) -libtests_a_DEPENDENCIES = $(gltests_LIBOBJS) -EXTRA_libtests_a_SOURCES = -AM_LIBTOOLFLAGS = --preserve-dup-deps - -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' - -## begin gnulib module alloca-opt-tests - -TESTS += test-alloca-opt -check_PROGRAMS += test-alloca-opt - -EXTRA_DIST += test-alloca-opt.c - -## end gnulib module alloca-opt-tests - -## begin gnulib module binary-io - -libtests_a_SOURCES += binary-io.h binary-io.c - -## end gnulib module binary-io - -## begin gnulib module binary-io-tests - -TESTS += test-binary-io.sh -check_PROGRAMS += test-binary-io - -EXTRA_DIST += test-binary-io.sh test-binary-io.c macros.h - -## end gnulib module binary-io-tests - -## begin gnulib module byteswap-tests - -TESTS += test-byteswap -check_PROGRAMS += test-byteswap -EXTRA_DIST += test-byteswap.c macros.h - -## end gnulib module byteswap-tests - -## begin gnulib module c-ctype-tests - -TESTS += test-c-ctype -check_PROGRAMS += test-c-ctype -EXTRA_DIST += test-c-ctype.c macros.h - -## end gnulib module c-ctype-tests - -## begin gnulib module ctype - -BUILT_SOURCES += ctype.h - -# We need the following in order to create <ctype.h> when the system -# doesn't have one that works with the given compiler. -ctype.h: ctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''GUARD_PREFIX''@|GL|g' \ - -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \ - -e 's/@''GNULIB_ISBLANK''@/$(GNULIB_ISBLANK)/g' \ - -e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/ctype.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += ctype.h ctype.h-t - -EXTRA_DIST += ctype.in.h - -## end gnulib module ctype - -## begin gnulib module ctype-tests - -TESTS += test-ctype -check_PROGRAMS += test-ctype -EXTRA_DIST += test-ctype.c - -## end gnulib module ctype-tests - -## begin gnulib module errno-tests - -TESTS += test-errno -check_PROGRAMS += test-errno - -EXTRA_DIST += test-errno.c - -## end gnulib module errno-tests - -## begin gnulib module fcntl-h - -BUILT_SOURCES += fcntl.h - -# We need the following in order to create <fcntl.h> when the system -# doesn't have one that works with the given compiler. -fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''GUARD_PREFIX''@|GL|g' \ - -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ - -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \ - -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \ - -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \ - -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \ - -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ - -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ - -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ - -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ - -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/fcntl.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += fcntl.h fcntl.h-t - -EXTRA_DIST += fcntl.in.h - -## end gnulib module fcntl-h - -## begin gnulib module fcntl-h-tests - -TESTS += test-fcntl-h -check_PROGRAMS += test-fcntl-h -EXTRA_DIST += test-fcntl-h.c - -## end gnulib module fcntl-h-tests - -## begin gnulib module fdopen - - -EXTRA_DIST += fdopen.c - -EXTRA_libtests_a_SOURCES += fdopen.c - -## end gnulib module fdopen - -## begin gnulib module fdopen-tests - -TESTS += test-fdopen -check_PROGRAMS += test-fdopen -EXTRA_DIST += test-fdopen.c signature.h macros.h - -## end gnulib module fdopen-tests - -## begin gnulib module fgetc-tests - -TESTS += test-fgetc -check_PROGRAMS += test-fgetc -EXTRA_DIST += test-fgetc.c signature.h macros.h - -## end gnulib module fgetc-tests - -## begin gnulib module float-tests - -TESTS += test-float -check_PROGRAMS += test-float -EXTRA_DIST += test-float.c macros.h - -## end gnulib module float-tests - -## begin gnulib module fpucw - - -EXTRA_DIST += fpucw.h - -## end gnulib module fpucw - -## begin gnulib module fputc-tests - -TESTS += test-fputc -check_PROGRAMS += test-fputc -EXTRA_DIST += test-fputc.c signature.h macros.h - -## end gnulib module fputc-tests - -## begin gnulib module fread-tests - -TESTS += test-fread -check_PROGRAMS += test-fread -EXTRA_DIST += test-fread.c signature.h macros.h - -## end gnulib module fread-tests - -## begin gnulib module fstat-tests - -TESTS += test-fstat -check_PROGRAMS += test-fstat -EXTRA_DIST += test-fstat.c signature.h macros.h - -## end gnulib module fstat-tests - -## begin gnulib module ftell-tests - -TESTS += test-ftell.sh test-ftell2.sh test-ftell3 -check_PROGRAMS += test-ftell test-ftell3 -MOSTLYCLEANFILES += t-ftell3.tmp -EXTRA_DIST += test-ftell.c test-ftell.sh test-ftell2.sh test-ftell3.c signature.h macros.h - -## end gnulib module ftell-tests - -## begin gnulib module ftello-tests - -TESTS += test-ftello.sh test-ftello2.sh test-ftello3 test-ftello4.sh -check_PROGRAMS += test-ftello test-ftello3 test-ftello4 -MOSTLYCLEANFILES += t-ftello3.tmp -EXTRA_DIST += test-ftello.c test-ftello.sh test-ftello2.sh test-ftello3.c test-ftello4.c test-ftello4.sh signature.h macros.h - -## end gnulib module ftello-tests - -## begin gnulib module func-tests - -TESTS += test-func -check_PROGRAMS += test-func -EXTRA_DIST += test-func.c macros.h - -## end gnulib module func-tests - -## begin gnulib module fwrite-tests - -TESTS += test-fwrite -check_PROGRAMS += test-fwrite -EXTRA_DIST += test-fwrite.c signature.h macros.h - -## end gnulib module fwrite-tests - -## begin gnulib module getdelim-tests - -TESTS += test-getdelim -check_PROGRAMS += test-getdelim -MOSTLYCLEANFILES += test-getdelim.txt -EXTRA_DIST += test-getdelim.c signature.h macros.h - -## end gnulib module getdelim-tests - -## begin gnulib module getline-tests - -TESTS += test-getline -check_PROGRAMS += test-getline -MOSTLYCLEANFILES += test-getline.txt -EXTRA_DIST += test-getline.c signature.h macros.h - -## end gnulib module getline-tests - -## begin gnulib module getpagesize - - -EXTRA_DIST += getpagesize.c - -EXTRA_libtests_a_SOURCES += getpagesize.c - -## end gnulib module getpagesize - -## begin gnulib module gettimeofday-tests - -TESTS += test-gettimeofday -check_PROGRAMS += test-gettimeofday - -EXTRA_DIST += signature.h test-gettimeofday.c - -## end gnulib module gettimeofday-tests - -## begin gnulib module intprops-tests - -TESTS += test-intprops -check_PROGRAMS += test-intprops -EXTRA_DIST += test-intprops.c macros.h - -## end gnulib module intprops-tests - -## begin gnulib module inttypes-incomplete - -BUILT_SOURCES += inttypes.h - -# We need the following in order to create <inttypes.h> when the system -# doesn't have one that works with the given compiler. -inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ - -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \ - -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \ - -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ - -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ - -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ - -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \ - -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \ - -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \ - -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \ - -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \ - -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \ - -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \ - -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ - -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \ - -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \ - -e 's/@''REPLACE_STRTOUMAX''@/$(REPLACE_STRTOUMAX)/g' \ - -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \ - -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \ - -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \ - -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ - -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/inttypes.in.h; \ - } > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += inttypes.h inttypes.h-t - -EXTRA_DIST += inttypes.in.h - -## end gnulib module inttypes-incomplete - -## begin gnulib module inttypes-tests - -TESTS += test-inttypes -check_PROGRAMS += test-inttypes -EXTRA_DIST += test-inttypes.c - -## end gnulib module inttypes-tests - -## begin gnulib module limits-h-tests - -TESTS += test-limits-h -check_PROGRAMS += test-limits-h -EXTRA_DIST += test-limits-h.c - -## end gnulib module limits-h-tests - -## begin gnulib module memchr-tests - -TESTS += test-memchr -check_PROGRAMS += test-memchr -EXTRA_DIST += test-memchr.c zerosize-ptr.h signature.h macros.h - -## end gnulib module memchr-tests - -## begin gnulib module netdb-tests - -TESTS += test-netdb -check_PROGRAMS += test-netdb -EXTRA_DIST += test-netdb.c - -## end gnulib module netdb-tests - -## begin gnulib module netinet_in-tests - -TESTS += test-netinet_in -check_PROGRAMS += test-netinet_in -EXTRA_DIST += test-netinet_in.c - -## end gnulib module netinet_in-tests - -## begin gnulib module read-file-tests - -TESTS += test-read-file -check_PROGRAMS += test-read-file -EXTRA_DIST += test-read-file.c - -## end gnulib module read-file-tests - -## begin gnulib module snippet/_Noreturn - -# Because this Makefile snippet defines a variable used by other -# gnulib Makefile snippets, it must be present in all Makefile.am that -# need it. This is ensured by the applicability 'all' defined above. - -_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h - -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h - -## end gnulib module snippet/_Noreturn - -## begin gnulib module snippet/arg-nonnull - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += arg-nonnull.h -# The arg-nonnull.h that gets inserted into generated .h files is the same as -# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut -# off. -arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_ARG_NONNULL/,$$p' \ - < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t - -ARG_NONNULL_H=arg-nonnull.h - -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h - -## end gnulib module snippet/arg-nonnull - -## begin gnulib module snippet/c++defs - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += c++defs.h -# The c++defs.h that gets inserted into generated .h files is the same as -# build-aux/snippet/c++defs.h, except that it has the copyright header cut off. -c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/_GL_CXXDEFS/,$$p' \ - < $(top_srcdir)/build-aux/snippet/c++defs.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += c++defs.h c++defs.h-t - -CXXDEFS_H=c++defs.h - -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h - -## end gnulib module snippet/c++defs - -## begin gnulib module snippet/warn-on-use - -BUILT_SOURCES += warn-on-use.h -# The warn-on-use.h that gets inserted into generated .h files is the same as -# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut -# off. -warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/^.ifndef/,$$p' \ - < $(top_srcdir)/build-aux/snippet/warn-on-use.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t - -WARN_ON_USE_H=warn-on-use.h - -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h - -## end gnulib module snippet/warn-on-use - -## begin gnulib module snprintf-tests - -TESTS += test-snprintf -check_PROGRAMS += test-snprintf - -EXTRA_DIST += test-snprintf.c signature.h macros.h - -## end gnulib module snprintf-tests - -## begin gnulib module stdalign-tests - -TESTS += test-stdalign -check_PROGRAMS += test-stdalign -EXTRA_DIST += test-stdalign.c macros.h - -## end gnulib module stdalign-tests - -## begin gnulib module stdbool-tests - -TESTS += test-stdbool -check_PROGRAMS += test-stdbool -EXTRA_DIST += test-stdbool.c - -## end gnulib module stdbool-tests - -## begin gnulib module stddef-tests - -TESTS += test-stddef -check_PROGRAMS += test-stddef -EXTRA_DIST += test-stddef.c - -## end gnulib module stddef-tests - -## begin gnulib module stdint-tests - -TESTS += test-stdint -check_PROGRAMS += test-stdint -EXTRA_DIST += test-stdint.c - -## end gnulib module stdint-tests - -## begin gnulib module stdio-tests - -TESTS += test-stdio -check_PROGRAMS += test-stdio -EXTRA_DIST += test-stdio.c - -## end gnulib module stdio-tests - -## begin gnulib module stdlib-tests - -TESTS += test-stdlib -check_PROGRAMS += test-stdlib -EXTRA_DIST += test-stdlib.c test-sys_wait.h - -## end gnulib module stdlib-tests - -## begin gnulib module string-tests - -TESTS += test-string -check_PROGRAMS += test-string -EXTRA_DIST += test-string.c - -## end gnulib module string-tests - -## begin gnulib module strings-tests - -TESTS += test-strings -check_PROGRAMS += test-strings -EXTRA_DIST += test-strings.c - -## end gnulib module strings-tests - -## begin gnulib module strnlen-tests - -TESTS += test-strnlen -check_PROGRAMS += test-strnlen -EXTRA_DIST += test-strnlen.c zerosize-ptr.h signature.h macros.h - -## end gnulib module strnlen-tests - -## begin gnulib module strverscmp-tests - -TESTS += test-strverscmp -check_PROGRAMS += test-strverscmp -EXTRA_DIST += test-strverscmp.c signature.h macros.h - -## end gnulib module strverscmp-tests - -## begin gnulib module sys_socket-tests - -TESTS += test-sys_socket -check_PROGRAMS += test-sys_socket -EXTRA_DIST += test-sys_socket.c - -## end gnulib module sys_socket-tests - -## begin gnulib module sys_stat-tests - -TESTS += test-sys_stat -check_PROGRAMS += test-sys_stat -EXTRA_DIST += test-sys_stat.c - -## end gnulib module sys_stat-tests - -## begin gnulib module sys_time-tests - -TESTS += test-sys_time -check_PROGRAMS += test-sys_time -EXTRA_DIST += test-sys_time.c - -## end gnulib module sys_time-tests - -## begin gnulib module sys_types-tests - -TESTS += test-sys_types -check_PROGRAMS += test-sys_types -EXTRA_DIST += test-sys_types.c - -## end gnulib module sys_types-tests - -## begin gnulib module sys_uio-tests - -TESTS += test-sys_uio -check_PROGRAMS += test-sys_uio -EXTRA_DIST += test-sys_uio.c - -## end gnulib module sys_uio-tests - -## begin gnulib module test-framework-sh-tests - -TESTS += test-init.sh -EXTRA_DIST += init.sh -EXTRA_DIST += test-init.sh - -## end gnulib module test-framework-sh-tests - -## begin gnulib module time-tests - -TESTS += test-time -check_PROGRAMS += test-time -EXTRA_DIST += test-time.c - -## end gnulib module time-tests - -## begin gnulib module unistd-tests - -TESTS += test-unistd -check_PROGRAMS += test-unistd -EXTRA_DIST += test-unistd.c - -## end gnulib module unistd-tests - -## begin gnulib module vasnprintf-tests - -TESTS += test-vasnprintf -check_PROGRAMS += test-vasnprintf - -EXTRA_DIST += test-vasnprintf.c macros.h - -## end gnulib module vasnprintf-tests - -## begin gnulib module vasprintf-tests - -TESTS += test-vasprintf -check_PROGRAMS += test-vasprintf - -EXTRA_DIST += test-vasprintf.c signature.h macros.h - -## end gnulib module vasprintf-tests - -## begin gnulib module vc-list-files-tests - -TESTS += test-vc-list-files-git.sh -TESTS += test-vc-list-files-cvs.sh -TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)' -EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh - -## end gnulib module vc-list-files-tests - -## begin gnulib module verify-tests - -TESTS_ENVIRONMENT += MAKE='$(MAKE)' -TESTS += test-verify test-verify.sh -check_PROGRAMS += test-verify - -# This test expects compilation of test-verify.c to fail, and -# each time it fails, the makefile rule does not perform the usual -# "mv -f $name.Tpo $name.po, so tell make clean to remove that file. -MOSTLYCLEANFILES += .deps/test-verify.Tpo -EXTRA_DIST += test-verify.c test-verify.sh - -## end gnulib module verify-tests - -## begin gnulib module vsnprintf-tests - -TESTS += test-vsnprintf -check_PROGRAMS += test-vsnprintf - -EXTRA_DIST += test-vsnprintf.c signature.h macros.h - -## end gnulib module vsnprintf-tests - -## begin gnulib module wchar-tests - -TESTS += test-wchar -check_PROGRAMS += test-wchar -EXTRA_DIST += test-wchar.c - -## end gnulib module wchar-tests - -# Clean up after Solaris cc. -clean-local: - rm -rf SunWS_cache - -mostlyclean-local: mostlyclean-generic - @for dir in '' $(MOSTLYCLEANDIRS); do \ - if test -n "$$dir" && test -d $$dir; then \ - echo "rmdir $$dir"; rmdir $$dir; \ - fi; \ - done; \ - : diff --git a/gl/tests/binary-io.c b/gl/tests/binary-io.c deleted file mode 100644 index d828bcd015..0000000000 --- a/gl/tests/binary-io.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <config.h> -#define BINARY_IO_INLINE _GL_EXTERN_INLINE -#include "binary-io.h" -typedef int dummy; diff --git a/gl/tests/binary-io.h b/gl/tests/binary-io.h deleted file mode 100644 index 9f17c0d398..0000000000 --- a/gl/tests/binary-io.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 2008-2016 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/>. */ - -#ifndef _BINARY_H -#define _BINARY_H - -/* For systems that distinguish between text and binary I/O. - O_BINARY is guaranteed by the gnulib <fcntl.h>. */ -#include <fcntl.h> - -/* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...', - so we include it here first. */ -#include <stdio.h> - -#ifndef _GL_INLINE_HEADER_BEGIN - #error "Please include config.h first." -#endif -_GL_INLINE_HEADER_BEGIN -#ifndef BINARY_IO_INLINE -# define BINARY_IO_INLINE _GL_INLINE -#endif - -/* set_binary_mode (fd, mode) - sets the binary/text I/O mode of file descriptor fd to the given mode - (must be O_BINARY or O_TEXT) and returns the previous mode. */ -#if O_BINARY -# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ -# include <io.h> /* declares setmode() */ -# define set_binary_mode setmode -# else -# define set_binary_mode _setmode -# undef fileno -# define fileno _fileno -# endif -#else - /* On reasonable systems, binary I/O is the only choice. */ - /* Use a function rather than a macro, to avoid gcc warnings - "warning: statement with no effect". */ -BINARY_IO_INLINE int -set_binary_mode (int fd, int mode) -{ - (void) fd; - (void) mode; - return O_BINARY; -} -#endif - -/* SET_BINARY (fd); - changes the file descriptor fd to perform binary I/O. */ -#if defined __DJGPP__ || defined __EMX__ -# include <unistd.h> /* declares isatty() */ - /* Avoid putting stdin/stdout in binary mode if it is connected to - the console, because that would make it impossible for the user - to interrupt the program through Ctrl-C or Ctrl-Break. */ -# define SET_BINARY(fd) ((void) (!isatty (fd) ? (set_binary_mode (fd, O_BINARY), 0) : 0)) -#else -# define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY)) -#endif - -_GL_INLINE_HEADER_END - -#endif /* _BINARY_H */ diff --git a/gl/tests/ctype.in.h b/gl/tests/ctype.in.h deleted file mode 100644 index 217812de10..0000000000 --- a/gl/tests/ctype.in.h +++ /dev/null @@ -1,57 +0,0 @@ -/* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete. - - Copyright (C) 2009-2016 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 Bruno Haible. */ - -/* - * ISO C 99 <ctype.h> for platforms on which it is incomplete. - * <http://www.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html> - */ - -#ifndef _@GUARD_PREFIX@_CTYPE_H - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -/* Include the original <ctype.h>. */ -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_CTYPE_H@ - -#ifndef _@GUARD_PREFIX@_CTYPE_H -#define _@GUARD_PREFIX@_CTYPE_H - -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - -/* Return non-zero if c is a blank, i.e. a space or tab character. */ -#if @GNULIB_ISBLANK@ -# if !@HAVE_ISBLANK@ -_GL_EXTERN_C int isblank (int c); -# endif -#elif defined GNULIB_POSIXCHECK -# undef isblank -# if HAVE_RAW_DECL_ISBLANK -_GL_WARN_ON_USE (isblank, "isblank is unportable - " - "use gnulib module isblank for portability"); -# endif -#endif - -#endif /* _@GUARD_PREFIX@_CTYPE_H */ -#endif /* _@GUARD_PREFIX@_CTYPE_H */ diff --git a/gl/tests/fcntl.in.h b/gl/tests/fcntl.in.h deleted file mode 100644 index b94397307e..0000000000 --- a/gl/tests/fcntl.in.h +++ /dev/null @@ -1,363 +0,0 @@ -/* Like <fcntl.h>, but with non-working flags defined to 0. - - Copyright (C) 2006-2016 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 Paul Eggert */ - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -#if defined __need_system_fcntl_h -/* Special invocation convention. */ - -/* Needed before <sys/stat.h>. - May also define off_t to a 64-bit type on native Windows. */ -#include <sys/types.h> -/* On some systems other than glibc, <sys/stat.h> is a prerequisite of - <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. - But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an - extern "C" { ... } block, which leads to errors in C++ mode with the - overridden <sys/stat.h> from gnulib. These errors are known to be gone - with g++ version >= 4.3. */ -#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) -# include <sys/stat.h> -#endif -#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ - -#else -/* Normal invocation convention. */ - -#ifndef _@GUARD_PREFIX@_FCNTL_H - -/* Needed before <sys/stat.h>. - May also define off_t to a 64-bit type on native Windows. */ -#include <sys/types.h> -/* On some systems other than glibc, <sys/stat.h> is a prerequisite of - <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. - But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an - extern "C" { ... } block, which leads to errors in C++ mode with the - overridden <sys/stat.h> from gnulib. These errors are known to be gone - with g++ version >= 4.3. */ -#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) -# include <sys/stat.h> -#endif -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ - -#ifndef _@GUARD_PREFIX@_FCNTL_H -#define _@GUARD_PREFIX@_FCNTL_H - -#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */ -# include <unistd.h> -#endif - -/* Native Windows platforms declare open(), creat() in <io.h>. */ -#if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ - && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) -# include <io.h> -#endif - - -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - - -/* Declare overridden functions. */ - -#if @GNULIB_FCNTL@ -# if @REPLACE_FCNTL@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef fcntl -# define fcntl rpl_fcntl -# endif -_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...)); -_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...)); -# else -# if !@HAVE_FCNTL@ -_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...)); -# endif -_GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...)); -# endif -_GL_CXXALIASWARN (fcntl); -#elif defined GNULIB_POSIXCHECK -# undef fcntl -# if HAVE_RAW_DECL_FCNTL -_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " - "use gnulib module fcntl for portability"); -# endif -#endif - -#if @GNULIB_OPEN@ -# if @REPLACE_OPEN@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef open -# define open rpl_open -# endif -_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); -# else -_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); -# endif -/* On HP-UX 11, in C++ mode, open() is defined as an inline function with a - default argument. _GL_CXXALIASWARN does not work in this case. */ -# if !defined __hpux -_GL_CXXALIASWARN (open); -# endif -#elif defined GNULIB_POSIXCHECK -# undef open -/* Assume open is always declared. */ -_GL_WARN_ON_USE (open, "open is not always POSIX compliant - " - "use gnulib module open for portability"); -#endif - -#if @GNULIB_OPENAT@ -# if @REPLACE_OPENAT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef openat -# define openat rpl_openat -# endif -_GL_FUNCDECL_RPL (openat, int, - (int fd, char const *file, int flags, /* mode_t mode */ ...) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (openat, int, - (int fd, char const *file, int flags, /* mode_t mode */ ...)); -# else -# if !@HAVE_OPENAT@ -_GL_FUNCDECL_SYS (openat, int, - (int fd, char const *file, int flags, /* mode_t mode */ ...) - _GL_ARG_NONNULL ((2))); -# endif -_GL_CXXALIAS_SYS (openat, int, - (int fd, char const *file, int flags, /* mode_t mode */ ...)); -# endif -_GL_CXXALIASWARN (openat); -#elif defined GNULIB_POSIXCHECK -# undef openat -# if HAVE_RAW_DECL_OPENAT -_GL_WARN_ON_USE (openat, "openat is not portable - " - "use gnulib module openat for portability"); -# endif -#endif - - -/* Fix up the FD_* macros, only known to be missing on mingw. */ - -#ifndef FD_CLOEXEC -# define FD_CLOEXEC 1 -#endif - -/* Fix up the supported F_* macros. Intentionally leave other F_* - macros undefined. Only known to be missing on mingw. */ - -#ifndef F_DUPFD_CLOEXEC -# define F_DUPFD_CLOEXEC 0x40000000 -/* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */ -# define GNULIB_defined_F_DUPFD_CLOEXEC 1 -#else -# define GNULIB_defined_F_DUPFD_CLOEXEC 0 -#endif - -#ifndef F_DUPFD -# define F_DUPFD 1 -#endif - -#ifndef F_GETFD -# define F_GETFD 2 -#endif - -/* Fix up the O_* macros. */ - -/* AIX 7.1 with XL C 12.1 defines O_CLOEXEC, O_NOFOLLOW, and O_TTY_INIT - to values outside 'int' range, so omit these misdefinitions. - But avoid namespace pollution on non-AIX systems. */ -#ifdef _AIX -# include <limits.h> -# if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX) -# undef O_CLOEXEC -# endif -# if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX) -# undef O_NOFOLLOW -# endif -# if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX) -# undef O_TTY_INIT -# endif -#endif - -#if !defined O_DIRECT && defined O_DIRECTIO -/* Tru64 spells it 'O_DIRECTIO'. */ -# define O_DIRECT O_DIRECTIO -#endif - -#if !defined O_CLOEXEC && defined O_NOINHERIT -/* Mingw spells it 'O_NOINHERIT'. */ -# define O_CLOEXEC O_NOINHERIT -#endif - -#ifndef O_CLOEXEC -# define O_CLOEXEC 0 -#endif - -#ifndef O_DIRECT -# define O_DIRECT 0 -#endif - -#ifndef O_DIRECTORY -# define O_DIRECTORY 0 -#endif - -#ifndef O_DSYNC -# define O_DSYNC 0 -#endif - -#ifndef O_EXEC -# define O_EXEC O_RDONLY /* This is often close enough in older systems. */ -#endif - -#ifndef O_IGNORE_CTTY -# define O_IGNORE_CTTY 0 -#endif - -#ifndef O_NDELAY -# define O_NDELAY 0 -#endif - -#ifndef O_NOATIME -# define O_NOATIME 0 -#endif - -#ifndef O_NONBLOCK -# define O_NONBLOCK O_NDELAY -#endif - -/* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero - value of O_NONBLOCK. Otherwise, O_NONBLOCK is defined (above) to O_NDELAY - or to 0 as fallback. */ -#if @GNULIB_NONBLOCKING@ -# if O_NONBLOCK -# define GNULIB_defined_O_NONBLOCK 0 -# else -# define GNULIB_defined_O_NONBLOCK 1 -# undef O_NONBLOCK -# define O_NONBLOCK 0x40000000 -# endif -#endif - -#ifndef O_NOCTTY -# define O_NOCTTY 0 -#endif - -#ifndef O_NOFOLLOW -# define O_NOFOLLOW 0 -#endif - -#ifndef O_NOLINK -# define O_NOLINK 0 -#endif - -#ifndef O_NOLINKS -# define O_NOLINKS 0 -#endif - -#ifndef O_NOTRANS -# define O_NOTRANS 0 -#endif - -#ifndef O_RSYNC -# define O_RSYNC 0 -#endif - -#ifndef O_SEARCH -# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */ -#endif - -#ifndef O_SYNC -# define O_SYNC 0 -#endif - -#ifndef O_TTY_INIT -# define O_TTY_INIT 0 -#endif - -#if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) -# undef O_ACCMODE -# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) -#endif - -/* For systems that distinguish between text and binary I/O. - O_BINARY is usually declared in fcntl.h */ -#if !defined O_BINARY && defined _O_BINARY - /* For MSC-compatible compilers. */ -# define O_BINARY _O_BINARY -# define O_TEXT _O_TEXT -#endif - -#if defined __BEOS__ || defined __HAIKU__ - /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ -# undef O_BINARY -# undef O_TEXT -#endif - -#ifndef O_BINARY -# define O_BINARY 0 -# define O_TEXT 0 -#endif - -/* Fix up the AT_* macros. */ - -/* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its - value exceeds INT_MAX, so its use as an int doesn't conform to the - C standard, and GCC and Sun C complain in some cases. If the bug - is present, undef AT_FDCWD here, so it can be redefined below. */ -#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553 -# undef AT_FDCWD -#endif - -/* Use the same bit pattern as Solaris 9, but with the proper - signedness. The bit pattern is important, in case this actually is - Solaris with the above workaround. */ -#ifndef AT_FDCWD -# define AT_FDCWD (-3041965) -#endif - -/* Use the same values as Solaris 9. This shouldn't matter, but - there's no real reason to differ. */ -#ifndef AT_SYMLINK_NOFOLLOW -# define AT_SYMLINK_NOFOLLOW 4096 -#endif - -#ifndef AT_REMOVEDIR -# define AT_REMOVEDIR 1 -#endif - -/* Solaris 9 lacks these two, so just pick unique values. */ -#ifndef AT_SYMLINK_FOLLOW -# define AT_SYMLINK_FOLLOW 2 -#endif - -#ifndef AT_EACCESS -# define AT_EACCESS 4 -#endif - - -#endif /* _@GUARD_PREFIX@_FCNTL_H */ -#endif /* _@GUARD_PREFIX@_FCNTL_H */ -#endif diff --git a/gl/tests/fdopen.c b/gl/tests/fdopen.c deleted file mode 100644 index 61fbfdfc5a..0000000000 --- a/gl/tests/fdopen.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Open a stream with a given file descriptor. - Copyright (C) 2011-2016 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/>. */ - -#include <config.h> - -/* Specification. */ -#include <stdio.h> - -#include <errno.h> - -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER -# include "msvc-inval.h" -#endif - -#undef fdopen - -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER -static FILE * -fdopen_nothrow (int fd, const char *mode) -{ - FILE *result; - - TRY_MSVC_INVAL - { - result = fdopen (fd, mode); - } - CATCH_MSVC_INVAL - { - result = NULL; - } - DONE_MSVC_INVAL; - - return result; -} -#else -# define fdopen_nothrow fdopen -#endif - -FILE * -rpl_fdopen (int fd, const char *mode) -{ - int saved_errno = errno; - FILE *fp; - - errno = 0; - fp = fdopen_nothrow (fd, mode); - if (fp == NULL) - { - if (errno == 0) - errno = EBADF; - } - else - errno = saved_errno; - - return fp; -} diff --git a/gl/tests/fpucw.h b/gl/tests/fpucw.h deleted file mode 100644 index 05ee0cac94..0000000000 --- a/gl/tests/fpucw.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Manipulating the FPU control word. -*- coding: utf-8 -*- - Copyright (C) 2007-2016 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2007. - - 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/>. */ - -#ifndef _FPUCW_H -#define _FPUCW_H - -/* The i386 floating point hardware (the 387 compatible FPU, not the modern - SSE/SSE2 hardware) has a controllable rounding precision. It is specified - through the 'PC' bits in the FPU control word ('fctrl' register). (See - the GNU libc i386 <fpu_control.h> header for details.) - - On some platforms, such as Linux or Solaris, the default precision setting - is set to "extended precision". This means that 'long double' instructions - operate correctly, but 'double' computations often produce slightly - different results as on strictly IEEE 754 conforming systems. - - On some platforms, such as NetBSD, the default precision is set to - "double precision". This means that 'long double' instructions will operate - only as 'double', i.e. lead to wrong results. Similarly on FreeBSD 6.4, at - least for the division of 'long double' numbers. - - The FPU control word is under control of the application, i.e. it is - not required to be set either way by the ABI. (In fact, the i386 ABI - http://refspecs.freestandards.org/elf/abi386-4.pdf page 3-12 = page 38 - is not clear about it. But in any case, gcc treats the control word - like a "preserved" register: it emits code that assumes that the control - word is preserved across calls, and it restores the control word at the - end of functions that modify it.) - - See Vincent Lefèvre's page http://www.vinc17.org/research/extended.en.html - for a good explanation. - See http://www.uwsg.iu.edu/hypermail/linux/kernel/0103.0/0453.html for - some argumentation which setting should be the default. */ - -/* This header file provides the following facilities: - fpucw_t integral type holding the value of 'fctrl' - FPU_PC_MASK bit mask denoting the precision control - FPU_PC_DOUBLE precision control for 53 bits mantissa - FPU_PC_EXTENDED precision control for 64 bits mantissa - GET_FPUCW () yields the current FPU control word - SET_FPUCW (word) sets the FPU control word - DECL_LONG_DOUBLE_ROUNDING variable declaration for - BEGIN/END_LONG_DOUBLE_ROUNDING - BEGIN_LONG_DOUBLE_ROUNDING () starts a sequence of instructions with - 'long double' safe operation precision - END_LONG_DOUBLE_ROUNDING () ends a sequence of instructions with - 'long double' safe operation precision - */ - -/* Inline assembler like this works only with GNU C. */ -#if (defined __i386__ || defined __x86_64__) && defined __GNUC__ - -typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */ - -# define FPU_PC_MASK 0x0300 -# define FPU_PC_DOUBLE 0x200 /* glibc calls this _FPU_DOUBLE */ -# define FPU_PC_EXTENDED 0x300 /* glibc calls this _FPU_EXTENDED */ - -# define GET_FPUCW() \ - ({ fpucw_t _cw; \ - __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_cw)); \ - _cw; \ - }) -# define SET_FPUCW(word) \ - (void)({ fpucw_t _ncw = (word); \ - __asm__ __volatile__ ("fldcw %0" : : "m" (*&_ncw)); \ - }) - -# define DECL_LONG_DOUBLE_ROUNDING \ - fpucw_t oldcw; -# define BEGIN_LONG_DOUBLE_ROUNDING() \ - (void)(oldcw = GET_FPUCW (), \ - SET_FPUCW ((oldcw & ~FPU_PC_MASK) | FPU_PC_EXTENDED)) -# define END_LONG_DOUBLE_ROUNDING() \ - SET_FPUCW (oldcw) - -#else - -typedef unsigned int fpucw_t; - -# define FPU_PC_MASK 0 -# define FPU_PC_DOUBLE 0 -# define FPU_PC_EXTENDED 0 - -# define GET_FPUCW() 0 -# define SET_FPUCW(word) (void)(word) - -# define DECL_LONG_DOUBLE_ROUNDING -# define BEGIN_LONG_DOUBLE_ROUNDING() -# define END_LONG_DOUBLE_ROUNDING() - -#endif - -#endif /* _FPUCW_H */ diff --git a/gl/tests/getpagesize.c b/gl/tests/getpagesize.c deleted file mode 100644 index dc4a200b21..0000000000 --- a/gl/tests/getpagesize.c +++ /dev/null @@ -1,39 +0,0 @@ -/* getpagesize emulation for systems where it cannot be done in a C macro. - - Copyright (C) 2007, 2009-2016 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 and Martin Lambers. */ - -#include <config.h> - -/* Specification. */ -#include <unistd.h> - -/* This implementation is only for native Windows systems. */ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - -# define WIN32_LEAN_AND_MEAN -# include <windows.h> - -int -getpagesize (void) -{ - SYSTEM_INFO system_info; - GetSystemInfo (&system_info); - return system_info.dwPageSize; -} - -#endif diff --git a/gl/tests/gnulib.mk b/gl/tests/gnulib.mk deleted file mode 100644 index c5836c7dc8..0000000000 --- a/gl/tests/gnulib.mk +++ /dev/null @@ -1,121 +0,0 @@ -## DO NOT EDIT! GENERATED AUTOMATICALLY! -## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 Free -# Software Foundation, Inc. -# -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -# Generated by gnulib-tool. - -AUTOMAKE_OPTIONS = 1.5 foreign - -SUBDIRS = -TESTS = -TESTS_ENVIRONMENT = -noinst_PROGRAMS = -check_PROGRAMS = -noinst_HEADERS = -noinst_LIBRARIES = -EXTRA_DIST = -BUILT_SOURCES = -SUFFIXES = -MOSTLYCLEANFILES = core *.stackdump -MOSTLYCLEANDIRS = -CLEANFILES = -DISTCLEANFILES = -MAINTAINERCLEANFILES = - -AM_CPPFLAGS = \ - -I. -I$(srcdir) \ - -I../.. -I$(srcdir)/../.. \ - -I../../gl -I$(srcdir)/../../gl - -LDADD = ../../gl/libgnu.la - -## begin gnulib module arpa_inet-tests - -TESTS += test-arpa_inet -check_PROGRAMS += test-arpa_inet - -EXTRA_DIST += test-arpa_inet.c - -## end gnulib module arpa_inet-tests - -## begin gnulib module c-ctype-tests - -TESTS += test-c-ctype -check_PROGRAMS += test-c-ctype - -EXTRA_DIST += test-c-ctype.c - -## end gnulib module c-ctype-tests - -## begin gnulib module getaddrinfo-tests - -TESTS += test-getaddrinfo -check_PROGRAMS += test-getaddrinfo -test_getaddrinfo_LDADD = $(LDADD) @LIBINTL@ - -EXTRA_DIST += test-getaddrinfo.c - -## end gnulib module getaddrinfo-tests - -## begin gnulib module getdelim-tests - -TESTS += test-getdelim -check_PROGRAMS += test-getdelim -MOSTLYCLEANFILES += test-getdelim.txt -EXTRA_DIST += test-getdelim.c - -## end gnulib module getdelim-tests - -## begin gnulib module getline-tests - -TESTS += test-getline -check_PROGRAMS += test-getline -MOSTLYCLEANFILES += test-getline.txt -EXTRA_DIST += test-getline.c - -## end gnulib module getline-tests - -## begin gnulib module netdb-tests - -TESTS += test-netdb -check_PROGRAMS += test-netdb - -EXTRA_DIST += test-netdb.c - -## end gnulib module netdb-tests - -## begin gnulib module netinet_in-tests - -TESTS += test-netinet_in -check_PROGRAMS += test-netinet_in - -EXTRA_DIST += test-netinet_in.c - -## end gnulib module netinet_in-tests - -## begin gnulib module strerror-tests - -TESTS += test-strerror -check_PROGRAMS += test-strerror -EXTRA_DIST += test-strerror.c - -## end gnulib module strerror-tests - -# Clean up after Solaris cc. -clean-local: - rm -rf SunWS_cache - -mostlyclean-local: mostlyclean-generic - @for dir in '' $(MOSTLYCLEANDIRS); do \ - if test -n "$$dir" && test -d $$dir; then \ - echo "rmdir $$dir"; rmdir $$dir; \ - fi; \ - done; \ - : diff --git a/gl/tests/init.sh b/gl/tests/init.sh deleted file mode 100644 index da743c2ab0..0000000000 --- a/gl/tests/init.sh +++ /dev/null @@ -1,598 +0,0 @@ -# source this file; set up for tests - -# Copyright (C) 2009-2016 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/>. - -# Using this file in a test -# ========================= -# -# The typical skeleton of a test looks like this: -# -# #!/bin/sh -# . "${srcdir=.}/init.sh"; path_prepend_ . -# Execute some commands. -# Note that these commands are executed in a subdirectory, therefore you -# need to prepend "../" to relative filenames in the build directory. -# Note that the "path_prepend_ ." is useful only if the body of your -# test invokes programs residing in the initial directory. -# For example, if the programs you want to test are in src/, and this test -# script is named tests/test-1, then you would use "path_prepend_ ../src", -# or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" -# to all tests via automake's TESTS_ENVIRONMENT. -# Set the exit code 0 for success, 77 for skipped, or 1 or other for failure. -# Use the skip_ and fail_ functions to print a diagnostic and then exit -# with the corresponding exit code. -# Exit $? - -# Executing a test that uses this file -# ==================================== -# -# Running a single test: -# $ make check TESTS=test-foo.sh -# -# Running a single test, with verbose output: -# $ make check TESTS=test-foo.sh VERBOSE=yes -# -# Running a single test, with single-stepping: -# 1. Go into a sub-shell: -# $ bash -# 2. Set relevant environment variables from TESTS_ENVIRONMENT in the -# Makefile: -# $ export srcdir=../../tests # this is an example -# 3. Execute the commands from the test, copy&pasting them one by one: -# $ . "$srcdir/init.sh"; path_prepend_ . -# ... -# 4. Finally -# $ exit - -ME_=`expr "./$0" : '.*/\(.*\)$'` - -# We use a trap below for cleanup. This requires us to go through -# hoops to get the right exit status transported through the handler. -# So use 'Exit STATUS' instead of 'exit STATUS' inside of the tests. -# Turn off errexit here so that we don't trip the bug with OSF1/Tru64 -# sh inside this function. -Exit () { set +e; (exit $1); exit $1; } - -# Print warnings (e.g., about skipped and failed tests) to this file number. -# Override by defining to say, 9, in init.cfg, and putting say, -# export ...ENVVAR_SETTINGS...; $(SHELL) 9>&2 -# in the definition of TESTS_ENVIRONMENT in your tests/Makefile.am file. -# This is useful when using automake's parallel tests mode, to print -# the reason for skip/failure to console, rather than to the .log files. -: ${stderr_fileno_=2} - -# Note that correct expansion of "$*" depends on IFS starting with ' '. -# Always write the full diagnostic to stderr. -# When stderr_fileno_ is not 2, also emit the first line of the -# diagnostic to that file descriptor. -warn_ () -{ - # If IFS does not start with ' ', set it and emit the warning in a subshell. - case $IFS in - ' '*) printf '%s\n' "$*" >&2 - test $stderr_fileno_ = 2 \ - || { printf '%s\n' "$*" | sed 1q >&$stderr_fileno_ ; } ;; - *) (IFS=' '; warn_ "$@");; - esac -} -fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; } -skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; } -fatal_ () { warn_ "$ME_: hard error: $@"; Exit 99; } -framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; } - -# This is used to simplify checking of the return value -# which is useful when ensuring a command fails as desired. -# I.e., just doing `command ... &&fail=1` will not catch -# a segfault in command for example. With this helper you -# instead check an explicit exit code like -# returns_ 1 command ... || fail -returns_ () { - # Disable tracing so it doesn't interfere with stderr of the wrapped command - { set +x; } 2>/dev/null - - local exp_exit="$1" - shift - "$@" - test $? -eq $exp_exit && ret_=0 || ret_=1 - - if test "$VERBOSE" = yes && test "$gl_set_x_corrupts_stderr_" = false; then - set -x - fi - { return $ret_; } 2>/dev/null -} - -# Sanitize this shell to POSIX mode, if possible. -DUALCASE=1; export DUALCASE -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; - esac -fi - -# We require $(...) support unconditionally. -# We require non-surprising "local" semantics (this eliminates dash). -# This takes the admittedly draconian step of eliminating dash, because the -# assignment tab=$(printf '\t') works fine, yet preceding it with "local " -# transforms it into an assignment that sets the variable to the empty string. -# That is too counter-intuitive, and can lead to subtle run-time malfunction. -# The example below is less subtle in that with dash, it evokes the run-time -# exception "dash: 1: local: 1: bad variable name". -# We require a few additional shell features only when $EXEEXT is nonempty, -# in order to support automatic $EXEEXT emulation: -# - hyphen-containing alias names -# - we prefer to use ${var#...} substitution, rather than having -# to work around lack of support for that feature. -# The following code attempts to find a shell with support for these features. -# If the current shell passes the test, we're done. Otherwise, test other -# shells until we find one that passes. If one is found, re-exec it. -# If no acceptable shell is found, skip the current test. -# -# The "...set -x; P=1 true 2>err..." test is to disqualify any shell that -# emits "P=1" into err, as /bin/sh from SunOS 5.11 and OpenBSD 4.7 do. -# -# Use "9" to indicate success (rather than 0), in case some shell acts -# like Solaris 10's /bin/sh but exits successfully instead of with status 2. - -# Eval this code in a subshell to determine a shell's suitability. -# 10 - passes all tests; ok to use -# 9 - ok, but enabling "set -x" corrupts app stderr; prefer higher score -# ? - not ok -gl_shell_test_script_=' -test $(echo y) = y || exit 1 -f_local_() { local v=1; }; f_local_ || exit 1 -f_dash_local_fail_() { local t=$(printf " 1"); }; f_dash_local_fail_ -score_=10 -if test "$VERBOSE" = yes; then - test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9 -fi -test -z "$EXEEXT" && exit $score_ -shopt -s expand_aliases -alias a-b="echo zoo" -v=abx - test ${v%x} = ab \ - && test ${v#a} = bx \ - && test $(a-b) = zoo \ - && exit $score_ -' - -if test "x$1" = "x--no-reexec"; then - shift -else - # Assume a working shell. Export to subshells (setup_ needs this). - gl_set_x_corrupts_stderr_=false - export gl_set_x_corrupts_stderr_ - - # Record the first marginally acceptable shell. - marginal_= - - # Search for a shell that meets our requirements. - for re_shell_ in __current__ "${CONFIG_SHELL:-no_shell}" \ - /bin/sh bash dash zsh pdksh fail - do - test "$re_shell_" = no_shell && continue - - # If we've made it all the way to the sentinel, "fail" without - # finding even a marginal shell, skip this test. - if test "$re_shell_" = fail; then - test -z "$marginal_" && skip_ failed to find an adequate shell - re_shell_=$marginal_ - break - fi - - # When testing the current shell, simply "eval" the test code. - # Otherwise, run it via $re_shell_ -c ... - if test "$re_shell_" = __current__; then - # 'eval'ing this code makes Solaris 10's /bin/sh exit with - # $? set to 2. It does not evaluate any of the code after the - # "unexpected" first '('. Thus, we must run it in a subshell. - ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1 - else - "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null - fi - - st_=$? - - # $re_shell_ works just fine. Use it. - if test $st_ = 10; then - gl_set_x_corrupts_stderr_=false - break - fi - - # If this is our first marginally acceptable shell, remember it. - if test "$st_:$marginal_" = 9: ; then - marginal_="$re_shell_" - gl_set_x_corrupts_stderr_=true - fi - done - - if test "$re_shell_" != __current__; then - # Found a usable shell. Preserve -v and -x. - case $- in - *v*x* | *x*v*) opts_=-vx ;; - *v*) opts_=-v ;; - *x*) opts_=-x ;; - *) opts_= ;; - esac - re_shell=$re_shell_ - export re_shell - exec "$re_shell_" $opts_ "$0" --no-reexec "$@" - echo "$ME_: exec failed" 1>&2 - exit 127 - fi -fi - -# If this is bash, turn off all aliases. -test -n "$BASH_VERSION" && unalias -a - -# Note that when supporting $EXEEXT (transparently mapping from PROG_NAME to -# PROG_NAME.exe), we want to support hyphen-containing names like test-acos. -# That is part of the shell-selection test above. Why use aliases rather -# than functions? Because support for hyphen-containing aliases is more -# widespread than that for hyphen-containing function names. -test -n "$EXEEXT" && shopt -s expand_aliases - -# Enable glibc's malloc-perturbing option. -# This is useful for exposing code that depends on the fact that -# malloc-related functions often return memory that is mostly zeroed. -# If you have the time and cycles, use valgrind to do an even better job. -: ${MALLOC_PERTURB_=87} -export MALLOC_PERTURB_ - -# This is a stub function that is run upon trap (upon regular exit and -# interrupt). Override it with a per-test function, e.g., to unmount -# a partition, or to undo any other global state changes. -cleanup_ () { :; } - -# Emit a header similar to that from diff -u; Print the simulated "diff" -# command so that the order of arguments is clear. Don't bother with @@ lines. -emit_diff_u_header_ () -{ - printf '%s\n' "diff -u $*" \ - "--- $1 1970-01-01" \ - "+++ $2 1970-01-01" -} - -# Arrange not to let diff or cmp operate on /dev/null, -# since on some systems (at least OSF/1 5.1), that doesn't work. -# When there are not two arguments, or no argument is /dev/null, return 2. -# When one argument is /dev/null and the other is not empty, -# cat the nonempty file to stderr and return 1. -# Otherwise, return 0. -compare_dev_null_ () -{ - test $# = 2 || return 2 - - if test "x$1" = x/dev/null; then - test -s "$2" || return 0 - emit_diff_u_header_ "$@"; sed 's/^/+/' "$2" - return 1 - fi - - if test "x$2" = x/dev/null; then - test -s "$1" || return 0 - emit_diff_u_header_ "$@"; sed 's/^/-/' "$1" - return 1 - fi - - return 2 -} - -for diff_opt_ in -u -U3 -c '' no; do - test "$diff_opt_" != no && - diff_out_=`exec 2>/dev/null; diff $diff_opt_ "$0" "$0" < /dev/null` && - break -done -if test "$diff_opt_" != no; then - if test -z "$diff_out_"; then - compare_ () { diff $diff_opt_ "$@"; } - else - compare_ () - { - # If no differences were found, AIX and HP-UX 'diff' produce output - # like "No differences encountered". Hide this output. - diff $diff_opt_ "$@" > diff.out - diff_status_=$? - test $diff_status_ -eq 0 || cat diff.out || diff_status_=2 - rm -f diff.out || diff_status_=2 - return $diff_status_ - } - fi -elif cmp -s /dev/null /dev/null 2>/dev/null; then - compare_ () { cmp -s "$@"; } -else - compare_ () { cmp "$@"; } -fi - -# Usage: compare EXPECTED ACTUAL -# -# Given compare_dev_null_'s preprocessing, defer to compare_ if 2 or more. -# Otherwise, propagate $? to caller: any diffs have already been printed. -compare () -{ - # This looks like it can be factored to use a simple "case $?" - # after unchecked compare_dev_null_ invocation, but that would - # fail in a "set -e" environment. - if compare_dev_null_ "$@"; then - return 0 - else - case $? in - 1) return 1;; - *) compare_ "$@";; - esac - fi -} - -# An arbitrary prefix to help distinguish test directories. -testdir_prefix_ () { printf gt; } - -# Run the user-overridable cleanup_ function, remove the temporary -# directory and exit with the incoming value of $?. -remove_tmp_ () -{ - __st=$? - cleanup_ - # cd out of the directory we're about to remove - cd "$initial_cwd_" || cd / || cd /tmp - chmod -R u+rwx "$test_dir_" - # If removal fails and exit status was to be 0, then change it to 1. - rm -rf "$test_dir_" || { test $__st = 0 && __st=1; } - exit $__st -} - -# Given a directory name, DIR, if every entry in it that matches *.exe -# contains only the specified bytes (see the case stmt below), then print -# a space-separated list of those names and return 0. Otherwise, don't -# print anything and return 1. Naming constraints apply also to DIR. -find_exe_basenames_ () -{ - feb_dir_=$1 - feb_fail_=0 - feb_result_= - feb_sp_= - for feb_file_ in $feb_dir_/*.exe; do - # If there was no *.exe file, or there existed a file named "*.exe" that - # was deleted between the above glob expansion and the existence test - # below, just skip it. - test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \ - && continue - # Exempt [.exe, since we can't create a function by that name, yet - # we can't invoke [ by PATH search anyways due to shell builtins. - test "x$feb_file_" = "x$feb_dir_/[.exe" && continue - case $feb_file_ in - *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;; - *) # Remove leading file name components as well as the .exe suffix. - feb_file_=${feb_file_##*/} - feb_file_=${feb_file_%.exe} - feb_result_="$feb_result_$feb_sp_$feb_file_";; - esac - feb_sp_=' ' - done - test $feb_fail_ = 0 && printf %s "$feb_result_" - return $feb_fail_ -} - -# Consider the files in directory, $1. -# For each file name of the form PROG.exe, create an alias named -# PROG that simply invokes PROG.exe, then return 0. If any selected -# file name or the directory name, $1, contains an unexpected character, -# define no alias and return 1. -create_exe_shims_ () -{ - case $EXEEXT in - '') return 0 ;; - .exe) ;; - *) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;; - esac - - base_names_=`find_exe_basenames_ $1` \ - || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 0; } - - if test -n "$base_names_"; then - for base_ in $base_names_; do - alias "$base_"="$base_$EXEEXT" - done - fi - - return 0 -} - -# Use this function to prepend to PATH an absolute name for each -# specified, possibly-$initial_cwd_-relative, directory. -path_prepend_ () -{ - while test $# != 0; do - path_dir_=$1 - case $path_dir_ in - '') fail_ "invalid path dir: '$1'";; - /*) abs_path_dir_=$path_dir_;; - *) abs_path_dir_=$initial_cwd_/$path_dir_;; - esac - case $abs_path_dir_ in - *:*) fail_ "invalid path dir: '$abs_path_dir_'";; - esac - PATH="$abs_path_dir_:$PATH" - - # Create an alias, FOO, for each FOO.exe in this directory. - create_exe_shims_ "$abs_path_dir_" \ - || fail_ "something failed (above): $abs_path_dir_" - shift - done - export PATH -} - -setup_ () -{ - if test "$VERBOSE" = yes; then - # Test whether set -x may cause the selected shell to corrupt an - # application's stderr. Many do, including zsh-4.3.10 and the /bin/sh - # from SunOS 5.11, OpenBSD 4.7 and Irix 5.x and 6.5. - # If enabling verbose output this way would cause trouble, simply - # issue a warning and refrain. - if $gl_set_x_corrupts_stderr_; then - warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr" - else - set -x - fi - fi - - initial_cwd_=$PWD - - pfx_=`testdir_prefix_` - test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ - || fail_ "failed to create temporary directory in $initial_cwd_" - cd "$test_dir_" || fail_ "failed to cd to temporary directory" - - # As autoconf-generated configure scripts do, ensure that IFS - # is defined initially, so that saving and restoring $IFS works. - gl_init_sh_nl_=' -' - IFS=" "" $gl_init_sh_nl_" - - # This trap statement, along with a trap on 0 below, ensure that the - # temporary directory, $test_dir_, is removed upon exit as well as - # upon receipt of any of the listed signals. - for sig_ in 1 2 3 13 15; do - eval "trap 'Exit $(expr $sig_ + 128)' $sig_" - done -} - -# Create a temporary directory, much like mktemp -d does. -# Written by Jim Meyering. -# -# Usage: mktempd_ /tmp phoey.XXXXXXXXXX -# -# First, try to use the mktemp program. -# Failing that, we'll roll our own mktemp-like function: -# - try to get random bytes from /dev/urandom -# - failing that, generate output from a combination of quickly-varying -# sources and gzip. Ignore non-varying gzip header, and extract -# "random" bits from there. -# - given those bits, map to file-name bytes using tr, and try to create -# the desired directory. -# - make only $MAX_TRIES_ attempts - -# Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. -rand_bytes_ () -{ - n_=$1 - - # Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first? - # But if they have openssl, they probably have mktemp, too. - - chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 - dev_rand_=/dev/urandom - if test -r "$dev_rand_"; then - # Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194. - dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \ - | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ - return - fi - - n_plus_50_=`expr $n_ + 50` - cmds_='date; date +%N; free; who -a; w; ps auxww; ps ef; netstat -n' - data_=` (eval "$cmds_") 2>&1 | gzip ` - - # Ensure that $data_ has length at least 50+$n_ - while :; do - len_=`echo "$data_"|wc -c` - test $n_plus_50_ -le $len_ && break; - data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip ` - done - - echo "$data_" \ - | dd bs=1 skip=50 count=$n_ 2>/dev/null \ - | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ -} - -mktempd_ () -{ - case $# in - 2);; - *) fail_ "Usage: mktempd_ DIR TEMPLATE";; - esac - - destdir_=$1 - template_=$2 - - MAX_TRIES_=4 - - # Disallow any trailing slash on specified destdir: - # it would subvert the post-mktemp "case"-based destdir test. - case $destdir_ in - / | //) destdir_slash_=$destdir;; - */) fail_ "invalid destination dir: remove trailing slash(es)";; - *) destdir_slash_=$destdir_/;; - esac - - case $template_ in - *XXXX) ;; - *) fail_ \ - "invalid template: $template_ (must have a suffix of at least 4 X's)";; - esac - - # First, try to use mktemp. - d=`unset TMPDIR; { mktemp -d -t -p "$destdir_" "$template_"; } 2>/dev/null` && - - # The resulting name must be in the specified directory. - case $d in "$destdir_slash_"*) :;; *) false;; esac && - - # It must have created the directory. - test -d "$d" && - - # It must have 0700 permissions. Handle sticky "S" bits. - perms=`ls -dgo "$d" 2>/dev/null` && - case $perms in drwx--[-S]---*) :;; *) false;; esac && { - echo "$d" - return - } - - # If we reach this point, we'll have to create a directory manually. - - # Get a copy of the template without its suffix of X's. - base_template_=`echo "$template_"|sed 's/XX*$//'` - - # Calculate how many X's we've just removed. - template_length_=`echo "$template_" | wc -c` - nx_=`echo "$base_template_" | wc -c` - nx_=`expr $template_length_ - $nx_` - - err_= - i_=1 - while :; do - X_=`rand_bytes_ $nx_` - candidate_dir_="$destdir_slash_$base_template_$X_" - err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \ - && { echo "$candidate_dir_"; return; } - test $MAX_TRIES_ -le $i_ && break; - i_=`expr $i_ + 1` - done - fail_ "$err_" -} - -# If you want to override the testdir_prefix_ function, -# or to add more utility functions, use this file. -test -f "$srcdir/init.cfg" \ - && . "$srcdir/init.cfg" - -setup_ "$@" -# This trap is here, rather than in the setup_ function, because some -# shells run the exit trap at shell function exit, rather than script exit. -trap remove_tmp_ 0 diff --git a/gl/tests/inttypes.in.h b/gl/tests/inttypes.in.h deleted file mode 100644 index ed09db6e86..0000000000 --- a/gl/tests/inttypes.in.h +++ /dev/null @@ -1,1144 +0,0 @@ -/* Copyright (C) 2006-2016 Free Software Foundation, Inc. - Written by Paul Eggert, Bruno Haible, Derek Price. - This file is part of gnulib. - - 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/>. */ - -/* - * ISO C 99 <inttypes.h> for platforms that lack it. - * <http://www.opengroup.org/susv3xbd/inttypes.h.html> - */ - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -/* Include the original <inttypes.h> if it exists, and if this file - has not been included yet or if this file includes gnulib stdint.h - which in turn includes this file. - The include_next requires a split double-inclusion guard. */ -#if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H -# if @HAVE_INTTYPES_H@ - - /* Some pre-C++11 <stdint.h> implementations need this. */ -# if defined __cplusplus && ! defined __STDC_FORMAT_MACROS -# define __STDC_FORMAT_MACROS 1 -# endif - -# @INCLUDE_NEXT@ @NEXT_INTTYPES_H@ -# endif -#endif - -#if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H -#define INTTYPES_H - -/* Include <stdint.h> or the gnulib replacement. - But avoid namespace pollution on glibc systems. */ -#ifndef __GLIBC__ -# include <stdint.h> -#endif -/* Get CHAR_BIT. */ -#include <limits.h> -/* On mingw, __USE_MINGW_ANSI_STDIO only works if <stdio.h> is also included */ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# include <stdio.h> -#endif - -#if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX) -# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>." -#endif - -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - -/* 7.8.1 Macros for format specifiers */ - -#if defined _TNS_R_TARGET - /* Tandem NonStop R series and compatible platforms released before - July 2005 support %Ld but not %lld. */ -# define _LONG_LONG_FORMAT_PREFIX "L" -#else -# define _LONG_LONG_FORMAT_PREFIX "ll" -#endif - -#if !defined PRId8 || @PRI_MACROS_BROKEN@ -# undef PRId8 -# ifdef INT8_MAX -# define PRId8 "d" -# endif -#endif -#if !defined PRIi8 || @PRI_MACROS_BROKEN@ -# undef PRIi8 -# ifdef INT8_MAX -# define PRIi8 "i" -# endif -#endif -#if !defined PRIo8 || @PRI_MACROS_BROKEN@ -# undef PRIo8 -# ifdef UINT8_MAX -# define PRIo8 "o" -# endif -#endif -#if !defined PRIu8 || @PRI_MACROS_BROKEN@ -# undef PRIu8 -# ifdef UINT8_MAX -# define PRIu8 "u" -# endif -#endif -#if !defined PRIx8 || @PRI_MACROS_BROKEN@ -# undef PRIx8 -# ifdef UINT8_MAX -# define PRIx8 "x" -# endif -#endif -#if !defined PRIX8 || @PRI_MACROS_BROKEN@ -# undef PRIX8 -# ifdef UINT8_MAX -# define PRIX8 "X" -# endif -#endif -#if !defined PRId16 || @PRI_MACROS_BROKEN@ -# undef PRId16 -# ifdef INT16_MAX -# define PRId16 "d" -# endif -#endif -#if !defined PRIi16 || @PRI_MACROS_BROKEN@ -# undef PRIi16 -# ifdef INT16_MAX -# define PRIi16 "i" -# endif -#endif -#if !defined PRIo16 || @PRI_MACROS_BROKEN@ -# undef PRIo16 -# ifdef UINT16_MAX -# define PRIo16 "o" -# endif -#endif -#if !defined PRIu16 || @PRI_MACROS_BROKEN@ -# undef PRIu16 -# ifdef UINT16_MAX -# define PRIu16 "u" -# endif -#endif -#if !defined PRIx16 || @PRI_MACROS_BROKEN@ -# undef PRIx16 -# ifdef UINT16_MAX -# define PRIx16 "x" -# endif -#endif -#if !defined PRIX16 || @PRI_MACROS_BROKEN@ -# undef PRIX16 -# ifdef UINT16_MAX -# define PRIX16 "X" -# endif -#endif -#if !defined PRId32 || @PRI_MACROS_BROKEN@ -# undef PRId32 -# ifdef INT32_MAX -# define PRId32 "d" -# endif -#endif -#if !defined PRIi32 || @PRI_MACROS_BROKEN@ -# undef PRIi32 -# ifdef INT32_MAX -# define PRIi32 "i" -# endif -#endif -#if !defined PRIo32 || @PRI_MACROS_BROKEN@ -# undef PRIo32 -# ifdef UINT32_MAX -# define PRIo32 "o" -# endif -#endif -#if !defined PRIu32 || @PRI_MACROS_BROKEN@ -# undef PRIu32 -# ifdef UINT32_MAX -# define PRIu32 "u" -# endif -#endif -#if !defined PRIx32 || @PRI_MACROS_BROKEN@ -# undef PRIx32 -# ifdef UINT32_MAX -# define PRIx32 "x" -# endif -#endif -#if !defined PRIX32 || @PRI_MACROS_BROKEN@ -# undef PRIX32 -# ifdef UINT32_MAX -# define PRIX32 "X" -# endif -#endif -#ifdef INT64_MAX -# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@) -# define _PRI64_PREFIX "l" -# elif defined _MSC_VER || defined __MINGW32__ -# define _PRI64_PREFIX "I64" -# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX -# endif -# if !defined PRId64 || @PRI_MACROS_BROKEN@ -# undef PRId64 -# define PRId64 _PRI64_PREFIX "d" -# endif -# if !defined PRIi64 || @PRI_MACROS_BROKEN@ -# undef PRIi64 -# define PRIi64 _PRI64_PREFIX "i" -# endif -#endif -#ifdef UINT64_MAX -# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@) -# define _PRIu64_PREFIX "l" -# elif defined _MSC_VER || defined __MINGW32__ -# define _PRIu64_PREFIX "I64" -# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -# define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX -# endif -# if !defined PRIo64 || @PRI_MACROS_BROKEN@ -# undef PRIo64 -# define PRIo64 _PRIu64_PREFIX "o" -# endif -# if !defined PRIu64 || @PRI_MACROS_BROKEN@ -# undef PRIu64 -# define PRIu64 _PRIu64_PREFIX "u" -# endif -# if !defined PRIx64 || @PRI_MACROS_BROKEN@ -# undef PRIx64 -# define PRIx64 _PRIu64_PREFIX "x" -# endif -# if !defined PRIX64 || @PRI_MACROS_BROKEN@ -# undef PRIX64 -# define PRIX64 _PRIu64_PREFIX "X" -# endif -#endif - -#if !defined PRIdLEAST8 || @PRI_MACROS_BROKEN@ -# undef PRIdLEAST8 -# define PRIdLEAST8 "d" -#endif -#if !defined PRIiLEAST8 || @PRI_MACROS_BROKEN@ -# undef PRIiLEAST8 -# define PRIiLEAST8 "i" -#endif -#if !defined PRIoLEAST8 || @PRI_MACROS_BROKEN@ -# undef PRIoLEAST8 -# define PRIoLEAST8 "o" -#endif -#if !defined PRIuLEAST8 || @PRI_MACROS_BROKEN@ -# undef PRIuLEAST8 -# define PRIuLEAST8 "u" -#endif -#if !defined PRIxLEAST8 || @PRI_MACROS_BROKEN@ -# undef PRIxLEAST8 -# define PRIxLEAST8 "x" -#endif -#if !defined PRIXLEAST8 || @PRI_MACROS_BROKEN@ -# undef PRIXLEAST8 -# define PRIXLEAST8 "X" -#endif -#if !defined PRIdLEAST16 || @PRI_MACROS_BROKEN@ -# undef PRIdLEAST16 -# define PRIdLEAST16 "d" -#endif -#if !defined PRIiLEAST16 || @PRI_MACROS_BROKEN@ -# undef PRIiLEAST16 -# define PRIiLEAST16 "i" -#endif -#if !defined PRIoLEAST16 || @PRI_MACROS_BROKEN@ -# undef PRIoLEAST16 -# define PRIoLEAST16 "o" -#endif -#if !defined PRIuLEAST16 || @PRI_MACROS_BROKEN@ -# undef PRIuLEAST16 -# define PRIuLEAST16 "u" -#endif -#if !defined PRIxLEAST16 || @PRI_MACROS_BROKEN@ -# undef PRIxLEAST16 -# define PRIxLEAST16 "x" -#endif -#if !defined PRIXLEAST16 || @PRI_MACROS_BROKEN@ -# undef PRIXLEAST16 -# define PRIXLEAST16 "X" -#endif -#if !defined PRIdLEAST32 || @PRI_MACROS_BROKEN@ -# undef PRIdLEAST32 -# define PRIdLEAST32 "d" -#endif -#if !defined PRIiLEAST32 || @PRI_MACROS_BROKEN@ -# undef PRIiLEAST32 -# define PRIiLEAST32 "i" -#endif -#if !defined PRIoLEAST32 || @PRI_MACROS_BROKEN@ -# undef PRIoLEAST32 -# define PRIoLEAST32 "o" -#endif -#if !defined PRIuLEAST32 || @PRI_MACROS_BROKEN@ -# undef PRIuLEAST32 -# define PRIuLEAST32 "u" -#endif -#if !defined PRIxLEAST32 || @PRI_MACROS_BROKEN@ -# undef PRIxLEAST32 -# define PRIxLEAST32 "x" -#endif -#if !defined PRIXLEAST32 || @PRI_MACROS_BROKEN@ -# undef PRIXLEAST32 -# define PRIXLEAST32 "X" -#endif -#ifdef INT64_MAX -# if !defined PRIdLEAST64 || @PRI_MACROS_BROKEN@ -# undef PRIdLEAST64 -# define PRIdLEAST64 PRId64 -# endif -# if !defined PRIiLEAST64 || @PRI_MACROS_BROKEN@ -# undef PRIiLEAST64 -# define PRIiLEAST64 PRIi64 -# endif -#endif -#ifdef UINT64_MAX -# if !defined PRIoLEAST64 || @PRI_MACROS_BROKEN@ -# undef PRIoLEAST64 -# define PRIoLEAST64 PRIo64 -# endif -# if !defined PRIuLEAST64 || @PRI_MACROS_BROKEN@ -# undef PRIuLEAST64 -# define PRIuLEAST64 PRIu64 -# endif -# if !defined PRIxLEAST64 || @PRI_MACROS_BROKEN@ -# undef PRIxLEAST64 -# define PRIxLEAST64 PRIx64 -# endif -# if !defined PRIXLEAST64 || @PRI_MACROS_BROKEN@ -# undef PRIXLEAST64 -# define PRIXLEAST64 PRIX64 -# endif -#endif - -#if !defined PRIdFAST8 || @PRI_MACROS_BROKEN@ -# undef PRIdFAST8 -# if INT_FAST8_MAX > INT32_MAX -# define PRIdFAST8 PRId64 -# else -# define PRIdFAST8 "d" -# endif -#endif -#if !defined PRIiFAST8 || @PRI_MACROS_BROKEN@ -# undef PRIiFAST8 -# if INT_FAST8_MAX > INT32_MAX -# define PRIiFAST8 PRIi64 -# else -# define PRIiFAST8 "i" -# endif -#endif -#if !defined PRIoFAST8 || @PRI_MACROS_BROKEN@ -# undef PRIoFAST8 -# if UINT_FAST8_MAX > UINT32_MAX -# define PRIoFAST8 PRIo64 -# else -# define PRIoFAST8 "o" -# endif -#endif -#if !defined PRIuFAST8 || @PRI_MACROS_BROKEN@ -# undef PRIuFAST8 -# if UINT_FAST8_MAX > UINT32_MAX -# define PRIuFAST8 PRIu64 -# else -# define PRIuFAST8 "u" -# endif -#endif -#if !defined PRIxFAST8 || @PRI_MACROS_BROKEN@ -# undef PRIxFAST8 -# if UINT_FAST8_MAX > UINT32_MAX -# define PRIxFAST8 PRIx64 -# else -# define PRIxFAST8 "x" -# endif -#endif -#if !defined PRIXFAST8 || @PRI_MACROS_BROKEN@ -# undef PRIXFAST8 -# if UINT_FAST8_MAX > UINT32_MAX -# define PRIXFAST8 PRIX64 -# else -# define PRIXFAST8 "X" -# endif -#endif -#if !defined PRIdFAST16 || @PRI_MACROS_BROKEN@ -# undef PRIdFAST16 -# if INT_FAST16_MAX > INT32_MAX -# define PRIdFAST16 PRId64 -# else -# define PRIdFAST16 "d" -# endif -#endif -#if !defined PRIiFAST16 || @PRI_MACROS_BROKEN@ -# undef PRIiFAST16 -# if INT_FAST16_MAX > INT32_MAX -# define PRIiFAST16 PRIi64 -# else -# define PRIiFAST16 "i" -# endif -#endif -#if !defined PRIoFAST16 || @PRI_MACROS_BROKEN@ -# undef PRIoFAST16 -# if UINT_FAST16_MAX > UINT32_MAX -# define PRIoFAST16 PRIo64 -# else -# define PRIoFAST16 "o" -# endif -#endif -#if !defined PRIuFAST16 || @PRI_MACROS_BROKEN@ -# undef PRIuFAST16 -# if UINT_FAST16_MAX > UINT32_MAX -# define PRIuFAST16 PRIu64 -# else -# define PRIuFAST16 "u" -# endif -#endif -#if !defined PRIxFAST16 || @PRI_MACROS_BROKEN@ -# undef PRIxFAST16 -# if UINT_FAST16_MAX > UINT32_MAX -# define PRIxFAST16 PRIx64 -# else -# define PRIxFAST16 "x" -# endif -#endif -#if !defined PRIXFAST16 || @PRI_MACROS_BROKEN@ -# undef PRIXFAST16 -# if UINT_FAST16_MAX > UINT32_MAX -# define PRIXFAST16 PRIX64 -# else -# define PRIXFAST16 "X" -# endif -#endif -#if !defined PRIdFAST32 || @PRI_MACROS_BROKEN@ -# undef PRIdFAST32 -# if INT_FAST32_MAX > INT32_MAX -# define PRIdFAST32 PRId64 -# else -# define PRIdFAST32 "d" -# endif -#endif -#if !defined PRIiFAST32 || @PRI_MACROS_BROKEN@ -# undef PRIiFAST32 -# if INT_FAST32_MAX > INT32_MAX -# define PRIiFAST32 PRIi64 -# else -# define PRIiFAST32 "i" -# endif -#endif -#if !defined PRIoFAST32 || @PRI_MACROS_BROKEN@ -# undef PRIoFAST32 -# if UINT_FAST32_MAX > UINT32_MAX -# define PRIoFAST32 PRIo64 -# else -# define PRIoFAST32 "o" -# endif -#endif -#if !defined PRIuFAST32 || @PRI_MACROS_BROKEN@ -# undef PRIuFAST32 -# if UINT_FAST32_MAX > UINT32_MAX -# define PRIuFAST32 PRIu64 -# else -# define PRIuFAST32 "u" -# endif -#endif -#if !defined PRIxFAST32 || @PRI_MACROS_BROKEN@ -# undef PRIxFAST32 -# if UINT_FAST32_MAX > UINT32_MAX -# define PRIxFAST32 PRIx64 -# else -# define PRIxFAST32 "x" -# endif -#endif -#if !defined PRIXFAST32 || @PRI_MACROS_BROKEN@ -# undef PRIXFAST32 -# if UINT_FAST32_MAX > UINT32_MAX -# define PRIXFAST32 PRIX64 -# else -# define PRIXFAST32 "X" -# endif -#endif -#ifdef INT64_MAX -# if !defined PRIdFAST64 || @PRI_MACROS_BROKEN@ -# undef PRIdFAST64 -# define PRIdFAST64 PRId64 -# endif -# if !defined PRIiFAST64 || @PRI_MACROS_BROKEN@ -# undef PRIiFAST64 -# define PRIiFAST64 PRIi64 -# endif -#endif -#ifdef UINT64_MAX -# if !defined PRIoFAST64 || @PRI_MACROS_BROKEN@ -# undef PRIoFAST64 -# define PRIoFAST64 PRIo64 -# endif -# if !defined PRIuFAST64 || @PRI_MACROS_BROKEN@ -# undef PRIuFAST64 -# define PRIuFAST64 PRIu64 -# endif -# if !defined PRIxFAST64 || @PRI_MACROS_BROKEN@ -# undef PRIxFAST64 -# define PRIxFAST64 PRIx64 -# endif -# if !defined PRIXFAST64 || @PRI_MACROS_BROKEN@ -# undef PRIXFAST64 -# define PRIXFAST64 PRIX64 -# endif -#endif - -#if !defined PRIdMAX || @PRI_MACROS_BROKEN@ -# undef PRIdMAX -# if @INT32_MAX_LT_INTMAX_MAX@ -# define PRIdMAX PRId64 -# else -# define PRIdMAX "ld" -# endif -#endif -#if !defined PRIiMAX || @PRI_MACROS_BROKEN@ -# undef PRIiMAX -# if @INT32_MAX_LT_INTMAX_MAX@ -# define PRIiMAX PRIi64 -# else -# define PRIiMAX "li" -# endif -#endif -#if !defined PRIoMAX || @PRI_MACROS_BROKEN@ -# undef PRIoMAX -# if @UINT32_MAX_LT_UINTMAX_MAX@ -# define PRIoMAX PRIo64 -# else -# define PRIoMAX "lo" -# endif -#endif -#if !defined PRIuMAX || @PRI_MACROS_BROKEN@ -# undef PRIuMAX -# if @UINT32_MAX_LT_UINTMAX_MAX@ -# define PRIuMAX PRIu64 -# else -# define PRIuMAX "lu" -# endif -#endif -#if !defined PRIxMAX || @PRI_MACROS_BROKEN@ -# undef PRIxMAX -# if @UINT32_MAX_LT_UINTMAX_MAX@ -# define PRIxMAX PRIx64 -# else -# define PRIxMAX "lx" -# endif -#endif -#if !defined PRIXMAX || @PRI_MACROS_BROKEN@ -# undef PRIXMAX -# if @UINT32_MAX_LT_UINTMAX_MAX@ -# define PRIXMAX PRIX64 -# else -# define PRIXMAX "lX" -# endif -#endif - -#if !defined PRIdPTR || @PRI_MACROS_BROKEN@ -# undef PRIdPTR -# ifdef INTPTR_MAX -# define PRIdPTR @PRIPTR_PREFIX@ "d" -# endif -#endif -#if !defined PRIiPTR || @PRI_MACROS_BROKEN@ -# undef PRIiPTR -# ifdef INTPTR_MAX -# define PRIiPTR @PRIPTR_PREFIX@ "i" -# endif -#endif -#if !defined PRIoPTR || @PRI_MACROS_BROKEN@ -# undef PRIoPTR -# ifdef UINTPTR_MAX -# define PRIoPTR @PRIPTR_PREFIX@ "o" -# endif -#endif -#if !defined PRIuPTR || @PRI_MACROS_BROKEN@ -# undef PRIuPTR -# ifdef UINTPTR_MAX -# define PRIuPTR @PRIPTR_PREFIX@ "u" -# endif -#endif -#if !defined PRIxPTR || @PRI_MACROS_BROKEN@ -# undef PRIxPTR -# ifdef UINTPTR_MAX -# define PRIxPTR @PRIPTR_PREFIX@ "x" -# endif -#endif -#if !defined PRIXPTR || @PRI_MACROS_BROKEN@ -# undef PRIXPTR -# ifdef UINTPTR_MAX -# define PRIXPTR @PRIPTR_PREFIX@ "X" -# endif -#endif - -#if !defined SCNd8 || @PRI_MACROS_BROKEN@ -# undef SCNd8 -# ifdef INT8_MAX -# define SCNd8 "hhd" -# endif -#endif -#if !defined SCNi8 || @PRI_MACROS_BROKEN@ -# undef SCNi8 -# ifdef INT8_MAX -# define SCNi8 "hhi" -# endif -#endif -#if !defined SCNo8 || @PRI_MACROS_BROKEN@ -# undef SCNo8 -# ifdef UINT8_MAX -# define SCNo8 "hho" -# endif -#endif -#if !defined SCNu8 || @PRI_MACROS_BROKEN@ -# undef SCNu8 -# ifdef UINT8_MAX -# define SCNu8 "hhu" -# endif -#endif -#if !defined SCNx8 || @PRI_MACROS_BROKEN@ -# undef SCNx8 -# ifdef UINT8_MAX -# define SCNx8 "hhx" -# endif -#endif -#if !defined SCNd16 || @PRI_MACROS_BROKEN@ -# undef SCNd16 -# ifdef INT16_MAX -# define SCNd16 "hd" -# endif -#endif -#if !defined SCNi16 || @PRI_MACROS_BROKEN@ -# undef SCNi16 -# ifdef INT16_MAX -# define SCNi16 "hi" -# endif -#endif -#if !defined SCNo16 || @PRI_MACROS_BROKEN@ -# undef SCNo16 -# ifdef UINT16_MAX -# define SCNo16 "ho" -# endif -#endif -#if !defined SCNu16 || @PRI_MACROS_BROKEN@ -# undef SCNu16 -# ifdef UINT16_MAX -# define SCNu16 "hu" -# endif -#endif -#if !defined SCNx16 || @PRI_MACROS_BROKEN@ -# undef SCNx16 -# ifdef UINT16_MAX -# define SCNx16 "hx" -# endif -#endif -#if !defined SCNd32 || @PRI_MACROS_BROKEN@ -# undef SCNd32 -# ifdef INT32_MAX -# define SCNd32 "d" -# endif -#endif -#if !defined SCNi32 || @PRI_MACROS_BROKEN@ -# undef SCNi32 -# ifdef INT32_MAX -# define SCNi32 "i" -# endif -#endif -#if !defined SCNo32 || @PRI_MACROS_BROKEN@ -# undef SCNo32 -# ifdef UINT32_MAX -# define SCNo32 "o" -# endif -#endif -#if !defined SCNu32 || @PRI_MACROS_BROKEN@ -# undef SCNu32 -# ifdef UINT32_MAX -# define SCNu32 "u" -# endif -#endif -#if !defined SCNx32 || @PRI_MACROS_BROKEN@ -# undef SCNx32 -# ifdef UINT32_MAX -# define SCNx32 "x" -# endif -#endif -#ifdef INT64_MAX -# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@) -# define _SCN64_PREFIX "l" -# elif defined _MSC_VER || defined __MINGW32__ -# define _SCN64_PREFIX "I64" -# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX -# endif -# if !defined SCNd64 || @PRI_MACROS_BROKEN@ -# undef SCNd64 -# define SCNd64 _SCN64_PREFIX "d" -# endif -# if !defined SCNi64 || @PRI_MACROS_BROKEN@ -# undef SCNi64 -# define SCNi64 _SCN64_PREFIX "i" -# endif -#endif -#ifdef UINT64_MAX -# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@) -# define _SCNu64_PREFIX "l" -# elif defined _MSC_VER || defined __MINGW32__ -# define _SCNu64_PREFIX "I64" -# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -# define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX -# endif -# if !defined SCNo64 || @PRI_MACROS_BROKEN@ -# undef SCNo64 -# define SCNo64 _SCNu64_PREFIX "o" -# endif -# if !defined SCNu64 || @PRI_MACROS_BROKEN@ -# undef SCNu64 -# define SCNu64 _SCNu64_PREFIX "u" -# endif -# if !defined SCNx64 || @PRI_MACROS_BROKEN@ -# undef SCNx64 -# define SCNx64 _SCNu64_PREFIX "x" -# endif -#endif - -#if !defined SCNdLEAST8 || @PRI_MACROS_BROKEN@ -# undef SCNdLEAST8 -# define SCNdLEAST8 "hhd" -#endif -#if !defined SCNiLEAST8 || @PRI_MACROS_BROKEN@ -# undef SCNiLEAST8 -# define SCNiLEAST8 "hhi" -#endif -#if !defined SCNoLEAST8 || @PRI_MACROS_BROKEN@ -# undef SCNoLEAST8 -# define SCNoLEAST8 "hho" -#endif -#if !defined SCNuLEAST8 || @PRI_MACROS_BROKEN@ -# undef SCNuLEAST8 -# define SCNuLEAST8 "hhu" -#endif -#if !defined SCNxLEAST8 || @PRI_MACROS_BROKEN@ -# undef SCNxLEAST8 -# define SCNxLEAST8 "hhx" -#endif -#if !defined SCNdLEAST16 || @PRI_MACROS_BROKEN@ -# undef SCNdLEAST16 -# define SCNdLEAST16 "hd" -#endif -#if !defined SCNiLEAST16 || @PRI_MACROS_BROKEN@ -# undef SCNiLEAST16 -# define SCNiLEAST16 "hi" -#endif -#if !defined SCNoLEAST16 || @PRI_MACROS_BROKEN@ -# undef SCNoLEAST16 -# define SCNoLEAST16 "ho" -#endif -#if !defined SCNuLEAST16 || @PRI_MACROS_BROKEN@ -# undef SCNuLEAST16 -# define SCNuLEAST16 "hu" -#endif -#if !defined SCNxLEAST16 || @PRI_MACROS_BROKEN@ -# undef SCNxLEAST16 -# define SCNxLEAST16 "hx" -#endif -#if !defined SCNdLEAST32 || @PRI_MACROS_BROKEN@ -# undef SCNdLEAST32 -# define SCNdLEAST32 "d" -#endif -#if !defined SCNiLEAST32 || @PRI_MACROS_BROKEN@ -# undef SCNiLEAST32 -# define SCNiLEAST32 "i" -#endif -#if !defined SCNoLEAST32 || @PRI_MACROS_BROKEN@ -# undef SCNoLEAST32 -# define SCNoLEAST32 "o" -#endif -#if !defined SCNuLEAST32 || @PRI_MACROS_BROKEN@ -# undef SCNuLEAST32 -# define SCNuLEAST32 "u" -#endif -#if !defined SCNxLEAST32 || @PRI_MACROS_BROKEN@ -# undef SCNxLEAST32 -# define SCNxLEAST32 "x" -#endif -#ifdef INT64_MAX -# if !defined SCNdLEAST64 || @PRI_MACROS_BROKEN@ -# undef SCNdLEAST64 -# define SCNdLEAST64 SCNd64 -# endif -# if !defined SCNiLEAST64 || @PRI_MACROS_BROKEN@ -# undef SCNiLEAST64 -# define SCNiLEAST64 SCNi64 -# endif -#endif -#ifdef UINT64_MAX -# if !defined SCNoLEAST64 || @PRI_MACROS_BROKEN@ -# undef SCNoLEAST64 -# define SCNoLEAST64 SCNo64 -# endif -# if !defined SCNuLEAST64 || @PRI_MACROS_BROKEN@ -# undef SCNuLEAST64 -# define SCNuLEAST64 SCNu64 -# endif -# if !defined SCNxLEAST64 || @PRI_MACROS_BROKEN@ -# undef SCNxLEAST64 -# define SCNxLEAST64 SCNx64 -# endif -#endif - -#if !defined SCNdFAST8 || @PRI_MACROS_BROKEN@ -# undef SCNdFAST8 -# if INT_FAST8_MAX > INT32_MAX -# define SCNdFAST8 SCNd64 -# elif INT_FAST8_MAX == 0x7fff -# define SCNdFAST8 "hd" -# elif INT_FAST8_MAX == 0x7f -# define SCNdFAST8 "hhd" -# else -# define SCNdFAST8 "d" -# endif -#endif -#if !defined SCNiFAST8 || @PRI_MACROS_BROKEN@ -# undef SCNiFAST8 -# if INT_FAST8_MAX > INT32_MAX -# define SCNiFAST8 SCNi64 -# elif INT_FAST8_MAX == 0x7fff -# define SCNiFAST8 "hi" -# elif INT_FAST8_MAX == 0x7f -# define SCNiFAST8 "hhi" -# else -# define SCNiFAST8 "i" -# endif -#endif -#if !defined SCNoFAST8 || @PRI_MACROS_BROKEN@ -# undef SCNoFAST8 -# if UINT_FAST8_MAX > UINT32_MAX -# define SCNoFAST8 SCNo64 -# elif UINT_FAST8_MAX == 0xffff -# define SCNoFAST8 "ho" -# elif UINT_FAST8_MAX == 0xff -# define SCNoFAST8 "hho" -# else -# define SCNoFAST8 "o" -# endif -#endif -#if !defined SCNuFAST8 || @PRI_MACROS_BROKEN@ -# undef SCNuFAST8 -# if UINT_FAST8_MAX > UINT32_MAX -# define SCNuFAST8 SCNu64 -# elif UINT_FAST8_MAX == 0xffff -# define SCNuFAST8 "hu" -# elif UINT_FAST8_MAX == 0xff -# define SCNuFAST8 "hhu" -# else -# define SCNuFAST8 "u" -# endif -#endif -#if !defined SCNxFAST8 || @PRI_MACROS_BROKEN@ -# undef SCNxFAST8 -# if UINT_FAST8_MAX > UINT32_MAX -# define SCNxFAST8 SCNx64 -# elif UINT_FAST8_MAX == 0xffff -# define SCNxFAST8 "hx" -# elif UINT_FAST8_MAX == 0xff -# define SCNxFAST8 "hhx" -# else -# define SCNxFAST8 "x" -# endif -#endif -#if !defined SCNdFAST16 || @PRI_MACROS_BROKEN@ -# undef SCNdFAST16 -# if INT_FAST16_MAX > INT32_MAX -# define SCNdFAST16 SCNd64 -# elif INT_FAST16_MAX == 0x7fff -# define SCNdFAST16 "hd" -# else -# define SCNdFAST16 "d" -# endif -#endif -#if !defined SCNiFAST16 || @PRI_MACROS_BROKEN@ -# undef SCNiFAST16 -# if INT_FAST16_MAX > INT32_MAX -# define SCNiFAST16 SCNi64 -# elif INT_FAST16_MAX == 0x7fff -# define SCNiFAST16 "hi" -# else -# define SCNiFAST16 "i" -# endif -#endif -#if !defined SCNoFAST16 || @PRI_MACROS_BROKEN@ -# undef SCNoFAST16 -# if UINT_FAST16_MAX > UINT32_MAX -# define SCNoFAST16 SCNo64 -# elif UINT_FAST16_MAX == 0xffff -# define SCNoFAST16 "ho" -# else -# define SCNoFAST16 "o" -# endif -#endif -#if !defined SCNuFAST16 || @PRI_MACROS_BROKEN@ -# undef SCNuFAST16 -# if UINT_FAST16_MAX > UINT32_MAX -# define SCNuFAST16 SCNu64 -# elif UINT_FAST16_MAX == 0xffff -# define SCNuFAST16 "hu" -# else -# define SCNuFAST16 "u" -# endif -#endif -#if !defined SCNxFAST16 || @PRI_MACROS_BROKEN@ -# undef SCNxFAST16 -# if UINT_FAST16_MAX > UINT32_MAX -# define SCNxFAST16 SCNx64 -# elif UINT_FAST16_MAX == 0xffff -# define SCNxFAST16 "hx" -# else -# define SCNxFAST16 "x" -# endif -#endif -#if !defined SCNdFAST32 || @PRI_MACROS_BROKEN@ -# undef SCNdFAST32 -# if INT_FAST32_MAX > INT32_MAX -# define SCNdFAST32 SCNd64 -# else -# define SCNdFAST32 "d" -# endif -#endif -#if !defined SCNiFAST32 || @PRI_MACROS_BROKEN@ -# undef SCNiFAST32 -# if INT_FAST32_MAX > INT32_MAX -# define SCNiFAST32 SCNi64 -# else -# define SCNiFAST32 "i" -# endif -#endif -#if !defined SCNoFAST32 || @PRI_MACROS_BROKEN@ -# undef SCNoFAST32 -# if UINT_FAST32_MAX > UINT32_MAX -# define SCNoFAST32 SCNo64 -# else -# define SCNoFAST32 "o" -# endif -#endif -#if !defined SCNuFAST32 || @PRI_MACROS_BROKEN@ -# undef SCNuFAST32 -# if UINT_FAST32_MAX > UINT32_MAX -# define SCNuFAST32 SCNu64 -# else -# define SCNuFAST32 "u" -# endif -#endif -#if !defined SCNxFAST32 || @PRI_MACROS_BROKEN@ -# undef SCNxFAST32 -# if UINT_FAST32_MAX > UINT32_MAX -# define SCNxFAST32 SCNx64 -# else -# define SCNxFAST32 "x" -# endif -#endif -#ifdef INT64_MAX -# if !defined SCNdFAST64 || @PRI_MACROS_BROKEN@ -# undef SCNdFAST64 -# define SCNdFAST64 SCNd64 -# endif -# if !defined SCNiFAST64 || @PRI_MACROS_BROKEN@ -# undef SCNiFAST64 -# define SCNiFAST64 SCNi64 -# endif -#endif -#ifdef UINT64_MAX -# if !defined SCNoFAST64 || @PRI_MACROS_BROKEN@ -# undef SCNoFAST64 -# define SCNoFAST64 SCNo64 -# endif -# if !defined SCNuFAST64 || @PRI_MACROS_BROKEN@ -# undef SCNuFAST64 -# define SCNuFAST64 SCNu64 -# endif -# if !defined SCNxFAST64 || @PRI_MACROS_BROKEN@ -# undef SCNxFAST64 -# define SCNxFAST64 SCNx64 -# endif -#endif - -#if !defined SCNdMAX || @PRI_MACROS_BROKEN@ -# undef SCNdMAX -# if @INT32_MAX_LT_INTMAX_MAX@ -# define SCNdMAX SCNd64 -# else -# define SCNdMAX "ld" -# endif -#endif -#if !defined SCNiMAX || @PRI_MACROS_BROKEN@ -# undef SCNiMAX -# if @INT32_MAX_LT_INTMAX_MAX@ -# define SCNiMAX SCNi64 -# else -# define SCNiMAX "li" -# endif -#endif -#if !defined SCNoMAX || @PRI_MACROS_BROKEN@ -# undef SCNoMAX -# if @UINT32_MAX_LT_UINTMAX_MAX@ -# define SCNoMAX SCNo64 -# else -# define SCNoMAX "lo" -# endif -#endif -#if !defined SCNuMAX || @PRI_MACROS_BROKEN@ -# undef SCNuMAX -# if @UINT32_MAX_LT_UINTMAX_MAX@ -# define SCNuMAX SCNu64 -# else -# define SCNuMAX "lu" -# endif -#endif -#if !defined SCNxMAX || @PRI_MACROS_BROKEN@ -# undef SCNxMAX -# if @UINT32_MAX_LT_UINTMAX_MAX@ -# define SCNxMAX SCNx64 -# else -# define SCNxMAX "lx" -# endif -#endif - -#if !defined SCNdPTR || @PRI_MACROS_BROKEN@ -# undef SCNdPTR -# ifdef INTPTR_MAX -# define SCNdPTR @PRIPTR_PREFIX@ "d" -# endif -#endif -#if !defined SCNiPTR || @PRI_MACROS_BROKEN@ -# undef SCNiPTR -# ifdef INTPTR_MAX -# define SCNiPTR @PRIPTR_PREFIX@ "i" -# endif -#endif -#if !defined SCNoPTR || @PRI_MACROS_BROKEN@ -# undef SCNoPTR -# ifdef UINTPTR_MAX -# define SCNoPTR @PRIPTR_PREFIX@ "o" -# endif -#endif -#if !defined SCNuPTR || @PRI_MACROS_BROKEN@ -# undef SCNuPTR -# ifdef UINTPTR_MAX -# define SCNuPTR @PRIPTR_PREFIX@ "u" -# endif -#endif -#if !defined SCNxPTR || @PRI_MACROS_BROKEN@ -# undef SCNxPTR -# ifdef UINTPTR_MAX -# define SCNxPTR @PRIPTR_PREFIX@ "x" -# endif -#endif - -/* 7.8.2 Functions for greatest-width integer types */ - -#ifdef __cplusplus -extern "C" { -#endif - -#if @GNULIB_IMAXABS@ -# if !@HAVE_DECL_IMAXABS@ -extern intmax_t imaxabs (intmax_t); -# endif -#elif defined GNULIB_POSIXCHECK -# undef imaxabs -# if HAVE_RAW_DECL_IMAXABS -_GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - " - "use gnulib module imaxabs for portability"); -# endif -#endif - -#if @GNULIB_IMAXDIV@ -# if !@HAVE_DECL_IMAXDIV@ -# if !GNULIB_defined_imaxdiv_t -typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t; -# define GNULIB_defined_imaxdiv_t 1 -# endif -extern imaxdiv_t imaxdiv (intmax_t, intmax_t); -# endif -#elif defined GNULIB_POSIXCHECK -# undef imaxdiv -# if HAVE_RAW_DECL_IMAXDIV -_GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - " - "use gnulib module imaxdiv for portability"); -# endif -#endif - -#if @GNULIB_STRTOIMAX@ -# if @REPLACE_STRTOIMAX@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef strtoimax -# define strtoimax rpl_strtoimax -# endif -_GL_FUNCDECL_RPL (strtoimax, intmax_t, - (const char *, char **, int) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strtoimax, intmax_t, (const char *, char **, int)); -# else -# if !@HAVE_DECL_STRTOIMAX@ -# undef strtoimax -_GL_FUNCDECL_SYS (strtoimax, intmax_t, - (const char *, char **, int) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (strtoimax, intmax_t, (const char *, char **, int)); -# endif -_GL_CXXALIASWARN (strtoimax); -#elif defined GNULIB_POSIXCHECK -# undef strtoimax -# if HAVE_RAW_DECL_STRTOIMAX -_GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - " - "use gnulib module strtoimax for portability"); -# endif -#endif - -#if @GNULIB_STRTOUMAX@ -# if @REPLACE_STRTOUMAX@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef strtoumax -# define strtoumax rpl_strtoumax -# endif -_GL_FUNCDECL_RPL (strtoumax, uintmax_t, - (const char *, char **, int) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strtoumax, uintmax_t, (const char *, char **, int)); -# else -# if !@HAVE_DECL_STRTOUMAX@ -# undef strtoumax -_GL_FUNCDECL_SYS (strtoumax, uintmax_t, - (const char *, char **, int) _GL_ARG_NONNULL ((1))); -# endif -_GL_CXXALIAS_SYS (strtoumax, uintmax_t, (const char *, char **, int)); -# endif -_GL_CXXALIASWARN (strtoumax); -#elif defined GNULIB_POSIXCHECK -# undef strtoumax -# if HAVE_RAW_DECL_STRTOUMAX -_GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - " - "use gnulib module strtoumax for portability"); -# endif -#endif - -/* Don't bother defining or declaring wcstoimax and wcstoumax, since - wide-character functions like this are hardly ever useful. */ - -#ifdef __cplusplus -} -#endif - -#endif /* !defined INTTYPES_H && !defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H */ diff --git a/gl/tests/macros.h b/gl/tests/macros.h deleted file mode 100644 index 578bfe737e..0000000000 --- a/gl/tests/macros.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Common macros used by gnulib tests. - Copyright (C) 2006-2016 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/>. */ - - -/* This file contains macros that are used by many gnulib tests. - Put here only frequently used macros, say, used by 10 tests or more. */ - -#include <stdio.h> -#include <stdlib.h> - -/* Define ASSERT_STREAM before including this file if ASSERT must - target a stream other than stderr. */ -#ifndef ASSERT_STREAM -# define ASSERT_STREAM stderr -#endif - -/* ASSERT (condition); - verifies that the specified condition is fulfilled. If not, a message - is printed to ASSERT_STREAM if defined (defaulting to stderr if - undefined) and the program is terminated with an error code. - - This macro has the following properties: - - The programmer specifies the expected condition, not the failure - condition. This simplifies thinking. - - The condition is tested always, regardless of compilation flags. - (Unlike the macro from <assert.h>.) - - On Unix platforms, the tester can debug the test program with a - debugger (provided core dumps are enabled: "ulimit -c unlimited"). - - For the sake of platforms where no debugger is available (such as - some mingw systems), an error message is printed on the error - stream that includes the source location of the ASSERT invocation. - */ -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (ASSERT_STREAM, "%s:%d: assertion '%s' failed\n", \ - __FILE__, __LINE__, #expr); \ - fflush (ASSERT_STREAM); \ - abort (); \ - } \ - } \ - while (0) - -/* SIZEOF (array) - returns the number of elements of an array. It works for arrays that are - declared outside functions and for local variables of array type. It does - *not* work for function parameters of array type, because they are actually - parameters of pointer type. */ -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) - -/* STREQ (str1, str2) - Return true if two strings compare equal. */ -#define STREQ(a, b) (strcmp (a, b) == 0) - -/* Some numbers in the interval [0,1). */ -extern const float randomf[1000]; -extern const double randomd[1000]; -extern const long double randoml[1000]; diff --git a/gl/tests/signature.h b/gl/tests/signature.h deleted file mode 100644 index 2df806788a..0000000000 --- a/gl/tests/signature.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Macro for checking that a function declaration is compliant. - Copyright (C) 2009-2016 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/>. */ - -#ifndef SIGNATURE_CHECK - -/* Check that the function FN takes the specified arguments ARGS with - a return type of RET. This header is designed to be included after - <config.h> and the one system header that is supposed to contain - the function being checked, but prior to any other system headers - that are necessary for the unit test. Therefore, this file does - not include any system headers, nor reference anything outside of - the macro arguments. For an example, if foo.h should provide: - - extern int foo (char, float); - - then the unit test named test-foo.c would start out with: - - #include <config.h> - #include <foo.h> - #include "signature.h" - SIGNATURE_CHECK (foo, int, (char, float)); - #include <other.h> - ... -*/ -# define SIGNATURE_CHECK(fn, ret, args) \ - SIGNATURE_CHECK1 (fn, ret, args, __LINE__) - -/* Necessary to allow multiple SIGNATURE_CHECK lines in a unit test. - Note that the checks must not occupy the same line. */ -# define SIGNATURE_CHECK1(fn, ret, args, id) \ - SIGNATURE_CHECK2 (fn, ret, args, id) /* macroexpand line */ -# define SIGNATURE_CHECK2(fn, ret, args, id) \ - static ret (* _GL_UNUSED signature_check ## id) args = fn - -#endif /* SIGNATURE_CHECK */ diff --git a/gl/tests/test-alloca-opt.c b/gl/tests/test-alloca-opt.c deleted file mode 100644 index b9aaa4a147..0000000000 --- a/gl/tests/test-alloca-opt.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Test of optional automatic memory allocation. - Copyright (C) 2005, 2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <alloca.h> - -#if HAVE_ALLOCA - -static void -do_allocation (int n) -{ - void *ptr = alloca (n); - (void) ptr; -} - -void (*func) (int) = do_allocation; - -#endif - -int -main () -{ -#if HAVE_ALLOCA - int i; - - /* Repeat a lot of times, to make sure there's no memory leak. */ - for (i = 0; i < 100000; i++) - { - /* Try various values. - n = 0 gave a crash on Alpha with gcc-2.5.8. - Some versions of Mac OS X have a stack size limit of 512 KB. */ - func (34); - func (134); - func (399); - func (510823); - func (129321); - func (0); - func (4070); - func (4095); - func (1); - func (16582); - } -#endif - - return 0; -} diff --git a/gl/tests/test-binary-io.c b/gl/tests/test-binary-io.c deleted file mode 100644 index 6801e9621f..0000000000 --- a/gl/tests/test-binary-io.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Test of binary mode I/O. - Copyright (C) 2005, 2007-2016 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>, 2005. */ - -#include <config.h> - -#include "binary-io.h" - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include "macros.h" - -int -main (int argc, char *argv[]) -{ - /* Test the O_BINARY macro. */ - { - int fd = - open ("t-bin-out0.tmp", O_CREAT | O_TRUNC | O_RDWR | O_BINARY, 0600); - if (write (fd, "Hello\n", 6) < 0) - exit (1); - close (fd); - } - { - struct stat statbuf; - if (stat ("t-bin-out0.tmp", &statbuf) < 0) - exit (1); - ASSERT (statbuf.st_size == 6); - } - - switch (argv[1][0]) - { - case '1': - /* Test the set_binary_mode() function. */ - set_binary_mode (1, O_BINARY); - fputs ("Hello\n", stdout); - break; - - case '2': - /* Test the SET_BINARY macro. */ - SET_BINARY (1); - fputs ("Hello\n", stdout); - break; - - default: - break; - } - - return 0; -} diff --git a/gl/tests/test-binary-io.sh b/gl/tests/test-binary-io.sh deleted file mode 100755 index c4dd6e9295..0000000000 --- a/gl/tests/test-binary-io.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles="$tmpfiles t-bin-out0.tmp t-bin-out1.tmp t-bin-out2.tmp" -./test-binary-io${EXEEXT} 1 > t-bin-out1.tmp || exit 1 -cmp t-bin-out0.tmp t-bin-out1.tmp > /dev/null || exit 1 -./test-binary-io${EXEEXT} 2 > t-bin-out2.tmp || exit 1 -cmp t-bin-out0.tmp t-bin-out2.tmp > /dev/null || exit 1 - -rm -fr $tmpfiles - -exit 0 diff --git a/gl/tests/test-byteswap.c b/gl/tests/test-byteswap.c deleted file mode 100644 index 909bd54d30..0000000000 --- a/gl/tests/test-byteswap.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test of <byteswap.h> substitute. - Copyright (C) 2007-2016 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>, 2007. */ - -#include <config.h> - -#include <byteswap.h> - -#include "macros.h" - -int -main () -{ - ASSERT (bswap_16 (0xABCD) == 0xCDAB); - ASSERT (bswap_32 (0xDEADBEEF) == 0xEFBEADDE); - - return 0; -} diff --git a/gl/tests/test-c-ctype.c b/gl/tests/test-c-ctype.c deleted file mode 100644 index 184cdec6e0..0000000000 --- a/gl/tests/test-c-ctype.c +++ /dev/null @@ -1,228 +0,0 @@ -/* Test of character handling in C locale. - Copyright (C) 2005, 2007-2016 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>, 2005. */ - -#include <config.h> - -#include "c-ctype.h" - -#include <ctype.h> -#include <limits.h> -#include <locale.h> - -#include "macros.h" - -static void -test_agree_with_C_locale (void) -{ - int c; - - for (c = 0; c <= UCHAR_MAX; c++) - { - ASSERT (c_isascii (c) == (isascii (c) != 0)); - if (c_isascii (c)) - { - ASSERT (c_isalnum (c) == (isalnum (c) != 0)); - ASSERT (c_isalpha (c) == (isalpha (c) != 0)); - ASSERT (c_isblank (c) == (isblank (c) != 0)); - ASSERT (c_iscntrl (c) == (iscntrl (c) != 0)); - ASSERT (c_isdigit (c) == (isdigit (c) != 0)); - ASSERT (c_islower (c) == (islower (c) != 0)); - ASSERT (c_isgraph (c) == (isgraph (c) != 0)); - ASSERT (c_isprint (c) == (isprint (c) != 0)); - ASSERT (c_ispunct (c) == (ispunct (c) != 0)); - ASSERT (c_isspace (c) == (isspace (c) != 0)); - ASSERT (c_isupper (c) == (isupper (c) != 0)); - ASSERT (c_isxdigit (c) == (isxdigit (c) != 0)); - ASSERT (c_tolower (c) == tolower (c)); - ASSERT (c_toupper (c) == toupper (c)); - } - } -} - -static void -test_all (void) -{ - int c; - int n_isascii = 0; - - for (c = CHAR_MIN; c <= UCHAR_MAX; c++) - { - if (! (0 <= c && c <= CHAR_MAX)) - { - ASSERT (! c_isascii (c)); - ASSERT (! c_isalnum (c)); - ASSERT (! c_isalpha (c)); - ASSERT (! c_isblank (c)); - ASSERT (! c_iscntrl (c)); - ASSERT (! c_isdigit (c)); - ASSERT (! c_islower (c)); - ASSERT (! c_isgraph (c)); - ASSERT (! c_isprint (c)); - ASSERT (! c_ispunct (c)); - ASSERT (! c_isspace (c)); - ASSERT (! c_isupper (c)); - ASSERT (! c_isxdigit (c)); - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == c); - } - - n_isascii += c_isascii (c); - -#ifdef C_CTYPE_ASCII - ASSERT (c_isascii (c) == (0 <= c && c <= 0x7f)); -#endif - - ASSERT (c_isascii (c) == (c_isprint (c) || c_iscntrl (c))); - - ASSERT (c_isalnum (c) == (c_isalpha (c) || c_isdigit (c))); - - ASSERT (c_isalpha (c) == (c_islower (c) || c_isupper (c))); - - switch (c) - { - case '\t': case ' ': - ASSERT (c_isblank (c) == 1); - break; - default: - ASSERT (c_isblank (c) == 0); - break; - } - -#ifdef C_CTYPE_ASCII - ASSERT (c_iscntrl (c) == ((c >= 0 && c < 0x20) || c == 0x7f)); -#endif - - switch (c) - { - case '\a': case '\b': case '\f': case '\n': - case '\r': case '\t': case '\v': - ASSERT (c_iscntrl (c)); - break; - } - - ASSERT (! (c_iscntrl (c) && c_isprint (c))); - - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - ASSERT (c_isdigit (c) == 1); - break; - default: - ASSERT (c_isdigit (c) == 0); - break; - } - - switch (c) - { - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - ASSERT (c_islower (c) == 1); - ASSERT (c_toupper (c) == c - 'a' + 'A'); - break; - default: - ASSERT (c_islower (c) == 0); - ASSERT (c_toupper (c) == c); - break; - } - -#ifdef C_CTYPE_ASCII - ASSERT (c_isgraph (c) == ((c >= 0x20 && c < 0x7f) && c != ' ')); - - ASSERT (c_isprint (c) == (c >= 0x20 && c < 0x7f)); -#endif - - ASSERT (c_isgraph (c) == (c_isalnum (c) || c_ispunct (c))); - - ASSERT (c_isprint (c) == (c_isgraph (c) || c == ' ')); - - switch (c) - { - case '!': case '"': case '#': case '$': case '%': case '&': case '\'': - case '(': case ')': case '*': case '+': case ',': case '-': case '.': - case '/': case ':': case ';': case '<': case '=': case '>': case '?': - case '@': case '[': case'\\': case ']': case '^': case '_': case '`': - case '{': case '|': case '}': case '~': - ASSERT (c_ispunct (c) == 1); - break; - default: - ASSERT (c_ispunct (c) == 0); - break; - } - - switch (c) - { - case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': - ASSERT (c_isspace (c) == 1); - break; - default: - ASSERT (c_isspace (c) == 0); - break; - } - - switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - ASSERT (c_isupper (c) == 1); - ASSERT (c_tolower (c) == c - 'A' + 'a'); - break; - default: - ASSERT (c_isupper (c) == 0); - ASSERT (c_tolower (c) == c); - break; - } - - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - ASSERT (c_isxdigit (c) == 1); - break; - default: - ASSERT (c_isxdigit (c) == 0); - break; - } - } - - ASSERT (n_isascii == 128); -} - -int -main () -{ - test_agree_with_C_locale (); - - test_all (); - - setlocale (LC_ALL, "de_DE"); - test_all (); - - setlocale (LC_ALL, "ja_JP.EUC-JP"); - test_all (); - - return 0; -} diff --git a/gl/tests/test-ctype.c b/gl/tests/test-ctype.c deleted file mode 100644 index 570fbdb0c1..0000000000 --- a/gl/tests/test-ctype.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test of <ctype.h> substitute. - Copyright (C) 2009-2016 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 Eric Blake <ebb9@byu.net>, 2009. */ - -#include <config.h> - -#include <ctype.h> - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-errno.c b/gl/tests/test-errno.c deleted file mode 100644 index 1e0bb6d4d3..0000000000 --- a/gl/tests/test-errno.c +++ /dev/null @@ -1,119 +0,0 @@ -/* Test of <errno.h> substitute. - Copyright (C) 2008-2016 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>, 2008. */ - -#include <config.h> - -#include <errno.h> - -/* Verify that the POSIX mandated errno values exist and can be used as - initializers outside of a function. - The variable names happen to match the Linux/x86 error numbers. */ -int e1 = EPERM; -int e2 = ENOENT; -int e3 = ESRCH; -int e4 = EINTR; -int e5 = EIO; -int e6 = ENXIO; -int e7 = E2BIG; -int e8 = ENOEXEC; -int e9 = EBADF; -int e10 = ECHILD; -int e11 = EAGAIN; -int e11a = EWOULDBLOCK; -int e12 = ENOMEM; -int e13 = EACCES; -int e14 = EFAULT; -int e16 = EBUSY; -int e17 = EEXIST; -int e18 = EXDEV; -int e19 = ENODEV; -int e20 = ENOTDIR; -int e21 = EISDIR; -int e22 = EINVAL; -int e23 = ENFILE; -int e24 = EMFILE; -int e25 = ENOTTY; -int e26 = ETXTBSY; -int e27 = EFBIG; -int e28 = ENOSPC; -int e29 = ESPIPE; -int e30 = EROFS; -int e31 = EMLINK; -int e32 = EPIPE; -int e33 = EDOM; -int e34 = ERANGE; -int e35 = EDEADLK; -int e36 = ENAMETOOLONG; -int e37 = ENOLCK; -int e38 = ENOSYS; -int e39 = ENOTEMPTY; -int e40 = ELOOP; -int e42 = ENOMSG; -int e43 = EIDRM; -int e67 = ENOLINK; -int e71 = EPROTO; -int e72 = EMULTIHOP; -int e74 = EBADMSG; -int e75 = EOVERFLOW; -int e84 = EILSEQ; -int e88 = ENOTSOCK; -int e89 = EDESTADDRREQ; -int e90 = EMSGSIZE; -int e91 = EPROTOTYPE; -int e92 = ENOPROTOOPT; -int e93 = EPROTONOSUPPORT; -int e95 = EOPNOTSUPP; -int e95a = ENOTSUP; -int e97 = EAFNOSUPPORT; -int e98 = EADDRINUSE; -int e99 = EADDRNOTAVAIL; -int e100 = ENETDOWN; -int e101 = ENETUNREACH; -int e102 = ENETRESET; -int e103 = ECONNABORTED; -int e104 = ECONNRESET; -int e105 = ENOBUFS; -int e106 = EISCONN; -int e107 = ENOTCONN; -int e110 = ETIMEDOUT; -int e111 = ECONNREFUSED; -int e113 = EHOSTUNREACH; -int e114 = EALREADY; -int e115 = EINPROGRESS; -int e116 = ESTALE; -int e122 = EDQUOT; -int e125 = ECANCELED; -int e130 = EOWNERDEAD; -int e131 = ENOTRECOVERABLE; - -/* Don't verify that these errno values are all different, except for possibly - EWOULDBLOCK == EAGAIN. Even Linux/x86 does not pass this check: it has - ENOTSUP == EOPNOTSUPP. */ - -int -main () -{ - /* Verify that errno can be assigned. */ - errno = EOVERFLOW; - - /* snprintf() callers want to distinguish EINVAL and EOVERFLOW. */ - if (errno == EINVAL) - return 1; - - return 0; -} diff --git a/gl/tests/test-fcntl-h.c b/gl/tests/test-fcntl-h.c deleted file mode 100644 index aef1661a64..0000000000 --- a/gl/tests/test-fcntl-h.c +++ /dev/null @@ -1,130 +0,0 @@ -/* Test of <fcntl.h> substitute. - Copyright (C) 2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <fcntl.h> - -/* Check that the various O_* macros are defined. */ -int o = (O_DIRECT | O_DIRECTORY | O_DSYNC | O_IGNORE_CTTY | O_NDELAY | O_NOATIME - | O_NONBLOCK | O_NOCTTY | O_NOFOLLOW | O_NOLINK | O_NOLINKS | O_NOTRANS - | O_RSYNC | O_SYNC | O_TTY_INIT | O_BINARY | O_TEXT); - -/* Check that the various SEEK_* macros are defined. */ -int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; - -/* Check that the FD_* macros are defined. */ -int i = FD_CLOEXEC; - -/* Check that the types are all defined. */ -pid_t t1; -off_t t2; -mode_t t3; - -int -main (void) -{ - /* Ensure no overlap in SEEK_*. */ - switch (0) - { - case SEEK_CUR: - case SEEK_END: - case SEEK_SET: - ; - } - - /* Ensure no dangerous overlap in non-zero gnulib-defined replacements. */ - switch (O_RDONLY) - { - /* Access modes */ - case O_RDONLY: - case O_WRONLY: - case O_RDWR: -#if O_EXEC && O_EXEC != O_RDONLY - case O_EXEC: -#endif -#if O_SEARCH && O_EXEC != O_SEARCH && O_SEARCH != O_RDONLY - case O_SEARCH: -#endif - i = ! (~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)); - break; - - /* Everyone should have these */ - case O_CREAT: - case O_EXCL: - case O_TRUNC: - case O_APPEND: - break; - - /* These might be 0 or O_RDONLY, only test non-zero versions. */ -#if O_CLOEXEC - case O_CLOEXEC: -#endif -#if O_DIRECT - case O_DIRECT: -#endif -#if O_DIRECTORY - case O_DIRECTORY: -#endif -#if O_DSYNC - case O_DSYNC: -#endif -#if O_IGNORE_CTTY - case O_IGNORE_CTTY: -#endif -#if O_NOATIME - case O_NOATIME: -#endif -#if O_NONBLOCK - case O_NONBLOCK: -#endif -#if O_NOCTTY - case O_NOCTTY: -#endif -#if O_NOFOLLOW - case O_NOFOLLOW: -#endif -#if O_NOLINK - case O_NOLINK: -#endif -#if O_NOLINKS - case O_NOLINKS: -#endif -#if O_NOTRANS - case O_NOTRANS: -#endif -#if O_RSYNC && O_RSYNC != O_DSYNC - case O_RSYNC: -#endif -#if O_SYNC && O_SYNC != O_DSYNC && O_SYNC != O_RSYNC - case O_SYNC: -#endif -#if O_TTY_INIT - case O_TTY_INIT: -#endif -#if O_BINARY - case O_BINARY: -#endif -#if O_TEXT - case O_TEXT: -#endif - ; - } - - return !i; -} diff --git a/gl/tests/test-fdopen.c b/gl/tests/test-fdopen.c deleted file mode 100644 index 55b49a6490..0000000000 --- a/gl/tests/test-fdopen.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Test opening a stream with a file descriptor. - Copyright (C) 2011-2016 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/>. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (fdopen, FILE *, (int, const char *)); - -#include <errno.h> -#include <unistd.h> - -#include "macros.h" - -int -main (void) -{ - /* Test behavior on failure. POSIX makes it hard to check for - failure, since the behavior is not well-defined on invalid file - descriptors, so try fdopen 1000 times and if that's not enough to - fail due to EMFILE, so be it. */ - - int i; - for (i = 0; i < 1000; i++) - { - errno = 0; - if (! fdopen (STDOUT_FILENO, "w")) - { - ASSERT (errno != 0); - break; - } - } - - return 0; -} diff --git a/gl/tests/test-fgetc.c b/gl/tests/test-fgetc.c deleted file mode 100644 index c62e70c6d9..0000000000 --- a/gl/tests/test-fgetc.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Test of fgetc() function. - Copyright (C) 2011-2016 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/>. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (fgetc, int, (FILE *)); - -#include <errno.h> -#include <fcntl.h> -#include <unistd.h> - -#include "msvc-inval.h" - -#include "macros.h" - -int -main (int argc, char **argv) -{ - const char *filename = "test-fgetc.txt"; - - /* We don't have an fgetc() function that installs an invalid parameter - handler so far. So install that handler here, explicitly. */ -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ - && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING - gl_msvc_inval_ensure_handler (); -#endif - - /* Prepare a file. */ - { - const char text[] = "hello world"; - int fd = open (filename, O_RDWR | O_CREAT | O_TRUNC, 0600); - ASSERT (fd >= 0); - ASSERT (write (fd, text, sizeof (text)) == sizeof (text)); - ASSERT (close (fd) == 0); - } - - /* Test that fgetc() sets errno if someone else closes the stream - fd behind the back of stdio. */ - { - FILE *fp = fopen (filename, "r"); - ASSERT (fp != NULL); - ASSERT (close (fileno (fp)) == 0); - errno = 0; - ASSERT (fgetc (fp) == EOF); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - - /* Test that fgetc() sets errno if the stream was constructed with - an invalid file descriptor. */ - { - FILE *fp = fdopen (-1, "r"); - if (fp != NULL) - { - errno = 0; - ASSERT (fgetc (fp) == EOF); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - } - { - FILE *fp; - close (99); - fp = fdopen (99, "r"); - if (fp != NULL) - { - errno = 0; - ASSERT (fgetc (fp) == EOF); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - } - - /* Clean up. */ - unlink (filename); - - return 0; -} diff --git a/gl/tests/test-float.c b/gl/tests/test-float.c deleted file mode 100644 index 1c95b12f97..0000000000 --- a/gl/tests/test-float.c +++ /dev/null @@ -1,383 +0,0 @@ -/* Test of <float.h> substitute. - Copyright (C) 2011-2016 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>, 2011. */ - -#include <config.h> - -#include <float.h> - -#include "fpucw.h" -#include "macros.h" - -#if 0 - -/* Check that FLT_RADIX is a constant expression. */ -int a[] = { FLT_RADIX }; - -/* Return 2^n. */ -static float -pow2f (int n) -{ - int k = n; - volatile float x = 1; - volatile float y = 2; - /* Invariant: 2^n == x * y^k. */ - if (k < 0) - { - y = 0.5f; - k = - k; - } - while (k > 0) - { - if (k != 2 * (k / 2)) - { - x = x * y; - k = k - 1; - } - if (k == 0) - break; - y = y * y; - k = k / 2; - } - /* Now k == 0, hence x == 2^n. */ - return x; -} - -/* Return 2^n. */ -static double -pow2d (int n) -{ - int k = n; - volatile double x = 1; - volatile double y = 2; - /* Invariant: 2^n == x * y^k. */ - if (k < 0) - { - y = 0.5; - k = - k; - } - while (k > 0) - { - if (k != 2 * (k / 2)) - { - x = x * y; - k = k - 1; - } - if (k == 0) - break; - y = y * y; - k = k / 2; - } - /* Now k == 0, hence x == 2^n. */ - return x; -} - -/* Return 2^n. */ -static long double -pow2l (int n) -{ - int k = n; - volatile long double x = 1; - volatile long double y = 2; - /* Invariant: 2^n == x * y^k. */ - if (k < 0) - { - y = 0.5L; - k = - k; - } - while (k > 0) - { - if (k != 2 * (k / 2)) - { - x = x * y; - k = k - 1; - } - if (k == 0) - break; - y = y * y; - k = k / 2; - } - /* Now k == 0, hence x == 2^n. */ - return x; -} - -/* ----------------------- Check macros for 'float' ----------------------- */ - -/* Check that the FLT_* macros expand to constant expressions. */ -int fb[] = - { - FLT_MANT_DIG, FLT_MIN_EXP, FLT_MAX_EXP, - FLT_DIG, FLT_MIN_10_EXP, FLT_MAX_10_EXP - }; -float fc[] = { FLT_EPSILON, FLT_MIN, FLT_MAX }; - -static void -test_float (void) -{ - /* Check that the value of FLT_MIN_EXP is well parenthesized. */ - ASSERT ((FLT_MIN_EXP % 101111) == (FLT_MIN_EXP) % 101111); - - /* Check that the value of DBL_MIN_10_EXP is well parenthesized. */ - ASSERT ((FLT_MIN_10_EXP % 101111) == (FLT_MIN_10_EXP) % 101111); - - /* Check that 'float' is as specified in IEEE 754. */ - ASSERT (FLT_MANT_DIG == 24); - ASSERT (FLT_MIN_EXP == -125); - ASSERT (FLT_MAX_EXP == 128); - - /* Check the value of FLT_MIN_10_EXP. */ - ASSERT (FLT_MIN_10_EXP == - (int) (- (FLT_MIN_EXP - 1) * 0.30103)); - - /* Check the value of FLT_DIG. */ - ASSERT (FLT_DIG == (int) ((FLT_MANT_DIG - 1) * 0.30103)); - - /* Check the value of FLT_MIN_10_EXP. */ - ASSERT (FLT_MIN_10_EXP == - (int) (- (FLT_MIN_EXP - 1) * 0.30103)); - - /* Check the value of FLT_MAX_10_EXP. */ - ASSERT (FLT_MAX_10_EXP == (int) (FLT_MAX_EXP * 0.30103)); - - /* Check the value of FLT_MAX. */ - { - volatile float m = FLT_MAX; - int n; - - ASSERT (m + m > m); - for (n = 0; n <= 2 * FLT_MANT_DIG; n++) - { - volatile float pow2_n = pow2f (n); /* 2^n */ - volatile float x = m + (m / pow2_n); - if (x > m) - ASSERT (x + x == x); - else - ASSERT (!(x + x == x)); - } - } - - /* Check the value of FLT_MIN. */ - { - volatile float m = FLT_MIN; - volatile float x = pow2f (FLT_MIN_EXP - 1); - ASSERT (m == x); - } - - /* Check the value of FLT_EPSILON. */ - { - volatile float e = FLT_EPSILON; - volatile float me; - int n; - - me = 1.0f + e; - ASSERT (me > 1.0f); - ASSERT (me - 1.0f == e); - for (n = 0; n <= 2 * FLT_MANT_DIG; n++) - { - volatile float half_n = pow2f (- n); /* 2^-n */ - volatile float x = me - half_n; - if (x < me) - ASSERT (x <= 1.0f); - } - } -} - -/* ----------------------- Check macros for 'double' ----------------------- */ - -/* Check that the DBL_* macros expand to constant expressions. */ -int db[] = - { - DBL_MANT_DIG, DBL_MIN_EXP, DBL_MAX_EXP, - DBL_DIG, DBL_MIN_10_EXP, DBL_MAX_10_EXP - }; -double dc[] = { DBL_EPSILON, DBL_MIN, DBL_MAX }; - -static void -test_double (void) -{ - /* Check that the value of DBL_MIN_EXP is well parenthesized. */ - ASSERT ((DBL_MIN_EXP % 101111) == (DBL_MIN_EXP) % 101111); - - /* Check that the value of DBL_MIN_10_EXP is well parenthesized. */ - ASSERT ((DBL_MIN_10_EXP % 101111) == (DBL_MIN_10_EXP) % 101111); - - /* Check that 'double' is as specified in IEEE 754. */ - ASSERT (DBL_MANT_DIG == 53); - ASSERT (DBL_MIN_EXP == -1021); - ASSERT (DBL_MAX_EXP == 1024); - - /* Check the value of DBL_MIN_10_EXP. */ - ASSERT (DBL_MIN_10_EXP == - (int) (- (DBL_MIN_EXP - 1) * 0.30103)); - - /* Check the value of DBL_DIG. */ - ASSERT (DBL_DIG == (int) ((DBL_MANT_DIG - 1) * 0.30103)); - - /* Check the value of DBL_MIN_10_EXP. */ - ASSERT (DBL_MIN_10_EXP == - (int) (- (DBL_MIN_EXP - 1) * 0.30103)); - - /* Check the value of DBL_MAX_10_EXP. */ - ASSERT (DBL_MAX_10_EXP == (int) (DBL_MAX_EXP * 0.30103)); - - /* Check the value of DBL_MAX. */ - { - volatile double m = DBL_MAX; - int n; - - ASSERT (m + m > m); - for (n = 0; n <= 2 * DBL_MANT_DIG; n++) - { - volatile double pow2_n = pow2d (n); /* 2^n */ - volatile double x = m + (m / pow2_n); - if (x > m) - ASSERT (x + x == x); - else - ASSERT (!(x + x == x)); - } - } - - /* Check the value of DBL_MIN. */ - { - volatile double m = DBL_MIN; - volatile double x = pow2d (DBL_MIN_EXP - 1); - ASSERT (m == x); - } - - /* Check the value of DBL_EPSILON. */ - { - volatile double e = DBL_EPSILON; - volatile double me; - int n; - - me = 1.0 + e; - ASSERT (me > 1.0); - ASSERT (me - 1.0 == e); - for (n = 0; n <= 2 * DBL_MANT_DIG; n++) - { - volatile double half_n = pow2d (- n); /* 2^-n */ - volatile double x = me - half_n; - if (x < me) - ASSERT (x <= 1.0); - } - } -} - -/* -------------------- Check macros for 'long double' -------------------- */ - -/* Check that the LDBL_* macros expand to constant expressions. */ -int lb[] = - { - LDBL_MANT_DIG, LDBL_MIN_EXP, LDBL_MAX_EXP, - LDBL_DIG, LDBL_MIN_10_EXP, LDBL_MAX_10_EXP - }; -long double lc1 = LDBL_EPSILON; -long double lc2 = LDBL_MIN; -#if 0 /* LDBL_MAX is not a constant expression on some platforms. */ -long double lc3 = LDBL_MAX; -#endif - -static void -test_long_double (void) -{ - /* Check that the value of LDBL_MIN_EXP is well parenthesized. */ - ASSERT ((LDBL_MIN_EXP % 101111) == (LDBL_MIN_EXP) % 101111); - - /* Check that the value of LDBL_MIN_10_EXP is well parenthesized. */ - ASSERT ((LDBL_MIN_10_EXP % 101111) == (LDBL_MIN_10_EXP) % 101111); - - /* Check that 'long double' is at least as wide as 'double'. */ - ASSERT (LDBL_MANT_DIG >= DBL_MANT_DIG); - ASSERT (LDBL_MIN_EXP - LDBL_MANT_DIG <= DBL_MIN_EXP - DBL_MANT_DIG); - ASSERT (LDBL_MAX_EXP >= DBL_MAX_EXP); - - /* Check the value of LDBL_DIG. */ - ASSERT (LDBL_DIG == (int)((LDBL_MANT_DIG - 1) * 0.30103)); - - /* Check the value of LDBL_MIN_10_EXP. */ - ASSERT (LDBL_MIN_10_EXP == - (int) (- (LDBL_MIN_EXP - 1) * 0.30103)); - - /* Check the value of LDBL_MAX_10_EXP. */ - ASSERT (LDBL_MAX_10_EXP == (int) (LDBL_MAX_EXP * 0.30103)); - - /* Check the value of LDBL_MAX. */ - { - volatile long double m = LDBL_MAX; - int n; - - ASSERT (m + m > m); - for (n = 0; n <= 2 * LDBL_MANT_DIG; n++) - { - volatile long double pow2_n = pow2l (n); /* 2^n */ - volatile long double x = m + (m / pow2_n); - if (x > m) - ASSERT (x + x == x); - else - ASSERT (!(x + x == x)); - } - } - - /* Check the value of LDBL_MIN. */ - { - volatile long double m = LDBL_MIN; - volatile long double x = pow2l (LDBL_MIN_EXP - 1); - ASSERT (m == x); - } - - /* Check the value of LDBL_EPSILON. */ - { - volatile long double e = LDBL_EPSILON; - volatile long double me; - int n; - - me = 1.0L + e; - ASSERT (me > 1.0L); - ASSERT (me - 1.0L == e); - for (n = 0; n <= 2 * LDBL_MANT_DIG; n++) - { - volatile long double half_n = pow2l (- n); /* 2^-n */ - volatile long double x = me - half_n; - if (x < me) - ASSERT (x <= 1.0L); - } - } -} - -int -main () -{ - test_float (); - test_double (); - - { - DECL_LONG_DOUBLE_ROUNDING - - BEGIN_LONG_DOUBLE_ROUNDING (); - - test_long_double (); - - END_LONG_DOUBLE_ROUNDING (); - } - - return 0; -} - -#else - -int -main () -{ - return 77; -} - -#endif diff --git a/gl/tests/test-fputc.c b/gl/tests/test-fputc.c deleted file mode 100644 index 95a1cb6014..0000000000 --- a/gl/tests/test-fputc.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Test of fputc() function. - Copyright (C) 2011-2016 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/>. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (fputc, int, (int, FILE *)); - -#include <errno.h> -#include <fcntl.h> -#include <unistd.h> - -#include "msvc-inval.h" - -#include "macros.h" - -int -main (int argc, char **argv) -{ - const char *filename = "test-fputc.txt"; - - /* We don't have an fputc() function that installs an invalid parameter - handler so far. So install that handler here, explicitly. */ -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ - && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING - gl_msvc_inval_ensure_handler (); -#endif - - /* Test that fputc() on an unbuffered stream sets errno if someone else - closes the stream fd behind the back of stdio. */ - { - FILE *fp = fopen (filename, "w"); - ASSERT (fp != NULL); - setvbuf (fp, NULL, _IONBF, 0); - ASSERT (close (fileno (fp)) == 0); - errno = 0; - ASSERT (fputc ('x', fp) == EOF); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - - /* Test that fputc() on an unbuffered stream sets errno if the stream - was constructed with an invalid file descriptor. */ - { - FILE *fp = fdopen (-1, "w"); - if (fp != NULL) - { - setvbuf (fp, NULL, _IONBF, 0); - errno = 0; - ASSERT (fputc ('x', fp) == EOF); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - } - { - FILE *fp; - close (99); - fp = fdopen (99, "w"); - if (fp != NULL) - { - setvbuf (fp, NULL, _IONBF, 0); - errno = 0; - ASSERT (fputc ('x', fp) == EOF); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - } - - /* Clean up. */ - unlink (filename); - - return 0; -} diff --git a/gl/tests/test-fread.c b/gl/tests/test-fread.c deleted file mode 100644 index b9fc72afa1..0000000000 --- a/gl/tests/test-fread.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Test of fread() function. - Copyright (C) 2011-2016 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/>. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (fread, size_t, (void *, size_t, size_t, FILE *)); - -#include <errno.h> -#include <fcntl.h> -#include <unistd.h> - -#include "msvc-inval.h" - -#include "macros.h" - -int -main (int argc, char **argv) -{ - const char *filename = "test-fread.txt"; - - /* We don't have an fread() function that installs an invalid parameter - handler so far. So install that handler here, explicitly. */ -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ - && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING - gl_msvc_inval_ensure_handler (); -#endif - - /* Prepare a file. */ - { - const char text[] = "hello world"; - int fd = open (filename, O_RDWR | O_CREAT | O_TRUNC, 0600); - ASSERT (fd >= 0); - ASSERT (write (fd, text, sizeof (text)) == sizeof (text)); - ASSERT (close (fd) == 0); - } - - /* Test that fread() sets errno if someone else closes the stream - fd behind the back of stdio. */ - { - FILE *fp = fopen (filename, "r"); - char buf[5]; - ASSERT (fp != NULL); - ASSERT (close (fileno (fp)) == 0); - errno = 0; - ASSERT (fread (buf, 1, sizeof (buf), fp) == 0); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - - /* Test that fread() sets errno if the stream was constructed with - an invalid file descriptor. */ - { - FILE *fp = fdopen (-1, "r"); - if (fp != NULL) - { - char buf[1]; - errno = 0; - ASSERT (fread (buf, 1, 1, fp) == 0); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - } - { - FILE *fp; - close (99); - fp = fdopen (99, "r"); - if (fp != NULL) - { - char buf[1]; - errno = 0; - ASSERT (fread (buf, 1, 1, fp) == 0); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - } - - /* Clean up. */ - unlink (filename); - - return 0; -} diff --git a/gl/tests/test-fstat.c b/gl/tests/test-fstat.c deleted file mode 100644 index c9ac749db8..0000000000 --- a/gl/tests/test-fstat.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Tests of fstat() function. - Copyright (C) 2011-2016 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/>. */ - -#include <config.h> - -#include <sys/stat.h> - -#include "signature.h" -SIGNATURE_CHECK (fstat, int, (int, struct stat *)); - -#include <errno.h> -#include <unistd.h> - -#include "macros.h" - -int -main (int argc, char *argv[]) -{ - /* Test behaviour for invalid file descriptors. */ - { - struct stat statbuf; - - errno = 0; - ASSERT (fstat (-1, &statbuf) == -1); - ASSERT (errno == EBADF); - } - { - struct stat statbuf; - - close (99); - errno = 0; - ASSERT (fstat (99, &statbuf) == -1); - ASSERT (errno == EBADF); - } - - return 0; -} diff --git a/gl/tests/test-ftell.c b/gl/tests/test-ftell.c deleted file mode 100644 index 9b523444eb..0000000000 --- a/gl/tests/test-ftell.c +++ /dev/null @@ -1,107 +0,0 @@ -/* Test of ftell() function. - Copyright (C) 2007-2016 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>, 2007. */ - -#include <config.h> - -/* None of the files accessed by this test are large, so disable the - fseek link warning if we are not using the gnulib fseek module. */ -#define _GL_NO_LARGE_FILES -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (ftell, long, (FILE *)); - -#include "binary-io.h" -#include "macros.h" - -#ifndef FUNC_UNGETC_BROKEN -# define FUNC_UNGETC_BROKEN 0 -#endif - -int -main (int argc, char **argv) -{ - int ch; - /* Assume stdin is seekable iff argc > 1. */ - if (argc == 1) - { - ASSERT (ftell (stdin) == -1); - return 0; - } - - /* mingw ftell is unreliable on text mode input. */ - SET_BINARY (0); - - /* Simple tests. */ - ASSERT (ftell (stdin) == 0); - - ch = fgetc (stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 1); - - /* Test ftell after ungetc of read input. */ - ch = ungetc ('#', stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 0); - - ch = fgetc (stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 1); - - /* Test ftell after fseek. */ - ASSERT (fseek (stdin, 2, SEEK_SET) == 0); - ASSERT (ftell (stdin) == 2); - - /* Test ftell after random ungetc. */ - ch = fgetc (stdin); - ASSERT (ch == '/'); - ch = ungetc ('@', stdin); - ASSERT (ch == '@'); - ASSERT (ftell (stdin) == 2); - - ch = fgetc (stdin); - ASSERT (ch == '@'); - ASSERT (ftell (stdin) == 3); - - if (2 < argc) - { - if (FUNC_UNGETC_BROKEN) - { - fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n", - stderr); - return 77; - } - /* Test ftell after ungetc without read. */ - ASSERT (fseek (stdin, 0, SEEK_CUR) == 0); - ASSERT (ftell (stdin) == 3); - - ch = ungetc ('~', stdin); - ASSERT (ch == '~'); - ASSERT (ftell (stdin) == 2); - } - -#if !defined __MINT__ /* FreeMiNT has problems seeking past end of file */ - /* Test ftell beyond end of file. */ - ASSERT (fseek (stdin, 0, SEEK_END) == 0); - ch = ftell (stdin); - ASSERT (fseek (stdin, 10, SEEK_END) == 0); - ASSERT (ftell (stdin) == ch + 10); -#endif - - return 0; -} diff --git a/gl/tests/test-ftell.sh b/gl/tests/test-ftell.sh deleted file mode 100755 index bf55d2e997..0000000000 --- a/gl/tests/test-ftell.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -./test-ftell${EXEEXT} 1 < "$srcdir/test-ftell.sh" || exit 1 -echo hi | ./test-ftell${EXEEXT} || exit 1 -exit 0 diff --git a/gl/tests/test-ftell2.sh b/gl/tests/test-ftell2.sh deleted file mode 100755 index 3b645b8318..0000000000 --- a/gl/tests/test-ftell2.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec ./test-ftell${EXEEXT} 1 2 < "$srcdir/test-ftell2.sh" diff --git a/gl/tests/test-ftell3.c b/gl/tests/test-ftell3.c deleted file mode 100644 index 695e5b2dc7..0000000000 --- a/gl/tests/test-ftell3.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Test of ftell() function. - Copyright (C) 2007-2016 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/>. */ - -#include <config.h> - -/* None of the files accessed by this test are large, so disable the - fseek link warning if we are not using the gnulib fseek module. */ -#define _GL_NO_LARGE_FILES -#include <stdio.h> - -#include <string.h> - -#include "macros.h" - -#define TESTFILE "t-ftell3.tmp" - -int -main (void) -{ - FILE *fp; - - /* Create a file with some contents. */ - fp = fopen (TESTFILE, "w"); - if (fp == NULL) - goto skip; - if (fwrite ("foogarsh", 1, 8, fp) < 8) - goto skip; - if (fclose (fp)) - goto skip; - - /* The file's contents is now "foogarsh". */ - - /* Try writing after reading to EOF. */ - fp = fopen (TESTFILE, "r+"); - if (fp == NULL) - goto skip; - if (fseek (fp, -1, SEEK_END)) - goto skip; - ASSERT (getc (fp) == 'h'); - ASSERT (getc (fp) == EOF); - ASSERT (ftell (fp) == 8); - ASSERT (ftell (fp) == 8); - ASSERT (putc ('!', fp) == '!'); - ASSERT (ftell (fp) == 9); - ASSERT (fclose (fp) == 0); - fp = fopen (TESTFILE, "r"); - if (fp == NULL) - goto skip; - { - char buf[10]; - ASSERT (fread (buf, 1, 10, fp) == 9); - ASSERT (memcmp (buf, "foogarsh!", 9) == 0); - } - ASSERT (fclose (fp) == 0); - - /* The file's contents is now "foogarsh!". */ - - remove (TESTFILE); - return 0; - - skip: - fprintf (stderr, "Skipping test: prerequisite file operations failed.\n"); - remove (TESTFILE); - return 77; -} diff --git a/gl/tests/test-ftello.c b/gl/tests/test-ftello.c deleted file mode 100644 index 369d476518..0000000000 --- a/gl/tests/test-ftello.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Test of ftello() function. - Copyright (C) 2007-2016 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>, 2007. */ - -#include <config.h> - -/* None of the files accessed by this test are large, so disable the - fseek link warning if we are not using the gnulib fseek module. */ -#define _GL_NO_LARGE_FILES -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (ftello, off_t, (FILE *)); - -#include "binary-io.h" -#include "macros.h" - -#ifndef FUNC_UNGETC_BROKEN -# define FUNC_UNGETC_BROKEN 0 -#endif - -int -main (int argc, char **argv _GL_UNUSED) -{ - int ch; - /* Assume stdin is seekable iff argc > 1. */ - if (argc == 1) - { - ASSERT (ftell (stdin) == -1); - ASSERT (ftello (stdin) == -1); - return 0; - } - - /* mingw ftell is unreliable on text mode input. */ - SET_BINARY (0); - - /* Simple tests. For each test, make sure ftell and ftello agree. */ - ASSERT (ftell (stdin) == 0); - ASSERT (ftello (stdin) == 0); - - ch = fgetc (stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 1); - ASSERT (ftello (stdin) == 1); - - /* Test ftell after ungetc of read input. */ - ch = ungetc ('#', stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 0); - ASSERT (ftello (stdin) == 0); - - ch = fgetc (stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 1); - ASSERT (ftello (stdin) == 1); - - /* Test ftell after fseek. */ - ASSERT (fseek (stdin, 2, SEEK_SET) == 0); - ASSERT (ftell (stdin) == 2); - ASSERT (ftello (stdin) == 2); - - /* Test ftell after random ungetc. */ - ch = fgetc (stdin); - ASSERT (ch == '/'); - ch = ungetc ('@', stdin); - ASSERT (ch == '@'); - ASSERT (ftell (stdin) == 2); - ASSERT (ftello (stdin) == 2); - - ch = fgetc (stdin); - ASSERT (ch == '@'); - ASSERT (ftell (stdin) == 3); - ASSERT (ftello (stdin) == 3); - - if (2 < argc) - { - if (FUNC_UNGETC_BROKEN) - { - fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n", - stderr); - return 77; - } - /* Test ftell after ungetc without read. */ - ASSERT (fseek (stdin, 0, SEEK_CUR) == 0); - ASSERT (ftell (stdin) == 3); - ASSERT (ftello (stdin) == 3); - - ch = ungetc ('~', stdin); - ASSERT (ch == '~'); - ASSERT (ftell (stdin) == 2); - ASSERT (ftello (stdin) == 2); - } - -#if !defined __MINT__ /* FreeMiNT has problems seeking past end of file */ - /* Test ftell beyond end of file. */ - ASSERT (fseek (stdin, 0, SEEK_END) == 0); - ch = ftello (stdin); - ASSERT (fseek (stdin, 10, SEEK_END) == 0); - ASSERT (ftell (stdin) == ch + 10); - ASSERT (ftello (stdin) == ch + 10); -#endif - - return 0; -} diff --git a/gl/tests/test-ftello.sh b/gl/tests/test-ftello.sh deleted file mode 100755 index 33d2e838db..0000000000 --- a/gl/tests/test-ftello.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -./test-ftello${EXEEXT} 1 < "$srcdir/test-ftello.sh" || exit 1 -echo hi | ./test-ftello${EXEEXT} || exit 1 -exit 0 diff --git a/gl/tests/test-ftello2.sh b/gl/tests/test-ftello2.sh deleted file mode 100755 index ba750b003d..0000000000 --- a/gl/tests/test-ftello2.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec ./test-ftello${EXEEXT} 1 2 < "$srcdir/test-ftello2.sh" diff --git a/gl/tests/test-ftello3.c b/gl/tests/test-ftello3.c deleted file mode 100644 index f75ce03432..0000000000 --- a/gl/tests/test-ftello3.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Test of ftello() function. - Copyright (C) 2007-2016 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/>. */ - -#include <config.h> - -/* None of the files accessed by this test are large, so disable the - fseek link warning if we are not using the gnulib fseek module. */ -#define _GL_NO_LARGE_FILES -#include <stdio.h> - -#include <string.h> - -#include "macros.h" - -#define TESTFILE "t-ftello3.tmp" - -int -main (void) -{ - FILE *fp; - - /* Create a file with some contents. */ - fp = fopen (TESTFILE, "w"); - if (fp == NULL) - goto skip; - if (fwrite ("foogarsh", 1, 8, fp) < 8) - goto skip; - if (fclose (fp)) - goto skip; - - /* The file's contents is now "foogarsh". */ - - /* Try writing after reading to EOF. */ - fp = fopen (TESTFILE, "r+"); - if (fp == NULL) - goto skip; - if (fseek (fp, -1, SEEK_END)) - goto skip; - ASSERT (getc (fp) == 'h'); - ASSERT (getc (fp) == EOF); - ASSERT (ftello (fp) == 8); - ASSERT (ftello (fp) == 8); - ASSERT (putc ('!', fp) == '!'); - ASSERT (ftello (fp) == 9); - ASSERT (fclose (fp) == 0); - fp = fopen (TESTFILE, "r"); - if (fp == NULL) - goto skip; - { - char buf[10]; - ASSERT (fread (buf, 1, 10, fp) == 9); - ASSERT (memcmp (buf, "foogarsh!", 9) == 0); - } - ASSERT (fclose (fp) == 0); - - /* The file's contents is now "foogarsh!". */ - - remove (TESTFILE); - return 0; - - skip: - fprintf (stderr, "Skipping test: prerequisite file operations failed.\n"); - remove (TESTFILE); - return 77; -} diff --git a/gl/tests/test-ftello4.c b/gl/tests/test-ftello4.c deleted file mode 100644 index 1f94ef67d8..0000000000 --- a/gl/tests/test-ftello4.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Test of ftello() function. - Copyright (C) 2011-2016 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/>. */ - -#include <config.h> - -#include <stdio.h> - -#include <errno.h> -#include <unistd.h> - -#include "macros.h" - -int -main (int argc, char **argv) -{ - const char *filename = argv[1]; - - /* Test that ftello() sets errno if someone else closes the stream - fd behind the back of stdio. */ - { - FILE *fp = fopen (filename, "r"); - ASSERT (fp != NULL); - setvbuf (fp, NULL, _IONBF, 0); - ASSERT (close (fileno (fp)) == 0); - errno = 0; - ASSERT (ftello (fp) == (off_t)-1); - ASSERT (errno == EBADF); - fclose (fp); - } - - /* Test that ftello() sets errno if the stream was constructed with - an invalid file descriptor. */ - { - FILE *fp = fdopen (-1, "w"); - if (fp != NULL) - { - errno = 0; - ASSERT (ftello (fp) == (off_t)-1); - ASSERT (errno == EBADF); - fclose (fp); - } - } - { - FILE *fp; - close (99); - fp = fdopen (99, "w"); - if (fp != NULL) - { - errno = 0; - ASSERT (ftello (fp) == (off_t)-1); - ASSERT (errno == EBADF); - fclose (fp); - } - } - - return 0; -} diff --git a/gl/tests/test-ftello4.sh b/gl/tests/test-ftello4.sh deleted file mode 100755 index e3702bb605..0000000000 --- a/gl/tests/test-ftello4.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -./test-ftello4${EXEEXT} "$srcdir/test-ftello4.sh" || exit 1 - -exit 0 diff --git a/gl/tests/test-func.c b/gl/tests/test-func.c deleted file mode 100644 index 54e3328d35..0000000000 --- a/gl/tests/test-func.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Test whether __func__ is available - Copyright (C) 2008-2016 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>, 2008. */ - -#include <config.h> - -#include <string.h> - -#include "macros.h" - -int -main () -{ - ASSERT (strlen (__func__) > 0); - - /* On SunPRO C 5.9, sizeof __func__ evaluates to 0. The compiler warns: - "warning: null dimension: sizeof()". */ -#if !defined __SUNPRO_C - ASSERT (strlen (__func__) + 1 == sizeof __func__); -#endif - - ASSERT (strcmp (__func__, "main") == 0 - || strcmp (__func__, "<unknown function>") == 0); - - return 0; -} diff --git a/gl/tests/test-fwrite.c b/gl/tests/test-fwrite.c deleted file mode 100644 index bc285f3017..0000000000 --- a/gl/tests/test-fwrite.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Test of fwrite() function. - Copyright (C) 2011-2016 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/>. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (fwrite, size_t, (const void *, size_t, size_t, FILE *)); - -#include <errno.h> -#include <fcntl.h> -#include <unistd.h> - -#include "msvc-inval.h" - -#include "macros.h" - -int -main (int argc, char **argv) -{ - const char *filename = "test-fwrite.txt"; - - /* We don't have an fwrite() function that installs an invalid parameter - handler so far. So install that handler here, explicitly. */ -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ - && MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING - gl_msvc_inval_ensure_handler (); -#endif - - /* Test that fwrite() on an unbuffered stream sets errno if someone else - closes the stream fd behind the back of stdio. */ - { - FILE *fp = fopen (filename, "w"); - char buf[5] = "world"; - ASSERT (fp != NULL); - setvbuf (fp, NULL, _IONBF, 0); - ASSERT (close (fileno (fp)) == 0); - errno = 0; - ASSERT (fwrite (buf, 1, sizeof (buf), fp) == 0); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - - /* Test that fwrite() on an unbuffered stream sets errno if the stream - was constructed with an invalid file descriptor. */ - { - FILE *fp = fdopen (-1, "w"); - if (fp != NULL) - { - char buf[5] = "world"; - setvbuf (fp, NULL, _IONBF, 0); - errno = 0; - ASSERT (fwrite (buf, 1, sizeof (buf), fp) == 0); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - } - { - FILE *fp; - close (99); - fp = fdopen (99, "w"); - if (fp != NULL) - { - char buf[5] = "world"; - setvbuf (fp, NULL, _IONBF, 0); - errno = 0; - ASSERT (fwrite (buf, 1, sizeof (buf), fp) == 0); - ASSERT (errno == EBADF); - ASSERT (ferror (fp)); - fclose (fp); - } - } - - /* Clean up. */ - unlink (filename); - - return 0; -} diff --git a/gl/tests/test-getdelim.c b/gl/tests/test-getdelim.c deleted file mode 100644 index 0770d5b3aa..0000000000 --- a/gl/tests/test-getdelim.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Test of getdelim() function. - Copyright (C) 2007-2016 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 Eric Blake <ebb9@byu.net>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (getdelim, ssize_t, (char **, size_t *, int, FILE *)); - -#include <stdlib.h> -#include <string.h> - -#include "macros.h" - -int -main (void) -{ - FILE *f; - char *line; - size_t len; - ssize_t result; - - /* Create test file. */ - f = fopen ("test-getdelim.txt", "wb"); - if (!f || fwrite ("anAnbcnd\0f", 1, 10, f) != 10 || fclose (f) != 0) - { - fputs ("Failed to create sample file.\n", stderr); - remove ("test-getdelim.txt"); - return 1; - } - f = fopen ("test-getdelim.txt", "rb"); - if (!f) - { - fputs ("Failed to reopen sample file.\n", stderr); - remove ("test-getdelim.txt"); - return 1; - } - - /* Test initial allocation, which must include trailing NUL. */ - line = NULL; - len = 0; - result = getdelim (&line, &len, 'n', f); - ASSERT (result == 2); - ASSERT (strcmp (line, "an") == 0); - ASSERT (2 < len); - free (line); - - /* Test initial allocation again, with line = NULL and len != 0. */ - line = NULL; - len = (size_t)(~0) / 4; - result = getdelim (&line, &len, 'n', f); - ASSERT (result == 2); - ASSERT (strcmp (line, "An") == 0); - ASSERT (2 < len); - free (line); - - /* Test growth of buffer. */ - line = malloc (1); - len = 1; - result = getdelim (&line, &len, 'n', f); - ASSERT (result == 3); - ASSERT (strcmp (line, "bcn") == 0); - ASSERT (3 < len); - - /* Test embedded NULs and EOF behavior. */ - result = getdelim (&line, &len, 'n', f); - ASSERT (result == 3); - ASSERT (memcmp (line, "d\0f", 4) == 0); - ASSERT (3 < len); - - result = getdelim (&line, &len, 'n', f); - ASSERT (result == -1); - - free (line); - fclose (f); - remove ("test-getdelim.txt"); - return 0; -} diff --git a/gl/tests/test-getline.c b/gl/tests/test-getline.c deleted file mode 100644 index 13dcb1d7f8..0000000000 --- a/gl/tests/test-getline.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Test of getline() function. - Copyright (C) 2007-2016 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 Eric Blake <ebb9@byu.net>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (getline, ssize_t, (char **, size_t *, FILE *)); - -#include <stdlib.h> -#include <string.h> - -#include "macros.h" - -int -main (void) -{ - FILE *f; - char *line; - size_t len; - ssize_t result; - - /* Create test file. */ - f = fopen ("test-getline.txt", "wb"); - if (!f || fwrite ("a\nA\nbc\nd\0f", 1, 10, f) != 10 || fclose (f) != 0) - { - fputs ("Failed to create sample file.\n", stderr); - remove ("test-getline.txt"); - return 1; - } - f = fopen ("test-getline.txt", "rb"); - if (!f) - { - fputs ("Failed to reopen sample file.\n", stderr); - remove ("test-getline.txt"); - return 1; - } - - /* Test initial allocation, which must include trailing NUL. */ - line = NULL; - len = 0; - result = getline (&line, &len, f); - ASSERT (result == 2); - ASSERT (strcmp (line, "a\n") == 0); - ASSERT (2 < len); - free (line); - - /* Test initial allocation again, with line = NULL and len != 0. */ - line = NULL; - len = (size_t)(~0) / 4; - result = getline (&line, &len, f); - ASSERT (result == 2); - ASSERT (strcmp (line, "A\n") == 0); - ASSERT (2 < len); - free (line); - - /* Test growth of buffer, must not leak. */ - len = 1; - line = malloc (len); - result = getline (&line, &len, f); - ASSERT (result == 3); - ASSERT (strcmp (line, "bc\n") == 0); - ASSERT (3 < len); - - /* Test embedded NULs and EOF behavior. */ - result = getline (&line, &len, f); - ASSERT (result == 3); - ASSERT (memcmp (line, "d\0f", 4) == 0); - ASSERT (3 < len); - - result = getline (&line, &len, f); - ASSERT (result == -1); - - free (line); - fclose (f); - remove ("test-getline.txt"); - return 0; -} diff --git a/gl/tests/test-gettimeofday.c b/gl/tests/test-gettimeofday.c deleted file mode 100644 index 7a44d71fa4..0000000000 --- a/gl/tests/test-gettimeofday.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2005, 2007, 2009-2016 Free Software Foundation, Inc. - * Written by Jim Meyering. - * - * 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/>. */ - -#include <config.h> - -#include <sys/time.h> - -#include "signature.h" -SIGNATURE_CHECK (gettimeofday, int, - (struct timeval *, GETTIMEOFDAY_TIMEZONE *)); - -#include <time.h> - -#include <stdio.h> -#include <string.h> - -int -main (void) -{ - time_t t = 0; - struct tm *lt; - struct tm saved_lt; - struct timeval tv; - lt = localtime (&t); - saved_lt = *lt; - gettimeofday (&tv, NULL); - if (memcmp (lt, &saved_lt, sizeof (struct tm)) != 0) - { - fprintf (stderr, "gettimeofday still clobbers the localtime buffer!\n"); - return 1; - } - return 0; -} diff --git a/gl/tests/test-init.sh b/gl/tests/test-init.sh deleted file mode 100755 index a6278599ad..0000000000 --- a/gl/tests/test-init.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -# Unit tests for init.sh -# Copyright (C) 2011-2016 Free Software Foundation, Inc. -# This file is part of the GNUlib Library. -# -# 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/>. */ - -: ${srcdir=.} -. "$srcdir/init.sh"; path_prepend_ . - -fail=0 - -test_compare() -{ - touch empty || fail=1 - echo xyz > in || fail=1 - - compare /dev/null /dev/null >out 2>err || fail=1 - test -s out && fail_ "out not empty: $(cat out)" - # "err" should be empty, too, but has "set -x" output when VERBOSE=yes - case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac - - compare /dev/null empty >out 2>err || fail=1 - test -s out && fail_ "out not empty: $(cat out)" - case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac - - compare in in >out 2>err || fail=1 - test -s out && fail_ "out not empty: $(cat out)" - case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac - - compare /dev/null in >out 2>err && fail=1 - cat <<\EOF > exp -diff -u /dev/null in ---- /dev/null 1970-01-01 -+++ in 1970-01-01 -+xyz -EOF - compare exp out || fail=1 - case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac - - compare empty in >out 2>err && fail=1 - # Compare against expected output only if compare is using diff -u. - if grep @ out >/dev/null; then - # Remove the TAB-date suffix on each --- and +++ line, - # for both the expected and the actual output files. - # Also remove the @@ line, since Solaris 5.10 and GNU diff formats differ: - # -@@ -0,0 +1 @@ - # +@@ -1,0 +1,1 @@ - # Also, remove space after leading '+', since AIX 7.1 diff outputs a space. - sed 's/ .*//;/^@@/d;s/^+ /+/' out > k && mv k out - cat <<\EOF > exp ---- empty -+++ in -+xyz -EOF - compare exp out || fail=1 - fi - case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac -} - -test_compare - -Exit $fail diff --git a/gl/tests/test-intprops.c b/gl/tests/test-intprops.c deleted file mode 100644 index 0a8ddcd748..0000000000 --- a/gl/tests/test-intprops.c +++ /dev/null @@ -1,370 +0,0 @@ -/* Test intprops.h. - Copyright (C) 2011-2016 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 Paul Eggert. */ - -/* Tell gcc not to warn about the long expressions that the overflow - macros expand to, or about the (X < 0) expressions. */ -#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) -# pragma GCC diagnostic ignored "-Woverlength-strings" -# pragma GCC diagnostic ignored "-Wtype-limits" - -/* Work around a bug in GCC 6.1 and earlier; see: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68971 */ -# pragma GCC diagnostic ignored "-Woverflow" - -#endif - -#include <config.h> - -#include "intprops.h" -#include "verify.h" - -#include <stdbool.h> -#include <inttypes.h> -#include <limits.h> - -#include "macros.h" - -/* VERIFY (X) uses a static assertion for compilers that are known to work, - and falls back on a dynamic assertion for other compilers. - These tests should be checkable via 'verify' rather than 'ASSERT', but - using 'verify' would run into a bug with HP-UX 11.23 cc; see - <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */ -#if __GNUC__ || __SUNPRO_C -# define VERIFY(x) do { verify (x); } while (0) -#else -# define VERIFY(x) ASSERT (x) -#endif - -#define DONTCARE __LINE__ - -int -main (void) -{ - /* Use VERIFY for tests that must be integer constant expressions, - ASSERT otherwise. */ - - /* TYPE_IS_INTEGER. */ - ASSERT (TYPE_IS_INTEGER (bool)); - ASSERT (TYPE_IS_INTEGER (char)); - ASSERT (TYPE_IS_INTEGER (signed char)); - ASSERT (TYPE_IS_INTEGER (unsigned char)); - ASSERT (TYPE_IS_INTEGER (short int)); - ASSERT (TYPE_IS_INTEGER (unsigned short int)); - ASSERT (TYPE_IS_INTEGER (int)); - ASSERT (TYPE_IS_INTEGER (unsigned int)); - ASSERT (TYPE_IS_INTEGER (long int)); - ASSERT (TYPE_IS_INTEGER (unsigned long int)); - ASSERT (TYPE_IS_INTEGER (intmax_t)); - ASSERT (TYPE_IS_INTEGER (uintmax_t)); - ASSERT (! TYPE_IS_INTEGER (float)); - ASSERT (! TYPE_IS_INTEGER (double)); - ASSERT (! TYPE_IS_INTEGER (long double)); - - /* TYPE_SIGNED. */ - /* VERIFY (! TYPE_SIGNED (bool)); // not guaranteed by gnulib substitute */ - VERIFY (TYPE_SIGNED (signed char)); - VERIFY (! TYPE_SIGNED (unsigned char)); - VERIFY (TYPE_SIGNED (short int)); - VERIFY (! TYPE_SIGNED (unsigned short int)); - VERIFY (TYPE_SIGNED (int)); - VERIFY (! TYPE_SIGNED (unsigned int)); - VERIFY (TYPE_SIGNED (long int)); - VERIFY (! TYPE_SIGNED (unsigned long int)); - VERIFY (TYPE_SIGNED (intmax_t)); - VERIFY (! TYPE_SIGNED (uintmax_t)); - ASSERT (TYPE_SIGNED (float)); - ASSERT (TYPE_SIGNED (double)); - ASSERT (TYPE_SIGNED (long double)); - - /* Integer representation. Check that it is two's complement. */ - VERIFY (INT_MIN + INT_MAX < 0); - - /* TYPE_MINIMUM, TYPE_MAXIMUM. */ - VERIFY (TYPE_MINIMUM (char) == CHAR_MIN); - VERIFY (TYPE_MAXIMUM (char) == CHAR_MAX); - VERIFY (TYPE_MINIMUM (unsigned char) == 0); - VERIFY (TYPE_MAXIMUM (unsigned char) == UCHAR_MAX); - VERIFY (TYPE_MINIMUM (signed char) == SCHAR_MIN); - VERIFY (TYPE_MAXIMUM (signed char) == SCHAR_MAX); - VERIFY (TYPE_MINIMUM (short int) == SHRT_MIN); - VERIFY (TYPE_MAXIMUM (short int) == SHRT_MAX); - VERIFY (TYPE_MINIMUM (unsigned short int) == 0); - VERIFY (TYPE_MAXIMUM (unsigned short int) == USHRT_MAX); - VERIFY (TYPE_MINIMUM (int) == INT_MIN); - VERIFY (TYPE_MAXIMUM (int) == INT_MAX); - VERIFY (TYPE_MINIMUM (unsigned int) == 0); - VERIFY (TYPE_MAXIMUM (unsigned int) == UINT_MAX); - VERIFY (TYPE_MINIMUM (long int) == LONG_MIN); - VERIFY (TYPE_MAXIMUM (long int) == LONG_MAX); - VERIFY (TYPE_MINIMUM (unsigned long int) == 0); - VERIFY (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX); - VERIFY (TYPE_MINIMUM (intmax_t) == INTMAX_MIN); - VERIFY (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX); - VERIFY (TYPE_MINIMUM (uintmax_t) == 0); - VERIFY (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX); - - /* INT_BITS_STRLEN_BOUND. */ - VERIFY (INT_BITS_STRLEN_BOUND (1) == 1); - VERIFY (INT_BITS_STRLEN_BOUND (2620) == 789); - - /* INT_STRLEN_BOUND, INT_BUFSIZE_BOUND. */ - #ifdef INT32_MAX /* POSIX guarantees int32_t; this ports to non-POSIX. */ - VERIFY (INT_STRLEN_BOUND (int32_t) == sizeof ("-2147483648") - 1); - VERIFY (INT_BUFSIZE_BOUND (int32_t) == sizeof ("-2147483648")); - #endif - #ifdef INT64_MAX - VERIFY (INT_STRLEN_BOUND (int64_t) == sizeof ("-9223372036854775808") - 1); - VERIFY (INT_BUFSIZE_BOUND (int64_t) == sizeof ("-9223372036854775808")); - #endif - - /* All the INT_<op>_RANGE_OVERFLOW tests are equally valid as - INT_<op>_OVERFLOW tests, so define macros to do both. OP is the - operation, OPNAME its symbolic name, A and B its operands, T the - result type, V the overflow flag, and VRES the result if V and if - two's complement. CHECK_BINOP is for most binary operatinos, - CHECK_SBINOP for binary +, -, * when the result type is signed, - and CHECK_UNOP for unary operations. */ - #define CHECK_BINOP(op, opname, a, b, t, v, vres) \ - VERIFY (INT_##opname##_RANGE_OVERFLOW (a, b, TYPE_MINIMUM (t), \ - TYPE_MAXIMUM (t)) \ - == (v)); \ - VERIFY (INT_##opname##_OVERFLOW (a, b) == (v)) - #define CHECK_SBINOP(op, opname, a, b, t, v, vres) \ - CHECK_BINOP(op, opname, a, b, t, v, vres); \ - { \ - t result; \ - ASSERT (INT_##opname##_WRAPV (a, b, &result) == (v)); \ - ASSERT (result == ((v) ? (vres) : ((a) op (b)))); \ - } - #define CHECK_UNOP(op, opname, a, t, v) \ - VERIFY (INT_##opname##_RANGE_OVERFLOW (a, TYPE_MINIMUM (t), \ - TYPE_MAXIMUM (t)) \ - == (v)); \ - VERIFY (INT_##opname##_OVERFLOW (a) == (v)) - - /* INT_<op>_RANGE_OVERFLOW, INT_<op>_OVERFLOW. */ - VERIFY (INT_ADD_RANGE_OVERFLOW (INT_MAX, 1, INT_MIN, INT_MAX)); - VERIFY (INT_ADD_OVERFLOW (INT_MAX, 1)); - - CHECK_SBINOP (+, ADD, INT_MAX, 1, int, true, INT_MIN); - CHECK_SBINOP (+, ADD, INT_MAX, -1, int, false, INT_MAX - 1); - CHECK_SBINOP (+, ADD, INT_MIN, 1, int, false, INT_MIN + 1); - CHECK_SBINOP (+, ADD, INT_MIN, -1, int, true, INT_MAX); - CHECK_BINOP (+, ADD, UINT_MAX, 1u, unsigned int, true, 0u); - CHECK_BINOP (+, ADD, 0u, 1u, unsigned int, false, 1u); - - CHECK_SBINOP (-, SUBTRACT, INT_MAX, 1, int, false, INT_MAX - 1); - CHECK_SBINOP (-, SUBTRACT, INT_MAX, -1, int, true, INT_MIN); - CHECK_SBINOP (-, SUBTRACT, INT_MIN, 1, int, true, INT_MAX); - CHECK_SBINOP (-, SUBTRACT, INT_MIN, -1, int, false, INT_MIN - -1); - CHECK_BINOP (-, SUBTRACT, UINT_MAX, 1u, unsigned int, false, UINT_MAX - 1u); - CHECK_BINOP (-, SUBTRACT, 0u, 1u, unsigned int, true, 0u - 1u); - - CHECK_UNOP (-, NEGATE, INT_MIN, int, true); - CHECK_UNOP (-, NEGATE, 0, int, false); - CHECK_UNOP (-, NEGATE, INT_MAX, int, false); - CHECK_UNOP (-, NEGATE, 0u, unsigned int, false); - CHECK_UNOP (-, NEGATE, 1u, unsigned int, true); - CHECK_UNOP (-, NEGATE, UINT_MAX, unsigned int, true); - - CHECK_SBINOP (*, MULTIPLY, INT_MAX, INT_MAX, int, true, 1); - CHECK_SBINOP (*, MULTIPLY, INT_MAX, INT_MIN, int, true, INT_MIN); - CHECK_SBINOP (*, MULTIPLY, INT_MIN, INT_MAX, int, true, INT_MIN); - CHECK_SBINOP (*, MULTIPLY, INT_MIN, INT_MIN, int, true, 0); - CHECK_SBINOP (*, MULTIPLY, -1, INT_MIN, int, - INT_NEGATE_OVERFLOW (INT_MIN), INT_MIN); - CHECK_SBINOP (*, MULTIPLY, LONG_MIN / INT_MAX, (long int) INT_MAX, - long int, false, LONG_MIN - LONG_MIN % INT_MAX); - - CHECK_BINOP (/, DIVIDE, INT_MIN, -1, int, - INT_NEGATE_OVERFLOW (INT_MIN), INT_MIN); - CHECK_BINOP (/, DIVIDE, INT_MAX, 1, int, false, INT_MAX); - CHECK_BINOP (/, DIVIDE, (unsigned int) INT_MIN, -1u, unsigned int, - false, INT_MIN / -1u); - - CHECK_BINOP (%, REMAINDER, INT_MIN, -1, int, INT_NEGATE_OVERFLOW (INT_MIN), 0); - CHECK_BINOP (%, REMAINDER, INT_MAX, 1, int, false, 0); - CHECK_BINOP (%, REMAINDER, (unsigned int) INT_MIN, -1u, unsigned int, - false, INT_MIN % -1u); - - CHECK_BINOP (<<, LEFT_SHIFT, UINT_MAX, 1, unsigned int, true, UINT_MAX << 1); - CHECK_BINOP (<<, LEFT_SHIFT, UINT_MAX / 2 + 1, 1, unsigned int, true, - (UINT_MAX / 2 + 1) << 1); - CHECK_BINOP (<<, LEFT_SHIFT, UINT_MAX / 2, 1, unsigned int, false, - (UINT_MAX / 2) << 1); - - /* INT_<op>_OVERFLOW and INT_<op>_WRAPV with mixed types. */ - #define CHECK_SUM(a, b, t, v, vres) \ - CHECK_SUM1(a, b, t, v, vres); \ - CHECK_SUM1(b, a, t, v, vres) - #define CHECK_SSUM(a, b, t, v, vres) \ - CHECK_SSUM1(a, b, t, v, vres); \ - CHECK_SSUM1(b, a, t, v, vres) - #define CHECK_SUM1(a, b, t, v, vres) \ - VERIFY (INT_ADD_OVERFLOW (a, b) == (v)) - #define CHECK_SSUM1(a, b, t, v, vres) \ - CHECK_SUM1(a, b, t, v, vres); \ - { \ - t result; \ - ASSERT (INT_ADD_WRAPV (a, b, &result) == (v)); \ - ASSERT (result == ((v) ? (vres) : ((a) + (b)))); \ - } - CHECK_SSUM (-1, LONG_MIN, long int, true, LONG_MAX); - CHECK_SUM (-1, UINT_MAX, unsigned int, false, DONTCARE); - CHECK_SSUM (-1L, INT_MIN, long int, INT_MIN == LONG_MIN, - INT_MIN == LONG_MIN ? INT_MAX : DONTCARE); - CHECK_SUM (0u, -1, unsigned int, true, 0u + -1); - CHECK_SUM (0u, 0, unsigned int, false, DONTCARE); - CHECK_SUM (0u, 1, unsigned int, false, DONTCARE); - CHECK_SSUM (1, LONG_MAX, long int, true, LONG_MIN); - CHECK_SUM (1, UINT_MAX, unsigned int, true, 0u); - CHECK_SSUM (1L, INT_MAX, long int, INT_MAX == LONG_MAX, - INT_MAX == LONG_MAX ? INT_MIN : DONTCARE); - CHECK_SUM (1u, INT_MAX, unsigned int, INT_MAX == UINT_MAX, 1u + INT_MAX); - CHECK_SUM (1u, INT_MIN, unsigned int, true, 1u + INT_MIN); - { - long int result; - ASSERT (INT_ADD_WRAPV (1, INT_MAX, &result) == (INT_MAX == LONG_MAX)); - ASSERT (INT_ADD_WRAPV (-1, INT_MIN, &result) == (INT_MIN == LONG_MIN)); - } - - #define CHECK_DIFFERENCE(a, b, t, v, vres) \ - VERIFY (INT_SUBTRACT_OVERFLOW (a, b) == (v)) - #define CHECK_SDIFFERENCE(a, b, t, v, vres) \ - CHECK_DIFFERENCE(a, b, t, v, vres); \ - { \ - t result; \ - ASSERT (INT_SUBTRACT_WRAPV (a, b, &result) == (v)); \ - ASSERT (result == ((v) ? (vres) : ((a) - (b)))); \ - } - CHECK_DIFFERENCE (INT_MAX, 1u, unsigned int, UINT_MAX < INT_MAX - 1, - INT_MAX - 1u); - CHECK_DIFFERENCE (UINT_MAX, 1, unsigned int, false, UINT_MAX - 1); - CHECK_DIFFERENCE (0u, -1, unsigned int, false, 0u - -1); - CHECK_DIFFERENCE (UINT_MAX, -1, unsigned int, true, UINT_MAX - -1); - CHECK_DIFFERENCE (INT_MIN, 1u, unsigned int, true, INT_MIN - 1u); - CHECK_DIFFERENCE (-1, 0u, unsigned int, true, -1 - 0u); - CHECK_SDIFFERENCE (-1, INT_MIN, int, false, -1 - INT_MIN); - CHECK_SDIFFERENCE (-1, INT_MAX, int, false, -1 - INT_MAX); - CHECK_SDIFFERENCE (0, INT_MIN, int, INT_MIN < -INT_MAX, INT_MIN); - CHECK_SDIFFERENCE (0, INT_MAX, int, false, 0 - INT_MAX); - { - long int result; - ASSERT (INT_SUBTRACT_WRAPV (INT_MAX, -1, &result) == (INT_MAX == LONG_MAX)); - ASSERT (INT_SUBTRACT_WRAPV (INT_MIN, 1, &result) == (INT_MAX == LONG_MAX)); - } - - #define CHECK_PRODUCT(a, b, t, v, vres) \ - CHECK_PRODUCT1(a, b, t, v, vres); \ - CHECK_PRODUCT1(b, a, t, v, vres) - #define CHECK_SPRODUCT(a, b, t, v, vres) \ - CHECK_SPRODUCT1(a, b, t, v, vres); \ - CHECK_SPRODUCT1(b, a, t, v, vres) - #define CHECK_PRODUCT1(a, b, t, v, vres) \ - VERIFY (INT_MULTIPLY_OVERFLOW (a, b) == (v)) - #define CHECK_SPRODUCT1(a, b, t, v, vres) \ - CHECK_PRODUCT1(a, b, t, v, vres); \ - { \ - t result; \ - ASSERT (INT_MULTIPLY_WRAPV (a, b, &result) == (v)); \ - ASSERT (result == ((v) ? (vres) : ((a) * (b)))); \ - } - CHECK_PRODUCT (-1, 1u, unsigned int, true, -1 * 1u); - CHECK_SPRODUCT (-1, INT_MIN, int, INT_NEGATE_OVERFLOW (INT_MIN), INT_MIN); - CHECK_PRODUCT (-1, UINT_MAX, unsigned int, true, -1 * UINT_MAX); - CHECK_SPRODUCT (-32768, LONG_MAX / -32768 - 1, long int, true, LONG_MIN); - CHECK_SPRODUCT (-12345, LONG_MAX / -12345, long int, false, DONTCARE); - CHECK_SPRODUCT (0, -1, int, false, DONTCARE); - CHECK_SPRODUCT (0, 0, int, false, DONTCARE); - CHECK_PRODUCT (0, 0u, unsigned int, false, DONTCARE); - CHECK_SPRODUCT (0, 1, int, false, DONTCARE); - CHECK_SPRODUCT (0, INT_MAX, int, false, DONTCARE); - CHECK_SPRODUCT (0, INT_MIN, int, false, DONTCARE); - CHECK_PRODUCT (0, UINT_MAX, unsigned int, false, DONTCARE); - CHECK_PRODUCT (0u, -1, unsigned int, false, DONTCARE); - CHECK_PRODUCT (0u, 0, unsigned int, false, DONTCARE); - CHECK_PRODUCT (0u, 0u, unsigned int, false, DONTCARE); - CHECK_PRODUCT (0u, 1, unsigned int, false, DONTCARE); - CHECK_PRODUCT (0u, INT_MAX, unsigned int, false, DONTCARE); - CHECK_PRODUCT (0u, INT_MIN, unsigned int, false, DONTCARE); - CHECK_PRODUCT (0u, UINT_MAX, unsigned int, false, DONTCARE); - CHECK_SPRODUCT (1, INT_MAX, int, false, DONTCARE); - CHECK_SPRODUCT (1, INT_MIN, int, false, DONTCARE); - CHECK_PRODUCT (1, UINT_MAX, unsigned int, false, DONTCARE); - CHECK_PRODUCT (1u, INT_MIN, unsigned int, true, 1u * INT_MIN); - CHECK_PRODUCT (1u, INT_MAX, unsigned int, UINT_MAX < INT_MAX, 1u * INT_MAX); - CHECK_PRODUCT (INT_MAX, UINT_MAX, unsigned int, true, INT_MAX * UINT_MAX); - CHECK_PRODUCT (INT_MAX, ULONG_MAX, unsigned long int, true, - INT_MAX * ULONG_MAX); - CHECK_SPRODUCT (INT_MIN, LONG_MAX / INT_MIN - 1, long int, true, LONG_MIN); - CHECK_SPRODUCT (INT_MIN, LONG_MAX / INT_MIN, long int, false, DONTCARE); - CHECK_PRODUCT (INT_MIN, UINT_MAX, unsigned int, true, INT_MIN * UINT_MAX); - CHECK_PRODUCT (INT_MIN, ULONG_MAX, unsigned long int, true, - INT_MIN * ULONG_MAX); - { - long int result; - ASSERT (INT_MULTIPLY_WRAPV (INT_MAX, INT_MAX, &result) - == (LONG_MAX / INT_MAX < INT_MAX)); - ASSERT (INT_MULTIPLY_WRAPV (INT_MAX, INT_MAX, &result) - || result == INT_MAX * (long int) INT_MAX); - ASSERT (INT_MULTIPLY_WRAPV (INT_MIN, INT_MIN, &result) - || result == INT_MIN * (long int) INT_MIN); - } - -# ifdef LLONG_MAX - { - long long int result; - ASSERT (INT_MULTIPLY_WRAPV (LONG_MAX, LONG_MAX, &result) - == (LLONG_MAX / LONG_MAX < LONG_MAX)); - ASSERT (INT_MULTIPLY_WRAPV (LONG_MAX, LONG_MAX, &result) - || result == LONG_MAX * (long long int) LONG_MAX); - ASSERT (INT_MULTIPLY_WRAPV (LONG_MIN, LONG_MIN, &result) - || result == LONG_MIN * (long long int) LONG_MIN); - } -# endif - - #define CHECK_QUOTIENT(a, b, v) VERIFY (INT_DIVIDE_OVERFLOW (a, b) == (v)) - - CHECK_QUOTIENT (INT_MIN, -1L, INT_MIN == LONG_MIN); - CHECK_QUOTIENT (INT_MIN, UINT_MAX, false); - CHECK_QUOTIENT (INTMAX_MIN, UINTMAX_MAX, false); - CHECK_QUOTIENT (INTMAX_MIN, UINT_MAX, false); - CHECK_QUOTIENT (-11, 10u, true); - CHECK_QUOTIENT (-10, 10u, true); - CHECK_QUOTIENT (-9, 10u, false); - CHECK_QUOTIENT (11u, -10, true); - CHECK_QUOTIENT (10u, -10, true); - CHECK_QUOTIENT (9u, -10, false); - - #define CHECK_REMAINDER(a, b, v) VERIFY (INT_REMAINDER_OVERFLOW (a, b) == (v)) - - CHECK_REMAINDER (INT_MIN, -1L, INT_MIN == LONG_MIN); - CHECK_REMAINDER (-1, UINT_MAX, true); - CHECK_REMAINDER ((intmax_t) -1, UINTMAX_MAX, true); - CHECK_REMAINDER (INTMAX_MIN, UINT_MAX, - (INTMAX_MAX < UINT_MAX - && - (unsigned int) INTMAX_MIN % UINT_MAX != 0)); - CHECK_REMAINDER (INT_MIN, ULONG_MAX, INT_MIN % ULONG_MAX != 1); - CHECK_REMAINDER (1u, -1, false); - CHECK_REMAINDER (37*39u, -39, false); - CHECK_REMAINDER (37*39u + 1, -39, true); - CHECK_REMAINDER (37*39u - 1, -39, true); - CHECK_REMAINDER (LONG_MAX, -INT_MAX, false); - - return 0; -} diff --git a/gl/tests/test-inttypes.c b/gl/tests/test-inttypes.c deleted file mode 100644 index 9a3193c398..0000000000 --- a/gl/tests/test-inttypes.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Test of <inttypes.h> substitute. - Copyright (C) 2006-2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <inttypes.h> - -#include <stddef.h> - -/* Tests for macros supposed to be defined in inttypes.h. */ - -const char *k = /* implicit string concatenation */ -#ifdef INT8_MAX - PRId8 PRIi8 -#endif -#ifdef UINT8_MAX - PRIo8 PRIu8 PRIx8 PRIX8 -#endif -#ifdef INT16_MAX - PRId16 PRIi16 -#endif -#ifdef UINT16_MAX - PRIo16 PRIu16 PRIx16 PRIX16 -#endif -#ifdef INT32_MAX - PRId32 PRIi32 -#endif -#ifdef UINT32_MAX - PRIo32 PRIu32 PRIx32 PRIX32 -#endif -#ifdef INT64_MAX - PRId64 PRIi64 -#endif -#ifdef UINT64_MAX - PRIo64 PRIu64 PRIx64 PRIX64 -#endif - PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8 - PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16 - PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32 - PRIdLEAST64 PRIiLEAST64 - PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64 - PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8 - PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16 - PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32 - PRIdFAST64 PRIiFAST64 - PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64 - PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX -#ifdef INTPTR_MAX - PRIdPTR PRIiPTR -#endif -#ifdef UINTPTR_MAX - PRIoPTR PRIuPTR PRIxPTR PRIXPTR -#endif - ; -const char *l = /* implicit string concatenation */ -#ifdef INT8_MAX - SCNd8 SCNi8 -#endif -#ifdef UINT8_MAX - SCNo8 SCNu8 SCNx8 -#endif -#ifdef INT16_MAX - SCNd16 SCNi16 -#endif -#ifdef UINT16_MAX - SCNo16 SCNu16 SCNx16 -#endif -#ifdef INT32_MAX - SCNd32 SCNi32 -#endif -#ifdef UINT32_MAX - SCNo32 SCNu32 SCNx32 -#endif -#ifdef INT64_MAX - SCNd64 SCNi64 -#endif -#ifdef UINT64_MAX - SCNo64 SCNu64 SCNx64 -#endif - SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8 - SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16 - SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32 - SCNdLEAST64 SCNiLEAST64 - SCNoLEAST64 SCNuLEAST64 SCNxLEAST64 - SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8 - SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16 - SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32 - SCNdFAST64 SCNiFAST64 - SCNoFAST64 SCNuFAST64 SCNxFAST64 - SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX -#ifdef INTPTR_MAX - SCNdPTR SCNiPTR -#endif -#ifdef UINTPTR_MAX - SCNoPTR SCNuPTR SCNxPTR -#endif - ; - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-limits-h.c b/gl/tests/test-limits-h.c deleted file mode 100644 index f5576bff01..0000000000 --- a/gl/tests/test-limits-h.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Test of <limits.h> substitute. - Copyright 2016 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 Paul Eggert. */ - -#include <config.h> - -#include <limits.h> - -#include "verify.h" - -#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) -# pragma GCC diagnostic ignored "-Woverlength-strings" -#endif - -/* Macros specified by ISO/IEC TS 18661-1:2014. */ - -#define verify_width(width, min, max) \ - verify ((max) >> ((width) - 1 - ((min) < 0)) == 1) - -verify_width (CHAR_WIDTH, CHAR_MIN, CHAR_MAX); -verify_width (SCHAR_WIDTH, SCHAR_MIN, SCHAR_MAX); -verify_width (UCHAR_WIDTH, 0, UCHAR_MAX); -verify_width (SHRT_WIDTH, SHRT_MIN, SHRT_MAX); -verify_width (USHRT_WIDTH, 0, USHRT_MAX); -verify_width (INT_WIDTH, INT_MIN, INT_MAX); -verify_width (UINT_WIDTH, 0, UINT_MAX); -verify_width (LONG_WIDTH, LONG_MIN, LONG_MAX); -verify_width (ULONG_WIDTH, 0, ULONG_MAX); -verify_width (LLONG_WIDTH, LLONG_MIN, LLONG_MAX); -verify_width (ULLONG_WIDTH, 0, ULLONG_MAX); - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-memchr.c b/gl/tests/test-memchr.c deleted file mode 100644 index 1526ed2a69..0000000000 --- a/gl/tests/test-memchr.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2008-2016 Free Software Foundation, Inc. - * Written by Eric Blake and Bruno Haible - * - * 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/>. */ - -#include <config.h> - -#include <string.h> - -#include "signature.h" -SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t)); - -#include <stdlib.h> - -#include "zerosize-ptr.h" -#include "macros.h" - -/* Calculating void * + int is not portable, so this wrapper converts - to char * to make the tests easier to write. */ -#define MEMCHR (char *) memchr - -int -main (void) -{ - size_t n = 0x100000; - char *input = malloc (n); - ASSERT (input); - - input[0] = 'a'; - input[1] = 'b'; - memset (input + 2, 'c', 1024); - memset (input + 1026, 'd', n - 1028); - input[n - 2] = 'e'; - input[n - 1] = 'a'; - - /* Basic behavior tests. */ - ASSERT (MEMCHR (input, 'a', n) == input); - - ASSERT (MEMCHR (input, 'a', 0) == NULL); - ASSERT (MEMCHR (zerosize_ptr (), 'a', 0) == NULL); - - ASSERT (MEMCHR (input, 'b', n) == input + 1); - ASSERT (MEMCHR (input, 'c', n) == input + 2); - ASSERT (MEMCHR (input, 'd', n) == input + 1026); - - ASSERT (MEMCHR (input + 1, 'a', n - 1) == input + n - 1); - ASSERT (MEMCHR (input + 1, 'e', n - 1) == input + n - 2); - ASSERT (MEMCHR (input + 1, 0x789abc00 | 'e', n - 1) == input + n - 2); - - ASSERT (MEMCHR (input, 'f', n) == NULL); - ASSERT (MEMCHR (input, '\0', n) == NULL); - - /* Check that a very long haystack is handled quickly if the byte is - found near the beginning. */ - { - size_t repeat = 10000; - for (; repeat > 0; repeat--) - { - ASSERT (MEMCHR (input, 'c', n) == input + 2); - } - } - - /* Alignment tests. */ - { - int i, j; - for (i = 0; i < 32; i++) - { - for (j = 0; j < 256; j++) - input[i + j] = j; - for (j = 0; j < 256; j++) - { - ASSERT (MEMCHR (input + i, j, 256) == input + i + j); - } - } - } - - /* Check that memchr() does not read past the first occurrence of the - byte being searched. See the Austin Group's clarification - <http://www.opengroup.org/austin/docs/austin_454.txt>. - Test both '\0' and something else, since some implementations - special-case searching for NUL. - */ - { - char *page_boundary = (char *) zerosize_ptr (); - /* Too small, and we miss cache line boundary tests; too large, - and the test takes cubically longer to complete. */ - int limit = 257; - - if (page_boundary != NULL) - { - for (n = 1; n <= limit; n++) - { - char *mem = page_boundary - n; - memset (mem, 'X', n); - ASSERT (MEMCHR (mem, 'U', n) == NULL); - ASSERT (MEMCHR (mem, 0, n) == NULL); - - { - size_t i; - size_t k; - - for (i = 0; i < n; i++) - { - mem[i] = 'U'; - for (k = i + 1; k < n + limit; k++) - ASSERT (MEMCHR (mem, 'U', k) == mem + i); - mem[i] = 0; - for (k = i + 1; k < n + limit; k++) - ASSERT (MEMCHR (mem, 0, k) == mem + i); - mem[i] = 'X'; - } - } - } - } - } - - free (input); - - return 0; -} diff --git a/gl/tests/test-netdb.c b/gl/tests/test-netdb.c deleted file mode 100644 index 93d9c97a5c..0000000000 --- a/gl/tests/test-netdb.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test of <netdb.h> substitute. - Copyright (C) 2007-2008, 2010-2016 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 Simon Josefsson <simon@josefsson.org>, 2008. */ - -#include <config.h> -#include <netdb.h> - -/* Check that the 'struct hostent' type is defined. */ -struct hostent t1; - -/* Check that the 'socklen_t' type is defined. */ -socklen_t t2; - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-netinet_in.c b/gl/tests/test-netinet_in.c deleted file mode 100644 index 8a603da6eb..0000000000 --- a/gl/tests/test-netinet_in.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test of <netinet/in.h> substitute. - Copyright (C) 2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <netinet/in.h> - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-read-file.c b/gl/tests/test-read-file.c deleted file mode 100644 index ab13f14b32..0000000000 --- a/gl/tests/test-read-file.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2006-2007, 2010-2016 Free Software Foundation, Inc. - * Written by Simon Josefsson - * - * 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/>. */ - -#include <config.h> - -#include "read-file.h" - -#include <stdio.h> -#include <stdlib.h> -#include <sys/stat.h> - -#define FILE1 "/etc/resolv.conf" -#define FILE2 "/dev/null" - -int -main (void) -{ - struct stat statbuf; - int err = 0; - - /* We can perform the test only if the file exists and is readable. - Test whether it exists, then assume it is world-readable. */ - if (stat (FILE1, &statbuf) >= 0) - { - size_t len; - char *out = read_file (FILE1, &len); - - if (!out) - { - perror ("Could not read file"); - err = 1; - } - else - { - if (out[len] != '\0') - { - perror ("BAD: out[len] not zero"); - err = 1; - } - - if (S_ISREG (statbuf.st_mode)) - { - /* FILE1 is a regular file or a symlink to a regular file. */ - if (len != statbuf.st_size) - { - fprintf (stderr, "Read %lu from %s...\n", - (unsigned long) len, FILE1); - err = 1; - } - } - else - { - /* Assume FILE1 is not empty. */ - if (len == 0) - { - fprintf (stderr, "Read nothing from %s\n", FILE1); - err = 1; - } - } - free (out); - } - } - - /* We can perform the test only if the file exists and is readable. - Test whether it exists, then assume it is world-readable. */ - if (stat (FILE2, &statbuf) >= 0) - { - size_t len; - char *out = read_file (FILE2, &len); - - if (!out) - { - perror ("Could not read file"); - err = 1; - } - else - { - if (out[len] != '\0') - { - perror ("BAD: out[len] not zero"); - err = 1; - } - - /* /dev/null should always be empty. Ignore statbuf.st_size, since it - is not a regular file. */ - if (len != 0) - { - fprintf (stderr, "Read %lu from %s...\n", - (unsigned long) len, FILE2); - err = 1; - } - free (out); - } - } - - return err; -} diff --git a/gl/tests/test-snprintf.c b/gl/tests/test-snprintf.c deleted file mode 100644 index 9041e4a047..0000000000 --- a/gl/tests/test-snprintf.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Test of snprintf() function. - Copyright (C) 2007-2016 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>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (snprintf, int, (char *, size_t, char const *, ...)); - -#include <string.h> - -#include "macros.h" - -int -main (int argc, char *argv[]) -{ - char buf[8]; - int size; - int retval; - - retval = snprintf (NULL, 0, "%d", 12345); - ASSERT (retval == 5); - - for (size = 0; size <= 8; size++) - { - memcpy (buf, "DEADBEEF", 8); - retval = snprintf (buf, size, "%d", 12345); - ASSERT (retval == 5); - if (size < 6) - { - if (size > 0) - { - ASSERT (memcmp (buf, "12345", size - 1) == 0); - ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size); - } -#if !CHECK_SNPRINTF_POSIX - if (size > 0) -#endif - ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); - } - else - { - ASSERT (memcmp (buf, "12345\0EF", 8) == 0); - } - } - - /* Test the support of the POSIX/XSI format strings with positions. */ - { - char result[100]; - retval = snprintf (result, sizeof (result), "%2$d %1$d", 33, 55); - ASSERT (strcmp (result, "55 33") == 0); - ASSERT (retval == strlen (result)); - } - - return 0; -} diff --git a/gl/tests/test-stdalign.c b/gl/tests/test-stdalign.c deleted file mode 100644 index 0f240c5516..0000000000 --- a/gl/tests/test-stdalign.c +++ /dev/null @@ -1,116 +0,0 @@ -/* Test of <stdalign.h>. - Copyright 2009-2016 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 Paul Eggert, inspired by Bruno Haible's test-alignof.c. */ - -#include <config.h> - -#include <stdalign.h> - -#include <stddef.h> -#include <stdint.h> - -#include "verify.h" - -#include "macros.h" - -typedef long double longdouble; -typedef struct { char a[1]; } struct1; -typedef struct { char a[2]; } struct2; -typedef struct { char a[3]; } struct3; -typedef struct { char a[4]; } struct4; - -verify (__alignof_is_defined == 1); -#ifndef alignof -# error "alignof is not a macro" -#endif - -#if __alignas_is_defined -verify (__alignas_is_defined == 1); -# ifndef alignas -# error "alignas is not a macro" -# endif -/* mingw can go up only to 8. 8 is all that GNU Emacs needs, so let's - limit the test to 8 for now. */ -# define TEST_ALIGNMENT 8 -#else -# define _Alignas(alignment) -# define alignas(alignment) -# define TEST_ALIGNMENT 1 -#endif - -#define CHECK_STATIC(type) \ - typedef struct { char slot1; type slot2; } type##_helper; \ - verify (alignof (type) == offsetof (type##_helper, slot2)); \ - verify (_Alignof (type) == alignof (type)); \ - const int type##_alignment = alignof (type); \ - type alignas (TEST_ALIGNMENT) static_##type##_alignas; \ - type _Alignas (TEST_ALIGNMENT) static_##type##_Alignas - -#define CHECK_ALIGNED(var) ASSERT ((uintptr_t) &(var) % TEST_ALIGNMENT == 0) - -CHECK_STATIC (char); -CHECK_STATIC (short); -CHECK_STATIC (int); -CHECK_STATIC (long); -#ifdef INT64_MAX -CHECK_STATIC (int64_t); -#endif -CHECK_STATIC (float); -CHECK_STATIC (double); -/* CHECK_STATIC (longdouble); */ -CHECK_STATIC (struct1); -CHECK_STATIC (struct2); -CHECK_STATIC (struct3); -CHECK_STATIC (struct4); - -int -main () -{ -#if defined __SUNPRO_C - /* Avoid a test failure due to Sun Studio Developer Bug Report #2125432. */ - fputs ("Skipping test: known Sun C compiler bug\n", stderr); - return 77; -#else - CHECK_ALIGNED (static_char_alignas); - CHECK_ALIGNED (static_char_Alignas); - CHECK_ALIGNED (static_short_alignas); - CHECK_ALIGNED (static_short_Alignas); - CHECK_ALIGNED (static_int_alignas); - CHECK_ALIGNED (static_int_Alignas); - CHECK_ALIGNED (static_long_alignas); - CHECK_ALIGNED (static_long_Alignas); -# ifdef INT64_MAX - CHECK_ALIGNED (static_int64_t_alignas); - CHECK_ALIGNED (static_int64_t_Alignas); -# endif - CHECK_ALIGNED (static_float_alignas); - CHECK_ALIGNED (static_float_Alignas); - CHECK_ALIGNED (static_double_alignas); - CHECK_ALIGNED (static_double_Alignas); - /* CHECK_ALIGNED (static_longdouble_alignas); */ - /* CHECK_ALIGNED (static_longdouble_Alignas); */ - CHECK_ALIGNED (static_struct1_alignas); - CHECK_ALIGNED (static_struct1_Alignas); - CHECK_ALIGNED (static_struct2_alignas); - CHECK_ALIGNED (static_struct2_Alignas); - CHECK_ALIGNED (static_struct3_alignas); - CHECK_ALIGNED (static_struct3_Alignas); - CHECK_ALIGNED (static_struct4_alignas); - CHECK_ALIGNED (static_struct4_Alignas); - return 0; -#endif -} diff --git a/gl/tests/test-stdbool.c b/gl/tests/test-stdbool.c deleted file mode 100644 index 45dc837675..0000000000 --- a/gl/tests/test-stdbool.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Test of <stdbool.h> substitute. - Copyright (C) 2002-2007, 2009-2016 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>, 2007. */ - -/* We want this test to succeed even when using gcc's -Werror; but to - do that requires a pragma that didn't exist before 4.3.0. */ -#ifndef __GNUC__ -# define ADDRESS_CHECK_OKAY -#elif __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) -/* No way to silence -Waddress. */ -#else -# pragma GCC diagnostic ignored "-Waddress" -# define ADDRESS_CHECK_OKAY -#endif - -#include <config.h> - -#include <stdbool.h> - -#ifndef bool - "error: bool is not defined" -#endif -#ifndef false - "error: false is not defined" -#endif -#if false - "error: false is not 0" -#endif -#ifndef true - "error: true is not defined" -#endif -#if true != 1 - "error: true is not 1" -#endif -#ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" -#endif - -/* Several tests cannot be guaranteed with gnulib's <stdbool.h>, at - least, not for all compilers and compiler options. */ -#if HAVE_STDBOOL_H || 3 <= __GNUC__ -struct s { _Bool s: 1; _Bool t; } s; -#endif - -char a[true == 1 ? 1 : -1]; -char b[false == 0 ? 1 : -1]; -char c[__bool_true_false_are_defined == 1 ? 1 : -1]; -#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above. */ -char d[(bool) 0.5 == true ? 1 : -1]; -# ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning. */ -/* C99 may plausibly be interpreted as not requiring support for a cast from - a variable's address to bool in a static initializer. So treat it like a - GCC extension. */ -# ifdef __GNUC__ -bool e = &s; -# endif -# endif -char f[(_Bool) 0.0 == false ? 1 : -1]; -#endif -char g[true]; -char h[sizeof (_Bool)]; -#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above. */ -char i[sizeof s.t]; -#endif -enum { j = false, k = true, l = false * true, m = true * 256 }; -_Bool n[m]; -char o[sizeof n == m * sizeof n[0] ? 1 : -1]; -char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; -/* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ -_Bool q = true; -_Bool *pq = &q; - -int -main () -{ - int error = 0; - -#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above. */ -# ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning. */ - /* A cast from a variable's address to bool is valid in expressions. */ - { - bool e1 = &s; - if (!e1) - error = 1; - } -# endif -#endif - - /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 - reported by James Lemley on 2005-10-05; see - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html - This is a runtime test, since a corresponding compile-time - test would rely on initializer extensions. */ - { - char digs[] = "0123456789"; - if (&(digs + 5)[-2 + (bool) 1] != &digs[4]) - error = 1; - } - - return error; -} diff --git a/gl/tests/test-stddef.c b/gl/tests/test-stddef.c deleted file mode 100644 index bfb72a01dc..0000000000 --- a/gl/tests/test-stddef.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Test of <stddef.h> substitute. - Copyright (C) 2009-2016 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 Eric Blake <ebb9@byu.net>, 2009. */ - -#include <config.h> - -#include <stddef.h> -#include <stdalign.h> -#include "verify.h" - -/* Check that appropriate types are defined. */ -wchar_t a = 'c'; -ptrdiff_t b = 1; -size_t c = 2; -max_align_t x; - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -/* Check that offsetof produces integer constants with correct type. */ -struct d -{ - char e; - char f; -}; -/* Solaris 10 has a bug where offsetof is under-parenthesized, and - cannot be used as an arbitrary expression. However, since it is - unlikely to bite real code, we ignore that short-coming. */ -/* verify (sizeof offsetof (struct d, e) == sizeof (size_t)); */ -verify (sizeof (offsetof (struct d, e)) == sizeof (size_t)); -verify (offsetof (struct d, e) < -1); /* Must be unsigned. */ -verify (offsetof (struct d, f) == 1); - -/* Check max_align_t's alignment. */ -verify (alignof (double) <= alignof (max_align_t)); -verify (alignof (int) <= alignof (max_align_t)); -verify (alignof (long double) <= alignof (max_align_t)); -verify (alignof (long int) <= alignof (max_align_t)); -verify (alignof (ptrdiff_t) <= alignof (max_align_t)); -verify (alignof (size_t) <= alignof (max_align_t)); -verify (alignof (wchar_t) <= alignof (max_align_t)); -verify (alignof (struct d) <= alignof (max_align_t)); -#if defined __GNUC__ || defined __IBM__ALIGNOF__ -verify (__alignof__ (double) <= __alignof__ (max_align_t)); -verify (__alignof__ (int) <= __alignof__ (max_align_t)); -verify (__alignof__ (long double) <= __alignof__ (max_align_t)); -verify (__alignof__ (long int) <= __alignof__ (max_align_t)); -verify (__alignof__ (ptrdiff_t) <= __alignof__ (max_align_t)); -verify (__alignof__ (size_t) <= __alignof__ (max_align_t)); -verify (__alignof__ (wchar_t) <= __alignof__ (max_align_t)); -verify (__alignof__ (struct d) <= __alignof__ (max_align_t)); -#endif - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-stdint.c b/gl/tests/test-stdint.c deleted file mode 100644 index 6eb1d2edab..0000000000 --- a/gl/tests/test-stdint.c +++ /dev/null @@ -1,426 +0,0 @@ -/* Test of <stdint.h> substitute. - Copyright (C) 2006-2016 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>, 2006. */ - -#include <config.h> - -/* Whether to enable pedantic checks. */ -#define DO_PEDANTIC 0 - -#include <stdint.h> - -#include "verify.h" -#include "intprops.h" - -#if __GNUC__ >= 2 && DO_PEDANTIC -# define verify_same_types(expr1,expr2) \ - extern void _verify_func(__LINE__) (__typeof__ (expr1) *); \ - extern void _verify_func(__LINE__) (__typeof__ (expr2) *); -# define _verify_func(line) _verify_func2(line) -# define _verify_func2(line) verify_func_ ## line -#else -# define verify_same_types(expr1,expr2) extern void verify_func (int) -#endif - -/* 7.18.1.1. Exact-width integer types */ -/* 7.18.2.1. Limits of exact-width integer types */ - -int8_t a1[3] = { INT8_C (17), INT8_MIN, INT8_MAX }; -verify (TYPE_MINIMUM (int8_t) == INT8_MIN); -verify (TYPE_MAXIMUM (int8_t) == INT8_MAX); -verify_same_types (INT8_MIN, (int8_t) 0 + 0); -verify_same_types (INT8_MAX, (int8_t) 0 + 0); - -int16_t a2[3] = { INT16_C (17), INT16_MIN, INT16_MAX }; -verify (TYPE_MINIMUM (int16_t) == INT16_MIN); -verify (TYPE_MAXIMUM (int16_t) == INT16_MAX); -verify_same_types (INT16_MIN, (int16_t) 0 + 0); -verify_same_types (INT16_MAX, (int16_t) 0 + 0); - -int32_t a3[3] = { INT32_C (17), INT32_MIN, INT32_MAX }; -verify (TYPE_MINIMUM (int32_t) == INT32_MIN); -verify (TYPE_MAXIMUM (int32_t) == INT32_MAX); -verify_same_types (INT32_MIN, (int32_t) 0 + 0); -verify_same_types (INT32_MAX, (int32_t) 0 + 0); - -#ifdef INT64_MAX -int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX }; -verify (TYPE_MINIMUM (int64_t) == INT64_MIN); -verify (TYPE_MAXIMUM (int64_t) == INT64_MAX); -verify_same_types (INT64_MIN, (int64_t) 0 + 0); -verify_same_types (INT64_MAX, (int64_t) 0 + 0); -#endif - -uint8_t b1[2] = { UINT8_C (17), UINT8_MAX }; -verify (TYPE_MAXIMUM (uint8_t) == UINT8_MAX); -verify_same_types (UINT8_MAX, (uint8_t) 0 + 0); - -uint16_t b2[2] = { UINT16_C (17), UINT16_MAX }; -verify (TYPE_MAXIMUM (uint16_t) == UINT16_MAX); -verify_same_types (UINT16_MAX, (uint16_t) 0 + 0); - -uint32_t b3[2] = { UINT32_C (17), UINT32_MAX }; -verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX); -verify_same_types (UINT32_MAX, (uint32_t) 0 + 0); - -#ifdef UINT64_MAX -uint64_t b4[2] = { UINT64_C (17), UINT64_MAX }; -verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX); -verify_same_types (UINT64_MAX, (uint64_t) 0 + 0); -#endif - -#if INT8_MIN && INT8_MAX && INT16_MIN && INT16_MAX && INT32_MIN && INT32_MAX -/* ok */ -#else -err or; -#endif - -#if UINT8_MAX && UINT16_MAX && UINT32_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.2. Minimum-width integer types */ -/* 7.18.2.2. Limits of minimum-width integer types */ - -int_least8_t c1[3] = { 17, INT_LEAST8_MIN, INT_LEAST8_MAX }; -verify (TYPE_MINIMUM (int_least8_t) == INT_LEAST8_MIN); -verify (TYPE_MAXIMUM (int_least8_t) == INT_LEAST8_MAX); -verify_same_types (INT_LEAST8_MIN, (int_least8_t) 0 + 0); -verify_same_types (INT_LEAST8_MAX, (int_least8_t) 0 + 0); - -int_least16_t c2[3] = { 17, INT_LEAST16_MIN, INT_LEAST16_MAX }; -verify (TYPE_MINIMUM (int_least16_t) == INT_LEAST16_MIN); -verify (TYPE_MAXIMUM (int_least16_t) == INT_LEAST16_MAX); -verify_same_types (INT_LEAST16_MIN, (int_least16_t) 0 + 0); -verify_same_types (INT_LEAST16_MAX, (int_least16_t) 0 + 0); - -int_least32_t c3[3] = { 17, INT_LEAST32_MIN, INT_LEAST32_MAX }; -verify (TYPE_MINIMUM (int_least32_t) == INT_LEAST32_MIN); -verify (TYPE_MAXIMUM (int_least32_t) == INT_LEAST32_MAX); -verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0); -verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0); - -#ifdef INT_LEAST64_MAX -int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX }; -verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN); -verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX); -verify_same_types (INT_LEAST64_MIN, (int_least64_t) 0 + 0); -verify_same_types (INT_LEAST64_MAX, (int_least64_t) 0 + 0); -#endif - -uint_least8_t d1[2] = { 17, UINT_LEAST8_MAX }; -verify (TYPE_MAXIMUM (uint_least8_t) == UINT_LEAST8_MAX); -verify_same_types (UINT_LEAST8_MAX, (uint_least8_t) 0 + 0); - -uint_least16_t d2[2] = { 17, UINT_LEAST16_MAX }; -verify (TYPE_MAXIMUM (uint_least16_t) == UINT_LEAST16_MAX); -verify_same_types (UINT_LEAST16_MAX, (uint_least16_t) 0 + 0); - -uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX }; -verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX); -verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0); - -#ifdef UINT_LEAST64_MAX -uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX }; -verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX); -verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0); -#endif - -#if INT_LEAST8_MIN && INT_LEAST8_MAX && INT_LEAST16_MIN && INT_LEAST16_MAX && INT_LEAST32_MIN && INT_LEAST32_MAX -/* ok */ -#else -err or; -#endif - -#if UINT_LEAST8_MAX && UINT_LEAST16_MAX && UINT_LEAST32_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.3. Fastest minimum-width integer types */ -/* 7.18.2.3. Limits of fastest minimum-width integer types */ - -int_fast8_t e1[3] = { 17, INT_FAST8_MIN, INT_FAST8_MAX }; -verify (TYPE_MINIMUM (int_fast8_t) == INT_FAST8_MIN); -verify (TYPE_MAXIMUM (int_fast8_t) == INT_FAST8_MAX); -verify_same_types (INT_FAST8_MIN, (int_fast8_t) 0 + 0); -verify_same_types (INT_FAST8_MAX, (int_fast8_t) 0 + 0); - -int_fast16_t e2[3] = { 17, INT_FAST16_MIN, INT_FAST16_MAX }; -verify (TYPE_MINIMUM (int_fast16_t) == INT_FAST16_MIN); -verify (TYPE_MAXIMUM (int_fast16_t) == INT_FAST16_MAX); -verify_same_types (INT_FAST16_MIN, (int_fast16_t) 0 + 0); -verify_same_types (INT_FAST16_MAX, (int_fast16_t) 0 + 0); - -int_fast32_t e3[3] = { 17, INT_FAST32_MIN, INT_FAST32_MAX }; -verify (TYPE_MINIMUM (int_fast32_t) == INT_FAST32_MIN); -verify (TYPE_MAXIMUM (int_fast32_t) == INT_FAST32_MAX); -verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0); -verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0); - -#ifdef INT_FAST64_MAX -int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX }; -verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN); -verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX); -verify_same_types (INT_FAST64_MIN, (int_fast64_t) 0 + 0); -verify_same_types (INT_FAST64_MAX, (int_fast64_t) 0 + 0); -#endif - -uint_fast8_t f1[2] = { 17, UINT_FAST8_MAX }; -verify (TYPE_MAXIMUM (uint_fast8_t) == UINT_FAST8_MAX); -verify_same_types (UINT_FAST8_MAX, (uint_fast8_t) 0 + 0); - -uint_fast16_t f2[2] = { 17, UINT_FAST16_MAX }; -verify (TYPE_MAXIMUM (uint_fast16_t) == UINT_FAST16_MAX); -verify_same_types (UINT_FAST16_MAX, (uint_fast16_t) 0 + 0); - -uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX }; -verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX); -verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0); - -#ifdef UINT_FAST64_MAX -uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX }; -verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX); -verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0); -#endif - -#if INT_FAST8_MIN && INT_FAST8_MAX && INT_FAST16_MIN && INT_FAST16_MAX && INT_FAST32_MIN && INT_FAST32_MAX -/* ok */ -#else -err or; -#endif - -#if UINT_FAST8_MAX && UINT_FAST16_MAX && UINT_FAST32_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.4. Integer types capable of holding object pointers */ -/* 7.18.2.4. Limits of integer types capable of holding object pointers */ - -intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX }; -verify (TYPE_MINIMUM (intptr_t) == INTPTR_MIN); -verify (TYPE_MAXIMUM (intptr_t) == INTPTR_MAX); -verify_same_types (INTPTR_MIN, (intptr_t) 0 + 0); -verify_same_types (INTPTR_MAX, (intptr_t) 0 + 0); - -uintptr_t h[2] = { 17, UINTPTR_MAX }; -verify (TYPE_MAXIMUM (uintptr_t) == UINTPTR_MAX); -verify_same_types (UINTPTR_MAX, (uintptr_t) 0 + 0); - -#if INTPTR_MIN && INTPTR_MAX && UINTPTR_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.5. Greatest-width integer types */ -/* 7.18.2.5. Limits of greatest-width integer types */ - -intmax_t i[3] = { INTMAX_C (17), INTMAX_MIN, INTMAX_MAX }; -verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN); -verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX); -verify_same_types (INTMAX_MIN, (intmax_t) 0 + 0); -verify_same_types (INTMAX_MAX, (intmax_t) 0 + 0); - -uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX }; -verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX); -verify_same_types (UINTMAX_MAX, (uintmax_t) 0 + 0); - -/* As of 2007, Sun C and HP-UX 10.20 cc don't support 'long long' constants in - the preprocessor. */ -#if !(defined __SUNPRO_C || (defined __hpux && !defined __GNUC__)) -#if INTMAX_MIN && INTMAX_MAX && UINTMAX_MAX -/* ok */ -#else -err or; -#endif -#endif - -/* 7.18.3. Limits of other integer types */ - -#include <stddef.h> - -verify (TYPE_MINIMUM (ptrdiff_t) == PTRDIFF_MIN); -verify (TYPE_MAXIMUM (ptrdiff_t) == PTRDIFF_MAX); -verify_same_types (PTRDIFF_MIN, (ptrdiff_t) 0 + 0); -verify_same_types (PTRDIFF_MAX, (ptrdiff_t) 0 + 0); - -#if PTRDIFF_MIN && PTRDIFF_MAX -/* ok */ -#else -err or; -#endif - -#include <signal.h> - -verify (TYPE_MINIMUM (sig_atomic_t) == SIG_ATOMIC_MIN); -verify (TYPE_MAXIMUM (sig_atomic_t) == SIG_ATOMIC_MAX); -verify_same_types (SIG_ATOMIC_MIN, (sig_atomic_t) 0 + 0); -verify_same_types (SIG_ATOMIC_MAX, (sig_atomic_t) 0 + 0); - -#if SIG_ATOMIC_MIN != 17 && SIG_ATOMIC_MAX -/* ok */ -#else -err or; -#endif - -verify (TYPE_MAXIMUM (size_t) == SIZE_MAX); -verify_same_types (SIZE_MAX, (size_t) 0 + 0); - -#if SIZE_MAX -/* ok */ -#else -err or; -#endif - -#if HAVE_WCHAR_T -verify (TYPE_MINIMUM (wchar_t) == WCHAR_MIN); -verify (TYPE_MAXIMUM (wchar_t) == WCHAR_MAX); -verify_same_types (WCHAR_MIN, (wchar_t) 0 + 0); -verify_same_types (WCHAR_MAX, (wchar_t) 0 + 0); - -# if WCHAR_MIN != 17 && WCHAR_MAX -/* ok */ -# else -err or; -# endif -#endif - -#if HAVE_WINT_T -# include <wchar.h> - -verify (TYPE_MINIMUM (wint_t) == WINT_MIN); -verify (TYPE_MAXIMUM (wint_t) == WINT_MAX); -verify_same_types (WINT_MIN, (wint_t) 0 + 0); -verify_same_types (WINT_MAX, (wint_t) 0 + 0); - -# if WINT_MIN != 17 && WINT_MAX -/* ok */ -# else -err or; -# endif -#endif - -/* 7.18.4. Macros for integer constants */ - -verify (INT8_C (17) == 17); -verify_same_types (INT8_C (17), (int_least8_t)0 + 0); -verify (UINT8_C (17) == 17); -verify_same_types (UINT8_C (17), (uint_least8_t)0 + 0); - -verify (INT16_C (17) == 17); -verify_same_types (INT16_C (17), (int_least16_t)0 + 0); -verify (UINT16_C (17) == 17); -verify_same_types (UINT16_C (17), (uint_least16_t)0 + 0); - -verify (INT32_C (17) == 17); -verify_same_types (INT32_C (17), (int_least32_t)0 + 0); -verify (UINT32_C (17) == 17); -verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0); - -#ifdef INT64_C -verify (INT64_C (17) == 17); -verify_same_types (INT64_C (17), (int_least64_t)0 + 0); -#endif -#ifdef UINT64_C -verify (UINT64_C (17) == 17); -verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0); -#endif - -verify (INTMAX_C (17) == 17); -verify_same_types (INTMAX_C (17), (intmax_t)0 + 0); -verify (UINTMAX_C (17) == 17); -verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); - -/* Use _GL_VERIFY (with a fixed-length diagnostic string) rather than verify, - because the latter would require forming each stringified expression, and - many of these would be so long as to trigger a warning/error like this: - - test-stdint.c:407:1: error: string length '6980' is greater than the \ - length '4095' ISO C99 compilers are required to support \ - [-Werror=overlength-strings] - */ -#define verify_width(width, min, max) \ - _GL_VERIFY ((max) >> ((width) - 1 - ((min) < 0)) == 1, \ - "verify_width check") - -/* Macros specified by ISO/IEC TS 18661-1:2014. */ - -#ifdef INT8_MAX -verify_width (INT8_WIDTH, INT8_MIN, INT8_MAX); -#endif -#ifdef UINT8_MAX -verify_width (UINT8_WIDTH, 0, UINT8_MAX); -#endif -#ifdef INT16_MAX -verify_width (INT16_WIDTH, INT16_MIN, INT16_MAX); -#endif -#ifdef UINT16_MAX -verify_width (UINT16_WIDTH, 0, UINT16_MAX); -#endif -#ifdef INT32_MAX -verify_width (INT32_WIDTH, INT32_MIN, INT32_MAX); -#endif -#ifdef UINT32_MAX -verify_width (UINT32_WIDTH, 0, UINT32_MAX); -#endif -#ifdef INT64_MAX -verify_width (INT64_WIDTH, INT64_MIN, INT64_MAX); -#endif -#ifdef UINT64_MAX -verify_width (UINT64_WIDTH, 0, UINT64_MAX); -#endif -verify_width (INT_LEAST8_WIDTH, INT_LEAST8_MIN, INT_LEAST8_MAX); -verify_width (UINT_LEAST8_WIDTH, 0, UINT_LEAST8_MAX); -verify_width (INT_LEAST16_WIDTH, INT_LEAST16_MIN, INT_LEAST16_MAX); -verify_width (UINT_LEAST16_WIDTH, 0, UINT_LEAST16_MAX); -verify_width (INT_LEAST32_WIDTH, INT_LEAST32_MIN, INT_LEAST32_MAX); -verify_width (UINT_LEAST32_WIDTH, 0, UINT_LEAST32_MAX); -verify_width (INT_LEAST64_WIDTH, INT_LEAST64_MIN, INT_LEAST64_MAX); -verify_width (UINT_LEAST64_WIDTH, 0, UINT_LEAST64_MAX); -verify_width (INT_FAST8_WIDTH, INT_FAST8_MIN, INT_FAST8_MAX); -verify_width (UINT_FAST8_WIDTH, 0, UINT_FAST8_MAX); -verify_width (INT_FAST16_WIDTH, INT_FAST16_MIN, INT_FAST16_MAX); -verify_width (UINT_FAST16_WIDTH, 0, UINT_FAST16_MAX); -verify_width (INT_FAST32_WIDTH, INT_FAST32_MIN, INT_FAST32_MAX); -verify_width (UINT_FAST32_WIDTH, 0, UINT_FAST32_MAX); -verify_width (INT_FAST64_WIDTH, INT_FAST64_MIN, INT_FAST64_MAX); -verify_width (UINT_FAST64_WIDTH, 0, UINT_FAST64_MAX); -verify_width (INTPTR_WIDTH, INTPTR_MIN, INTPTR_MAX); -verify_width (UINTPTR_WIDTH, 0, UINTPTR_MAX); -verify_width (INTMAX_WIDTH, INTMAX_MIN, INTMAX_MAX); -verify_width (UINTMAX_WIDTH, 0, UINTMAX_MAX); -verify_width (PTRDIFF_WIDTH, PTRDIFF_MIN, PTRDIFF_MAX); -verify_width (SIZE_WIDTH, 0, SIZE_MAX); -verify_width (WCHAR_WIDTH, WCHAR_MIN, WCHAR_MAX); -#ifdef WINT_MAX -verify_width (WINT_WIDTH, WINT_MIN, WINT_MAX); -#endif -#ifdef SIG_ATOMIC_MAX -verify_width (SIG_ATOMIC_WIDTH, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX); -#endif - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-stdio.c b/gl/tests/test-stdio.c deleted file mode 100644 index 6cde888b69..0000000000 --- a/gl/tests/test-stdio.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Test of <stdio.h> substitute. - Copyright (C) 2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "verify.h" - -/* Check that the various SEEK_* macros are defined. */ -int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -/* Check that the types are all defined. */ -fpos_t t1; -off_t t2; -size_t t3; -ssize_t t4; -va_list t5; - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-stdlib.c b/gl/tests/test-stdlib.c deleted file mode 100644 index a1fc0d814c..0000000000 --- a/gl/tests/test-stdlib.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Test of <stdlib.h> substitute. - Copyright (C) 2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <stdlib.h> - -#include "verify.h" - -/* Check that EXIT_SUCCESS is 0, per POSIX. */ -static int exitcode = EXIT_SUCCESS; -#if EXIT_SUCCESS -"oops" -#endif - -/* Check for GNU value (not guaranteed by POSIX, but is guaranteed by - gnulib). */ -#if EXIT_FAILURE != 1 -"oops" -#endif - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -#if GNULIB_TEST_SYSTEM_POSIX -# include "test-sys_wait.h" -#else -# define test_sys_wait_macros() 0 -#endif - -int -main (void) -{ - if (test_sys_wait_macros ()) - return 1; - - return exitcode; -} diff --git a/gl/tests/test-string.c b/gl/tests/test-string.c deleted file mode 100644 index f4c60f72c9..0000000000 --- a/gl/tests/test-string.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Test of <string.h> substitute. - Copyright (C) 2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <string.h> - -#include "verify.h" - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-strings.c b/gl/tests/test-strings.c deleted file mode 100644 index 5eaa61a68e..0000000000 --- a/gl/tests/test-strings.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test of <strings.h> substitute. - Copyright (C) 2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <strings.h> - -int -main () -{ - return 0; -} diff --git a/gl/tests/test-strnlen.c b/gl/tests/test-strnlen.c deleted file mode 100644 index ee5bd78262..0000000000 --- a/gl/tests/test-strnlen.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2010-2016 Free Software Foundation, Inc. - * Written by Eric Blake - * - * 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/>. */ - -#include <config.h> - -#include <string.h> - -#include "signature.h" -SIGNATURE_CHECK (strnlen, size_t, (char const *, size_t)); - -#include <stdlib.h> - -#include "zerosize-ptr.h" -#include "macros.h" - -int -main (void) -{ - size_t i; - char *page_boundary = (char *) zerosize_ptr (); - if (!page_boundary) - { - page_boundary = malloc (0x1000); - ASSERT (page_boundary); - page_boundary += 0x1000; - } - - /* Basic behavior tests. */ - ASSERT (strnlen ("a", 0) == 0); - ASSERT (strnlen ("a", 1) == 1); - ASSERT (strnlen ("a", 2) == 1); - ASSERT (strnlen ("", 0x100000) == 0); - - /* Memory fence and alignment testing. */ - for (i = 0; i < 512; i++) - { - char *start = page_boundary - i; - size_t j = i; - memset (start, 'x', i); - do - { - if (i != j) - { - start[j] = 0; - ASSERT (strnlen (start, i + j) == j); - } - ASSERT (strnlen (start, i) == j); - ASSERT (strnlen (start, j) == j); - } - while (j--); - } - - return 0; -} diff --git a/gl/tests/test-strverscmp.c b/gl/tests/test-strverscmp.c deleted file mode 100644 index 0cafe08fb1..0000000000 --- a/gl/tests/test-strverscmp.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Test of strverscmp() function. - Copyright (C) 2008-2016 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 Eric Blake <ebb9@byu.net>, 2008. */ - -#include <config.h> - -#include <string.h> - -#include "signature.h" -SIGNATURE_CHECK (strverscmp, int, (const char *, const char *)); - -#include "macros.h" - -int -main (void) -{ - ASSERT (strverscmp ("", "") == 0); - ASSERT (strverscmp ("a", "a") == 0); - ASSERT (strverscmp ("a", "b") < 0); - ASSERT (strverscmp ("b", "a") > 0); - ASSERT (strverscmp ("000", "00") < 0); - ASSERT (strverscmp ("00", "000") > 0); - ASSERT (strverscmp ("a0", "a") > 0); - ASSERT (strverscmp ("00", "01") < 0); - ASSERT (strverscmp ("01", "010") < 0); - ASSERT (strverscmp ("010", "09") < 0); - ASSERT (strverscmp ("09", "0") < 0); - ASSERT (strverscmp ("9", "10") < 0); - ASSERT (strverscmp ("0a", "0") > 0); - - /* From glibc bug 9913. */ - { - static char const a[] = "B0075022800016.gbp.corp.com"; - static char const b[] = "B007502280067.gbp.corp.com"; - static char const c[] = "B007502357019.GBP.CORP.COM"; - ASSERT (strverscmp (a, b) < 0); - ASSERT (strverscmp (b, c) < 0); - ASSERT (strverscmp (a, c) < 0); - ASSERT (strverscmp (b, a) > 0); - ASSERT (strverscmp (c, b) > 0); - ASSERT (strverscmp (c, a) > 0); - } - - return 0; -} diff --git a/gl/tests/test-sys_socket.c b/gl/tests/test-sys_socket.c deleted file mode 100644 index a4f7108735..0000000000 --- a/gl/tests/test-sys_socket.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Test of <sys/socket.h> substitute. - Copyright (C) 2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <sys/socket.h> - -#include <errno.h> - -#if HAVE_SHUTDOWN -/* Check some integer constant expressions. */ -int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR }; -#endif - -/* Check that the 'socklen_t' type is defined. */ -socklen_t t1; - -/* Check that the 'size_t' and 'ssize_t' types are defined. */ -size_t t2; -ssize_t t3; - -/* Check that 'struct iovec' is defined. */ -struct iovec io; - -/* Check that a minimal set of 'struct msghdr' is defined. */ -struct msghdr msg; - -int -main (void) -{ - struct sockaddr_storage x; - sa_family_t i; - - /* Check some errno values. */ - switch (ENOTSOCK) - { - case ENOTSOCK: - case EADDRINUSE: - case ENETRESET: - case ECONNABORTED: - case ECONNRESET: - case ENOTCONN: - case ESHUTDOWN: - break; - } - - x.ss_family = 42; - i = 42; - msg.msg_iov = &io; - - return (x.ss_family - i + msg.msg_namelen + msg.msg_iov->iov_len - + msg.msg_iovlen); -} diff --git a/gl/tests/test-sys_stat.c b/gl/tests/test-sys_stat.c deleted file mode 100644 index 8a3af941be..0000000000 --- a/gl/tests/test-sys_stat.c +++ /dev/null @@ -1,340 +0,0 @@ -/* Test of <sys/stat.h> substitute. - Copyright (C) 2007-2016 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>, 2007. */ - -#include <config.h> - -#include <sys/stat.h> - -#include "verify.h" - -/* Check the existence of some macros. */ -int a[] = - { - S_IFMT, -#ifdef S_IFBLK /* missing on MSVC */ - S_IFBLK, -#endif - S_IFCHR, S_IFDIR, S_IFIFO, S_IFREG, -#ifdef S_IFLNK /* missing on native Windows and DJGPP */ - S_IFLNK, -#endif -#ifdef S_IFSOCK /* missing on native Windows and DJGPP */ - S_IFSOCK, -#endif - S_IRWXU, S_IRUSR, S_IWUSR, S_IXUSR, - S_IRWXG, S_IRGRP, S_IWGRP, S_IXGRP, - S_IRWXO, S_IROTH, S_IWOTH, S_IXOTH, - S_ISUID, S_ISGID, S_ISVTX, - S_ISBLK (S_IFREG), - S_ISCHR (S_IFREG), - S_ISDIR (S_IFREG), - S_ISFIFO (S_IFREG), - S_ISREG (S_IFREG), - S_ISLNK (S_IFREG), - S_ISSOCK (S_IFREG), - S_ISDOOR (S_IFREG), - S_ISMPB (S_IFREG), - S_ISMPX (S_IFREG), - S_ISNAM (S_IFREG), - S_ISNWK (S_IFREG), - S_ISPORT (S_IFREG), - S_ISCTG (S_IFREG), - S_ISOFD (S_IFREG), - S_ISOFL (S_IFREG), - S_ISWHT (S_IFREG) - }; - -/* Sanity checks. */ - -verify (S_IRWXU == (S_IRUSR | S_IWUSR | S_IXUSR)); -verify (S_IRWXG == (S_IRGRP | S_IWGRP | S_IXGRP)); -verify (S_IRWXO == (S_IROTH | S_IWOTH | S_IXOTH)); - -#ifdef S_IFBLK -verify (S_ISBLK (S_IFBLK)); -#endif -verify (!S_ISBLK (S_IFCHR)); -verify (!S_ISBLK (S_IFDIR)); -verify (!S_ISBLK (S_IFIFO)); -verify (!S_ISBLK (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISBLK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISBLK (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISCHR (S_IFBLK)); -#endif -verify (S_ISCHR (S_IFCHR)); -verify (!S_ISCHR (S_IFDIR)); -verify (!S_ISCHR (S_IFIFO)); -verify (!S_ISCHR (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISCHR (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISCHR (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISDIR (S_IFBLK)); -#endif -verify (!S_ISDIR (S_IFCHR)); -verify (S_ISDIR (S_IFDIR)); -verify (!S_ISDIR (S_IFIFO)); -verify (!S_ISDIR (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISDIR (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISDIR (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISFIFO (S_IFBLK)); -#endif -verify (!S_ISFIFO (S_IFCHR)); -verify (!S_ISFIFO (S_IFDIR)); -verify (S_ISFIFO (S_IFIFO)); -verify (!S_ISFIFO (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISFIFO (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISFIFO (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISREG (S_IFBLK)); -#endif -verify (!S_ISREG (S_IFCHR)); -verify (!S_ISREG (S_IFDIR)); -verify (!S_ISREG (S_IFIFO)); -verify (S_ISREG (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISREG (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISREG (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISLNK (S_IFBLK)); -#endif -verify (!S_ISLNK (S_IFCHR)); -verify (!S_ISLNK (S_IFDIR)); -verify (!S_ISLNK (S_IFIFO)); -verify (!S_ISLNK (S_IFREG)); -#ifdef S_IFLNK -verify (S_ISLNK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISLNK (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISSOCK (S_IFBLK)); -#endif -verify (!S_ISSOCK (S_IFCHR)); -verify (!S_ISSOCK (S_IFDIR)); -verify (!S_ISSOCK (S_IFIFO)); -verify (!S_ISSOCK (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISSOCK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (S_ISSOCK (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISDOOR (S_IFBLK)); -#endif -verify (!S_ISDOOR (S_IFCHR)); -verify (!S_ISDOOR (S_IFDIR)); -verify (!S_ISDOOR (S_IFIFO)); -verify (!S_ISDOOR (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISDOOR (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISDOOR (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISMPB (S_IFBLK)); -#endif -verify (!S_ISMPB (S_IFCHR)); -verify (!S_ISMPB (S_IFDIR)); -verify (!S_ISMPB (S_IFIFO)); -verify (!S_ISMPB (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISMPB (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISMPB (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISMPX (S_IFBLK)); -#endif -verify (!S_ISMPX (S_IFCHR)); -verify (!S_ISMPX (S_IFDIR)); -verify (!S_ISMPX (S_IFIFO)); -verify (!S_ISMPX (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISMPX (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISMPX (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISNAM (S_IFBLK)); -#endif -verify (!S_ISNAM (S_IFCHR)); -verify (!S_ISNAM (S_IFDIR)); -verify (!S_ISNAM (S_IFIFO)); -verify (!S_ISNAM (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISNAM (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISNAM (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISNWK (S_IFBLK)); -#endif -verify (!S_ISNWK (S_IFCHR)); -verify (!S_ISNWK (S_IFDIR)); -verify (!S_ISNWK (S_IFIFO)); -verify (!S_ISNWK (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISNWK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISNWK (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISPORT (S_IFBLK)); -#endif -verify (!S_ISPORT (S_IFCHR)); -verify (!S_ISPORT (S_IFDIR)); -verify (!S_ISPORT (S_IFIFO)); -verify (!S_ISPORT (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISPORT (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISPORT (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISCTG (S_IFBLK)); -#endif -verify (!S_ISCTG (S_IFCHR)); -verify (!S_ISCTG (S_IFDIR)); -verify (!S_ISCTG (S_IFIFO)); -verify (!S_ISCTG (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISCTG (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISCTG (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISOFD (S_IFBLK)); -#endif -verify (!S_ISOFD (S_IFCHR)); -verify (!S_ISOFD (S_IFDIR)); -verify (!S_ISOFD (S_IFIFO)); -verify (!S_ISOFD (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISOFD (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISOFD (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISOFL (S_IFBLK)); -#endif -verify (!S_ISOFL (S_IFCHR)); -verify (!S_ISOFL (S_IFDIR)); -verify (!S_ISOFL (S_IFIFO)); -verify (!S_ISOFL (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISOFL (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISOFL (S_IFSOCK)); -#endif - -#ifdef S_IFBLK -verify (!S_ISWHT (S_IFBLK)); -#endif -verify (!S_ISWHT (S_IFCHR)); -verify (!S_ISWHT (S_IFDIR)); -verify (!S_ISWHT (S_IFIFO)); -verify (!S_ISWHT (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISWHT (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISWHT (S_IFSOCK)); -#endif - -/* POSIX 2008 requires traditional encoding of permission constants. */ -verify (S_IRWXU == 00700); -verify (S_IRUSR == 00400); -verify (S_IWUSR == 00200); -verify (S_IXUSR == 00100); -verify (S_IRWXG == 00070); -verify (S_IRGRP == 00040); -verify (S_IWGRP == 00020); -verify (S_IXGRP == 00010); -verify (S_IRWXO == 00007); -verify (S_IROTH == 00004); -verify (S_IWOTH == 00002); -verify (S_IXOTH == 00001); -verify (S_ISUID == 04000); -verify (S_ISGID == 02000); -verify (S_ISVTX == 01000); - -#if ((0 <= UTIME_NOW && UTIME_NOW < 1000000000) \ - || (0 <= UTIME_OMIT && UTIME_OMIT < 1000000000) \ - || UTIME_NOW == UTIME_OMIT) -invalid UTIME macros -#endif - -/* Check the existence of some types. */ -nlink_t t1; -off_t t2; -mode_t t3; - -struct timespec st; - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-sys_time.c b/gl/tests/test-sys_time.c deleted file mode 100644 index 44535b99dd..0000000000 --- a/gl/tests/test-sys_time.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Test of <sys/time.h> substitute. - Copyright (C) 2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <sys/time.h> - -/* Check that the 'struct timeval' type is defined. */ -struct timeval a; - -/* Check that a.tv_sec is wide enough to hold a time_t, ignoring - signedness issues. */ -typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1]; - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-sys_types.c b/gl/tests/test-sys_types.c deleted file mode 100644 index 7f8fb6d121..0000000000 --- a/gl/tests/test-sys_types.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Test of <sys/types.h> substitute. - Copyright (C) 2011-2016 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>, 2011. */ - -#include <config.h> - -#include <sys/types.h> - -/* Check that the types are all defined. */ -pid_t t1; -size_t t2; -ssize_t t3; -off_t t4; -mode_t t5; - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-sys_uio.c b/gl/tests/test-sys_uio.c deleted file mode 100644 index c433847918..0000000000 --- a/gl/tests/test-sys_uio.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test of <sys/uio.h> substitute. - Copyright (C) 2011-2016 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 Eric Blake <eblake@redhat.com>, 2011. */ - -#include <config.h> - -#include <sys/uio.h> - -/* Check that necessary types are defined. */ -size_t a; -ssize_t b; -struct iovec c; - -int -main (void) -{ - return a + b + !!c.iov_base + c.iov_len; -} diff --git a/gl/tests/test-sys_wait.h b/gl/tests/test-sys_wait.h deleted file mode 100644 index 7389be4256..0000000000 --- a/gl/tests/test-sys_wait.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Test of macros shared between <sys/wait.h> and <stdlib.h>. - Copyright (C) 2010-2016 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 Eric Blake <ebb9@byu.net>, 2010. */ - -static int -test_sys_wait_macros (void) -{ - /* Check subset of <sys/wait.h> macros that must be visible here. - Note that some of these macros are only portable when operating - on an lvalue. */ - int i; - for (i = 0; i < 0x8000; i = (i ? i << 1 : 1)) - { - /* POSIX requires that for all valid process statuses, that - exactly one of these three macros is true. But not all - possible 16-bit values map to valid process status. - Traditionally, 8 of the bits are for WIFEXITED, 7 of the bits - to tell between WIFSIGNALED and WIFSTOPPED, and either 0x80 - or 0x8000 to flag that core was also dumped. Since we don't - know which byte is WIFEXITED, we skip the both possible bits - that can signal core dump. */ - if (i == 0x80) - continue; - if (!!WIFSIGNALED (i) + !!WIFEXITED (i) + !!WIFSTOPPED (i) != 1) - return 1; - } - i = WEXITSTATUS (i) + WSTOPSIG (i) + WTERMSIG (i); - - switch (i) - { -#if 0 - /* Gnulib doesn't guarantee these, yet. */ - case WNOHANG: - case WUNTRACED: -#endif - break; - } - return 0; -} diff --git a/gl/tests/test-time.c b/gl/tests/test-time.c deleted file mode 100644 index dec2b1338a..0000000000 --- a/gl/tests/test-time.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Test of <time.h> substitute. - Copyright (C) 2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <time.h> - -#include "verify.h" - -/* Check that the types are all defined. */ -struct timespec t1; -#if 0 -/* POSIX:2008 does not require pid_t in <time.h> unconditionally, and indeed - it's missing on Mac OS X 10.5, FreeBSD 6.4, OpenBSD 4.9, mingw. */ -pid_t t2; -#endif - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-unistd.c b/gl/tests/test-unistd.c deleted file mode 100644 index 463ef578cc..0000000000 --- a/gl/tests/test-unistd.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Test of <unistd.h> substitute. - Copyright (C) 2007, 2009-2016 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>, 2007. */ - -#include <config.h> - -#include <unistd.h> - -#include "verify.h" - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -/* Check that the various SEEK_* macros are defined. */ -int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; - -/* Check that the various *_FILENO macros are defined. */ -#if ! (defined STDIN_FILENO \ - && (STDIN_FILENO + STDOUT_FILENO + STDERR_FILENO == 3)) -missing or broken *_FILENO macros -#endif - -/* Check that the types are all defined. */ -size_t t1; -ssize_t t2; -#ifdef TODO /* Not implemented in gnulib yet */ -uid_t t3; -gid_t t4; -#endif -off_t t5; -pid_t t6; -#ifdef TODO -useconds_t t7; -intptr_t t8; -#endif - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-vasnprintf.c b/gl/tests/test-vasnprintf.c deleted file mode 100644 index a75c004ffc..0000000000 --- a/gl/tests/test-vasnprintf.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Test of vasnprintf() and asnprintf() functions. - Copyright (C) 2007-2016 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>, 2007. */ - -#include <config.h> - -#include "vasnprintf.h" - -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#include "macros.h" - -static void -test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) -{ - char buf[8]; - int size; - - for (size = 0; size <= 8; size++) - { - size_t length = size; - char *result = my_asnprintf (NULL, &length, "%d", 12345); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - ASSERT (length == 5); - free (result); - } - - for (size = 0; size <= 8; size++) - { - size_t length; - char *result; - - memcpy (buf, "DEADBEEF", 8); - length = size; - result = my_asnprintf (buf, &length, "%d", 12345); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - ASSERT (length == 5); - if (size < 6) - ASSERT (result != buf); - ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); - if (result != buf) - free (result); - } -} - -static char * -my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) -{ - va_list args; - char *ret; - - va_start (args, format); - ret = vasnprintf (resultbuf, lengthp, format, args); - va_end (args); - return ret; -} - -static void -test_vasnprintf () -{ - test_function (my_asnprintf); -} - -static void -test_asnprintf () -{ - test_function (asnprintf); -} - -int -main (int argc, char *argv[]) -{ - test_vasnprintf (); - test_asnprintf (); - return 0; -} diff --git a/gl/tests/test-vasprintf.c b/gl/tests/test-vasprintf.c deleted file mode 100644 index ebcbfc4d15..0000000000 --- a/gl/tests/test-vasprintf.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Test of vasprintf() and asprintf() functions. - Copyright (C) 2007-2016 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>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (asprintf, int, (char **, char const *, ...)); -SIGNATURE_CHECK (vasprintf, int, (char **, char const *, va_list)); - -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#include "macros.h" - -static int -my_asprintf (char **result, const char *format, ...) -{ - va_list args; - int ret; - - va_start (args, format); - ret = vasprintf (result, format, args); - va_end (args); - return ret; -} - -static void -test_vasprintf () -{ - int repeat; - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = my_asprintf (&result, "%d", 12345); - ASSERT (retval == 5); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - free (result); - } - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = my_asprintf (&result, "%08lx", 12345UL); - ASSERT (retval == 8); - ASSERT (result != NULL); - ASSERT (strcmp (result, "00003039") == 0); - free (result); - } -} - -static void -test_asprintf () -{ - int repeat; - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = asprintf (&result, "%d", 12345); - ASSERT (retval == 5); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - free (result); - } - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = asprintf (&result, "%08lx", 12345UL); - ASSERT (retval == 8); - ASSERT (result != NULL); - ASSERT (strcmp (result, "00003039") == 0); - free (result); - } -} - -int -main (int argc, char *argv[]) -{ - test_vasprintf (); - test_asprintf (); - return 0; -} diff --git a/gl/tests/test-vc-list-files-cvs.sh b/gl/tests/test-vc-list-files-cvs.sh deleted file mode 100755 index 6262944412..0000000000 --- a/gl/tests/test-vc-list-files-cvs.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# Unit tests for vc-list-files -# Copyright (C) 2008-2016 Free Software Foundation, Inc. -# This file is part of the GNUlib Library. -# -# 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/>. */ - -: ${srcdir=.} -. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" . - -tmpdir=vc-cvs -repo=`pwd`/$tmpdir/repo - -fail=0 -for i in with-cvsu without; do - # On the first iteration, test using cvsu, if it's in your path. - # On the second iteration, ensure that cvsu fails, so we'll - # exercise the awk-using code. - if test $i = without; then - printf '%s\n' '#!/bin/sh' 'exit 1' > cvsu - chmod a+x cvsu - PATH=`pwd`:$PATH - export PATH - fi - ok=0 - mkdir $tmpdir && cd $tmpdir && - # without cvs, skip the test - { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \ - || skip_ "cvs not found in PATH"; } && - mkdir w && cd w && - mkdir d && - touch d/a b c && - cvs -Q -d "$repo" import -m imp m M M0 && - cvs -Q -d "$repo" co m && cd m && - printf '%s\n' b c d/a > expected && - vc-list-files | sort > actual && - compare expected actual && - ok=1 - test $ok = 0 && fail=1 -done - -Exit $fail diff --git a/gl/tests/test-vc-list-files-git.sh b/gl/tests/test-vc-list-files-git.sh deleted file mode 100755 index 4358115ffe..0000000000 --- a/gl/tests/test-vc-list-files-git.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# Unit tests for vc-list-files -# Copyright (C) 2008-2016 Free Software Foundation, Inc. -# This file is part of the GNUlib Library. -# -# 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/>. */ - -: ${srcdir=.} -. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" . - -tmpdir=vc-git-$$ -GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE - -fail=1 -mkdir $tmpdir && cd $tmpdir && - # without git, skip the test - # The double use of 'exit' is needed for the reference to $? inside the trap. - { ( git init -q ) > /dev/null 2>&1 \ - || skip_ "git not found in PATH"; } && - mkdir d && - touch d/a b c && - git config user.email "you@example.com" && - git config user.name "Your Name" && - git add . > /dev/null && - git commit -q -a -m log && - printf '%s\n' b c d/a > expected && - vc-list-files > actual && - compare expected actual && - fail=0 - -Exit $fail diff --git a/gl/tests/test-verify.c b/gl/tests/test-verify.c deleted file mode 100644 index d7ca0538b0..0000000000 --- a/gl/tests/test-verify.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Test the "verify" module. - - Copyright (C) 2005, 2009-2016 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. */ - -#include <config.h> - -#include "verify.h" - -#ifndef EXP_FAIL -# define EXP_FAIL 0 -#endif - -int x; -enum { a, b, c }; - -#if EXP_FAIL == 1 -verify (x >= 0); /* should give ERROR: non-constant expression */ -#endif -verify (c == 2); /* should be ok */ -#if EXP_FAIL == 2 -verify (1 + 1 == 3); /* should give ERROR */ -#endif -verify (1 == 1); verify (1 == 1); /* should be ok */ - -enum -{ - item = verify_true (1 == 1) * 0 + 17 /* should be ok */ -}; - -static int -function (int n) -{ -#if EXP_FAIL == 3 - verify (n >= 0); /* should give ERROR: non-constant expression */ -#endif - verify (c == 2); /* should be ok */ -#if EXP_FAIL == 4 - verify (1 + 1 == 3); /* should give ERROR */ -#endif - verify (1 == 1); verify (1 == 1); /* should be ok */ - - if (n) - return ((void) verify_expr (1 == 1, 1), verify_expr (1 == 1, 8)); /* should be ok */ -#if EXP_FAIL == 5 - return verify_expr (1 == 2, 5); /* should give ERROR */ -#endif - return 0; -} - -int -main (void) -{ - return !(function (0) == 0 && function (1) == 8); -} diff --git a/gl/tests/test-verify.sh b/gl/tests/test-verify.sh deleted file mode 100755 index 3e7676148a..0000000000 --- a/gl/tests/test-verify.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -. "${srcdir=.}/init.sh" - -# We are not interested in triggering bugs in the compilers and tools -# (such as gcc 4.3.1 on openSUSE 11.0). -unset MALLOC_PERTURB_ - -# Rather than figure out how to invoke the compiler with the right -# include path ourselves, we let make do it: -(cd "$initial_cwd_" && rm -f test-verify.o \ - && $MAKE test-verify.o >/dev/null 2>&1) \ - || skip_ "cannot compile error-free" - -# Now, prove that we encounter all expected compilation failures: -: >out -: >err -for i in 1 2 3 4 5; do - (cd "$initial_cwd_" - rm -f test-verify.o - $MAKE CFLAGS=-DEXP_FAIL=$i test-verify.o) >>out 2>>err \ - && { warn_ "compiler didn't detect verification failure $i"; fail=1; } -done - -Exit $fail diff --git a/gl/tests/test-vsnprintf.c b/gl/tests/test-vsnprintf.c deleted file mode 100644 index 0a2ff02991..0000000000 --- a/gl/tests/test-vsnprintf.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Test of vsnprintf() function. - Copyright (C) 2007-2016 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>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (vsnprintf, int, (char *, size_t, char const *, va_list)); - -#include <stdarg.h> -#include <string.h> - -#include "macros.h" - -static int -my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} - -int -main (int argc, char *argv[]) -{ - char buf[8]; - int size; - int retval; - - retval = my_snprintf (NULL, 0, "%d", 12345); - ASSERT (retval == 5); - - for (size = 0; size <= 8; size++) - { - memcpy (buf, "DEADBEEF", 8); - retval = my_snprintf (buf, size, "%d", 12345); - ASSERT (retval == 5); - if (size < 6) - { - if (size > 0) - { - ASSERT (memcmp (buf, "12345", size - 1) == 0); - ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size); - } -#if !CHECK_VSNPRINTF_POSIX - if (size > 0) -#endif - ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); - } - else - { - ASSERT (memcmp (buf, "12345\0EF", 8) == 0); - } - } - - /* Test the support of the POSIX/XSI format strings with positions. */ - { - char result[100]; - retval = my_snprintf (result, sizeof (result), "%2$d %1$d", 33, 55); - ASSERT (strcmp (result, "55 33") == 0); - ASSERT (retval == strlen (result)); - } - - return 0; -} diff --git a/gl/tests/test-wchar.c b/gl/tests/test-wchar.c deleted file mode 100644 index e118048224..0000000000 --- a/gl/tests/test-wchar.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Test of <wchar.h> substitute. - Copyright (C) 2007-2016 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>, 2007. */ - -#include <config.h> - -#include <wchar.h> - -#include "verify.h" - -/* Check that the types wchar_t and wint_t are defined. */ -wchar_t a = 'c'; -wint_t b = 'x'; - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/zerosize-ptr.h b/gl/tests/zerosize-ptr.h deleted file mode 100644 index e6ff672b64..0000000000 --- a/gl/tests/zerosize-ptr.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Return a pointer to a zero-size object in memory. - Copyright (C) 2009-2016 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/>. */ - -/* ISO C 99 does not allow memcmp(), memchr() etc. to be invoked with a NULL - argument. Therefore this file produces a non-NULL pointer which cannot - be dereferenced, if possible. */ - -#include <stdlib.h> - -/* Test whether mmap() and mprotect() are available. - We don't use HAVE_MMAP, because AC_FUNC_MMAP would not define it on HP-UX. - HAVE_MPROTECT is not enough, because mingw does not have mmap() but has an - mprotect() function in libgcc.a. */ -#if HAVE_SYS_MMAN_H && HAVE_MPROTECT -# include <fcntl.h> -# include <unistd.h> -# include <sys/types.h> -# include <sys/mman.h> -/* Define MAP_FILE when it isn't otherwise. */ -# ifndef MAP_FILE -# define MAP_FILE 0 -# endif -#endif - -/* Return a pointer to a zero-size object in memory (that is, actually, a - pointer to a page boundary where the previous page is readable and writable - and the next page is neither readable not writable), if possible. - Return NULL otherwise. */ - -static void * -zerosize_ptr (void) -{ -/* Use mmap and mprotect when they exist. Don't test HAVE_MMAP, because it is - not defined on HP-UX 11 (since it does not support MAP_FIXED). */ -#if HAVE_SYS_MMAN_H && HAVE_MPROTECT -# if HAVE_MAP_ANONYMOUS - const int flags = MAP_ANONYMOUS | MAP_PRIVATE; - const int fd = -1; -# else /* !HAVE_MAP_ANONYMOUS */ - const int flags = MAP_FILE | MAP_PRIVATE; - int fd = open ("/dev/zero", O_RDONLY, 0666); - if (fd >= 0) -# endif - { - int pagesize = getpagesize (); - char *two_pages = - (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, - flags, fd, 0); - if (two_pages != (char *)(-1) - && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) - return two_pages + pagesize; - } -#endif - return NULL; -} |