diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-10-21 10:21:33 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-10-21 10:21:33 +0000 |
commit | 4eca37ecd81a80606e9c2afed5401f15d15e3671 (patch) | |
tree | edb21b983f86981f8ed77704231cbe589bc19bdd | |
parent | 7f4d37b99e25e931918580a353dba7eed11407ee (diff) | |
parent | d3ed30f2deefe6a5ed0d07a3018c723749ca5d7b (diff) | |
download | ydb-4eca37ecd81a80606e9c2afed5401f15d15e3671.tar.gz |
Merge branch 'rightlib' into mergelibs-241021-1020
278 files changed, 11147 insertions, 4055 deletions
diff --git a/build/conf/licenses.json b/build/conf/licenses.json index abfed06c8d..2832e2871a 100644 --- a/build/conf/licenses.json +++ b/build/conf/licenses.json @@ -48,6 +48,7 @@ "GCC-exception-3.1", "GDAL", "GFDL-1.1-or-later", + "GFDL-1.3-or-later", "Go-License", "Google-Patent-License-Webm", "Google-Patent-License-Webrtc", diff --git a/build/conf/linkers/ld.conf b/build/conf/linkers/ld.conf index afaaa1cb42..df576648f3 100644 --- a/build/conf/linkers/ld.conf +++ b/build/conf/linkers/ld.conf @@ -340,7 +340,8 @@ SWIG_DLL_JAR_CMD=\ $REAL_SWIG_DLL_JAR_CMD && \ $DWARF_COMMAND -_LD_TAIL_LINK_LIB=$AUTO_INPUT ${hide;kv:"p AR"} $TOOLCHAIN_ENV ${hide;kv:"pc light-red"} ${hide;kv:"show_out"} +_LD_LINK_LIB_EXTRA_INPUT= +_LD_TAIL_LINK_LIB=$AUTO_INPUT $_LD_LINK_LIB_EXTRA_INPUT ${hide;kv:"p AR"} $TOOLCHAIN_ENV ${hide;kv:"pc light-red"} ${hide;kv:"show_out"} _LD_ARCHIVER=$YMAKE_PYTHON ${input:"build/scripts/link_lib.py"} ${quo:AR_TOOL} $AR_TYPE $_LD_LLVM_AR_FORMAT $ARCADIA_BUILD_ROOT $_LD_AR_PLUGIN _LD_LIB_GENERATE_MF=$GENERATE_MF && when ($TIDY == "yes") { diff --git a/build/external_resources/ymake/public.resources.json b/build/external_resources/ymake/public.resources.json index 93d20b5650..3d0dcf2c0c 100644 --- a/build/external_resources/ymake/public.resources.json +++ b/build/external_resources/ymake/public.resources.json @@ -1,19 +1,19 @@ { "by_platform": { "darwin": { - "uri": "sbr:7255221832" + "uri": "sbr:7299619998" }, "darwin-arm64": { - "uri": "sbr:7255220942" + "uri": "sbr:7299619667" }, "linux": { - "uri": "sbr:7255223649" + "uri": "sbr:7299620690" }, "linux-aarch64": { - "uri": "sbr:7255220285" + "uri": "sbr:7299619265" }, "win32-clang-cl": { - "uri": "sbr:7255222862" + "uri": "sbr:7299620278" } } } diff --git a/build/external_resources/ymake/resources.json b/build/external_resources/ymake/resources.json index aec5a0de95..91bc84b2d7 100644 --- a/build/external_resources/ymake/resources.json +++ b/build/external_resources/ymake/resources.json @@ -1,19 +1,19 @@ { "by_platform": { "darwin": { - "uri": "sbr:7255220552" + "uri": "sbr:7299618240" }, "darwin-arm64": { - "uri": "sbr:7255219972" + "uri": "sbr:7299617682" }, "linux": { - "uri": "sbr:7255222128" + "uri": "sbr:7299619235" }, "linux-aarch64": { - "uri": "sbr:7255219168" + "uri": "sbr:7299616994" }, "win32-clang-cl": { - "uri": "sbr:7255221316" + "uri": "sbr:7299618667" } } } diff --git a/build/mapping.conf.json b/build/mapping.conf.json index 5522059b32..c527364b80 100644 --- a/build/mapping.conf.json +++ b/build/mapping.conf.json @@ -418,6 +418,8 @@ "7258655189": "https://devtools-registry.s3.yandex.net/7258655189", "7268412397": "https://devtools-registry.s3.yandex.net/7268412397", "7268415538": "https://devtools-registry.s3.yandex.net/7268415538", + "7303146160": "https://devtools-registry.s3.yandex.net/7303146160", + "7303155140": "https://devtools-registry.s3.yandex.net/7303155140", "5486731632": "https://devtools-registry.s3.yandex.net/5486731632", "5514350352": "https://devtools-registry.s3.yandex.net/5514350352", "5514360398": "https://devtools-registry.s3.yandex.net/5514360398", @@ -575,6 +577,7 @@ "7167514017": "https://devtools-registry.s3.yandex.net/7167514017", "7211385890": "https://devtools-registry.s3.yandex.net/7211385890", "7255221832": "https://devtools-registry.s3.yandex.net/7255221832", + "7299619998": "https://devtools-registry.s3.yandex.net/7299619998", "5766171800": "https://devtools-registry.s3.yandex.net/5766171800", "5805430761": "https://devtools-registry.s3.yandex.net/5805430761", "5829025456": "https://devtools-registry.s3.yandex.net/5829025456", @@ -619,6 +622,7 @@ "7167513539": "https://devtools-registry.s3.yandex.net/7167513539", "7211384971": "https://devtools-registry.s3.yandex.net/7211384971", "7255220942": "https://devtools-registry.s3.yandex.net/7255220942", + "7299619667": "https://devtools-registry.s3.yandex.net/7299619667", "5766173070": "https://devtools-registry.s3.yandex.net/5766173070", "5805432830": "https://devtools-registry.s3.yandex.net/5805432830", "5829031598": "https://devtools-registry.s3.yandex.net/5829031598", @@ -663,6 +667,7 @@ "7167514830": "https://devtools-registry.s3.yandex.net/7167514830", "7211387031": "https://devtools-registry.s3.yandex.net/7211387031", "7255223649": "https://devtools-registry.s3.yandex.net/7255223649", + "7299620690": "https://devtools-registry.s3.yandex.net/7299620690", "5766171341": "https://devtools-registry.s3.yandex.net/5766171341", "5805430188": "https://devtools-registry.s3.yandex.net/5805430188", "5829023352": "https://devtools-registry.s3.yandex.net/5829023352", @@ -707,6 +712,7 @@ "7167513152": "https://devtools-registry.s3.yandex.net/7167513152", "7211384106": "https://devtools-registry.s3.yandex.net/7211384106", "7255220285": "https://devtools-registry.s3.yandex.net/7255220285", + "7299619265": "https://devtools-registry.s3.yandex.net/7299619265", "5766172695": "https://devtools-registry.s3.yandex.net/5766172695", "5805432230": "https://devtools-registry.s3.yandex.net/5805432230", "5829029743": "https://devtools-registry.s3.yandex.net/5829029743", @@ -751,6 +757,7 @@ "7167514469": "https://devtools-registry.s3.yandex.net/7167514469", "7211386552": "https://devtools-registry.s3.yandex.net/7211386552", "7255222862": "https://devtools-registry.s3.yandex.net/7255222862", + "7299620278": "https://devtools-registry.s3.yandex.net/7299620278", "4307890075": "https://devtools-registry.s3.yandex.net/4307890075", "5517245192": "https://devtools-registry.s3.yandex.net/5517245192", "4307901240": "https://devtools-registry.s3.yandex.net/4307901240", @@ -1353,6 +1360,8 @@ "7258655189": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "7268412397": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "7268415538": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", + "7303146160": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", + "7303155140": "devtools/ya/test/programs/test_tool/bin/test_tool for linux", "5486731632": "devtools/ya/test/programs/test_tool/bin3/test_tool3 for linux", "5514350352": "devtools/ya/test/programs/test_tool/bin3/test_tool3 for linux", "5514360398": "devtools/ya/test/programs/test_tool/bin3/test_tool3 for linux", @@ -1510,6 +1519,7 @@ "7167514017": "devtools/ymake/bin/ymake for darwin", "7211385890": "devtools/ymake/bin/ymake for darwin", "7255221832": "devtools/ymake/bin/ymake for darwin", + "7299619998": "devtools/ymake/bin/ymake for darwin", "5766171800": "devtools/ymake/bin/ymake for darwin-arm64", "5805430761": "devtools/ymake/bin/ymake for darwin-arm64", "5829025456": "devtools/ymake/bin/ymake for darwin-arm64", @@ -1554,6 +1564,7 @@ "7167513539": "devtools/ymake/bin/ymake for darwin-arm64", "7211384971": "devtools/ymake/bin/ymake for darwin-arm64", "7255220942": "devtools/ymake/bin/ymake for darwin-arm64", + "7299619667": "devtools/ymake/bin/ymake for darwin-arm64", "5766173070": "devtools/ymake/bin/ymake for linux", "5805432830": "devtools/ymake/bin/ymake for linux", "5829031598": "devtools/ymake/bin/ymake for linux", @@ -1598,6 +1609,7 @@ "7167514830": "devtools/ymake/bin/ymake for linux", "7211387031": "devtools/ymake/bin/ymake for linux", "7255223649": "devtools/ymake/bin/ymake for linux", + "7299620690": "devtools/ymake/bin/ymake for linux", "5766171341": "devtools/ymake/bin/ymake for linux-aarch64", "5805430188": "devtools/ymake/bin/ymake for linux-aarch64", "5829023352": "devtools/ymake/bin/ymake for linux-aarch64", @@ -1642,6 +1654,7 @@ "7167513152": "devtools/ymake/bin/ymake for linux-aarch64", "7211384106": "devtools/ymake/bin/ymake for linux-aarch64", "7255220285": "devtools/ymake/bin/ymake for linux-aarch64", + "7299619265": "devtools/ymake/bin/ymake for linux-aarch64", "5766172695": "devtools/ymake/bin/ymake for win32-clang-cl", "5805432230": "devtools/ymake/bin/ymake for win32-clang-cl", "5829029743": "devtools/ymake/bin/ymake for win32-clang-cl", @@ -1686,6 +1699,7 @@ "7167514469": "devtools/ymake/bin/ymake for win32-clang-cl", "7211386552": "devtools/ymake/bin/ymake for win32-clang-cl", "7255222862": "devtools/ymake/bin/ymake for win32-clang-cl", + "7299620278": "devtools/ymake/bin/ymake for win32-clang-cl", "4307890075": "flake8_linter for linux", "5517245192": "flake8_linter for linux", "4307901240": "flake8_linter for linux-aarch64", diff --git a/build/platform/python/ymake_python3/resources.json b/build/platform/python/ymake_python3/resources.json index f68bc69d4b..53c4a82d5b 100644 --- a/build/platform/python/ymake_python3/resources.json +++ b/build/platform/python/ymake_python3/resources.json @@ -1,18 +1,18 @@ { "by_platform": { - "darwin": { + "darwin-x86_64": { "uri": "sbr:7203671634" }, "darwin-arm64": { "uri": "sbr:7203671142" }, - "linux": { + "linux-x86_64": { "uri": "sbr:7203672677" }, "linux-aarch64": { "uri": "sbr:7203672172" }, - "win32": { + "win32-x86_64": { "uri": "sbr:7203670792" } } diff --git a/build/platform/test_tool/host.ya.make.inc b/build/platform/test_tool/host.ya.make.inc index 33747e51fd..058b1a9d61 100644 --- a/build/platform/test_tool/host.ya.make.inc +++ b/build/platform/test_tool/host.ya.make.inc @@ -1,12 +1,12 @@ IF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7268414015) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7303154871) ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_ARM64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7268412855) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7303154594) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7268415538) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7303155140) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_AARCH64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7268411722) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7303154435) ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7268414733) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7303155023) ENDIF() diff --git a/build/platform/test_tool/host_os.ya.make.inc b/build/platform/test_tool/host_os.ya.make.inc index 5c8418f65d..0066d0c96f 100644 --- a/build/platform/test_tool/host_os.ya.make.inc +++ b/build/platform/test_tool/host_os.ya.make.inc @@ -1,12 +1,12 @@ IF (HOST_OS_DARWIN AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7268408068) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7303145767) ELSEIF (HOST_OS_DARWIN AND HOST_ARCH_ARM64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7268405912) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7303145350) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7268412397) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7303146160) ELSEIF (HOST_OS_LINUX AND HOST_ARCH_AARCH64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7268404402) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7303145126) ELSEIF (HOST_OS_WINDOWS AND HOST_ARCH_X86_64) - DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7268410113) + DECLARE_EXTERNAL_RESOURCE(TEST_TOOL_HOST sbr:7303145973) ENDIF() diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 79ad503dea..8470d35c2f 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -4083,13 +4083,25 @@ macro CUDA_NVCC_FLAGS(Flags...) { SET_APPEND(CUDA_NVCC_FLAGS $Flags) } +CUDA_DEVICE_LINK_LIBRARY_CMD=$NVCC_OLD $NVCC_FLAGS -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"} -dlink ${input:_NVCC_DEVICE_SRCS} -I$CUDA_TARGET_ROOT/include --compiler-options ${join= :C_FLAGS_PLATFORM} $NVCC_ENV ${hide;kv:"p DL"} ${hide;kv:"pc light-blue"} && $LINK_LIB + +### @usage: CUDA_DEVICE_LINK_LIBRARY() +### +### The LIBRARY() module with an additional step with CUDA device linking. +### Use [NVCC_DEVICE_LINK](#macro_NVCC_DEVICE_LINK) macro to specify sources for device link. +module CUDA_DEVICE_LINK_LIBRARY: LIBRARY { + SET(_LD_LINK_LIB_EXTRA_INPUT ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"}) + .CMD=$CUDA_DEVICE_LINK_LIBRARY_CMD +} + # tag:flags ### @usage: NVCC_DEVICE_LINK(file.cu...) ### Run nvcc --device-link on objects compiled from srcs with --device-c. ### This generates a stub object devlink.o that supplies missing pieces for the ### host linker to link relocatable device objects into the final executable. +### This macro can be used only with [CUDA_DEVICE_LINK_LIBRARY](#module_CUDA_DEVICE_LINK_LIBRARY) module. macro NVCC_DEVICE_LINK(Srcs...) { - .CMD=$NVCC_OLD $NVCC_FLAGS -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"} -dlink ${input;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:Srcs} -I$CUDA_TARGET_ROOT/include --compiler-options ${quo:C_FLAGS_PLATFORM} $NVCC_ENV ${hide;kv:"p DL"} ${hide;kv:"pc light-blue"} + SET_APPEND(_NVCC_DEVICE_SRCS ${suf=${OBJ_SUF}${NVCC_OBJ_EXT}:Srcs}) .PEERDIR=build/platform/cuda } @@ -4335,7 +4347,8 @@ macro NEED_CHECK(Flags...) { ENABLE(UNUSED_MACRO) } -### @usage: NO_NEED_CHECK() +# tag:deprecated +### @usage: NO_NEED_CHECK() # deprecated ### ### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro. macro NO_NEED_CHECK(Flags...) { @@ -4353,6 +4366,27 @@ macro NEED_REVIEW(Flags...) { ENABLE(UNUSED_MACRO) } +# tag:deprecated +### @usage: OWNER(UsersOrGroups) # deprecated +### +### Old way to cpecify owners of code. Now completely unused. Use a.yaml to specify ownership +macro OWNER(Owners...) { + ENABLE(UNUSED_MACRO) +} + +### @usage: SUBSCIBER(UsersOrGroups) +### +### Add observers of the code. +### In the SUBSCRIBER macro you can use: +### 1. login-s from staff.yandex-team.ru +### 2. Review group (to specify the Code-review group need to use the prefix g:) +### +### Note: currently SUBSCRIBER is read only by Arcanum and is not processed by +### the build system. It's planned to be phased out in favor of subcription via a.yaml +macro SUBSCIBER(Subscribers...) { + ENABLE(UNUSED_MACRO) +} + MODVER=unknown ### @usage: VERSION(Args...) ### diff --git a/contrib/libs/protobuf/.yandex_meta/__init__.py b/contrib/libs/protobuf/.yandex_meta/__init__.py index a61afd98f1..7d7498e483 100644 --- a/contrib/libs/protobuf/.yandex_meta/__init__.py +++ b/contrib/libs/protobuf/.yandex_meta/__init__.py @@ -147,12 +147,14 @@ ENDIF() libprotobuf.RECURSE = ["builtin_proto"] libprotobuf.PEERDIR.add("library/cpp/sanitizer/include") - + # Dont use full y_absl library + # fmt: off libprotobuf.PEERDIR = set([ lib for lib in libprotobuf.PEERDIR if 'abseil-cpp-tstring' not in lib ]) + # fmt: on libprotobuf.PEERDIR.add("contrib/restricted/abseil-cpp-tstring/y_absl/status") libprotobuf.PEERDIR.add("contrib/restricted/abseil-cpp-tstring/y_absl/log") diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA index 3de6c50f33..418a478f2c 100644 --- a/contrib/python/hypothesis/py3/.dist-info/METADATA +++ b/contrib/python/hypothesis/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: hypothesis -Version: 6.112.2 +Version: 6.112.4 Summary: A library for property-based testing Home-page: https://hypothesis.works Author: David R. MacIver and Zac Hatfield-Dodds @@ -41,7 +41,7 @@ Requires-Dist: exceptiongroup>=1.0.0; python_version < "3.11" Provides-Extra: all Requires-Dist: black>=19.10b0; extra == "all" Requires-Dist: click>=7.0; extra == "all" -Requires-Dist: crosshair-tool>=0.0.72; extra == "all" +Requires-Dist: crosshair-tool>=0.0.73; extra == "all" Requires-Dist: django>=3.2; extra == "all" Requires-Dist: dpcontracts>=0.4; extra == "all" Requires-Dist: hypothesis-crosshair>=0.0.14; extra == "all" @@ -64,7 +64,7 @@ Provides-Extra: codemods Requires-Dist: libcst>=0.3.16; extra == "codemods" Provides-Extra: crosshair Requires-Dist: hypothesis-crosshair>=0.0.14; extra == "crosshair" -Requires-Dist: crosshair-tool>=0.0.72; extra == "crosshair" +Requires-Dist: crosshair-tool>=0.0.73; extra == "crosshair" Provides-Extra: dateutil Requires-Dist: python-dateutil>=1.4; extra == "dateutil" Provides-Extra: django diff --git a/contrib/python/hypothesis/py3/_hypothesis_ftz_detector.py b/contrib/python/hypothesis/py3/_hypothesis_ftz_detector.py index abc1d65655..2c73530c9a 100644 --- a/contrib/python/hypothesis/py3/_hypothesis_ftz_detector.py +++ b/contrib/python/hypothesis/py3/_hypothesis_ftz_detector.py @@ -18,6 +18,14 @@ import of Hypothesis itself from each subprocess which must import the worker fu import importlib import sys +from typing import TYPE_CHECKING, Callable, Optional, Set, Tuple + +if TYPE_CHECKING: + from multiprocessing import Queue + from typing import TypeAlias + +FTZCulprits: "TypeAlias" = Tuple[Optional[bool], Set[str]] + KNOWN_EVER_CULPRITS = ( # https://moyix.blogspot.com/2022/09/someones-been-messing-with-my-subnormals.html @@ -35,16 +43,16 @@ KNOWN_EVER_CULPRITS = ( ) -def flush_to_zero(): +def flush_to_zero() -> bool: # If this subnormal number compares equal to zero we have a problem return 2.0**-1073 == 0 -def run_in_process(fn, *args): +def run_in_process(fn: Callable[..., FTZCulprits], *args: object) -> FTZCulprits: import multiprocessing as mp mp.set_start_method("spawn", force=True) - q = mp.Queue() + q: "Queue[FTZCulprits]" = mp.Queue() p = mp.Process(target=target, args=(q, fn, *args)) p.start() retval = q.get() @@ -52,15 +60,17 @@ def run_in_process(fn, *args): return retval -def target(q, fn, *args): +def target( + q: "Queue[FTZCulprits]", fn: Callable[..., FTZCulprits], *args: object +) -> None: q.put(fn(*args)) -def always_imported_modules(): +def always_imported_modules() -> FTZCulprits: return flush_to_zero(), set(sys.modules) -def modules_imported_by(mod): +def modules_imported_by(mod: str) -> FTZCulprits: """Return the set of modules imported transitively by mod.""" before = set(sys.modules) try: @@ -77,7 +87,7 @@ KNOWN_FTZ = None CHECKED_CACHE = set() -def identify_ftz_culprits(): +def identify_ftz_culprits() -> str: """Find the modules in sys.modules which cause "mod" to be imported.""" # If we've run this function before, return the same result. global KNOWN_FTZ @@ -94,7 +104,7 @@ def identify_ftz_culprits(): # that importing them in a new process sets the FTZ state. As a heuristic, we'll # start with packages known to have ever enabled FTZ, then top-level packages as # a way to eliminate large fractions of the search space relatively quickly. - def key(name): + def key(name: str) -> Tuple[bool, int, str]: """Prefer known-FTZ modules, then top-level packages, then alphabetical.""" return (name not in KNOWN_EVER_CULPRITS, name.count("."), name) diff --git a/contrib/python/hypothesis/py3/hypothesis/configuration.py b/contrib/python/hypothesis/py3/hypothesis/configuration.py index b7bc8879ce..cd9115533a 100644 --- a/contrib/python/hypothesis/py3/hypothesis/configuration.py +++ b/contrib/python/hypothesis/py3/hypothesis/configuration.py @@ -12,22 +12,22 @@ import os import sys import warnings from pathlib import Path +from typing import Union import _hypothesis_globals from hypothesis.errors import HypothesisSideeffectWarning __hypothesis_home_directory_default = Path.cwd() / ".hypothesis" - __hypothesis_home_directory = None -def set_hypothesis_home_dir(directory): +def set_hypothesis_home_dir(directory: Union[str, Path, None]) -> None: global __hypothesis_home_directory __hypothesis_home_directory = None if directory is None else Path(directory) -def storage_directory(*names, intent_to_write=True): +def storage_directory(*names: str, intent_to_write: bool = True) -> Path: if intent_to_write: check_sideeffect_during_initialization( "accessing storage for {}", "/".join(names) diff --git a/contrib/python/hypothesis/py3/hypothesis/errors.py b/contrib/python/hypothesis/py3/hypothesis/errors.py index 1dcf4493b2..7da59ebd90 100644 --- a/contrib/python/hypothesis/py3/hypothesis/errors.py +++ b/contrib/python/hypothesis/py3/hypothesis/errors.py @@ -214,7 +214,7 @@ class StopTest(BaseException): the Hypothesis engine, which should then continue normally. """ - def __init__(self, testcounter): + def __init__(self, testcounter: int) -> None: super().__init__(repr(testcounter)) self.testcounter = testcounter @@ -230,7 +230,7 @@ class Found(HypothesisException): class RewindRecursive(Exception): """Signal that the type inference should be rewound due to recursive types. Internal use only.""" - def __init__(self, target): + def __init__(self, target: object) -> None: self.target = target diff --git a/contrib/python/hypothesis/py3/hypothesis/extra/_patching.py b/contrib/python/hypothesis/py3/hypothesis/extra/_patching.py index b8fbfa3c7a..b508f199d6 100644 --- a/contrib/python/hypothesis/py3/hypothesis/extra/_patching.py +++ b/contrib/python/hypothesis/py3/hypothesis/extra/_patching.py @@ -18,11 +18,13 @@ discovered during testing, and by HypoFuzz for _covering_ examples discovered during fuzzing. """ +import ast import difflib import hashlib import inspect import re import sys +import types from ast import literal_eval from contextlib import suppress from datetime import date, datetime, timedelta, timezone @@ -31,6 +33,7 @@ from pathlib import Path import libcst as cst from libcst import matchers as m from libcst.codemod import CodemodContext, VisitorBasedCodemodCommand +from libcst.metadata import ExpressionContext, ExpressionContextProvider from hypothesis.configuration import storage_directory from hypothesis.version import __version__ @@ -148,18 +151,64 @@ def get_patch_for(func, failing_examples, *, strip_via=()): except Exception: return None + modules_in_test_scope = sorted( + ( + (k, v) + for (k, v) in module.__dict__.items() + if isinstance(v, types.ModuleType) + ), + key=lambda kv: len(kv[1].__name__), + ) + # The printed examples might include object reprs which are invalid syntax, # so we parse here and skip over those. If _none_ are valid, there's no patch. call_nodes = [] for ex, via in set(failing_examples): with suppress(Exception): - node = cst.parse_expression(ex) - assert isinstance(node, cst.Call), node + node = cst.parse_module(ex) + the_call = node.body[0].body[0].value + assert isinstance(the_call, cst.Call), the_call # Check for st.data(), which doesn't support explicit examples data = m.Arg(m.Call(m.Name("data"), args=[m.Arg(m.Ellipsis())])) - if m.matches(node, m.Call(args=[m.ZeroOrMore(), data, m.ZeroOrMore()])): + if m.matches(the_call, m.Call(args=[m.ZeroOrMore(), data, m.ZeroOrMore()])): return None + + # Many reprs use the unqualified name of the type, e.g. np.array() + # -> array([...]), so here we find undefined names and look them up + # on each module which was in the test's global scope. + names = {} + for anode in ast.walk(ast.parse(ex, "eval")): + if ( + isinstance(anode, ast.Name) + and isinstance(anode.ctx, ast.Load) + and anode.id not in names + and anode.id not in module.__dict__ + ): + for k, v in modules_in_test_scope: + if anode.id in v.__dict__: + names[anode.id] = cst.parse_expression(f"{k}.{anode.id}") + break + + # LibCST doesn't track Load()/Store() state of names by default, so we have + # to do a bit of a dance here, *and* explicitly handle keyword arguments + # which are treated as Load() context - but even if that's fixed later + # we'll still want to support older versions. + with suppress(Exception): + wrapper = cst.metadata.MetadataWrapper(node) + kwarg_names = { + a.keyword for a in m.findall(wrapper, m.Arg(keyword=m.Name())) + } + node = m.replace( + wrapper, + m.Name(value=m.MatchIfTrue(names.__contains__)) + & m.MatchMetadata(ExpressionContextProvider, ExpressionContext.LOAD) + & m.MatchIfTrue(lambda n, k=kwarg_names: n not in k), + replacement=lambda node, _, ns=names: ns[node.value], + ) + node = node.body[0].body[0].value + assert isinstance(node, cst.Call), node call_nodes.append((node, via)) + if not call_nodes: return None @@ -205,8 +254,8 @@ def make_patch(triples, *, msg="Hypothesis: add explicit examples", when=None): ud = difflib.unified_diff( source_before.splitlines(keepends=True), source_after.splitlines(keepends=True), - fromfile=str(fname), - tofile=str(fname), + fromfile=f"./{fname}", # git strips the first part of the path by default + tofile=f"./{fname}", ) diffs.append("".join(ud)) return "".join(diffs) diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/cache.py b/contrib/python/hypothesis/py3/hypothesis/internal/cache.py index a41cdb0549..8eb1bdba7e 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/cache.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/cache.py @@ -307,7 +307,7 @@ class LRUCache: # Anecdotally, OrderedDict seems quite competitive with lru_cache, but perhaps # that is localized to our access patterns. - def __init__(self, max_size): + def __init__(self, max_size: int) -> None: assert max_size > 0 self.max_size = max_size self._threadlocal = threading.local() diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/cathetus.py b/contrib/python/hypothesis/py3/hypothesis/internal/cathetus.py index 1f8f2fe82b..2012df4cdd 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/cathetus.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/cathetus.py @@ -12,7 +12,7 @@ from math import fabs, inf, isinf, isnan, nan, sqrt from sys import float_info -def cathetus(h, a): +def cathetus(h: float, a: float) -> float: """Given the lengths of the hypotenuse and a side of a right triangle, return the length of the other side. diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/compat.py b/contrib/python/hypothesis/py3/hypothesis/internal/compat.py index 4a3a94a084..df1ba067e9 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/compat.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/compat.py @@ -110,7 +110,7 @@ def int_to_byte(i: int) -> bytes: return bytes([i]) -def is_typed_named_tuple(cls): +def is_typed_named_tuple(cls: type) -> bool: """Return True if cls is probably a subtype of `typing.NamedTuple`. Unfortunately types created with `class T(NamedTuple):` actually diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py index 0f4f1138f3..2d24f984e5 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py @@ -271,7 +271,7 @@ class Example: return self.owner.labels[self.owner.label_indices[self.index]] @property - def parent(self): + def parent(self) -> Optional[int]: """The index of the example that this one is nested directly within.""" if self.index == 0: return None @@ -298,13 +298,13 @@ class Example: return self.owner.ir_ends[self.index] @property - def depth(self): + def depth(self) -> int: """Depth of this example in the example tree. The top-level example has a depth of 0.""" return self.owner.depths[self.index] @property - def trivial(self): + def trivial(self) -> bool: """An example is "trivial" if it only contains forced bytes and zero bytes. All examples start out as trivial, and then get marked non-trivial when we see a byte that is neither forced nor zero.""" @@ -352,6 +352,7 @@ class ExampleProperty: self.example_count = 0 self.block_count = 0 self.ir_node_count = 0 + self.result: Any = None def run(self) -> Any: """Rerun the test case with this visitor and return the @@ -425,7 +426,7 @@ def calculated_example_property(cls: Type[ExampleProperty]) -> Any: name = cls.__name__ cache_name = "__" + name - def lazy_calculate(self: "Examples") -> IntList: + def lazy_calculate(self: "Examples") -> Any: result = getattr(self, cache_name, None) if result is None: result = cls(self).run() @@ -465,7 +466,14 @@ class ExampleRecord: def freeze(self) -> None: self.__index_of_labels = None - def record_ir_draw(self, ir_type, value, *, kwargs, was_forced): + def record_ir_draw( + self, + ir_type: IRTypeName, + value: IRType, + *, + kwargs: IRKWargsType, + was_forced: bool, + ) -> None: self.trail.append(IR_NODE_RECORD) node = IRNode( ir_type=ir_type, @@ -517,7 +525,7 @@ class Examples: self.__children: "Optional[List[Sequence[int]]]" = None class _starts_and_ends(ExampleProperty): - def begin(self): + def begin(self) -> None: self.starts = IntList.of_length(len(self.examples)) self.ends = IntList.of_length(len(self.examples)) @@ -543,7 +551,7 @@ class Examples: return self.starts_and_ends[1] class _ir_starts_and_ends(ExampleProperty): - def begin(self): + def begin(self) -> None: self.starts = IntList.of_length(len(self.examples)) self.ends = IntList.of_length(len(self.examples)) @@ -570,7 +578,7 @@ class Examples: class _discarded(ExampleProperty): def begin(self) -> None: - self.result: "Set[int]" = set() # type: ignore # IntList in parent class + self.result: "Set[int]" = set() def finish(self) -> FrozenSet[int]: return frozenset(self.result) @@ -584,7 +592,7 @@ class Examples: class _trivial(ExampleProperty): def begin(self) -> None: self.nontrivial = IntList.of_length(len(self.examples)) - self.result: "Set[int]" = set() # type: ignore # IntList in parent class + self.result: "Set[int]" = set() def block(self, i: int) -> None: if not self.examples.blocks.trivial(i): @@ -610,7 +618,7 @@ class Examples: parentage: IntList = calculated_example_property(_parentage) class _depths(ExampleProperty): - def begin(self): + def begin(self) -> None: self.result = IntList.of_length(len(self.examples)) def start_example(self, i: int, label_index: int) -> None: @@ -619,10 +627,10 @@ class Examples: depths: IntList = calculated_example_property(_depths) class _ir_tree_nodes(ExampleProperty): - def begin(self): + def begin(self) -> None: self.result = [] - def ir_node(self, ir_node): + def ir_node(self, ir_node: "IRNode") -> None: self.result.append(ir_node) ir_tree_nodes: "List[IRNode]" = calculated_example_property(_ir_tree_nodes) @@ -788,7 +796,7 @@ class Blocks: prev = e @property - def last_block_length(self): + def last_block_length(self) -> int: return self.end(-1) - self.start(-1) def __len__(self) -> int: @@ -869,7 +877,7 @@ class Blocks: return result - def __check_completion(self): + def __check_completion(self) -> None: """The list of blocks is complete if we have created every ``Block`` object that we currently good and know that no more will be created. @@ -899,7 +907,7 @@ class Blocks: class _Overrun: status = Status.OVERRUN - def __repr__(self): + def __repr__(self) -> str: return "Overrun" @@ -1052,7 +1060,7 @@ class IRNode: and self.was_forced == other.was_forced ) - def __hash__(self): + def __hash__(self) -> int: return hash( ( self.ir_type, @@ -1062,7 +1070,7 @@ class IRNode: ) ) - def __repr__(self): + def __repr__(self) -> str: # repr to avoid "BytesWarning: str() on a bytes instance" for bytes nodes forced_marker = " [forced]" if self.was_forced else "" return f"{self.ir_type} {self.value!r}{forced_marker} {self.kwargs!r}" @@ -1911,8 +1919,7 @@ class HypothesisProvider(PrimitiveProvider): "writeup - and good luck!" ) - def permitted(f): - assert isinstance(f, float) + def permitted(f: float) -> bool: if math.isnan(f): return allow_nan if 0 < abs(f) < smallest_nonzero_magnitude: @@ -2080,7 +2087,7 @@ class ConjectureData: self._node_index = 0 self.start_example(TOP_LABEL) - def __repr__(self): + def __repr__(self) -> str: return "ConjectureData(%s, %d bytes%s)" % ( self.status.name, len(self.buffer), diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py index 7126918736..8c8fd18add 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py @@ -197,6 +197,7 @@ StatisticsDict = TypedDict( "shrink-phase": NotRequired[PhaseStatistics], "stopped-because": NotRequired[str], "targets": NotRequired[Dict[str, float]], + "nodeid": NotRequired[str], }, ) diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/detection.py b/contrib/python/hypothesis/py3/hypothesis/internal/detection.py index 9d3496176a..8ce11808c3 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/detection.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/detection.py @@ -11,7 +11,7 @@ from types import MethodType -def is_hypothesis_test(test): +def is_hypothesis_test(test: object) -> bool: if isinstance(test, MethodType): return is_hypothesis_test(test.__func__) return getattr(test, "is_hypothesis_test", False) diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/filtering.py b/contrib/python/hypothesis/py3/hypothesis/internal/filtering.py index f352e9cb6d..bfe858ccfe 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/filtering.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/filtering.py @@ -331,9 +331,9 @@ def get_float_predicate_bounds(predicate: Predicate) -> ConstructivePredicate: return ConstructivePredicate(kwargs, predicate) -def max_len(size: int, element: Collection) -> bool: +def max_len(size: int, element: Collection[object]) -> bool: return len(element) <= size -def min_len(size: int, element: Collection) -> bool: +def min_len(size: int, element: Collection[object]) -> bool: return size <= len(element) diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/scrutineer.py b/contrib/python/hypothesis/py3/hypothesis/internal/scrutineer.py index 0cd760cf17..8f7aa4c503 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/scrutineer.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/scrutineer.py @@ -18,7 +18,7 @@ from collections import defaultdict from functools import lru_cache, reduce from os import sep from pathlib import Path -from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple +from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Set, Tuple from hypothesis._settings import Phase, Verbosity from hypothesis.internal.compat import PYPY @@ -35,7 +35,7 @@ Trace: TypeAlias = Set[Branch] @lru_cache(maxsize=None) -def should_trace_file(fname): +def should_trace_file(fname: str) -> bool: # fname.startswith("<") indicates runtime code-generation via compile, # e.g. compile("def ...", "<string>", "exec") in e.g. attrs methods. return not (is_hypothesis_file(fname) or fname.startswith("<")) @@ -55,12 +55,12 @@ class Tracer: __slots__ = ("branches", "_previous_location") - def __init__(self): + def __init__(self) -> None: self.branches: Trace = set() - self._previous_location = None + self._previous_location: Optional[Location] = None @staticmethod - def can_trace(): + def can_trace() -> bool: return ( (sys.version_info[:2] < (3, 12) and sys.gettrace() is None) or ( @@ -138,7 +138,7 @@ UNHELPFUL_LOCATIONS = ( ) -def _glob_to_re(locs): +def _glob_to_re(locs: Iterable[str]) -> str: """Translate a list of glob patterns to a combined regular expression. Only the * wildcard is supported, and patterns including special characters will only work by chance.""" diff --git a/contrib/python/hypothesis/py3/hypothesis/provisional.py b/contrib/python/hypothesis/py3/hypothesis/provisional.py index a6f1c4afc5..aac93b6a0e 100644 --- a/contrib/python/hypothesis/py3/hypothesis/provisional.py +++ b/contrib/python/hypothesis/py3/hypothesis/provisional.py @@ -20,6 +20,7 @@ definitions it links to. If not, report the bug! import string from importlib import resources +from typing import Optional from hypothesis import strategies as st from hypothesis.errors import InvalidArgument @@ -48,7 +49,9 @@ TOP_LEVEL_DOMAINS = ["COM", *sorted((d for d in _tlds if d != "ARPA"), key=len)] class DomainNameStrategy(st.SearchStrategy): @staticmethod - def clean_inputs(minimum, maximum, value, variable_name): + def clean_inputs( + minimum: int, maximum: int, value: Optional[int], variable_name: str + ) -> int: if value is None: value = maximum elif not isinstance(value, int): @@ -61,7 +64,9 @@ class DomainNameStrategy(st.SearchStrategy): ) return value - def __init__(self, max_length=None, max_element_length=None): + def __init__( + self, max_length: Optional[int] = None, max_element_length: Optional[int] = None + ) -> None: """ A strategy for :rfc:`1035` fully qualified domain names. @@ -165,7 +170,7 @@ _url_fragments_strategy = ( def urls() -> st.SearchStrategy[str]: """A strategy for :rfc:`3986`, generating http/https URLs.""" - def url_encode(s): + def url_encode(s: str) -> str: return "".join(c if c in URL_SAFE_CHARACTERS else "%%%02X" % ord(c) for c in s) schemes = st.sampled_from(["http", "https"]) diff --git a/contrib/python/hypothesis/py3/hypothesis/stateful.py b/contrib/python/hypothesis/py3/hypothesis/stateful.py index 067d9c77c6..06e97b7ba5 100644 --- a/contrib/python/hypothesis/py3/hypothesis/stateful.py +++ b/contrib/python/hypothesis/py3/hypothesis/stateful.py @@ -196,6 +196,10 @@ def run_state_machine_as_test(state_machine_factory, *, settings=None, _min_step for k, v in list(data.items()): if isinstance(v, VarReference): data[k] = machine.names_to_values[v.name] + elif isinstance(v, list) and all( + isinstance(item, VarReference) for item in v + ): + data[k] = [machine.names_to_values[item.name] for item in v] label = f"execute:rule:{rule.function.__name__}" start = perf_counter() @@ -300,6 +304,10 @@ class RuleBasedStateMachine(metaclass=StateMachineMeta): def _pretty_print(self, value): if isinstance(value, VarReference): return value.name + elif isinstance(value, list) and all( + isinstance(item, VarReference) for item in value + ): + return "[" + ", ".join([item.name for item in value]) + "]" self.__stream.seek(0) self.__stream.truncate(0) self.__printer.output_width = 0 @@ -457,11 +465,8 @@ class Rule: self.arguments_strategies = {} bundles = [] for k, v in sorted(self.arguments.items()): - assert not isinstance(v, BundleReferenceStrategy) if isinstance(v, Bundle): bundles.append(v) - consume = isinstance(v, BundleConsumer) - v = BundleReferenceStrategy(v.name, consume=consume) self.arguments_strategies[k] = v self.bundles = tuple(bundles) @@ -474,26 +479,6 @@ class Rule: self_strategy = st.runner() -class BundleReferenceStrategy(SearchStrategy): - def __init__(self, name: str, *, consume: bool = False): - self.name = name - self.consume = consume - - def do_draw(self, data): - machine = data.draw(self_strategy) - bundle = machine.bundle(self.name) - if not bundle: - data.mark_invalid(f"Cannot draw from empty bundle {self.name!r}") - # Shrink towards the right rather than the left. This makes it easier - # to delete data generated earlier, as when the error is towards the - # end there can be a lot of hard to remove padding. - position = data.draw_integer(0, len(bundle) - 1, shrink_towards=len(bundle)) - if self.consume: - return bundle.pop(position) # pragma: no cover # coverage is flaky here - else: - return bundle[position] - - class Bundle(SearchStrategy[Ex]): """A collection of values for use in stateful testing. @@ -518,15 +503,29 @@ class Bundle(SearchStrategy[Ex]): def __init__(self, name: str, *, consume: bool = False) -> None: self.name = name - self.__reference_strategy = BundleReferenceStrategy(name, consume=consume) + self.consume = consume def do_draw(self, data): machine = data.draw(self_strategy) - reference = data.draw(self.__reference_strategy) - return machine.names_to_values[reference.name] + + bundle = machine.bundle(self.name) + if not bundle: + data.mark_invalid(f"Cannot draw from empty bundle {self.name!r}") + # Shrink towards the right rather than the left. This makes it easier + # to delete data generated earlier, as when the error is towards the + # end there can be a lot of hard to remove padding. + position = data.draw_integer(0, len(bundle) - 1, shrink_towards=len(bundle)) + if self.consume: + reference = bundle.pop( + position + ) # pragma: no cover # coverage is flaky here + else: + reference = bundle[position] + + return reference def __repr__(self): - consume = self.__reference_strategy.consume + consume = self.consume if consume is False: return f"Bundle(name={self.name!r})" return f"Bundle(name={self.name!r}, {consume=})" @@ -543,11 +542,6 @@ class Bundle(SearchStrategy[Ex]): return bool(machine.bundle(self.name)) -class BundleConsumer(Bundle[Ex]): - def __init__(self, bundle: Bundle[Ex]) -> None: - super().__init__(bundle.name, consume=True) - - def consumes(bundle: Bundle[Ex]) -> SearchStrategy[Ex]: """When introducing a rule in a RuleBasedStateMachine, this function can be used to mark bundles from which each value used in a step with the @@ -563,7 +557,10 @@ def consumes(bundle: Bundle[Ex]) -> SearchStrategy[Ex]: """ if not isinstance(bundle, Bundle): raise TypeError("Argument to be consumed must be a bundle.") - return BundleConsumer(bundle) + return type(bundle)( + name=bundle.name, + consume=True, + ) @attr.s() @@ -610,7 +607,7 @@ def _convert_targets(targets, target): ) raise InvalidArgument(msg % (t, type(t))) while isinstance(t, Bundle): - if isinstance(t, BundleConsumer): + if t.consume: note_deprecation( f"Using consumes({t.name}) doesn't makes sense in this context. " "This will be an error in a future version of Hypothesis.", @@ -1007,6 +1004,10 @@ class RuleStrategy(SearchStrategy): return (rule, arguments) def is_valid(self, rule): + for b in rule.bundles: + if not self.machine.bundle(b.name): + return False + predicates = self.machine._observability_predicates desc = f"{self.machine.__class__.__qualname__}, rule {rule.function.__name__}," for pred in rule.preconditions: @@ -1016,8 +1017,4 @@ class RuleStrategy(SearchStrategy): if not meets_precond: return False - for b in rule.bundles: - bundle = self.machine.bundle(b.name) - if not bundle: - return False return True diff --git a/contrib/python/hypothesis/py3/hypothesis/statistics.py b/contrib/python/hypothesis/py3/hypothesis/statistics.py index 465c92e9c1..bd3f4e3e30 100644 --- a/contrib/python/hypothesis/py3/hypothesis/statistics.py +++ b/contrib/python/hypothesis/py3/hypothesis/statistics.py @@ -10,20 +10,24 @@ import math from collections import Counter +from typing import TYPE_CHECKING, Dict, Iterable, List, cast from hypothesis._settings import Phase from hypothesis.utils.dynamicvariables import DynamicVariable +if TYPE_CHECKING: + from hypothesis.internal.conjecture.engine import PhaseStatistics, StatisticsDict + collector = DynamicVariable(None) -def note_statistics(stats_dict): +def note_statistics(stats_dict: "StatisticsDict") -> None: callback = collector.value if callback is not None: callback(stats_dict) -def describe_targets(best_targets): +def describe_targets(best_targets: Dict[str, float]) -> List[str]: """Return a list of lines describing the results of `target`, if any.""" # These lines are included in the general statistics description below, # but also printed immediately below failing examples to alleviate the @@ -41,7 +45,7 @@ def describe_targets(best_targets): return lines -def format_ms(times): +def format_ms(times: Iterable[float]) -> str: """Format `times` into a string representing approximate milliseconds. `times` is a collection of durations in seconds. @@ -60,7 +64,7 @@ def format_ms(times): return f"~ {lower}-{upper} ms" -def describe_statistics(stats_dict): +def describe_statistics(stats_dict: "StatisticsDict") -> str: """Return a multi-line string describing the passed run statistics. `stats_dict` must be a dictionary of data in the format collected by @@ -76,7 +80,7 @@ def describe_statistics(stats_dict): lines = [stats_dict["nodeid"] + ":\n"] if "nodeid" in stats_dict else [] prev_failures = 0 for phase in (p.name for p in list(Phase)[1:]): - d = stats_dict.get(phase + "-phase", {}) + d = cast("PhaseStatistics", stats_dict.get(phase + "-phase", {})) # Basic information we report for every phase cases = d.get("test-cases", []) if not cases: diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/random.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/random.py index 41c9feb523..30de91e234 100644 --- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/random.py +++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/random.py @@ -364,30 +364,31 @@ def convert_kwargs(name, kwargs): kwargs = dict(kwargs) signature = sig_of(name) + params = signature.parameters bound = signature.bind(DUMMY_RANDOM, **kwargs) bound.apply_defaults() for k in list(kwargs): if ( - kwargs[k] is signature.parameters[k].default - or signature.parameters[k].kind != inspect.Parameter.KEYWORD_ONLY + kwargs[k] is params[k].default + or params[k].kind != inspect.Parameter.KEYWORD_ONLY ): kwargs.pop(k) - arg_names = list(signature.parameters)[1:] + arg_names = list(params)[1:] args = [] for a in arg_names: - if signature.parameters[a].kind == inspect.Parameter.KEYWORD_ONLY: + if params[a].kind == inspect.Parameter.KEYWORD_ONLY: break args.append(bound.arguments[a]) kwargs.pop(a, None) while args: name = arg_names[len(args) - 1] - if args[-1] is signature.parameters[name].default: + if args[-1] is params[name].default: args.pop() else: break @@ -402,9 +403,13 @@ class TrueRandom(HypothesisRandom): self.__random = Random(seed) def _hypothesis_do_random(self, method, kwargs): + fn = getattr(self.__random, method) + try: + return fn(**kwargs) + except TypeError: + pass args, kwargs = convert_kwargs(method, kwargs) - - return getattr(self.__random, method)(*args, **kwargs) + return fn(*args, **kwargs) def __copy__(self): result = TrueRandom( diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/regex.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/regex.py index 8de137a422..b51e90ec0c 100644 --- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/regex.py +++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/regex.py @@ -39,8 +39,8 @@ UNICODE_CATEGORIES = set(categories()) SPACE_CHARS = set(" \t\n\r\f\v") UNICODE_SPACE_CHARS = SPACE_CHARS | set("\x1c\x1d\x1e\x1f\x85") UNICODE_DIGIT_CATEGORIES = {"Nd"} -UNICODE_SPACE_CATEGORIES = set(as_general_categories("Z")) -UNICODE_LETTER_CATEGORIES = set(as_general_categories("L")) +UNICODE_SPACE_CATEGORIES = set(as_general_categories(["Z"])) +UNICODE_LETTER_CATEGORIES = set(as_general_categories(["L"])) UNICODE_WORD_CATEGORIES = set(as_general_categories(["L", "N"])) # This is verbose, but correct on all versions of Python diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py index 53bee1fe22..dc7a129d06 100644 --- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py +++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py @@ -29,7 +29,7 @@ from typing import ( ) from hypothesis._settings import HealthCheck, Phase, Verbosity, settings -from hypothesis.control import _current_build_context +from hypothesis.control import _current_build_context, current_build_context from hypothesis.errors import ( HypothesisException, HypothesisWarning, @@ -843,7 +843,7 @@ class MappedStrategy(SearchStrategy[Ex]): x = data.draw(self.mapped_strategy) result = self.pack(x) # type: ignore data.stop_example() - _current_build_context.value.record_call(result, self.pack, [x], {}) + current_build_context().record_call(result, self.pack, [x], {}) return result except UnsatisfiedAssumption: data.stop_example(discard=True) diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/types.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/types.py index 13e01b0b05..7288d8b73a 100644 --- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/types.py +++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/types.py @@ -304,24 +304,24 @@ def is_a_new_type(thing): return isinstance(thing, typing.NewType) -def is_a_union(thing): +def is_a_union(thing: object) -> bool: """Return True if thing is a typing.Union or types.UnionType (in py310).""" return isinstance(thing, UnionType) or get_origin(thing) is typing.Union -def is_a_type(thing): +def is_a_type(thing: object) -> bool: """Return True if thing is a type or a generic type like thing.""" return isinstance(thing, type) or is_generic_type(thing) or is_a_new_type(thing) -def is_typing_literal(thing): +def is_typing_literal(thing: object) -> bool: return get_origin(thing) in ( typing.Literal, getattr(typing_extensions, "Literal", object()), ) -def is_annotated_type(thing): +def is_annotated_type(thing: object) -> bool: return ( isinstance(thing, _AnnotatedAlias) and getattr(thing, "__args__", None) is not None diff --git a/contrib/python/hypothesis/py3/hypothesis/utils/dynamicvariables.py b/contrib/python/hypothesis/py3/hypothesis/utils/dynamicvariables.py index ad00cc8b48..cb823628b2 100644 --- a/contrib/python/hypothesis/py3/hypothesis/utils/dynamicvariables.py +++ b/contrib/python/hypothesis/py3/hypothesis/utils/dynamicvariables.py @@ -10,23 +10,26 @@ import threading from contextlib import contextmanager +from typing import Generator, Generic, TypeVar +T = TypeVar("T") -class DynamicVariable: - def __init__(self, default): + +class DynamicVariable(Generic[T]): + def __init__(self, default: T) -> None: self.default = default self.data = threading.local() @property - def value(self): + def value(self) -> T: return getattr(self.data, "value", self.default) @value.setter - def value(self, value): + def value(self, value: T) -> None: self.data.value = value @contextmanager - def with_value(self, value): + def with_value(self, value: T) -> Generator[None, None, None]: old_value = self.value try: self.data.value = value diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py index d03669dd3f..a2112a2f36 100644 --- a/contrib/python/hypothesis/py3/hypothesis/version.py +++ b/contrib/python/hypothesis/py3/hypothesis/version.py @@ -8,5 +8,5 @@ # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. -__version_info__ = (6, 112, 2) +__version_info__ = (6, 112, 4) __version__ = ".".join(map(str, __version_info__)) diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make index 513d144e16..7dc523a75e 100644 --- a/contrib/python/hypothesis/py3/ya.make +++ b/contrib/python/hypothesis/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.112.2) +VERSION(6.112.4) LICENSE(MPL-2.0) diff --git a/contrib/tools/bison/.yandex_meta/__init__.py b/contrib/tools/bison/.yandex_meta/__init__.py index 52a66e9547..009d94080e 100644 --- a/contrib/tools/bison/.yandex_meta/__init__.py +++ b/contrib/tools/bison/.yandex_meta/__init__.py @@ -55,6 +55,12 @@ WINDOWS_SRCS = [ "windows-tls.h", ] +MUSL_SRCS = [ + "error.c", + "obstack.c", + "obstack_printf.c", +] + DARWIN_SRCS = [ "error.c", "fpending.c", @@ -101,16 +107,31 @@ EXCESSIVE_SRCS = [ def post_install(self): with self.yamakes["lib"] as gnulib: + # musl-libc has fseterr + gnulib.SRCS.remove("fseterr.c") + gnulib.after( + "SRCS", + """ + IF (NOT MUSL) + SRCS( + fseterr.c + ) + ENDIF() + """, + ) gnulib.after( "SRCS", Switch( - OS_WINDOWS=Linkable( - SRCS=[src for src in WINDOWS_SRCS if pathutil.is_source(src)], - ADDINCL=[GLOBAL(f"{self.arcdir}/lib/platform/win64")], + MUSL=Linkable( + SRCS=MUSL_SRCS, ), OS_DARWIN=Linkable( SRCS=DARWIN_SRCS, ), + OS_WINDOWS=Linkable( + SRCS=[src for src in WINDOWS_SRCS if pathutil.is_source(src)], + ADDINCL=[GLOBAL(f"{self.arcdir}/lib/platform/win64")], + ), ), ) for src in WINDOWS_SRCS: @@ -162,7 +183,7 @@ bison = NixProject( "src/scan-skel.l", "src/parse-gram.y", ] - + [f"lib/{src}" for src in itertools.chain(WINDOWS_SRCS, DARWIN_SRCS)], + + [f"lib/{src}" for src in itertools.chain(MUSL_SRCS, DARWIN_SRCS, WINDOWS_SRCS)], copy_sources_except=[ # Don't need them for now, reduce import footprint "data/skeletons/d.m4", diff --git a/contrib/tools/bison/lib/config-musl.h b/contrib/tools/bison/lib/config-musl.h index d8ad04c19e..41777d40f2 100644 --- a/contrib/tools/bison/lib/config-musl.h +++ b/contrib/tools/bison/lib/config-musl.h @@ -1,3 +1,5 @@ #define HAVE_SYS_TIMES_H 1 #define HAVE_STRUCT_TMS 1 #define HAVE_CLOCK_T 1 + +#define _GL_ARG_NONNULL(...) diff --git a/contrib/tools/bison/lib/ya.make b/contrib/tools/bison/lib/ya.make index da1aacbe5c..38ca9b0120 100644 --- a/contrib/tools/bison/lib/ya.make +++ b/contrib/tools/bison/lib/ya.make @@ -60,7 +60,6 @@ SRCS( fd-safer-flag.c fd-safer.c fopen-safer.c - fseterr.c fstrcmp.c get-errno.c gethrxtime.c @@ -121,7 +120,19 @@ SRCS( xtime.c ) -IF (OS_DARWIN) +IF (NOT MUSL) + SRCS( + fseterr.c + ) +ENDIF() + +IF (MUSL) + SRCS( + error.c + obstack.c + obstack_printf.c + ) +ELSEIF (OS_DARWIN) SRCS( error.c fpending.c diff --git a/contrib/tools/m4/.yandex_meta/__init__.py b/contrib/tools/m4/.yandex_meta/__init__.py new file mode 100644 index 0000000000..657a7148a3 --- /dev/null +++ b/contrib/tools/m4/.yandex_meta/__init__.py @@ -0,0 +1,199 @@ +import os +import itertools + +from devtools.yamaker.modules import GLOBAL, Linkable, Switch +from devtools.yamaker import pathutil +from devtools.yamaker.project import NixProject + + +WINDOWS_SRCS = [ + "close.c", + "dup2.c", + "error.c", + "float+.h", + "fpending.c", + "fseeko.c", + "getdtablesize.c", + "getopt.c", + "getopt1.c", + "getopt_int.h", + "gettimeofday.c", + "isnand-nolibm.h", + "isnanf-nolibm.h", + "isnanl-nolibm.h", + "localeconv.c", + "mkdtemp.c", + "msvc-inval.c", + "msvc-inval.h", + "msvc-nothrow.c", + "msvc-nothrow.h", + "nl_langinfo.c", + "obstack.c", + "raise.c", + "regex.c", + "regex.h", + "sigaction.c", + "siglist.h", + "sigprocmask.c", + "strsignal.c", + "w32spawn.h", + "waitpid.c", +] + +DARWIN_SRCS = [ + "error.c", + "fpending.c", + "obstack.c", + "regex.c", + "secure_getenv.c", +] + +EXCESSIVE_SRCS = [ + "alloca.h", + "asprintf.c", + "fflush.c", + "fpurge.c", + "fseek.c", + "freading.c", + "langinfo.h", + "limits.h", + "locale.h", + "math.h", + "signal.h", + "spawn.h", + "stdio.h", + "stdlib.h", + "string.h", + "sys/stat.h", + "sys/time.h", + "sys/types.h", + "sys/wait.h", + "time.h", + "unistd.h", + "wchar.h", + "wctype.h", +] + +MUSL_SRCS = [ + "error.c", + "obstack.c", + "regex.c", +] + + +def post_install(self): + + with self.yamakes["lib"] as gnulib: + gnulib.SRCS.remove("freadahead.c") + gnulib.SRCS.remove("fseeko.c") + + # Provide sys/random.h implementations which is used disregarding HAVE_SYS_RANDOM configuration value + gnulib.PEERDIR.add("contrib/libs/libc_compat") + + gnulib.after( + "SRCS", + Switch( + MUSL=Linkable( + SRCS=[src for src in MUSL_SRCS if pathutil.is_source(src)], + ), + OS_WINDOWS=Linkable( + SRCS=[src for src in WINDOWS_SRCS if pathutil.is_source(src)], + ADDINCL=[GLOBAL(f"{self.arcdir}/lib/platform/win64")], + ), + OS_DARWIN=Linkable( + SRCS=[src for src in DARWIN_SRCS if pathutil.is_source(src)], + ), + ), + ) + + gnulib.after( + "SRCS", + """ + IF (NOT MUSL) + SRCS( + freadahead.c + ) + ENDIF() + """, + ) + + for src in WINDOWS_SRCS: + if pathutil.is_source(src) and src in gnulib.SRCS: + gnulib.SRCS.remove(src) + + for src in EXCESSIVE_SRCS: + os.remove(f"{self.dstdir}/lib/{src}") + if pathutil.is_source(src): + gnulib.SRCS.remove(src) + + +m4 = NixProject( + arcdir="contrib/tools/m4", + owners=["g:cpp-contrib"], + nixattr="m4", + ignore_commands=[ + "bash", + "cat", + "sed", + ], + # fmt: off + copy_sources=[ + # these are included from regex.c and should not be added into SRCS + "lib/intprops.h", + "lib/regcomp.c", + "lib/regex_internal.c", + "lib/regex_internal.h", + "lib/regexec.c", + ] + [f"lib/{src}" for src in itertools.chain(WINDOWS_SRCS, DARWIN_SRCS)], + # fmt: on + use_full_libnames=True, + install_targets=[ + "libm4", + "m4", + ], + keep_paths=[ + "lib/platform/win64/*.h", + "lib/platform/win64/sys/*.h", + # Keep this for now, these were backported from the future + "lib/fpending.c", + "lib/freadahead.c", + "lib/fseeko.c", + "lib/stdio-impl.h", + ], + platform_dispatchers=[ + "lib/config.h", + "lib/configmake.h", + ], + disable_includes=[ + "InnoTekLIBC/backend.h", + "bits/libc-lock.h", + "gettextP.h", + "lc-charset-dispatch.h", + "libc-lock.h", + "localename-table.h", + "../locale/localeinfo.h", + "OS.h", + "os2.h", + "os2-spawn.h", + "mbtowc-lock.h", + "mbrtowc-impl.h", + "relocatable.h", + "sigsegv.h", + "streq.h", + "synch.h", + "sys/ps.h", + "sys/single_threaded.h", + "unistring-notinline.h", + ], + put={ + "libm4": "lib", + "m4": ".", + }, + post_install=post_install, +) + +m4.copy_top_sources_except |= { + "ABOUT-NLS", + "ChangeLog", + "ChangeLog-2014", +} diff --git a/contrib/tools/m4/.yandex_meta/devtools.copyrights.report b/contrib/tools/m4/.yandex_meta/devtools.copyrights.report new file mode 100644 index 0000000000..036eb41b8c --- /dev/null +++ b/contrib/tools/m4/.yandex_meta/devtools.copyrights.report @@ -0,0 +1,1636 @@ +# File format ($ symbol means the beginning of a line): +# +# $ # this message +# $ # ======================= +# $ # comments (all commentaries should starts with some number of spaces and # symbol) +# $ IGNORE_FILES {file1.ext1} {file2.ext2} - (optional) ignore listed files when generating license macro and credits +# $ RENAME {original license id} TO {new license id} # user comments - (optional) use {new license id} instead {original license id} in ya.make files +# $ # user comments +# $ +# ${action} {license id} {license text hash} +# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make +# ${all_file_action} filename +# $ # user commentaries (many lines) +# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) +# ${action} {license spdx} {license text hash} +# $BELONGS ./ya/make/file/relative/path/3/ya.make +# ${all_file_action} filename +# $ # user commentaries +# $ generated description +# $ ... +# +# You can modify action, all_file_action and add commentaries +# Available actions: +# keep - keep license in contrib and use in credits +# skip - skip license +# remove - remove all files with this license +# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file +# +# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) +# We suppose that that files can contain some license info +# Available all file actions: +# FILE_IGNORE - ignore file (do nothing) +# FILE_INCLUDE - include all file data into licenses text file +# ======================= + +KEEP COPYRIGHT_SERVICE_LABEL 020c22af0ed4f90d8ef06d21bbc68edd +BELONGS lib/ya.make + License text: + Copyright (C) 2001-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/intprops.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 021f9ce4929c908703b3306db4f67824 +BELONGS lib/ya.make + License text: + Copyright (C) 2002-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/regcomp.c [2:4] + lib/regex.c [2:4] + lib/regex_internal.c [2:4] + lib/regex_internal.h [2:4] + lib/regexec.c [2:4] + +KEEP COPYRIGHT_SERVICE_LABEL 02520a034d838e17b3fd20ba4a95721b +BELONGS lib/ya.make + License text: + Copyright (C) 1995-1997, 2003, 2006, 2008-2016 Free Software Foundation, + Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/error.h [2:4] + +KEEP COPYRIGHT_SERVICE_LABEL 02abc590ff5099797174410087e28901 +BELONGS lib/ya.make + License text: + Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/malloca.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 03d99e84ae3a1e2c827d9a3a281bd250 +BELONGS lib/ya.make + License text: + Copyright (C) 1990, 2001, 2003-2006, 2009-2016 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/stripslash.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL 041f89aaa62da971c690568f502564ff +BELONGS ya.make + License text: + Copyright (C) 2000, 2006, 2009-2014, 2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + BACKLOG [53:53] + +KEEP COPYRIGHT_SERVICE_LABEL 0684cf2aa3d8f91098f64fa84d2a3b9f +BELONGS lib/ya.make + License text: + Copyright (C) 2004, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/cloexec.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 09837f4dd01bb3c38252ba2bee2c6aa9 +BELONGS ya.make + License text: + Copyright (C) 1989-1993, 2004, 2006-2014, 2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + src/path.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL 0a30301ae6b19b7f7ba66e418a1880ea +BELONGS lib/ya.make + License text: + Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/c-strcase.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 0b2cd38daefcd34e306aa0ea05722f29 +BELONGS lib/ya.make + License text: + Copyright (C) 1991-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/tempname.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 0d25f0c1b8534fc36757270479e9990f +BELONGS lib/ya.make + License text: + Copyright (C) 2001-2003, 2005-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2001. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/progname.c [2:3] + lib/wait-process.c [2:3] + lib/waitpid.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 0d52a61588a7a579449724b3b2b10256 +BELONGS lib/ya.make + License text: + Copyright (C) 1998-2001, 2003, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/quote.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 0ebf532497f0b229da5a112a036973fd +BELONGS lib/ya.make + License text: + Copyright (C) 2000-2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/dosname.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 11ad23ee3922f2bc54d6a0de07a04a6c +BELONGS lib/ya.make + License text: + Copyright (C) 2005, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/stdlib-safer.h [3:3] + lib/unistd--.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 16ab19de40b3769149d9792fb62fc9bf +BELONGS lib/ya.make + License text: + Copyright (C) 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/exitfail.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 1c23eeb45a8056e937ad3e12a697c2d0 +BELONGS lib/ya.make + License text: + Copyright (C) 2001, 2003, 2005, 2008-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/binary-io.h [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 1fad0189682f14ce1bb5adcd85e5bfa1 +BELONGS ya.make + License text: + Copyright (C) 1989-1994, 2006-2014, 2016 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + src/format.c [3:4] + src/freeze.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL 24fd791125179b6005d4844027da88d6 +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2002-2004, 2006, 2009-2016 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/xasprintf.c [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 27384c90fe0ea5b31626e24ce0332bdd +BELONGS lib/ya.make + License text: + Copyright (C) 2006-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/fcntl.h [4:4] + lib/gl_anylinked_list2.h [1:3] + lib/gl_list.h [2:3] + lib/sigprocmask.c [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 2a068c57e32ec1b4926bba8d17eb6677 +BELONGS lib/ya.make + License text: + /* Sequential list data type implemented by a hash table with another list. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/gl_anyhash_list1.h [1:3] + lib/gl_anyhash_list2.h [1:3] + lib/gl_anylinked_list1.h [1:3] + lib/gl_avltree_oset.h [1:3] + lib/gl_linkedhash_list.h [1:3] + lib/tempname.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 2b284e7e16ee23f2ef721b06e27cd6f7 +BELONGS lib/ya.make + License text: + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2016 Free Software + Foundation, Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/getopt_int.h [2:4] + +KEEP COPYRIGHT_SERVICE_LABEL 2ceea3ddee6a7331a901d09a11fbceed +BELONGS lib/ya.make + License text: + Copyright (C) 2003-2004, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/fatal-signal.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 2d578c9695bb520e0b7b7ae303ef017c +BELONGS lib/ya.make + License text: + /* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2016 Free Software + Foundation, Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/mkdtemp.c [1:3] + +KEEP COPYRIGHT_SERVICE_LABEL 2fd604d3359a5e4fc8c95bc70cbab925 +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2002-2004, 2006-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/xvasprintf.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 30e632b67c665d5739d3b12965a9ffd7 +BELONGS ya.make + License text: + Copyright (C) 2000, 2006-2007, 2009-2014, 2016 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + AUTHORS [35:36] + TODO [40:41] + +KEEP COPYRIGHT_SERVICE_LABEL 35b81b855f3d5c5afcc195c2a86eaa5c +BELONGS lib/ya.make + License text: + Copyright (C) 1998, 2001, 2003-2006, 2009-2016 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/dirname.h [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL 39da4b42a1a7628ed8407c5d7b557b2f +BELONGS lib/ya.make + License text: + Copyright (C) 1990-2000, 2003-2004, 2006-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/xalloc-oversized.h [3:3] + lib/xalloc.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 3b8fb448593f43892e2f5da542804dde +BELONGS lib/ya.make + License text: + Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2016 Free Software + Foundation, Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/getopt1.c [2:4] + +KEEP COPYRIGHT_SERVICE_LABEL 400a1e7179fd6f7b44ea3b5de1cef23c +BELONGS lib/ya.make + License text: + Copyright (C) 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/unistd-safer.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 40115c44b23b766f3c982bffae358fa0 +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2002, 2006, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/asnprintf.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 4184562b88c3624de8cdb446d894c390 +BELONGS lib/ya.make + License text: + Copyright (C) 2008-2013 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/platform/win64/sched.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 4185034d68efcf01cec5200570ec123a +BELONGS lib/ya.make + License text: + Copyright (C) 2005-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/glthread/lock.c [2:2] + lib/glthread/lock.h [2:2] + lib/glthread/threadlib.c [2:2] + lib/glthread/tls.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 422bc90acb59e21340f7fcc1acb0ae3a +BELONGS lib/ya.make + License text: + Copyright (C) 2000, 2004, 2006-2007, 2009-2021 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/fpending.c [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 43c041991a7120a2ddcfaea16fa37a08 +BELONGS lib/ya.make + License text: + /* Variable with FSF copyright information, for version-etc. + Copyright (C) 1999-2006, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/version-etc-fsf.c [1:2] + +KEEP COPYRIGHT_SERVICE_LABEL 4797f888ce3ee0eba403813fd36d2dda +BELONGS lib/ya.make + License text: + Copyright (C) 1998-2002, 2004, 2006, 2008-2016 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/closeout.c [3:4] + lib/quotearg.h [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL 47f0ed3adff29b0888b6fd0d294d1d26 +BELONGS lib/ya.make + License text: + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/minmax.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 4c2eab8b162059a7c70f33b0340ff5a7 +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2004-2007, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/dup2.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 4c930b3f752e2731aff53a1f82279c68 +BELONGS lib/ya.make + License text: + Copyright (C) 2002, 2004, 2008-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/c-stack.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 4cc350b9b8dcb19df9faba89002e8b55 +BELONGS lib/ya.make + License text: + Copyright (C) 2002, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/exitfail.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 4d6253f33abc179952f327ee3b1f4e15 +BELONGS lib/ya.make + License text: + Copyright (C) 1995, 1999, 2001-2004, 2006-2013 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/platform/win64/alloca.h [4:5] + +KEEP COPYRIGHT_SERVICE_LABEL 4f5224922ca1060274bb2d14132e28d2 +BELONGS lib/ya.make + License text: + Copyright (C) 2009-2013 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/platform/win64/langinfo.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 50373a25681bbf4d374eacce30fb00b9 +BELONGS lib/ya.make + License text: + Copyright (C) 2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/getprogname.c [2:2] + lib/getprogname.h [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 52db3eb649b1559aa9113ce26e039ec6 +BELONGS lib/ya.make + License text: + Copyright (C) 2003, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/xstrndup.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 53b19367c4cfc77fe8351516a21ff332 +BELONGS lib/ya.make + License text: + Copyright (C) 2007-2021 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/freadahead.c [2:2] + lib/fseeko.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 544ab2438f7aa43ef1ce1ed67e54b937 +BELONGS lib/ya.make + License text: + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free Software + Foundation, Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/platform/win64/getopt.h [3:5] + +KEEP COPYRIGHT_SERVICE_LABEL 5885bad6fee13bce0f660d6f0cdf4bd9 +BELONGS lib/ya.make + License text: + Copyright (C) 2005, 2007-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/glthread/tls.h [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 59510767896cb7dcd25bee3ef41a4a44 +BELONGS lib/ya.make + License text: + Copyright (C) 2002-2004, 2007-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/vasnprintf.h [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 5ac728804304ac476150a2d894ad7108 +BELONGS lib/ya.make + License text: + Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/hard-locale.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL 5cdd46d5dff8232bc46b8f81525dd67f +BELONGS lib/ya.make + License text: + /* Ordered set data type implemented by a binary tree. + Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/gl_anytree_oset.h [1:3] + lib/gl_avltree_oset.c [1:3] + lib/gl_oset.h [2:3] + lib/verror.c [2:2] + lib/verror.h [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 5d1667bf16257cb8c0eddfec1ef63a4f +BELONGS lib/ya.make + License text: + Copyright (C) 2003-2013 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/platform/win64/unistd.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 62ae9b7756c80545eff63b4bc99bfe9d +BELONGS ya.make + License text: + Copyright (C) 1989-1994, 2006-2007, 2009-2014, 2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + src/eval.c [3:4] + src/macro.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL 63f13d55f12018114a7583ad4326977e +BELONGS lib/ya.make + License text: + Copyright 2013-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/secure_getenv.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 66b86f65358bc5039267f11499c62afd +BELONGS lib/ya.make + License text: + Copyright (C) 1999-2000, 2002-2003, 2006-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/printf-parse.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 68267df6c0f167cba826473b5c9e4aba +BELONGS lib/ya.make + License text: + Copyright (C) 1996-1999, 2008-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/siglist.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 6c11153e470211ed5e779b1c5990f89d +BELONGS lib/ya.make + License text: + Copyright (C) 1996-2007, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/filenamecat-lgpl.c [3:3] + lib/filenamecat.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 71499817b900aaf04d853fdffdc657b0 +BELONGS ya.make + License text: + Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + INSTALL [4:5] + +KEEP COPYRIGHT_SERVICE_LABEL 71de0111bb2934395d6c712100e955bf +BELONGS lib/ya.make + License text: + Copyright (C) 2000, 2003-2004, 2008-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/platform/win64/spawn.h [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL 735ec2d684a04ef21231f247536b29c8 +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2003-2004, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/hard-locale.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 74bf6d6cb74f3104314a106e04ce3152 +BELONGS lib/ya.make + License text: + Copyright (C) 2001-2004, 2006, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2001. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/progname.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 7792bbce75afbb9ac20312cb5a4374be +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/printf-args.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 795febd0e8211d8af9b069ecbf574430 +BELONGS lib/ya.make + License text: + Copyright (C) 2001-2004, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/unlocked-io.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 7a936da6a1a519e3fdff149f8b0a8978 +BELONGS lib/ya.make + License text: + Copyright (C) 2003-2004, 2006-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/fatal-signal.c [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 7b6c8226902b3656b0bd91ff0c7e4e8f +BELONGS ya.make + License text: + Copyright (C) 1989-1994, 2003, 2006-2014, 2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + src/symtab.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL 7ba7e7c431dd4f511672633c48fff2e1 +BELONGS ya.make + License text: + Copyright (C) 2000, 2006-2014, 2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + THANKS [143:143] + +KEEP COPYRIGHT_SERVICE_LABEL 7be90e0d0202acefed5049f50633159b +BELONGS lib/ya.make + License text: + Copyright (C) 2001, 2003, 2006-2007, 2009-2016 Free Software Foundation, + Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/clean-temp.c [2:4] + +KEEP COPYRIGHT_SERVICE_LABEL 7e30414ba92d78e37f102f6ab2494d89 +BELONGS lib/ya.make + License text: + Copyright (C) 1998-1999, 2005-2006, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/c-strcasecmp.c [2:2] + lib/c-strncasecmp.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 821c2564413e04c718ffc7a54d289632 +BELONGS lib/ya.make + License text: + Copyright (C) 2000, 2003, 2005-2006, 2009-2016 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/fpending.h [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL 8719a2d74273264497746bf1dcd47ff5 +BELONGS lib/ya.make + License text: + Copyright (C) 1991, 2004-2006, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/cloexec.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 8852eec613da8d0c23dbe9378c64629d +BELONGS lib/ya.make + License text: + Copyright d Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/version-etc-fsf.c [26:30] + +KEEP COPYRIGHT_SERVICE_LABEL 89987ec1024c9f4d65e939d586271b9f +BELONGS lib/ya.make + License text: + Copyright (C) 2012-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/localeconv.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 8cd18281e0ba2868ccc73d5c2c1f695b +BELONGS lib/ya.make + License text: + Copyright (C) 2001, 2003-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/w32spawn.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 8dd7ff31f740aeca019fe2662a7e7ccf +BELONGS lib/ya.make + License text: + Copyright (C) 1990-2000, 2002-2006, 2008-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/xmalloc.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 8e0ab5b0f41c709c6282e35537ee543b +BELONGS lib/ya.make + License text: + Copyright (C) 2000-2003, 2009-2016 Free Software Foundation, Inc. + This file is part of the GNU CHARSET Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/localcharset.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 8eeb4089b33f8b2f249f4052f7d93686 +BELONGS lib/ya.make + License text: + Copyright (C) 2001-2003, 2008-2016 Free Software Foundation, Inc. + Written by Bruno Haible <haible@clisp.cons.org>, 2001. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/execute.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 8f32c78fd44b2f759221274b58abca44 +BELONGS lib/ya.make + License text: + Copyright (C) 1998-2002, 2004-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/quotearg.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 8fa64b3895a0d9ed96b8592b457e5134 +BELONGS lib/ya.make + License text: + Copyright (C) 2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/dup-safer-flag.c [4:4] + lib/dup-safer.c [3:3] + lib/fopen-safer.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 914d53bbffbf6815a58f629c2b82c301 +BELONGS lib/ya.make + License text: + Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/closein.c [3:3] + lib/closein.h [3:3] + lib/float+.h [2:3] + lib/printf-frexp.c [2:2] + lib/printf-frexp.h [2:2] + lib/printf-frexpl.c [2:2] + lib/printf-frexpl.h [2:2] + lib/xprintf.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 92e42fb2fd3f2c5fead79f64ea58fdb2 +BELONGS lib/ya.make + License text: + Copyright (C) 2001-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/gettimeofday.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 959147d84977be57112b5fe8b89a8a23 +BELONGS lib/ya.make + License text: + Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2016 Free Software + Foundation, Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/getopt.c [5:7] + +KEEP COPYRIGHT_SERVICE_LABEL 96bf6bd5f021f33789770fb1c61c2386 +BELONGS lib/ya.make + License text: + Copyright (C) 2002-2003, 2005-2006, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/raise.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL 98ad972265fe8fdd0aae2a74a0919c24 +BELONGS lib/ya.make + License text: + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/pathmax.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL 9ae366a7ff1d7343508f4419d8f30902 +BELONGS lib/ya.make + License text: + Copyright (C) 2007-2013 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/platform/win64/locale.h [3:3] + lib/platform/win64/sys/time.h [4:4] + +KEEP COPYRIGHT_SERVICE_LABEL 9dccf46a2c0ae5b529abd023140ba384 +BELONGS lib/ya.make + License text: + /* Sequential list data type implemented by a hash table with a linked list. + Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/gl_linkedhash_list.c [1:3] + +KEEP COPYRIGHT_SERVICE_LABEL 9eb6961d6c589a9f47d9ed09c91e4730 +BELONGS lib/ya.make + License text: + Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/closeout.h [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL 9ec93a01fbde7f55b38fde0295b04c70 +BELONGS lib/ya.make +FILE_INCLUDE lib/obstack.c found in files: lib/obstack.c at line 1, lib/obstack.h at line 2 + License text: + /* obstack.c - subroutines used implicitly by object stack macros + Copyright (C) 1988-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/obstack.c [1:3] + lib/obstack.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL a110b6de310cf601d9fa4e3146da66d1 +BELONGS lib/ya.make + License text: + Copyright (C) 2001-2003, 2006, 2008-2016 Free Software Foundation, Inc. + Written by Bruno Haible <haible@clisp.cons.org>, 2001. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/spawn-pipe.h [2:3] + lib/wait-process.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL a163ecc333dc48ad804fb19accd2c48b +BELONGS ya.make + License text: + Copyright (C) 1991-1994, 2004, 2006-2007, 2009-2014, 2016 Free + Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + src/debug.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL a26c5fb6cf2dd8ee29563c3fabbb3b95 +BELONGS lib/ya.make + License text: + Copyright (C) 2001-2002, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/tmpdir.h [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL a3ffe34b7c0227ffa2ecf65c45834d70 +BELONGS lib/ya.make + License text: + Copyright (C) 2008-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/close.c [2:2] + lib/fclose.c [2:2] + lib/getdtablesize.c [2:3] + lib/ignore-value.h [3:3] + lib/memchr2.h [2:2] + lib/sig-handler.h [3:3] + lib/sigaction.c [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL a44b350918471bd1b683751ff01f614f +BELONGS lib/ya.make + License text: + Copyright (C) 2007-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2007. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/fpucw.h [2:3] + lib/freadahead.h [2:2] + lib/freading.h [2:2] + lib/isnand-nolibm.h [2:2] + lib/isnanf-nolibm.h [2:2] + lib/isnanl-nolibm.h [2:2] + lib/nl_langinfo.c [3:3] + lib/xprintf.h [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL a61d5e110342a26917f3faebebc08629 +BELONGS lib/ya.make + License text: + Copyright (C) 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/malloca.c [2:3] + lib/xmalloca.c [2:3] + lib/xstrndup.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL a66bbf9a4475d3f8b4d177714e9e88d4 +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2002, 2006-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/vasprintf.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL a8170d952ab4796676d574f35b4290c4 +BELONGS ya.make + License text: + Copyright (C) 2000, 2005-2014, 2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + README [69:69] + +KEEP COPYRIGHT_SERVICE_LABEL b3c1a47d4a4b023c9e95eb264186e69a +BELONGS lib/ya.make + License text: + Copyright (C) 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/fcntl.c [3:3] + lib/fd-hook.c [2:3] + lib/fd-hook.h [2:2] + lib/gl_xlist.h [2:3] + lib/gl_xoset.h [2:3] + lib/pipe2.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL b6950a75fcf0e973a4b16458cc379aaa +BELONGS lib/ya.make + License text: + Copyright (C) 2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2003. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/xmalloca.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL b78d2fba2b832b27e3066a77aeceb44a +BELONGS lib/ya.make + License text: + Copyright (C) 2006-2013 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/platform/win64/fcntl.h [4:4] + lib/platform/win64/signal.h [4:4] + +KEEP COPYRIGHT_SERVICE_LABEL ba2add96cded3adb3a9fd060a9d7cc0e +BELONGS lib/ya.make + License text: + Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/filenamecat.h [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL bb055df14f87a9e8477c69bb1c41d405 +BELONGS lib/ya.make + License text: + Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/xalloc-die.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL bdcf2252dc018af2e5097df309e87c63 +BELONGS lib/ya.make + License text: + Copyright (C) 2006, 2011-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/clean-temp.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL c0163a2fe88e2703b1880e204238f2ec +BELONGS lib/ya.make + License text: + Copyright (C) 2005-2013 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/platform/win64/sys/stat.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL c1c53c72ba1cfea48ae40b9743690aca +BELONGS lib/ya.make + License text: + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/dirname-lgpl.c [3:4] + lib/dirname.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL c2b537cfaf2e75502027b9f7dd37c12f +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2002-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/vasnprintf.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL c63774738612c2a6d394fc87e885fb7c +BELONGS lib/ya.make + License text: + Copyright (C) 1990-1998, 2000-2007, 2009-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/error.c [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL c7c09f52633fc029bfc4bedec718e058 +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/printf-parse.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL ca8667a4b0d50e8656a98a8c87be9c94 +BELONGS lib/ya.make + License text: + /* Copyright (C) 1991, 1994-2002, 2005, 2008-2016 Free Software Foundation, + Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/strsignal.c [1:3] + +KEEP COPYRIGHT_SERVICE_LABEL cc21af37886638cc44d3c01346fa635e +BELONGS lib/ya.make + License text: + Copyright (C) 1999-2002, 2005-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2008. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/mbrtowc.c [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL ceaffa082023b9a1bad67b7806ce54b1 +BELONGS lib/ya.make + License text: + Copyright (C) 2011-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/msvc-inval.c [2:2] + lib/msvc-inval.h [2:2] + lib/msvc-nothrow.c [3:3] + lib/msvc-nothrow.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL cf8b5eb7be88c983ec362d16655c10e8 +BELONGS lib/ya.make + License text: + Copyright (C) 2001, 2003, 2006, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/stdio-safer.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL cfcfc487949e8475fa2756714ff4827a +BELONGS lib/ya.make + License text: + Copyright (C) 1999-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/version-etc.c [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL d00ba1bf4e95526accacbc7f64aeccc8 +BELONGS lib/ya.make + License text: + Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/platform/win64/sys/wait.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL d5cef0f26539e08357c2551d8b15875e +BELONGS lib/ya.make + License text: + Copyright (C) 2002-2004, 2006-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/xvasprintf.h [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL d75e399b570ee4aa6ff03850e9dfc4e7 +BELONGS lib/ya.make + License text: + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/basename-lgpl.c [3:4] + lib/basename.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL d9d8214ab92fb2f2e20d7e55a9af45f1 +BELONGS lib/ya.make + License text: + Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2016 Free Software + Foundation, Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/regex.h [3:5] + +KEEP COPYRIGHT_SERVICE_LABEL d9f5816f4a588316ca2f09360e3175f9 +BELONGS lib/ya.make + License text: + Copyright (C) 2001-2002, 2007, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/c-strcaseeq.h [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL df97657845f746f885a67c630a3b4b7d +BELONGS lib/ya.make + License text: + Copyright (C) 2007-2008, 2010-2021 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/stdio-impl.h [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL e298457ad046df8c39105db59c98ccf4 +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/printf-args.c [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL e449244634ffc918ab11e5bf4948f9d4 +BELONGS lib/ya.make + License text: + /* Copyright (C) 1999, 2001-2002, 2006, 2009-2016 Free Software Foundation, + Inc. + This file is part of the GNU C Library. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/tmpdir.c [1:3] + +KEEP COPYRIGHT_SERVICE_LABEL e4d70afe20f4ac0875388b0e72ec907a +BELONGS ya.make + License text: + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, + Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + src/input.c [3:4] + src/m4.c [3:4] + src/m4.h [3:4] + src/output.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL e7f93a91902c57106f9ae9fca5dad5e4 +BELONGS lib/ya.make + License text: + Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/fd-safer-flag.c [4:4] + lib/fd-safer.c [3:3] + lib/pipe-safer.c [2:2] + lib/pipe2-safer.c [2:2] + lib/stdio--.h [3:3] + lib/verify.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL e968e86436a1190f643c24d1ba2df9b4 +BELONGS lib/ya.make + License text: + Copyright (C) 1998-2002, 2004, 2006-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/close-stream.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL ea6c01c4be1d841ec0f77d04be1bae1e +BELONGS lib/ya.make + License text: + Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc. + Written by Bruno Haible <haible@clisp.cons.org>, 2001. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/execute.c [2:3] + lib/spawn-pipe.c [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL eb9847b9b3d1b9a2437be2833dcee73d +BELONGS ya.make + License text: + Copyright (C) 1989-1994, 2000, 2004, 2006-2014, 2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + src/builtin.c [3:4] + +KEEP COPYRIGHT_SERVICE_LABEL eb9b469c4d9d8f8ac344975f338e7769 +BELONGS lib/ya.make + License text: + Copyright (C) 2000-2006, 2008-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/localcharset.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL f4c2b7991b69502ea5084a3836cc3f74 +BELONGS lib/ya.make + License text: + /* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2016 + Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/memchr2.c [1:2] + +KEEP COPYRIGHT_SERVICE_LABEL f5cb65d965582d943744dcfbd9043de3 +BELONGS lib/ya.make + License text: + Copyright (C) 2002, 2004, 2006, 2008-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/c-stack.c [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL f7e3f488082a594ca29d0df624ce62b7 +BELONGS lib/ya.make + License text: + Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/mkstemp-safer.c [3:3] + lib/stdlib--.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL f95721e5fd5b346c98aaf8f423087ceb +BELONGS lib/ya.make + License text: + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software + Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/gettext.h [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL f975dd3f6b5561ccd9040eeeb11a5165 +BELONGS lib/ya.make + License text: + Copyright (C) 2003, 2008-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/xsize.h [3:3] + +KEEP COPYRIGHT_SERVICE_LABEL fc546066e5a39bbce394f359e85dbd6b +BELONGS lib/ya.make + License text: + Copyright (C) 1999, 2003, 2005, 2009-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/version-etc.h [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL fe6f4a2cadd39168e946fc1f97e42e56 +BELONGS ya.make + License text: + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + COPYING [4:6] + +KEEP COPYRIGHT_SERVICE_LABEL fe8ac3242674b9e52b8449d6f4cc5c96 +BELONGS lib/ya.make + License text: + Copyright (C) 2000-2003, 2006, 2008-2016 Free Software Foundation, Inc. + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + lib/c-ctype.h [8:8] diff --git a/contrib/tools/m4/.yandex_meta/devtools.licenses.report b/contrib/tools/m4/.yandex_meta/devtools.licenses.report new file mode 100644 index 0000000000..69d284571f --- /dev/null +++ b/contrib/tools/m4/.yandex_meta/devtools.licenses.report @@ -0,0 +1,464 @@ +# File format ($ symbol means the beginning of a line): +# +# $ # this message +# $ # ======================= +# $ # comments (all commentaries should starts with some number of spaces and # symbol) +# $ IGNORE_FILES {file1.ext1} {file2.ext2} - (optional) ignore listed files when generating license macro and credits +# $ RENAME {original license id} TO {new license id} # user comments - (optional) use {new license id} instead {original license id} in ya.make files +# $ # user comments +# $ +# ${action} {license id} {license text hash} +# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make +# ${all_file_action} filename +# $ # user commentaries (many lines) +# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) +# ${action} {license spdx} {license text hash} +# $BELONGS ./ya/make/file/relative/path/3/ya.make +# ${all_file_action} filename +# $ # user commentaries +# $ generated description +# $ ... +# +# You can modify action, all_file_action and add commentaries +# Available actions: +# keep - keep license in contrib and use in credits +# skip - skip license +# remove - remove all files with this license +# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file +# +# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) +# We suppose that that files can contain some license info +# Available all file actions: +# FILE_IGNORE - ignore file (do nothing) +# FILE_INCLUDE - include all file data into licenses text file +# ======================= +IGNORE_FILES ChangeLog-1998 ChangeLog-2012 NEWS + +KEEP GPL-3.0-or-later 1693b04c7e65f9c96100278355221b12 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/fpending.c [5:16] + lib/freadahead.c [4:15] + lib/stdio-impl.h [4:15] + +KEEP GPL-3.0-or-later 35d1da49e32346e7015e3afbe5b31200 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/c-ctype.h [10:21] + +KEEP GPL-3.0-or-later 3cd46c6a1211d1fc8d07f721f1554323 +BELONGS ya.make + License text: + source, you must update the license to be GPLv3 or later. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 16.00 + Match type : TAG + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + README [42:42] + +KEEP GPL-3.0-or-later 3f43560ef83ab8f3e18de24f216342f9 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/asnprintf.c [4:15] + lib/gettext.h [5:16] + lib/localcharset.c [5:16] + lib/localcharset.h [5:16] + lib/msvc-inval.c [4:15] + lib/msvc-inval.h [4:15] + lib/msvc-nothrow.c [5:16] + lib/msvc-nothrow.h [5:16] + lib/pipe2.c [4:15] + lib/printf-args.c [5:16] + lib/printf-args.h [5:16] + lib/printf-parse.c [4:15] + lib/printf-parse.h [5:16] + lib/vasnprintf.c [4:15] + lib/vasnprintf.h [4:15] + lib/vasprintf.c [4:15] + +KEEP GPL-3.0-or-later 4ae51eba59eabe09f95132c440dce661 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/obstack.c [5:17] + lib/obstack.h [5:17] + lib/regcomp.c [6:18] + lib/regex.c [6:18] + lib/regex.h [7:19] + lib/regex_internal.c [6:18] + lib/regex_internal.h [6:18] + lib/regexec.c [6:18] + +KEEP GPL-3.0-or-later 4c1501e84b9200d3a65db7c65c2a40eb +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/platform/win64/alloca.h [7:19] + +KEEP GPL-3.0-only 4fe869ee987a340198fb0d54c55c47f1 +BELONGS ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-only + Score : 100.00 + Match type : TEXT + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, http://www.gnu.org/licenses/gpl-3.0.html, https://spdx.org/licenses/GPL-3.0-only + Files with this license: + COPYING [1:674] + +KEEP GPL-3.0-or-later 5ba7dada0924de4a0806984d740f21db +BELONGS ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 98.99 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + src/builtin.c [8:19] + src/debug.c [8:19] + src/eval.c [8:19] + src/format.c [8:19] + src/freeze.c [8:19] + src/input.c [8:19] + src/m4.c [8:19] + src/m4.h [8:19] + src/macro.c [8:19] + src/output.c [8:19] + src/path.c [8:19] + src/symtab.c [8:19] + +KEEP GFDL-1.3-or-later 60919ca4d1580be02b2b016156c1e2a2 +BELONGS ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GFDL-1.3-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/fdl-1.3.txt, https://spdx.org/licenses/GFDL-1.3-or-later + Files with this license: + AUTHORS [38:43] + BACKLOG [55:60] + README [71:76] + THANKS [145:150] + TODO [43:48] + +KEEP GPL-3.0-or-later 659dd41b50d94dd686004e4d8e78c706 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/c-strcase.h [5:16] + lib/c-strcasecmp.c [4:15] + lib/c-strncasecmp.c [4:15] + lib/float+.h [5:16] + lib/gettimeofday.c [5:16] + lib/glthread/lock.c [4:15] + lib/glthread/lock.h [4:15] + lib/glthread/threadlib.c [4:15] + lib/malloca.c [5:16] + lib/malloca.h [5:16] + lib/minmax.h [5:16] + lib/pathmax.h [5:16] + lib/platform/win64/langinfo.h [5:16] + lib/platform/win64/sys/stat.h [5:16] + lib/platform/win64/sys/time.h [6:17] + lib/platform/win64/sys/wait.h [5:16] + lib/platform/win64/unistd.h [5:16] + lib/waitpid.c [4:15] + lib/xsize.h [5:16] + +KEEP GPL-3.0-or-later 7c229c32d3d54dacee032f7da11d3dc5 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/basename-lgpl.c [6:17] + lib/basename.c [6:17] + lib/binary-io.h [4:15] + lib/c-stack.c [5:16] + lib/c-stack.h [5:16] + lib/clean-temp.c [6:17] + lib/clean-temp.h [5:16] + lib/close-stream.c [5:16] + lib/close.c [4:15] + lib/closein.c [5:16] + lib/closein.h [5:16] + lib/closeout.c [6:17] + lib/closeout.h [6:17] + lib/dirname-lgpl.c [6:17] + lib/dirname.c [6:17] + lib/dup-safer-flag.c [6:17] + lib/dup-safer.c [5:16] + lib/dup2.c [5:16] + lib/error.c [5:16] + lib/error.h [6:17] + lib/execute.c [5:16] + lib/execute.h [5:16] + lib/exitfail.c [5:16] + lib/exitfail.h [5:16] + lib/fatal-signal.c [5:16] + lib/fatal-signal.h [5:16] + lib/fclose.c [4:15] + lib/fcntl.c [5:16] + lib/fcntl.h [6:17] + lib/fd-safer-flag.c [6:17] + lib/fd-safer.c [5:16] + lib/filenamecat-lgpl.c [5:16] + lib/filenamecat.c [5:16] + lib/filenamecat.h [6:17] + lib/fopen-safer.c [5:16] + lib/fpucw.h [5:16] + lib/freadahead.h [4:15] + lib/freading.h [4:15] + lib/getdtablesize.c [5:16] + lib/getopt.c [9:20] + lib/getopt1.c [6:17] + lib/getopt_int.h [6:17] + lib/getprogname.c [4:15] + lib/getprogname.h [4:15] + lib/gl_anyhash_list1.h [5:16] + lib/gl_anyhash_list2.h [5:16] + lib/gl_anylinked_list1.h [5:16] + lib/gl_anylinked_list2.h [5:16] + lib/gl_anytree_oset.h [5:16] + lib/gl_avltree_oset.c [5:16] + lib/gl_avltree_oset.h [5:16] + lib/gl_linkedhash_list.c [5:16] + lib/gl_linkedhash_list.h [5:16] + lib/gl_list.h [5:16] + lib/gl_oset.h [5:16] + lib/gl_xlist.h [5:16] + lib/gl_xoset.h [5:16] + lib/glthread/tls.c [4:15] + lib/glthread/tls.h [4:15] + lib/hard-locale.c [6:17] + lib/hard-locale.h [5:16] + lib/ignore-value.h [5:16] + lib/isnand-nolibm.h [4:15] + lib/isnanf-nolibm.h [4:15] + lib/isnanl-nolibm.h [4:15] + lib/localeconv.c [4:15] + lib/mbrtowc.c [5:16] + lib/memchr2.h [4:15] + lib/mkdtemp.c [5:16] + lib/mkstemp-safer.c [5:16] + lib/nl_langinfo.c [5:16] + lib/pipe-safer.c [4:15] + lib/pipe2-safer.c [4:15] + lib/platform/win64/fcntl.h [6:17] + lib/platform/win64/getopt.h [7:18] + lib/platform/win64/locale.h [5:16] + lib/platform/win64/sched.h [5:16] + lib/platform/win64/signal.h [6:17] + lib/platform/win64/spawn.h [6:17] + lib/printf-frexp.c [4:15] + lib/printf-frexp.h [4:15] + lib/printf-frexpl.c [4:15] + lib/printf-frexpl.h [4:15] + lib/progname.c [5:16] + lib/progname.h [5:16] + lib/quote.h [5:16] + lib/quotearg.c [5:16] + lib/quotearg.h [6:17] + lib/raise.c [5:16] + lib/sig-handler.h [5:16] + lib/sigaction.c [5:16] + lib/siglist.h [5:16] + lib/sigprocmask.c [5:16] + lib/spawn-pipe.c [5:16] + lib/spawn-pipe.h [5:16] + lib/stdio--.h [5:16] + lib/stdio-safer.h [5:16] + lib/stdlib--.h [5:16] + lib/stdlib-safer.h [5:16] + lib/stripslash.c [6:17] + lib/strsignal.c [5:16] + lib/tempname.c [5:16] + lib/tempname.h [5:16] + lib/tmpdir.c [5:16] + lib/tmpdir.h [4:15] + lib/unistd--.h [5:16] + lib/unistd-safer.h [5:16] + lib/unlocked-io.h [5:16] + lib/verify.h [5:16] + lib/verror.c [4:15] + lib/verror.h [4:15] + lib/version-etc-fsf.c [4:15] + lib/version-etc.c [4:15] + lib/version-etc.h [4:15] + lib/w32spawn.h [5:16] + lib/wait-process.c [5:16] + lib/wait-process.h [5:16] + lib/xalloc-die.c [6:17] + lib/xalloc-oversized.h [5:16] + lib/xalloc.h [5:16] + lib/xasprintf.c [5:16] + lib/xmalloc.c [5:16] + lib/xmalloca.c [5:16] + lib/xmalloca.h [5:16] + lib/xprintf.c [4:15] + lib/xprintf.h [4:15] + lib/xstrndup.c [5:16] + lib/xstrndup.h [5:16] + lib/xvasprintf.c [4:15] + lib/xvasprintf.h [4:15] + +KEEP LGPL-2.0-or-later 99de7539428539ca5bda44e3fc08a41c +BELONGS lib/ya.make +FILE_INCLUDE lib/filenamecat-lgpl.c found in files: lib/filenamecat.c at line 30 + License text: + /* Just like mfile_name_concat (filenamecat-lgpl.c), except, rather than + Scancode info: + Original SPDX id: LGPL-2.0-or-later + Score : 75.00 + Match type : REFERENCE + Links : http://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html, http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html, https://spdx.org/licenses/LGPL-2.0-or-later + Files with this license: + lib/filenamecat.c [30:30] + +KEEP GPL-3.0-or-later a1643cc46ca6d0af0b8502b175335376 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/intprops.h [5:16] + +KEEP GPL-3.0-or-later a6532c8141a6e70f23165e25c02c7e03 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/memchr2.c [11:22] + +KEEP GPL-3.0-or-later b8b08f6b7c2fc67e871e96840b7f67e8 +BELONGS ya.make +FILE_INCLUDE COPYING found in files: README at line 37 + License text: + See file `COPYING' for copying conditions. Note that M4 is distributed + under the GNU Public License version 3 or later. Some files in the + Scancode info: + Original SPDX id: GPL-2.0-or-later + Score : 14.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html, https://spdx.org/licenses/GPL-2.0-or-later + Files with this license: + README [37:38] + +KEEP GPL-3.0-or-later bd5912a561636d67d8f95a9e34cf5b04 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/c-strcaseeq.h [4:15] + lib/fd-hook.c [5:16] + lib/fd-hook.h [4:15] + lib/secure_getenv.c [5:16] + +KEEP GPL-3.0-or-later c3d8c615523b05d13b1f620348206d18 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/fseeko.c [4:15] + +KEEP GPL-3.0-or-later c43a3f8af41c78419310d68f52c2a0fd +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/version-etc.c [88:90] + +KEEP FSFAP d02cc4799cbd521d2aa8c3ff19e655f6 +BELONGS ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: FSFAP + Score : 100.00 + Match type : TEXT + Links : http://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html, https://spdx.org/licenses/FSFAP + Files with this license: + INSTALL [7:10] + +KEEP GPL-3.0-or-later d4567748e68738e056e4352a3e312182 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/cloexec.c [5:16] + lib/cloexec.h [5:16] + lib/dosname.h [5:16] + lib/fpending.h [6:17] + +KEEP GPL-3.0-or-later f35abb2e4128ba709bfba3bd5a3e7ce3 +BELONGS lib/ya.make + Note: matched license text is too long. Read it in the source files. + Scancode info: + Original SPDX id: GPL-3.0-or-later + Score : 100.00 + Match type : NOTICE + Links : http://www.gnu.org/licenses/gpl-3.0-standalone.html, https://spdx.org/licenses/GPL-3.0-or-later + Files with this license: + lib/dirname.h [6:17] diff --git a/contrib/tools/m4/.yandex_meta/licenses.list.txt b/contrib/tools/m4/.yandex_meta/licenses.list.txt index c0c24001ed..cf12905758 100644 --- a/contrib/tools/m4/.yandex_meta/licenses.list.txt +++ b/contrib/tools/m4/.yandex_meta/licenses.list.txt @@ -1,39 +1,1433 @@ ====================COPYRIGHT==================== - Copyright (C) 1989-1993, 2004, 2006-2013 Free Software Foundation, + Copyright (C) 1989-1993, 2004, 2006-2014, 2016 Free Software + Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 1989-1994, 2000, 2004, 2006-2014, 2016 Free Software + Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 1989-1994, 2003, 2006-2014, 2016 Free Software + Foundation, Inc. + + +====================COPYRIGHT==================== + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1989-1994, 2000, 2004, 2006-2013 Free Software + Copyright (C) 1989-1994, 2006-2007, 2009-2014, 2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1989-1994, 2003, 2006-2013 Free Software Foundation, + Copyright (C) 1989-1994, 2006-2014, 2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1989-1994, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1991-1994, 2004, 2006-2007, 2009-2014, 2016 Free + Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1989-1994, 2006-2007, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software +Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1989-1994, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. ====================COPYRIGHT==================== - Copyright (C) 1991-1994, 2004, 2006-2007, 2009-2013 Free Software - Foundation, Inc. +Copyright (C) 2000, 2005-2014, 2016 Free Software Foundation, Inc. + + +====================COPYRIGHT==================== +Copyright (C) 2000, 2006, 2009-2014, 2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2006-2013 Free Software Foundation, Inc. +Copyright (C) 2000, 2006-2007, 2009-2014, 2016 Free Software Foundation, +Inc. + + +====================COPYRIGHT==================== +Copyright (C) 2000, 2006-2014, 2016 Free Software Foundation, Inc. + + +====================FSFAP==================== + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + + +====================File: COPYING==================== + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + 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/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. + + +====================GFDL-1.3-or-later==================== +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. + +====================GPL-3.0-only==================== + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. ====================GPL-3.0-or-later==================== GNU M4 is free software: you can redistribute it and/or modify @@ -51,15 +1445,9 @@ ====================GPL-3.0-or-later==================== -## GNU M4 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. -## -## GNU M4 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/>. +See file `COPYING' for copying conditions. Note that M4 is distributed +under the GNU Public License version 3 or later. Some files in the + + +====================GPL-3.0-or-later==================== +source, you must update the license to be GPLv3 or later. diff --git a/contrib/tools/m4/.yandex_meta/override.nix b/contrib/tools/m4/.yandex_meta/override.nix new file mode 100644 index 0000000000..a1710c37d9 --- /dev/null +++ b/contrib/tools/m4/.yandex_meta/override.nix @@ -0,0 +1,8 @@ +pkgs: attrs: with pkgs; with attrs; rec { + version = "1.4.18"; + + src = fetchurl { + url = "mirror://gnu/m4/m4-${version}.tar.bz2"; + sha256 = "sha256-ZkDXawQ7xlgTnIkD4pPVl4MJvw9AgQcUZQXspwHmfPY="; + }; +} diff --git a/contrib/tools/m4/AUTHORS b/contrib/tools/m4/AUTHORS new file mode 100644 index 0000000000..44b959b721 --- /dev/null +++ b/contrib/tools/m4/AUTHORS @@ -0,0 +1,43 @@ +Authors of GNU M4. + +The following contributors have warranted legal paper exchanges with +the Free Software Foundation for their contributions to GNU M4. Also +see the files ChangeLog and THANKS. This list results from searching +for /\bM4\b/ in the file /gd/gnuorg/copyright.list on the +fencepost.gnu.org machine. + +Rene' Seindal seindal@diku.dk 1990-03-28 +James L. Avera jima@netcom.com 1993-10-04 +Pete Chown pete.chown@dale.dircon.co.uk 1994-06-28 +John Gerard Makecki johnm@vlibs.com 1995-04-24 +Francois Pinard pinard@iro.umontreal.ca 1996-02-01 +Thomas Tanner tanner@ffii.org 1999-06-23 +Gary V. Vaughan gary@gnu.org 2000-10-02 +Yuji Minejima ? 2001-05-09 +Akim Demaille akim@freefriends.org 2001-11-01 +Andrew James Bettison andrewb@zip.com.au 2001-11-19 +Noah Jeffrey Misch noah@cs.caltech.edu 2004-07-05 +Michael Elizabeth Chastain mec@shout.net 2001-12-27 +William C. Cox bill@qswtools.com 2004-12-04 +Alexandre Duret-Lutz adl@gnu.org 2004-12-04 +John Gatewood Ham zappaman@buraphalinux.org 2005-11-01 +Eric Benjamin Blake ebb9@byu.net 2006-01-18 +John Brzustowski jbrzusto@fastmail.fm 2006-03-06 +Ralf Wildenhues Ralf.Wildenhues@gmx.de 2006-03-20 +Markus Duft markus.duft@salomon.at 2006-08-03 +Joel E. Denny jdenny@clemson.edu 2009-08-18 +David Warme David.Warme@Group-W-Inc.com 2010-03-10 +Raphael Poss m4-patches@raphael.poss.name 2010-10-04 +Tim Rice tim@multitalents.net 2011-01-24 + +======================================================================== + +Copyright (C) 2000, 2006-2007, 2009-2014, 2016 Free Software Foundation, +Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. diff --git a/contrib/tools/m4/BACKLOG b/contrib/tools/m4/BACKLOG new file mode 100644 index 0000000000..eeb59e2186 --- /dev/null +++ b/contrib/tools/m4/BACKLOG @@ -0,0 +1,60 @@ +# Summary of pending email for GNU m4 1.4. +# Last updated: Saturday, November 05, 1994. + +rmail/announce + 1. 15 Sep 94 <pinard@IRO.UMontreal.CA> Release: GNU m4 1.3 + 2. 29 Oct 94 <pinard@IRO.UMontreal.CA> Prerelease: GNU m4 1.3.1 + +rmail/changeword + 1. 02 Sep 94 <pinard> Re: Prerelease: GNU m4 1.2.3 + 2. 05 Sep 94 <Pete.Chown@dale.dircon.co.uk> Re: Prerelease: GNU m4 1.2.3 + +rmail/configuration + 1. 03 Nov 94 <Fredrik_Lundh@ivab.se> Re: m4 1.3 on DEC OSF/1 3.0 + 2. 05 Nov 94 <pinard> Re: m4 1.3 on DEC OSF/1 3.0 + +rmail/documentation + 1. 05 Jun 92 <berstel@mipsmath.math.uqam.ca> Re: M4 + 2. 10 Nov 92 <tchrist@convex.COM> Re: Is anyone using m4? + 3. 25 May 94 <schwab@issan.informatik.uni-dortmund.de> Autoconf 1.11: minor bu + 4. 27 Jul 94 <pinard@IRO.UMontreal.CA> Re: 0.95: Spacing details + 5. 28 Jul 94 <pinard@IRO.UMontreal.CA> Re: 0.95: Spacing details + 6. 31 Aug 94 <kb@cs.umb.edu> Re: Frozen file documentation to proofread + +rmail/floating-point + 1. 27 Oct 94 <johnm@vlibs.com> Re: enhancement to m4 eval() + 2. 25 Oct 94 <johnm@vlibs.com> enhancement to m4 + 3. 27 Oct 94 <pinard> Re: enhancement to m4 + 4. 27 Oct 94 <johnm@vlibs.com> Re: enhancement to m4 eval() + 5. 27 Oct 94 <pinard> Re: enhancement to m4 eval() + 6. 27 Oct 94 <johnm@vlibs.com> Re: enhancement to m4 eval() + 7. 28 Oct 94 <pinard> Re: enhancement to m4 eval() + 8. 28 Oct 94 <pinard> Re: enhancement to m4 eval() + 9. 28 Oct 94 <feeley@IRO.UMontreal.CA> Re: enhancement to m4 eval() +10. 28 Oct 94 <pinard> Re: enhancement to m4 eval() +11. 28 Oct 94 <johnm@vlibs.com> Re: enhancement to m4 eval() +12. 28 Oct 94 <johnm@vlibs.com> Re: enhancement to m4 eval() +13. 28 Oct 94 <pinard@IRO.UMontreal.CA> Re: enhancement to m4 eval() + +rmail/format-rewrite + 1. 25 Jun 94 <tmcconne@sedona.intel.com> Re: Prerelease: GNU m4 1.1.3 + +rmail/named-formals + 1. 30 Sep 94 <djm@va.pubnix.com> m4 macros with named formal parameters + +rmail/purify + 1. 06 Dec 93 <vern@horse.ee.lbl.gov> m4 1.1.1 "make realclean" + +rmail/speed + 1. 29 Aug 94 <pinard> Re: diversions and freezing + 2. 05 Sep 94 <djm@va.pubnix.com> slowness + 3. 04 Oct 94 <pinard> Autoconf, m4, and dnl's. + +Copyright (C) 2000, 2006, 2009-2014, 2016 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. diff --git a/contrib/tools/m4/COPYING b/contrib/tools/m4/COPYING new file mode 100644 index 0000000000..94a9ed024d --- /dev/null +++ b/contrib/tools/m4/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/contrib/tools/m4/INSTALL b/contrib/tools/m4/INSTALL new file mode 100644 index 0000000000..8865734f81 --- /dev/null +++ b/contrib/tools/m4/INSTALL @@ -0,0 +1,368 @@ +Installation Instructions +************************* + + Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software +Foundation, Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell command './configure && make && make install' +should configure, build, and install this package. The following +more-detailed instructions are generic; see the 'README' file for +instructions specific to this package. Some packages provide this +'INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The 'configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a 'Makefile' in each directory of the package. +It may also create one or more '.h' files containing system-dependent +definitions. Finally, it creates a shell script 'config.status' that +you can run in the future to recreate the current configuration, and a +file 'config.log' containing compiler output (useful mainly for +debugging 'configure'). + + It can also use an optional file (typically called 'config.cache' and +enabled with '--cache-file=config.cache' or simply '-C') that saves the +results of its tests to speed up reconfiguring. Caching is disabled by +default to prevent problems with accidental use of stale cache files. + + If you need to do unusual things to compile the package, please try +to figure out how 'configure' could check whether to do them, and mail +diffs or instructions to the address given in the 'README' so they can +be considered for the next release. If you are using the cache, and at +some point 'config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file 'configure.ac' (or 'configure.in') is used to create +'configure' by a program called 'autoconf'. You need 'configure.ac' if +you want to change it or regenerate 'configure' using a newer version of +'autoconf'. + + The simplest way to compile this package is: + + 1. 'cd' to the directory containing the package's source code and type + './configure' to configure the package for your system. + + Running 'configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type 'make' to compile the package. + + 3. Optionally, type 'make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type 'make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the 'make install' phase executed with root + privileges. + + 5. Optionally, type 'make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior 'make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing 'make clean'. To also remove the + files that 'configure' created (so you can compile the package for + a different kind of computer), type 'make distclean'. There is + also a 'make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type 'make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide 'make + distcheck', which can by used by developers to test that all other + targets like 'make install' and 'make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the 'configure' script does not know about. Run './configure --help' +for details on some of the pertinent environment variables. + + You can give 'configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here is +an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU 'make'. 'cd' to the +directory where you want the object files and executables to go and run +the 'configure' script. 'configure' automatically checks for the source +code in the directory that 'configure' is in and in '..'. This is known +as a "VPATH" build. + + With a non-GNU 'make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use 'make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple '-arch' options to the +compiler but only a single '-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the 'lipo' tool if you have problems. + +Installation Names +================== + + By default, 'make install' installs the package's commands under +'/usr/local/bin', include files under '/usr/local/include', etc. You +can specify an installation prefix other than '/usr/local' by giving +'configure' the option '--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option '--exec-prefix=PREFIX' to 'configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like '--bindir=DIR' to specify different values for particular +kinds of files. Run 'configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the default +for these options is expressed in terms of '${prefix}', so that +specifying just '--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to 'configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +'make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, 'make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +'${prefix}'. Any directories that were specified during 'configure', +but not in terms of '${prefix}', must each be overridden at install time +for the entire installation to be relocated. The approach of makefile +variable overrides for each directory variable is required by the GNU +Coding Standards, and ideally causes no recompilation. However, some +platforms have known limitations with the semantics of shared libraries +that end up requiring recompilation when using this method, particularly +noticeable in packages that use GNU Libtool. + + The second method involves providing the 'DESTDIR' variable. For +example, 'make install DESTDIR=/alternate/directory' will prepend +'/alternate/directory' before all installation names. The approach of +'DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of '${prefix}' +at 'configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving 'configure' the +option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. + + Some packages pay attention to '--enable-FEATURE' options to +'configure', where FEATURE indicates an optional part of the package. +They may also pay attention to '--with-PACKAGE' options, where PACKAGE +is something like 'gnu-as' or 'x' (for the X Window System). The +'README' should mention any '--enable-' and '--with-' options that the +package recognizes. + + For packages that use the X Window System, 'configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the 'configure' options '--x-includes=DIR' and +'--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of 'make' will be. For these packages, running './configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with 'make V=1'; while running './configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with 'make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC +is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX 'make' updates targets which have the same time stamps as their +prerequisites, which makes it generally unusable when shipped generated +files such as 'configure' are involved. Use GNU 'make' instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its '<wchar.h>' header file. The option '-nodtk' can be used as a +workaround. If GNU CC is not installed, it is therefore recommended to +try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put '/usr/ucb' early in your 'PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in '/usr/bin'. So, if you need '/usr/ucb' +in your 'PATH', put it _after_ '/usr/bin'. + + On Haiku, software installed for all users goes in '/boot/common', +not '/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features 'configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, 'configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +'--build=TYPE' option. TYPE can either be a short name for the system +type, such as 'sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file 'config.sub' for the possible values of each field. If +'config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option '--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with '--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for 'configure' scripts to share, +you can create a site shell script called 'config.site' that gives +default values for variables like 'CC', 'cache_file', and 'prefix'. +'configure' looks for 'PREFIX/share/config.site' if it exists, then +'PREFIX/etc/config.site' if it exists. Or, you can set the +'CONFIG_SITE' environment variable to the location of the site script. +A warning: not all 'configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to 'configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the 'configure' command line, using 'VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified 'gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an +Autoconf limitation. Until the limitation is lifted, you can use this +workaround: + + CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash + +'configure' Invocation +====================== + + 'configure' recognizes the following options to control how it +operates. + +'--help' +'-h' + Print a summary of all of the options to 'configure', and exit. + +'--help=short' +'--help=recursive' + Print a summary of the options unique to this package's + 'configure', and exit. The 'short' variant lists options used only + in the top level, while the 'recursive' variant lists options also + present in any nested packages. + +'--version' +'-V' + Print the version of Autoconf used to generate the 'configure' + script, and exit. + +'--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally 'config.cache'. FILE defaults to '/dev/null' to + disable caching. + +'--config-cache' +'-C' + Alias for '--cache-file=config.cache'. + +'--quiet' +'--silent' +'-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to '/dev/null' (any error + messages will still be shown). + +'--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + 'configure' can determine that directory automatically. + +'--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: for + more details, including other options available for fine-tuning the + installation locations. + +'--no-create' +'-n' + Run the configure checks, but stop before creating any output + files. + +'configure' also accepts some other, not widely useful, options. Run +'configure --help' for more details. diff --git a/contrib/tools/m4/NEWS b/contrib/tools/m4/NEWS new file mode 100644 index 0000000000..356b6bcfab --- /dev/null +++ b/contrib/tools/m4/NEWS @@ -0,0 +1,731 @@ +GNU M4 NEWS - User visible changes. + +* Noteworthy changes in release 1.4.18 (2016-12-31) [stable] + +** Diagnose --word-regexp as unsupported if it was not configured. + +** Preliminary support for OS/2. + +** A number of portability improvements inherited from gnulib. + + +* Noteworthy changes in release 1.4.17 (2013-09-22) [stable] + +** Fix compilation with newer glibc headers. + +** Fix a failure with diverting large amounts of text on mingw (does + not affect platforms that can rename an open file). + +** A number of portability improvements inherited from gnulib. + + +* Noteworthy changes in release 1.4.16 (2011-03-01) [stable] + +** Fix regressions in the `index' builtin. On glibc platforms, this + avoids false positives from a strstr bug in glibc 2.9 through 2.12; + on many other platforms, it fixes two separate regressions, a false + positive introduced in 1.4.11 and a false negative in 1.4.15. + +** A number of portability improvements inherited from gnulib. + + +* Noteworthy changes in release 1.4.15 (2010-08-31) [stable] + +** Fix regression introduced in 1.4.9b where the `format' builtin could + crash on an invalid format string. + +** Fix compilation against newer glibc, and on AIX 7.1BETA. + +** A number of portability improvements inherited from gnulib. + + +* Noteworthy changes in Version 1.4.14 (2010-02-24) [stable] + Released by Eric Blake, based on git version 1.4.13.* + +** Fix regression introduced in 1.4.12 where executing with stdout closed + could crash m4 on exit on some platforms. + +** Fix regressions introduced in 1.4.13 in the `esyscmd' builtin, where + closed file descriptors could interfere with child execution, and where + a child status of 127 made m4 print a spurious message to stderr. + +** Fix a security hole in 'make dist', present since at least M4 1.4, that + could affect anybody attempting to redistribute modified sources (see + Automake CVE-2009-4029). + +** A number of portability improvements inherited from gnulib. + +* Noteworthy changes in Version 1.4.13 (2009-04-01) [stable] + Released by Eric Blake, based on git version 1.4.12.* + +** The manual is now distributed under the terms of FDL 1.3. + +** The `divert' and `undivert' builtins have been made more efficient + when using temporary files for large diversions. + +** The `translit' builtin has been made more efficient when the second + argument is short. + +** The input engine has been optimized for faster processing. + +** The command line option `--debugfile', introduced in 1.4.7, now + treats its argument as optional, in order to allow setting the debug + output back to stderr when used without an argument; and order is now + significant with respect to command line files. You must therefore use + `m4 --debugfile=trace file', not `m4 file --debugfile trace'. This + change does not affect the deprecated `-o'/`--error-output' option. + +** The `syscmd' and `esyscmd' builtins can be configured to use an + alternate shell, via the new `configure' option `--with-syscmd-shell'. + +** A number of portability improvements inherited from gnulib. + +* Noteworthy changes in Version 1.4.12 (2008-10-10) [stable] + Released by Eric Blake, based on git version 1.4.11.* + +** Fix regression introduced in 1.4.4b where using `traceon' could delete + a macro. This was most noticeable with `traceon(`traceon')', but + would also happen in cases such as `foo(traceon(`foo'))'. + +** Fix regression introduced in 1.4.7 where `m4 -N9' died with an assertion + failure. + +** Fix regression introduced in 1.4.11 where `defn' died with an assertion + failure on a traced but undefined macro. + +** New `-g'/`--gnu' command-line option overrides `-G'/`--traditional'. + For now, the environment variable POSIXLY_CORRECT has no effect on M4 + behavior; but a future release of M4 will behave as though --traditional + is implied if POSIXLY_CORRECT is set (this future change is necessary, + because in the current release, there is no way to disable GNU + extensions that conflict with POSIX without the use of a non-POSIX + command-line argument). Clients of M4 that want to use GNU extensions, + even when POSIXLY_CORRECT is set, should start using the -g command-line + argument, even though it is currently a no-op if -G did not appear + earlier in the command line, so that the client will not break in the + face of an upgraded m4 and a POSIXLY_CORRECT execution environment. + +** The `-L'/`--nesting-limit' command-line option now defaults to 0 for + unlimited on platforms that can detect and deal with stack overflow. On + systems that lack alternate stack support, such as Cygwin, and on + systems that do not obey the POSIX semantics for distinguishing stack + overflow from other exceptions, such as Linux, you can optionally + install the libsigsegv library (version 2.6 or newer recommended) to + enhance m4's ability to accurately report stack overflow: + http://www.gnu.org/software/libsigsegv/ + +** A number of portability improvements inherited from gnulib. + +* Noteworthy changes in Version 1.4.11 (2008-04-02) [stable] + Released by Eric Blake, based on git version 1.4.10a + +** Security fixes for the -F option, for bugs present since -F was + introduced in 1.3: Avoid core dump with 'm4 -F file -t undefined', and + avoid arbitrary code execution with certain file names. + +** Fix regression introduced in 1.4.9b in the `divert' builtin when more + than 512 kibibytes are saved in diversions on platforms like NetBSD + or darwin where fopen(name,"a+") seeks to the end of the file. + +** The output of the `maketemp' and `mkstemp' builtins is now quoted if a + file was created. This is a minor security fix, because it was possible + (although rather unlikely) that an unquoted string could match an + existing macro name, such that use of the `mkstemp' output would trigger + inadvertent macro expansion and operate on the wrong file name. + +** Enhance the `defn' builtin to support concatenation of multiple text + arguments, as required by POSIX. However, at this time, it is not + possible to concatenate a builtin macro with anything else; a warning is + now issued if this is attempted, although a future version of M4 may + lift this restriction to match other implementations. + +** Enhance the `format' builtin to parse all C99 floating point numbers, + even on platforms where strtod(3) is buggy, although the replacement + function does have the known issue of rounding errors when parsing + some decimal floating point values. This fixes testsuite failures + introduced in 1.4.9b. + +** Enhance the `index' builtin to guarantee linear behavior, in spite of + the surprisingly large number of systems with a brain-dead quadratic + strstr(3). + +** A number of portability improvements inherited from gnulib. + +* Noteworthy changes in Version 1.4.10 (2007-07-09) [stable] + Released by Eric Blake, based on CVS version 1.4.9c + +** Upgrade from GPL version 2 to GPL version 3 or later. + +** A number of portability improvements inherited from gnulib. + +** Avoid undefined behavior introduced in 1.4.9b in the `format' builtin + when handling %c. However, this area of code has never been documented, + and currently does not match the POSIX behavior of printf(1), so it may + have further changes in the next version. + +* Noteworthy changes in Version 1.4.9b (2007-05-29) [beta] + Released by Eric Blake, based on CVS version 1.4.9a + +** Fix regression introduced in 1.4.9 in the `eval' builtin when performing + division. + +** Fix regression introduced in 1.4.8 in the `-F' option that made it + impossible to freeze more than 512 kibibytes of diverted text. + +** The synclines option `-s' no longer generates sync lines in the middle of + multiline comments or quoted strings. + +** Work around a number of corner-case POSIX compliance bugs in various + broken stdio libraries. In particular, the `syscmd' builtin behaves + more predictably when stdin is seekable. + +** The `format' builtin now understands formats such as %a, %A, and %'hhd, + and works around a number of platform printf bugs. Furthermore, the + sequence format(%*.*d,-1,-1,1) no longer outputs random data. However, + some non-compliant platforms such as mingw still have known bugs in + strtod that may cause testsuite failures. + +** The testsuite is improved to also run gnulib portability tests for the + features that M4 imports from gnulib. + +* Noteworthy changes in Version 1.4.9 (2007-03-23) [stable] + Released by Eric Blake, based on CVS version 1.4.8c + +** Minor documentation and portability cleanups. + +* Noteworthy changes in Version 1.4.8b (2007-02-24) [beta] + Released by Eric Blake, based on CVS version 1.4.8a + +** Fix a regression introduced in 1.4.8 that made m4 unable to process + files larger than 2GiB on some platforms. + +** Fix a regression introduced in 1.4.8 that made m4 dump core when + invoked as 'm4 -- file'. + +** The `eval' builtin now follows C precedence rules. Additionally, the + short-circuit operators correctly short-circuit division by zero. The + previously undocumented alias of '=' meaning '==' in eval now triggers a + deprecation warning, so that a future version of M4 can implement a form + of variable assignment as an extension. + +** The `include' builtin now affects exit status on failure, as required by + POSIX. Use `sinclude' if you need a successful exit status. + +** The `-E'/`--fatal-warnings' command-line option now has two levels. When + specified only once, warnings affect exit status, but execution + continues, so that you can see all warnings instead of fixing them one + at a time. To achieve 1.4.8 behavior, where the first warning + immediately exits, specify -E twice on the command line. + +** A new `--warn-macro-sequence' command-line option allows detection of + sequences in `define' and `pushdef' definitions that match an optional + regular expression. The default regular expression is + `\$\({[^}]*}\|[0-9][0-9]+\)', corresponding to the sequences that might + not behave correctly when upgrading to the eventual M4 2.0. By default, + M4 2.0 will follow the POSIX requirement that a macro definition + containing `$11' must expand to the first argument concatenated with 1, + rather than the eleventh argument; and will take advantage of the POSIX + wording that allows implementations to treat `${11}' as the eleventh + argument instead of literal text. Be aware that Autoconf 2.61 will not + work with this option enabled with the default regular expression; but + Autoconf 2.62 will be compatible with this option. + +** Improved portability to platforms such as BSD/OS and AIX. + +* Noteworthy changes in Version 1.4.8 (2006-11-20) [stable] + Released by Eric Blake, based on CVS version 1.4.7a + +** The `divert' macro and `-H'/`--hashsize' command line option no longer + cause a core dump when handed extra large values. Also, `divert' now + uses memory proportional to the number of diversions in use, rather than + to the maximum diversion number encountered, so that large diversion + numbers are less likely to exhaust system memory; and is no longer + limited by the maximum number of file descriptors. + +** The `--help' and `--version' command line options now consistently + override all earlier options. For example, `m4 --debugfile=trace + --help' now no longer accidentally creates an empty file `trace'. + +** The `-L'/`--nesting-limit' command line option can now be set to 0 + to remove the default limit of 1024. However, it is still possible that + heavily nested input can cause abrupt program termination due to stack + overflow. + +** Problems encountered when writing to standard error, such as with the + `errprint' macro, now always cause a non-zero exit status. + +** Warnings and errors issued during macro expansion are now consistently + reported at the line where the macro name was detected, rather than + where the close parenthesis resides. Text wrapped by `m4wrap' now + remembers the location that was in effect when m4wrap was invoked, + rather than changing to line 0 and the empty string for a file. The + macros `__line__' and `__file__' now work correctly even as the last + token in an included file. + +** The `builtin' and `indir' macros now transparently handle builtin + tokens generated by `defn'. + +** When diversions created by the `divert' macro collect enough text that + M4 must use temporary files, the environment variable $TMPDIR is now + consulted, and a better effort is made to clean up those files in the + event of a fatal signal. + +** The `mkstemp' builtin is added with the same GNU semantics as `maketemp', + based on the recommendation of POSIX to deprecate the POSIX semantics of + `maketemp' as inherently insecure. In GNU mode (no -G supplied on the + command line), `maketemp' silently retains the secure GNU semantics, but + a future release of M4 will change this to emit a warning. In + traditional mode (m4 -G), `maketemp' now uses the POSIX-mandated + insecure semantics, and issues a warning that you should convert your + script to use `mkstemp' instead. Additionally, `mkstemp' and `maketemp' + are now well-defined even if the template argument does not end in six + `X' characters. + +** The manual has been improved, including a new section on a composite + macro `foreach'. + +** The `changecom' and `changequote' macros now treat an empty second + argument the same as if it were missing, rather than using the empty + string and making it impossible to end a comment or quote. + +** The `translit' macro now operates in linear instead of quadratic time, + and is now eight-bit clean. + +** The `-D', `-U', `-s', and `-t' command line options now take effect + after any files encountered earlier on the command line, rather than up + front, as is done in traditional implementations and required by POSIX. + +* Noteworthy changes in Version 1.4.7 (2006-09-25) [stable] + Released by Eric Blake, based on CVS version 1.4.6a + +** Fix regression from 1.4.5 in handling a file that ends in a macro + expansion without arguments instead of a newline. + +** The define and pushdef macros now warn when the first argument is not + a string, rather than silently doing nothing. + +** Standard input can now be read more than once, as in 'm4 - file -', and + is not closed until all wrapped text is handled. This makes a + difference when stdin is not a regular file, and also fixes bugs when + using the syscmd or esyscmd macros from wrapped text. + +** When standard input is a seekable file, the m4exit, syscmd, and esyscmd + macros now restore the current position to the next unread byte rather + than discarding an arbitrary amount of buffered data. + +** SysV command-line compatibility is no longer a goal of GNU M4; the + focus will be instead on POSIX compatibility. This release continues to + support previous usage, but adds warnings in areas which will allow a + future version of GNU M4 to use its own extensions without being tied to + the SysV command line interface. + +** The no-op compatibility command line options -B, -N, -S, -T, and + --diversions may be withdrawn or assigned new meanings in future + releases, so they now issue a warning if used. + +** A new command line option -i replaces the compatibility -e as the + short spelling of --interactive, for consistency with other GNU tools; a + warning is issued if the old spelling is used, and it may be assigned + new meaning in future releases. + +** A new command line option --debugfile replaces the options -o and + --error-output as the preferred spelling. The old options were + misleading in their names and inconsistent with other GNU tools; they + are still silently accepted, but no longer documented in --help, and may + be assigned new meanings in future releases. + +* Noteworthy changes in Version 1.4.6 (2006-08-25) [stable] + Released by Eric Blake, based on CVS version 1.4.5a + +** Fix buffer overruns in regexp and patsubst macros when handed a trailing + backslash in the replacement text, or when handling \n substitutions + beyond the number of \(\) groups. + +** Fix memory leak in regexp, patsubst, and changeword macros. + +** The format macro now understands %F, %g, and %G. + +** When loading frozen files, m4 now exits with status 63 if version + mismatch is detected. + +** Fix bugs that occurred when invoked with stdout or stderr closed, + and detect write failures to stdout or to the target of the debugfile + macro. In particular, the syscmd and esyscmd macros can no longer + interfere with the debug stream or diversions. + +** The m4exit macro now converts values outside the range 0-255 to 1. + +** It is now an error if a command-line input file ends in the middle of a + comment, matching the behavior of mid-string and mid-argument + collection. + +** The dnl macro now warns if end of file is encountered instead of a + newline. + +** The error message when end of file is encountered now uses the file and + line where the dangling construct started, rather than `NONE:0:'. + +** The debugmode and __file__ macros, and the -s/--synclines option, now + show what directory a file was found in when the -I/--include option or + M4PATH variable had an effect. + +** The changequote and changecom macros now work with 8-bit characters, and + quotes and comments that begin with `(' are properly recognized + following a word. + +** The new macro __program__ is added, which allows the input file to issue + an error message that resembles messages from m4. Warning and error + messages have been reformatted to comply with GNU Coding Standards. + +** The errprint, m4wrap, and shift macros are now recognized only with + arguments. + +** The index, substr, translit, regexp, and patsubst macros now produce + output when given only one argument, but still warn about a missing + second argument. + +** The patsubst macro now reliably finds zero-length matches at the end + of a string. + +* Noteworthy changes in Version 1.4.5 (2006-07-15) [stable] + Released by Eric Blake, based on CVS version 1.4.4c + +** Fix sysval on BeOS, OS/2, and other systems that store exit status + in the low-order byte. Additionally, on Unix platforms, if syscmd was + terminated by a signal, sysval now displays the signal number shifted + left by eight bits, to match traditional m4 implementations. + +** The maketemp macro is no longer subject to platform limitations (such as + 26 or 32 max files from a given template). + +** Frozen files now require that the first directive be V (version), to + better diagnose version mismatch. Additionally, if the F directive + (builtin function) names an unknown builtin that existed in the m4 that + froze the file but not in the current m4 (for example, changeword), the + warning is deferred until an attempt is made to actually use the + builtin. This allows downgrading from beta m4-1.4o to stable m4-1.4.5 + without breaking autoconf. + +** The format and indir macros are now recognized only with arguments. + +** The eval macro no longer crashes on x86 architectures when dividing the + minimum integer by -1. + +** On systems with ecvt and fcvt, format no longer truncates trailing + zeroes on integers printed with %.0f. On systems without these + functions, format is no longer subject to a buffer overflow that + permitted arbitrary code execution. + +** On native Windows builds, the macro __windows__ is provided instead of + __unix__. Likewise, on OS/2 builds, the macro __os2__ is provided. + This allows input files to determine when syscmd might behave + differently. + +** Fix bug in 1.4.3 patch to use \n line-endings that did not work for + cygwin. + +** When given the empty string or 0, undivert is now documented as a no-op + rather than closing stdout, warning about a non-existent file, or trying + to read a directory as a file. + +** Many documentation improvements. Also, the manual is now distributed + under FDL 1.2, rather than a stricter verbatim-only license. + +** Raise the -L (--nesting-limit) command line option limit from 250 to + 1024. + +** The decr, incr, divert, m4exit, and substr macros treat an empty number + as 0, issue a warning, and expand as normal; rather than issuing an + error and expanding to the empty string. + +** The eval macro now treats an empty radix argument as 10, handles radix 1, + and treats the width argument as number of digits excluding the sign, + for compatibility with other m4 implementations. + +** The ifdef, divert, m4exit, substr, and translit macros now correctly + ignore extra arguments. + +** The popdef and undefine macros now correctly accept multiple arguments. + +** Although changeword is on its last leg, if enabled, it now reverts to the + default (faster) regexp when passed the empty string. + +** The regexp and substr macros now warn and ignore a trailing backslash in + the replacement, and warn on \n for n larger than the number of + sub-expressions in the regexp. + +* Noteworthy changes in Version 1.4.4b (2006-06-17) [beta] + Released by Eric Blake, based on CVS version 1.4.4a + +** Fix a recursive push_string crashing bug, which affected changequote of + three or more characters on some compilers. + +** Use automake to fix build portability issues. + +** Fix a recursive m4wrap crashing bug. + +** Fix a 1 in 2**32 hash crashing bug. + +** Tracing a macro by name is now persistent, even if the macro is + subsequently undefined or redefined. The traceon and traceoff macros no + longer warn about undefined symbols. This solves a crash when using + indir on an undefined macro traced with the -t option, as well as an + incorrect result of ifdef. Furthermore, tracing is no longer + transferred with builtins, solving the bug of "m4 -tm4_eval" failing to + give trace output on the input + "define(`m4_eval',defn(`eval'))m4_eval(1)". + +** Fix a crash when a macro is undefined while collecting its arguments, by + always using the definition that was in effect before argument + collection. This behavior matches the C pre-processor, and means that + the sequence "define(`f',`1')f(define(`f',`2'))f" is now documented to + result in "12", rather than the previously undocumented "22". + +** Update the regex engine to fix several bugs. + +** Fix a potential crash on machines where char is signed. + +* Noteworthy changes in Version 1.4.4 (Oct 2005) [stable] + Released by Gary V. Vaughan + +** ./configure --infodir=/usr/share/info now works correctly. + +** When any file named on the command line is missing exit with status 1. + +* Noteworthy changes in Version 1.4.3 (Mar 2005) [stable] + Released by Gary V. Vaughan + +** DESTDIR installs now work correctly. + +** Don't segfault with uncompilable regexps to changeword(). + +** Always use \n line-endings for frozen files (fixes a Windows bug). + +** Portability fix for systems lacking mkstemp(3). + +** Approximately 20% speed up in the common case of usage with autoconf. + +** Supported on QNX 6.3. + +* Noteworthy changes in Version 1.4.2 (Aug 2004) [stable] + Released by Paul Eggert + +** No user visible changes; portability bug fixes only. + +* Noteworthy changes in Version 1.4.1 (Jun 2004) [stable] + Released by Paul Eggert + +** maketemp now creates an empty file with the given name, instead of merely + returning the name of a nonexistent file. This closes a security hole. + +* Noteworthy changes in Version 1.4 (Oct 1994) [stable] + Released by Franc,ois Pinard + +** (No user visible changes) + + +Version 1.3 - September 1994, by Franc,ois Pinard + +* Diversions are created as needed. Option `-N' is still accepted, but +otherwise ignored. Users should use only negative diversion numbers, +instead of high positive numbers, for diverting to nowhere. + +* Diversions should also work faster. No temporary files will be needed +at all if all diversions taken altogether do not use more than 512K. + +* Frozen state files may be produced with the `--freeze-state' (-F) +option and later brought back through the `--reload-state' (-R) option. + +Version 1.2 - July 1994, by Franc,ois Pinard + +* In patsubst(STRING, REGEXP, REPLACEMENT), \& in REPLACEMENT has been +changed to represent this part of STRING matched by the whole REGEXP, +instead of the whole STRING as before. \0 does the same, but emits a +diagnostic saying it will disappear in some subsequent release. + +* eval(EXPR) emits a diagnostic if EXPR has suffixed crumb. The same for +other numeric conversions in incr(), decr(), divert(), etc. + +* `--fatal-warnings' (-E) stops execution at first warning. + +* `--nesting-limit=LEVEL' (-L LEVEL) sets a limit to macro nesting. +It is initially fixed at 250. + +* `--word-regexp=REGEXP' (-W REGEXP) modifies macro name syntax, like +does the new `changeword(REGEXP)' macro. This feature is experimental, +tell me your opinions about it. You do need --enable-changeword at +configure time to get these things. Do *not* depend on them yet. + +* Trace output format is scannable by GNU Emacs' next-error function. + +* Stack overflow is detected and diagnosed on some capable systems. + +* Various bugs have been corrected, m4 should be more portable. See the +ChangeLog for details. + +Version 1.1 - November 1993, by Franc,ois Pinard + +Changes which might affect existing GNU m4 scripts: + +* Option `-V' has been removed, use `--version' instead. `--version' +writes on standard output instead of standard error, and inhibits any +script execution. + +* `--no-gnu-extensions' has been renamed `--traditional'. + +* In `eval', `^' used to indicate exponentiation, use `**' instead. + +* The automatic undiversion which takes place at end of all input is +forced into the main output stream. + +Changes which are unlikely to affect existing scripts: + +* `--help' prints an usage summary on standard output. Script execution +is then inhibited. + +* `--prefix-builtins' (-P) prefixes all builtin macros by `m4_'. + +* Most builtin macros for which arguments are mandatory, called without +any arguments, are no more recognized as builtin macros: they are +consequently copied verbatim to the output stream. + +* `define' and `pushdef' are usable with only one argument, they give +this argument an empty definition. + +* `eval' new operators for binary representation handling: `^' for +exclusive-or, `~' for the bitwise negation, `<<' and `>>' for shifts. + +* `eval' recognizes the notation 0bDIGITS for binary numbers and the +notation 0rRADIX:DIGITS for numbers in any radix from 1 to 36. + +Version 1.0.3 - December 1992, by Franc,ois Pinard + +Changes for the user: + +* `dnl' outputs a diagnostic if immediately followed by `('. Usually, +`dnl' is followed by newline or whitespace. + +* `ifelse' accepts without complaining the common idiom of having only +one argument. This is useful for introducing long comments. + +* `eval' always expresses values as signed, whatever the radix. + +* M4OPTS environment variable is no longer obeyed. + +* `--no-warnings' option is renamed `--silent'. + +* Debug lines use a new format more compatible with GNU standards. + +* Various bugs have been corrected. See the ChangeLog for details. + +Changes for the installer: + +* GNU m4 now uses an Autoconf-generated configure script, and should be +more easily portable in many ways. (Cray is not supported yet). + +* `make check' has been made more portable, expect no errors. + +Changes for the programmer: + +* Sources have been fully reindented to comply with GNU standards, and +cleaned up in many ways. + +* Sources have been protoized. Non-ANSI compilers are automatically +detected, then sources are unprotoized on the fly before compilation. + +* GNU m4 uses newer versions of obstack, regex, getopt, etc. + +Version 1.0 - October 1991, by Rene' Seindal + +* Uses GNU configure, taken from the gdb distribution. + +* Uses GNU getopt(), with long option names. + +* The -Q/+quiet option is added, which suppresses warnings about missing +or superflous arguments to built-in macros. + +* Added default options via the M4OPTS environment variable. + +* Several minor bugs have been fixed. + +Version 0.99 - July 1991, by Rene' Seindal + +* The builtins `incr' and `decr' are now implemented without use of +`eval'. + +* The builtin `indir' is added, to allow for indirect macro calls +(allows use of "illegal" macro names). + +* The debugging and tracing facilities has been enhanced considerably. +See the manual for details. + +* The -tMACRO option is added, marks MACRO for tracing as soon as it +is defined. + +* Builtins are traced after renaming iff they were before. + +* Named files can now be undiverted. + +* The -Nnum option can be used to increase the number of divertions +available. + +* Calling changecom without arguments now disables all comment handling. + +* A bug in `dnl' is fixed. + +* A bug in the multi-character quoting code is fixed. + +* Several typos in the manual has been corrected. More probably persist. + +Version 0.75 - November 1990, by Rene' Seindal + +* Implemented search path for include files (-I option and M4PATH +environment variable). + +* Implemented builtin `format' for printf-like formatting. + +* Implemented builtin `regexp' for searching for regular expressions. + +* Implemented builtin `patsubst' for substitution with regular +expressions. + +* Implemented builtin `esyscmd', which expands to a shell commands output. + +* Implemented `__file__' and `__line__' for use in error messages. + +* Implemented character ranges in `translit'. + +* Implemented control over debugging output. + +* Implemented multi-character quotes. + +* Implemented multi-character comment delimiters. + +* Changed predefined macro `gnu' to `__gnu__'. + +* Changed predefined macro `unix' to `__unix__', when the -G option is +not used. With -G, `unix' is still defined. + +* Added program name to error messages. + +* Fixed two missing null bytes bugs. + +Version 0.50 - January 1990, by Rene' Seindal + +* Initial beta release. + +======================================================================== + +Local Variables: +mode: outline +fill-column: 75 +End: + +Copyright (C) 1992-1994, 2004-2014, 2016 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. diff --git a/contrib/tools/m4/README b/contrib/tools/m4/README new file mode 100644 index 0000000000..d4ef916e94 --- /dev/null +++ b/contrib/tools/m4/README @@ -0,0 +1,76 @@ +GNU `m4' is an implementation of the traditional Unix macro +processor. It is mostly SVR4 compatible, although it has some +extensions (for example, handling more than 9 positional parameters +to macros). `m4' also has built-in functions for including files, +running shell commands, doing arithmetic, etc. Autoconf needs GNU +`m4' for generating `configure' scripts, but not for running them. + +GNU `m4' was originally written by Rene' Seindal, from Denmark. +This release is considered stable. + +If GNU `m4' is meant to serve GNU `autoconf', beware that `m4' +should be fully installed *prior to* configuring `autoconf' itself. +Likewise, if you intend on hacking GNU `m4' from git, the bootstrap +process requires that you first install a released copy of GNU `m4'. + +If you are just trying to build `m4' from a released tarball, you +should not normally need to run `./bootstrap' or `autoreconf'; just go +ahead and start with `./configure'. If you are trying to build `m4' +from git, more information can be found in the version-control-only +file HACKING. + +M4 has an optional dependency on the libsigsegv library: + http://www.gnu.org/software/libsigsegv/ +If the library has not been installed in the standard location, you +can use `./configure --with-libsigsegv-prefix=/path/to/dir', to make +the build of `m4' use /path/to/dir/include/sigsegv.h as appropriate. +The use of this library is optional; the only difference in having it +available is that it increases the number of platforms where `m4' can +correctly distinguish stack overflow from an internal bug. It is +recommended that you use version 2.9 or newer. + +In the subdirectory `examples' you will find various m4 files, ranging +from trivial test files to rather advanced macros. If you intend to +use m4 seriously, you might find useful material down there. + +See file `BACKLOG' for a summary of pending mail and articles. +See file `COPYING' for copying conditions. Note that M4 is distributed +under the GNU Public License version 3 or later. Some files in the +distribution are copied from the gnulib project, and hence bear the +designation version 2 or later because they are unmodified from gnulib; +however, if you modify these files using M4 rather than gnulib as the +source, you must update the license to be GPLv3 or later. +See file `INSTALL' for compilation and installation instructions. +See file `NEWS' for a list of major changes in the current release. +See file `THANKS' for a list of contributors. + +By default, the `syscmd' and `esyscmd' macros try to use the first +instance of `sh' found by `command -p getconf PATH' at configure time, +with a default of `/bin/sh'. If that default is inappropriate, you +can use `./configure --with-syscmd-shell=location' to specify the +shell to use. + +By using `./configure --enable-changeword', you get an experimental +feature which allows for changing the syntax of what is a "word" in +`m4'. This feature will not be present in m4 2.0, but will be +replaced by other new features which provide similar capability, so +do not count on it. + +Send bug reports to `bug-m4@gnu.org'. A bug report is an adequate +description of the problem: your input, what you expected, what you got, +and why this is wrong. Diffs are welcome, but they only describe a +solution, from which the problem might be uneasy to infer. + +For any copyright year range specified as YYYY-ZZZZ in this package +note that the range specifies every single year in that closed interval. + +======================================================================== + +Copyright (C) 2000, 2005-2014, 2016 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. diff --git a/contrib/tools/m4/THANKS b/contrib/tools/m4/THANKS new file mode 100644 index 0000000000..bcd99a17a5 --- /dev/null +++ b/contrib/tools/m4/THANKS @@ -0,0 +1,150 @@ +GNU M4 THANKS file + +GNU M4 was originally written by René Seindal. Many people +further contributed to GNU M4 by reporting problems, suggesting +various improvements or submitting actual code. Here is a list of +these people. Help me keep it complete and exempt of errors. + +Akiko Matsushita matusita@sra.co.jp +Akim Demaille demaille@inf.enst.fr +Alan Magnuson awm@osc.edu +Albert Chin m4-discuss@mlists.thewrittenword.com +Alexander Lehmann alex@hal.rhein-main.de +Amos Shapira amoss@cs.huji.ac.il +Andreas Büning andreas.buening@nexgo.de +Andreas Gustafsson gson@niksula.hut.fi +Andreas Schultz aschultz@warp10.net +Andreas Schwab schwab@ls5.informatik.uni-dortmund.de +Assar Westerlund assar@nada.kth.se +Ben A. Mesander ben@piglet.cr.usgs.gov +Bengt Mertensson bengt@mathematik.uni-bremen.de +Bernhard Daeubler daeb@physik.uni-ulm.de +Bjorn R. Bjornsson brb@falcon.is +Bob Badour bob@badour.net +Bob Proulx bob@proulx.com +Brendan Kehoe brendan@cygnus.com +Bruno Haible bruno@clisp.org +Carlo Teubner carlo.teubner@gmail.com +Cesar Strauss cestrauss@gmail.com +Chris McGuire chris@wso.net +Chris Penev xpenev@gmail.com +Dagobert Michelsen dagobert@familie-michelsen.de +Damian Menscher menscher@uiuc.edu +Dan Jacobson jidanni@jidanni.org +David J. MacKenzie djm@uunet.uu.net +David Perlin davep@nanosoft.com +Elbert Pol elbert.pol@gmail.com +Elias Benali elptr@users.sourceforge.net +Erez Zadok ezk@cs.columbia.edu +Eric Allman eric@cs.berkeley.edu +Eric Backus ericb@lsid.hp.com +Eric Blake ebb9@byu.net +Fernando Carrijo fcarrijo1980@gmail.com +François Pinard pinard@iro.umontreal.ca +Frank Schwidom schwidom@impernet.de +Gary V. Vaughan gary@gnu.org +Geoff Russell grussell@guest.adelaide.edu.au +Giovanni Toffetti toffettg@lu.unisi.ch +Giuseppe Scrivano gscrivano@gnu.org +Greg A. Woods woods@web.apc.org +Hal Peterson hrp@pecan.cray.com +Hoang Uong hoang@ornews.intel.com +Ian Taylor ian@cygnus.com +Ilya N. Golubev gin@mo.msk.ru +Jason Merrill jason@jarthur.claremont.edu +Jay Krell jay.krell@cornell.edu +Jean-Charles Longuet jclonguet@free.fr +Jens Rehsack rehsack@googlemail.com +Jim Avera jima@netcom.com +Jim Kingdom kingdon@cygnus.com +Jim Meyering meyering@acm.org +Joel E. Denny jdenny@ces.clemson.edu +Joel Sherrill jsherril@uahcs2.cs.uah.edu +John Brzustowski jbrzusto@fastmail.fm +John David Anglin dave@hiauly1.hia.nrc.ca +John Gatewood Ham zappaman@buraphalinux.org +Josef T. Burger bolo@bolo.com +Joseph E. Sacco jsacco@ssl.com +Karl Berry karl@freefriends.org +Karl Nelson nelson85@llnl.gov +Karl Vogel vogelke@c-17igp.wpafb.af.mil +Kaveh R. Ghazi ghazi@noc.rutgers.edu +KO Myung-Hun komh@chollian.net +Konrad Schwarz konrad.schwarz@siemens.com +Kristine Lund lund@lpnaxp.in2p3.fr +Krste Asanovic krste@icsi.berkeley.edu +Lawson Chan Lawson.Chan@tdsecurities.com +Marion Hakanson hakanson@cse.ogi.edu +Mark Seiden mis@seiden.com +Martin Koeppe mkoeppe@gmx.de +Matt Kraai kraai@debian.org +Matthew Woehlke mw_triad@users.sourceforge.net +Matthias Rabe rabe@mathematik.uni-bielefeld.de +Michael Fetterman mafetter@ichips.intel.com +Michael L. Welcome welcome@bigbird.llnl.gov +Mike Dupont jamesmikedupont@googlemail.com +Mike Frysinger vapier@gentoo.org +Mike Lijewski lijewski@theory.tc.cornell.edu +Mike R. mroberge@aol.com +Mike Stump mikestump@comcast.net +Mikhail Teterin Mikhail.Teterin@murex.com +Nelson H. F. Beebe beebe@math.utah.edu +Nick S. Kanakakorn skanan@otl.scu.edu +Nicolas Lichtmaier nick@technisys.com.ar +Nicolas Pioch pioch@inf.enst.fr +Noah Friedman friedman@gnu.org +Noah Misch noah@cs.caltech.edu +Paolo Bonzini bonzini@gnu.org +Paul Eggert eggert@cs.ucla.edu +Pete Chown pete.chown@dale.dircon.co.uk +Pierre Gaumond gaumondp@ere.umontreal.ca +Pierre Mathieu mathieu@geod.emr.ca +Rainer Tammer tammer@tammer.net +Ralf Wildenhues Ralf.Wildenhues@gmx.de +René Seindal seindal@diku.dk +Richard A Nelson cowboy@vnet.ibm.com +Richard Stallman rms@gnu.org +Robert Bernstein rocky@panix.com +Robert Bihlmeyer robbe@orcus.priv.at +Roland H. Pesch roland@wrs.com +Roland McGrath roland@gnu.org +Ronny Peine RonnyPeine@gmx.de +Sami Liedes sliedes@cc.hut.fi +Santiago Vila sanvila@debian.org +Scott Bartram deneb!scottb +Scott McCreary scottmc2@gmail.com +Sergey Poznyakoff gray@gnu.org.ua +Simon Leinen simon@lia.di.epfl.ch +Skip Montanaro skip@automatrix.com +Stepan Kasal kasal@ucw.cz +Stephen Perkins perkins@cps.msu.edu +Steve Williamson willy@uinpla.npl.uiuc.edu +Steven Augart saugart@yahoo.com +Thomas Klausner tk@giga.or.at +Thorsten Ohl ohl@physics.harvard.edu +Todd Rinaldo toddr@cpanel.net +Tom G. Christensen tgc@jupiterrise.com +Tom McConnell tmcconne@sedona.intel.com +Tom Quinn trq@dionysos.thphys.ox.ac.uk +Tom Tromey tromey@cns.caltech.edu +Ulrich Drepper drepper@gnu.org +Vern Paxson vern@ee.lbl.gov +Vincent Lonngren Vincent.lonngren.759@student.lu.se +Vitezslav Crhonek vcrhonek@redhat.com +Vivek P. Singhal singhal@cs.utexas.edu +Walter Wong wcw+@cmu.edu + +======================================================================== + +Local Variables: +coding: utf-8 +End: + +Copyright (C) 2000, 2006-2014, 2016 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. diff --git a/contrib/tools/m4/TODO b/contrib/tools/m4/TODO new file mode 100644 index 0000000000..55b5d1c5cc --- /dev/null +++ b/contrib/tools/m4/TODO @@ -0,0 +1,48 @@ +TODO file for GNU m4 + +Tell <bug-m4@gnu.org> if you feel like volunteering for any +of these ideas, listed more or less in decreasing order of priority. + +* Features or problems + - Fix format() builtin to handle %c more like printf(1) in the shell + http://lists.gnu.org/archive/html/bug-m4/2007-05/msg00047.html + Also, gnulib needs help to overcome mingw bugs related to format(). + - Update documentation from accumulated mail about it + - Study synclines at the very beginning of each diverted sequence + - Make eval work on bignums - the 32 bits limit is artificial + From Krste Asanovic <krste@icsi.berkeley.edu>, 1993-03-20 + +* Optimization and clean up + - Check for memory leaks and uninitialized reads + From Vern Paxson <vern@horse.ee.lbl.gov> on 1993-12-06 + - Profile GNU m4 and speed it up + From David J. MacKenzie <djm@eng.umd.edu>, 1993-01-20 + + GNU m4 should be sped up by a factor of three for competing + with other versions (I think that the lexer is not agressive + enough and too often return single characters; obstacks might + be a little abused, too). + - Have NULs go really undisturbed through GNU m4 + See `dumpdef' and debugging section, which abuses %s + From Thorsten Ohl <ohl@chico.harvard.edu>, 1992-12-21 + + path.c (add_include_directory): Why the '\0' terminator? + + GNU m4 is lousy regarding NULs in streams (this would require + maintaining the string lengths, and avoiding strlen, strcpy, + etc.). + +Local Variables: +mode: outline +outline-regexp: " *[-+*.] \\|" +End: + +Copyright (C) 2000, 2006-2007, 2009-2014, 2016 Free Software Foundation, +Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the ``GNU Free +Documentation License'' file as part of this distribution. diff --git a/contrib/tools/m4/lib/.yandex_meta/licenses.list.txt b/contrib/tools/m4/lib/.yandex_meta/licenses.list.txt index 8d30fca783..a965e77fd8 100644 --- a/contrib/tools/m4/lib/.yandex_meta/licenses.list.txt +++ b/contrib/tools/m4/lib/.yandex_meta/licenses.list.txt @@ -1,70 +1,28 @@ -====================BSD-3-Clause==================== -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the product nor the names of its contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -====================COPYRIGHT==================== - Copyright (C) 1998, 2001, 2003-2006, 2009-2013 Free Software Foundation, +====================COPYRIGHT==================== + Copyright (C) 1998, 2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2013 Free Software + Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2013 Free Software + Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2013 Free Software + Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2013 Free Software - Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 1988-1994, 1996-1999, 2003-2006, 2009-2013 Free Software - Foundation, Inc. - This file is part of the GNU C Library. - - -====================COPYRIGHT==================== - Copyright (C) 1988-1994, 1996-2006, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2013 Free Software + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -76,63 +34,48 @@ ====================COPYRIGHT==================== - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software - Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2013 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2013 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software - Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 1990, 2001, 2003-2006, 2009-2013 Free Software Foundation, + Copyright (C) 1990, 2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1990-1998, 2000-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1990-2000, 2002-2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2002-2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1990-2000, 2003-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1991, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1991, 2004-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 1991-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1991-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2013 Free Software + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2013 Free Software + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. @@ -142,171 +85,134 @@ ====================COPYRIGHT==================== - Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2013 Free Software + Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1995-1997, 2003, 2006, 2008-2013 Free Software Foundation, + Copyright (C) 1995-1997, 2003, 2006, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2013 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2013 Free Software + Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2013 Free Software - Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 1996-1999, 2008-2013 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - -====================COPYRIGHT==================== - Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 1996-2013 Free Software Foundation, Inc. + Copyright (C) 1996-1999, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== - Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2013 Free Software - Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997. + Copyright (C) 1996-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2013 Free Software + Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1997-1998, 2006-2007, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2013 Free Software + Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1997-2006, 2008-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2013 Free Software + Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1998-1999, 2001, 2003, 2009-2013 Free Software Foundation, - Inc. - Written by Jim Meyering <meyering@ascend.com>, 1998. - - -====================COPYRIGHT==================== - Copyright (C) 1998-1999, 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1998-2001, 2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2001, 2003, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1998-2002, 2004, 2006, 2008-2013 Free Software Foundation, + Copyright (C) 1998-2002, 2004, 2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1998-2002, 2004, 2006-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 1998-2002, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1998-2004, 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2013 Free Software + Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2013 Free Software + Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2013 Free Software + Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2004, 2006, 2009-2013 Free Software Foundation, + Copyright (C) 1999, 2002-2004, 2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2004, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2002-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2003, 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2003, 2005, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999, 2004-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2003-2004, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999-2000, 2002-2003, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 1999-2002, 2005-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2008. + Copyright (C) 1999-2000, 2002-2003, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2000, 2002, 2004, 2006, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 1999-2002, 2005-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2008. ====================COPYRIGHT==================== - Copyright (C) 2000, 2002, 2004, 2009-2013 Free Software Foundation, - Inc. + Copyright (C) 1999-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2000, 2003, 2005-2006, 2009-2013 Free Software Foundation, + Copyright (C) 2000, 2003, 2005-2006, 2009-2016 Free Software Foundation, Inc. @@ -316,109 +222,64 @@ ====================COPYRIGHT==================== - Copyright (C) 2000, 2004, 2006-2007, 2009-2013 Free Software Foundation, + Copyright (C) 2000, 2004, 2006-2007, 2009-2021 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2000-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2000-2003, 2006, 2008-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2000-2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. ====================COPYRIGHT==================== - Copyright (C) 2000-2004, 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2000-2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2000-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2000-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2001, 2003, 2005, 2008-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2001, 2003, 2005, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2001, 2003, 2006, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2001, 2003, 2006-2007, 2009-2013 Free Software Foundation, + Copyright (C) 2001, 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. ====================COPYRIGHT==================== - Copyright (C) 2001, 2003-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. ====================COPYRIGHT==================== - Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2001-2002, 2004, 2006, 2009-2013 Free Software - Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2001-2002, 2004-2006, 2009-2013 Free Software - Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2001-2002, 2005, 2007, 2009-2013 Free Software Foundation, - Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2001-2002, 2005-2007, 2009-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2002. - - -====================COPYRIGHT==================== - Copyright (C) 2001-2002, 2006-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2002. + Copyright (C) 2001, 2004-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2001-2002, 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2001-2002, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2001-2003, 2005-2006, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2001-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== @@ -426,140 +287,102 @@ ====================COPYRIGHT==================== - Copyright (C) 2001-2003, 2006, 2008-2013 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. + Copyright (C) 2001-2003, 2005-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2001. ====================COPYRIGHT==================== - Copyright (C) 2001-2003, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2008-2016 Free Software Foundation, Inc. + Written by Bruno Haible <haible@clisp.cons.org>, 2001. ====================COPYRIGHT==================== - Copyright (C) 2001-2003, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. ====================COPYRIGHT==================== - Copyright (C) 2001-2004, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. ====================COPYRIGHT==================== - Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2001-2004, 2007-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2001-2004, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2001-2005, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2002, 2004, 2006, 2008-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2002, 2004, 2008-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2002, 2005-2006, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2002, 2006, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2002, 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc. + Written by Bruno Haible <haible@clisp.cons.org>, 2001. ====================COPYRIGHT==================== - Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2003, 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2003, 2006, 2009-2013 Free Software Foundation, - Inc. + Copyright (C) 2002, 2004, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2003, 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2004, 2006, 2009-2013 Free Software Foundation, - Inc. + Copyright (C) 2002-2003, 2005-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2007-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. ====================COPYRIGHT==================== - Copyright (C) 2003, 2005, 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. ====================COPYRIGHT==================== - Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. ====================COPYRIGHT==================== - Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2003, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2003, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2003-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. ====================COPYRIGHT==================== - Copyright (C) 2003-2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. ====================COPYRIGHT==================== - Copyright (C) 2003-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. @@ -568,31 +391,23 @@ ====================COPYRIGHT==================== - Copyright (C) 2004, 2006-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2004-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== - Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== @@ -600,166 +415,134 @@ ====================COPYRIGHT==================== - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2006, 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2011-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. ====================COPYRIGHT==================== - Copyright (C) 2006-2007, 2010-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== Copyright (C) 2006-2013 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2007, 2010-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2007-2008, 2010-2013 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2008. + Copyright (C) 2007-2008, 2010-2021 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2007-2013 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright (C) 2011-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2011. + Copyright (C) 2007-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2007. ====================COPYRIGHT==================== - Copyright 2000-2003, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2007-2021 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright 2002-2003, 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2008-2013 Free Software Foundation, Inc. ====================COPYRIGHT==================== - Copyright 2013 Free Software Foundation, Inc. + Copyright (C) 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -# Copyright (C) 1999-2013 Free Software Foundation, Inc. - - -====================COPYRIGHT==================== -# Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2013 Free Software Foundation, Inc. ====================COPYRIGHT==================== -# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -# Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2011-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -# Copyright (C) 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2012-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -# Copyright (C) 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -# Copyright (C) 2012-2013 Free Software Foundation, Inc. + Copyright 2013-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2013 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -/* Copyright (C) 1991, 1994-2002, 2005, 2008-2013 Free Software Foundation, +/* Copyright (C) 1991, 1994-2002, 2005, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== -/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2013 Free Software - Foundation, Inc. - - -====================COPYRIGHT==================== -/* Copyright (C) 1991, 1997, 2009-2013 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - -====================COPYRIGHT==================== -/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2013 Free Software - Foundation, Inc. - This file is part of the GNU C Library. - - -====================COPYRIGHT==================== -/* Copyright (C) 1992, 1995-2002, 2005-2013 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - -====================COPYRIGHT==================== -/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2013 Free Software - Foundation, Inc. - This file is derived from the one in the GNU C Library. - - -====================COPYRIGHT==================== -/* Copyright (C) 1999, 2001-2002, 2006, 2009-2013 Free Software Foundation, +/* Copyright (C) 1999, 2001-2002, 2006, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== -/* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2013 Free Software +/* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. ====================COPYRIGHT==================== -/* Copyright (C) 2000, 2004, 2009-2013 Free Software Foundation, Inc. - This file is part of the GNU C Library. +/* Ordered set data type implemented by a binary tree. + Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. ====================COPYRIGHT==================== -/* Copyright (C) 2000, 2008-2013 Free Software Foundation, Inc. - This file is part of the GNU C Library. +/* Sequential list data type implemented by a hash table with a linked list. + Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2006. ====================COPYRIGHT==================== -/* Sequential list data type implemented by a hash table with a linked list. - Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc. +/* Sequential list data type implemented by a hash table with another list. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. ====================COPYRIGHT==================== /* Variable with FSF copyright information, for version-etc. - Copyright (C) 1999-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2006, 2009-2016 Free Software Foundation, Inc. ====================COPYRIGHT==================== -// Copyright (c) 2006-2013 Alexander Chemeris +/* obstack.c - subroutines used implicitly by object stack macros + Copyright (C) 1988-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. ====================COPYRIGHT==================== Copyright d Free Software Foundation, Inc. -====================File: gnulib/src/filenamecat-lgpl.c==================== +====================File: lib/filenamecat-lgpl.c==================== /* Concatenate two arbitrary file names. - Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1996-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 @@ -847,6 +630,359 @@ mfile_name_concat (char const *dir, char const *abase, char **base_in_result) } +====================File: lib/obstack.c==================== +/* obstack.c - subroutines used implicitly by object stack macros + Copyright (C) 1988-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library 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. + + The GNU C Library 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 the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + + +#ifdef _LIBC +# include <obstack.h> +#else +# include <config.h> +# include "obstack.h" +#endif + +/* NOTE BEFORE MODIFYING THIS FILE: _OBSTACK_INTERFACE_VERSION in + obstack.h must be incremented whenever callers compiled using an old + obstack.h can no longer properly call the functions in this file. */ + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself, and the installed library + supports the same library interface we do. This code is part of the GNU + C Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand 'configure --with-gnu-libc' and omit the object + files, it is simpler to just do this in the source for each such file. */ +#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 +# include <gnu-versions.h> +# if (_GNU_OBSTACK_INTERFACE_VERSION == _OBSTACK_INTERFACE_VERSION \ + || (_GNU_OBSTACK_INTERFACE_VERSION == 1 \ + && _OBSTACK_INTERFACE_VERSION == 2 \ + && defined SIZEOF_INT && defined SIZEOF_SIZE_T \ + && SIZEOF_INT == SIZEOF_SIZE_T)) +# define _OBSTACK_ELIDE_CODE +# endif +#endif + +#ifndef _OBSTACK_ELIDE_CODE +/* If GCC, or if an oddball (testing?) host that #defines __alignof__, + use the already-supplied __alignof__. Otherwise, this must be Gnulib + (as glibc assumes GCC); defer to Gnulib's alignof_type. */ +# include <stdlib.h> +# include <stdint.h> + +# ifndef MAX +# define MAX(a,b) ((a) > (b) ? (a) : (b)) +# endif + +/* Determine default alignment. */ + +/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. + But in fact it might be less smart and round addresses to as much as + DEFAULT_ROUNDING. So we prepare for it to do that. + + DEFAULT_ALIGNMENT cannot be an enum constant; see gnulib's alignof.h. */ +#define DEFAULT_ALIGNMENT MAX (__alignof__ (long double), \ + MAX (__alignof__ (uintmax_t), \ + __alignof__ (void *))) +#define DEFAULT_ROUNDING MAX (sizeof (long double), \ + MAX (sizeof (uintmax_t), \ + sizeof (void *))) + +/* Call functions with either the traditional malloc/free calling + interface, or the mmalloc/mfree interface (that adds an extra first + argument), based on the value of use_extra_arg. */ + +static void * +call_chunkfun (struct obstack *h, size_t size) +{ + if (h->use_extra_arg) + return h->chunkfun.extra (h->extra_arg, size); + else + return h->chunkfun.plain (size); +} + +static void +call_freefun (struct obstack *h, void *old_chunk) +{ + if (h->use_extra_arg) + h->freefun.extra (h->extra_arg, old_chunk); + else + h->freefun.plain (old_chunk); +} + + +/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). + Objects start on multiples of ALIGNMENT (0 means use default). + + Return nonzero if successful, calls obstack_alloc_failed_handler if + allocation fails. */ + +static int +_obstack_begin_worker (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment) +{ + struct _obstack_chunk *chunk; /* points to new chunk */ + + if (alignment == 0) + alignment = DEFAULT_ALIGNMENT; + if (size == 0) + /* Default size is what GNU malloc can fit in a 4096-byte block. */ + { + /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. + Use the values for range checking, because if range checking is off, + the extra bytes won't be missed terribly, but if range checking is on + and we used a larger request, a whole extra 4096 bytes would be + allocated. + + These number are irrelevant to the new GNU malloc. I suspect it is + less sensitive to the size of the request. */ + int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) + + 4 + DEFAULT_ROUNDING - 1) + & ~(DEFAULT_ROUNDING - 1)); + size = 4096 - extra; + } + + h->chunk_size = size; + h->alignment_mask = alignment - 1; + + chunk = h->chunk = call_chunkfun (h, h->chunk_size); + if (!chunk) + (*obstack_alloc_failed_handler) (); + h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, + alignment - 1); + h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; + chunk->prev = 0; + /* The initial chunk now contains no empty object. */ + h->maybe_empty_object = 0; + h->alloc_failed = 0; + return 1; +} + +int +_obstack_begin (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment, + void *(*chunkfun) (size_t), + void (*freefun) (void *)) +{ + h->chunkfun.plain = chunkfun; + h->freefun.plain = freefun; + h->use_extra_arg = 0; + return _obstack_begin_worker (h, size, alignment); +} + +int +_obstack_begin_1 (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment, + void *(*chunkfun) (void *, size_t), + void (*freefun) (void *, void *), + void *arg) +{ + h->chunkfun.extra = chunkfun; + h->freefun.extra = freefun; + h->extra_arg = arg; + h->use_extra_arg = 1; + return _obstack_begin_worker (h, size, alignment); +} + +/* Allocate a new current chunk for the obstack *H + on the assumption that LENGTH bytes need to be added + to the current object, or a new object of length LENGTH allocated. + Copies any partial object from the end of the old chunk + to the beginning of the new one. */ + +void +_obstack_newchunk (struct obstack *h, _OBSTACK_SIZE_T length) +{ + struct _obstack_chunk *old_chunk = h->chunk; + struct _obstack_chunk *new_chunk = 0; + size_t obj_size = h->next_free - h->object_base; + char *object_base; + + /* Compute size for new chunk. */ + size_t sum1 = obj_size + length; + size_t sum2 = sum1 + h->alignment_mask; + size_t new_size = sum2 + (obj_size >> 3) + 100; + if (new_size < sum2) + new_size = sum2; + if (new_size < h->chunk_size) + new_size = h->chunk_size; + + /* Allocate and initialize the new chunk. */ + if (obj_size <= sum1 && sum1 <= sum2) + new_chunk = call_chunkfun (h, new_size); + if (!new_chunk) + (*obstack_alloc_failed_handler)(); + h->chunk = new_chunk; + new_chunk->prev = old_chunk; + new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; + + /* Compute an aligned object_base in the new chunk */ + object_base = + __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask); + + /* Move the existing object to the new chunk. */ + memcpy (object_base, h->object_base, obj_size); + + /* If the object just copied was the only data in OLD_CHUNK, + free that chunk and remove it from the chain. + But not if that chunk might contain an empty object. */ + if (!h->maybe_empty_object + && (h->object_base + == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, + h->alignment_mask))) + { + new_chunk->prev = old_chunk->prev; + call_freefun (h, old_chunk); + } + + h->object_base = object_base; + h->next_free = h->object_base + obj_size; + /* The new chunk certainly contains no empty object yet. */ + h->maybe_empty_object = 0; +} + +/* Return nonzero if object OBJ has been allocated from obstack H. + This is here for debugging. + If you use it in a program, you are probably losing. */ + +/* Suppress -Wmissing-prototypes warning. We don't want to declare this in + obstack.h because it is just for debugging. */ +int _obstack_allocated_p (struct obstack *h, void *obj) __attribute_pure__; + +int +_obstack_allocated_p (struct obstack *h, void *obj) +{ + struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = (h)->chunk; + /* We use >= rather than > since the object cannot be exactly at + the beginning of the chunk but might be an empty object exactly + at the end of an adjacent chunk. */ + while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) + { + plp = lp->prev; + lp = plp; + } + return lp != 0; +} + +/* Free objects in obstack H, including OBJ and everything allocate + more recently than OBJ. If OBJ is zero, free everything in H. */ + +void +_obstack_free (struct obstack *h, void *obj) +{ + struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = h->chunk; + /* We use >= because there cannot be an object at the beginning of a chunk. + But there can be an empty object at that address + at the end of another chunk. */ + while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) + { + plp = lp->prev; + call_freefun (h, lp); + lp = plp; + /* If we switch chunks, we can't tell whether the new current + chunk contains an empty object, so assume that it may. */ + h->maybe_empty_object = 1; + } + if (lp) + { + h->object_base = h->next_free = (char *) (obj); + h->chunk_limit = lp->limit; + h->chunk = lp; + } + else if (obj != 0) + /* obj is not in any of the chunks! */ + abort (); +} + +_OBSTACK_SIZE_T +_obstack_memory_used (struct obstack *h) +{ + struct _obstack_chunk *lp; + _OBSTACK_SIZE_T nbytes = 0; + + for (lp = h->chunk; lp != 0; lp = lp->prev) + { + nbytes += lp->limit - (char *) lp; + } + return nbytes; +} + +# ifndef _OBSTACK_NO_ERROR_HANDLER +/* Define the error handler. */ +# include <stdio.h> + +/* Exit value used when 'print_and_abort' is used. */ +# ifdef _LIBC +int obstack_exit_failure = EXIT_FAILURE; +# else +# include "exitfail.h" +# define obstack_exit_failure exit_failure +# endif + +# ifdef _LIBC +# include <libintl.h> +# else +# include "gettext.h" +# endif +# ifndef _ +# define _(msgid) gettext (msgid) +# endif + +# ifdef _LIBC +# include <libio/iolibio.h> +# endif + +static _Noreturn void +print_and_abort (void) +{ + /* Don't change any of these strings. Yes, it would be possible to add + the newline to the string and use fputs or so. But this must not + happen because the "memory exhausted" message appears in other places + like this and the translation should be reused instead of creating + a very similar string which requires a separate translation. */ +# ifdef _LIBC + (void) __fxprintf (NULL, "%s\n", _("memory exhausted")); +# else + fprintf (stderr, "%s\n", _("memory exhausted")); +# endif + exit (obstack_exit_failure); +} + +/* The functions allocating more room by calling 'obstack_chunk_alloc' + jump to the handler pointed to by 'obstack_alloc_failed_handler'. + This can be set to a user defined function which should either + abort gracefully or use longjump - but shouldn't return. This + variable by default points to the internal function + 'print_and_abort'. */ +__attribute_noreturn__ void (*obstack_alloc_failed_handler) (void) + = print_and_abort; +# endif /* !_OBSTACK_NO_ERROR_HANDLER */ +#endif /* !_OBSTACK_ELIDE_CODE */ + + ====================GPL-3.0-or-later==================== 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 @@ -881,7 +1017,7 @@ mfile_name_concat (char const *dir, char const *abase, char **base_in_result) ====================GPL-3.0-or-later==================== 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 + 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, @@ -890,7 +1026,7 @@ mfile_name_concat (char const *dir, char const *abase, char **base_in_result) 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/>. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. ====================GPL-3.0-or-later==================== @@ -905,7 +1041,7 @@ mfile_name_concat (char const *dir, char const *abase, char **base_in_result) 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/>. + along with this program. If not, see <http://www.gnu.org/licenses/>. */ ====================GPL-3.0-or-later==================== @@ -920,7 +1056,7 @@ mfile_name_concat (char const *dir, char const *abase, char **base_in_result) 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/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ ====================GPL-3.0-or-later==================== @@ -931,8 +1067,8 @@ mfile_name_concat (char const *dir, char const *abase, char **base_in_result) 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. + 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/>. */ @@ -940,14 +1076,14 @@ mfile_name_concat (char const *dir, char const *abase, char **base_in_result) ====================GPL-3.0-or-later==================== 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 any - later version. + 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. + 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/>. */ @@ -984,34 +1120,34 @@ mfile_name_concat (char const *dir, char const *abase, char **base_in_result) ====================GPL-3.0-or-later==================== - 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) + 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. + 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/>. + You should have received a copy of the GNU General Public License along + with this program; if not, see <https://www.gnu.org/licenses/>. */ ====================GPL-3.0-or-later==================== 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. + 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. + 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/>. */ + You should have received a copy of the GNU General Public + License along with this program; if not, see + <http://www.gnu.org/licenses/>. ====================GPL-3.0-or-later==================== diff --git a/contrib/tools/m4/lib/asnprintf.c b/contrib/tools/m4/lib/asnprintf.c index 76e228d860..f23b776786 100644 --- a/contrib/tools/m4/lib/asnprintf.c +++ b/contrib/tools/m4/lib/asnprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 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 diff --git a/contrib/tools/m4/lib/basename-lgpl.c b/contrib/tools/m4/lib/basename-lgpl.c index 9307e83142..11821096ae 100644 --- a/contrib/tools/m4/lib/basename-lgpl.c +++ b/contrib/tools/m4/lib/basename-lgpl.c @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/basename.c b/contrib/tools/m4/lib/basename.c index d73fd41aa1..ed1872d404 100644 --- a/contrib/tools/m4/lib/basename.c +++ b/contrib/tools/m4/lib/basename.c @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/binary-io.c b/contrib/tools/m4/lib/binary-io.c index 8bbdb44d12..d828bcd015 100644 --- a/contrib/tools/m4/lib/binary-io.c +++ b/contrib/tools/m4/lib/binary-io.c @@ -1,3 +1,4 @@ #include <config.h> #define BINARY_IO_INLINE _GL_EXTERN_INLINE #include "binary-io.h" +typedef int dummy; diff --git a/contrib/tools/m4/lib/binary-io.h b/contrib/tools/m4/lib/binary-io.h index 256c23a0ea..8dbc25b6a1 100644 --- a/contrib/tools/m4/lib/binary-io.h +++ b/contrib/tools/m4/lib/binary-io.h @@ -1,5 +1,5 @@ /* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 2008-2013 Free Software Foundation, Inc. + 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 @@ -68,7 +68,7 @@ set_binary_mode (int fd, int mode) /* SET_BINARY (fd); changes the file descriptor fd to perform binary I/O. */ -#ifdef __DJGPP__ +#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 diff --git a/contrib/tools/m4/lib/c-ctype.c b/contrib/tools/m4/lib/c-ctype.c index 752d2e32ae..5d9d4d87a6 100644 --- a/contrib/tools/m4/lib/c-ctype.c +++ b/contrib/tools/m4/lib/c-ctype.c @@ -1,395 +1,3 @@ -/* Character handling in C locale. - - Copyright 2000-2003, 2006, 2009-2013 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. */ -#define NO_C_CTYPE_MACROS +#define C_CTYPE_INLINE _GL_EXTERN_INLINE #include "c-ctype.h" - -/* The function isascii is not locale dependent. Its use in EBCDIC is - questionable. */ -bool -c_isascii (int c) -{ - return (c >= 0x00 && c <= 0x7f); -} - -bool -c_isalnum (int c) -{ -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII - return ((c >= '0' && c <= '9') - || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')); -#else - return ((c >= '0' && c <= '9') - || (c >= 'A' && c <= 'Z') - || (c >= 'a' && c <= 'z')); -#endif -#else - 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 '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': - 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': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isalpha (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII - return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'); -#else - return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); -#endif -#else - 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': - 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': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isblank (int c) -{ - return (c == ' ' || c == '\t'); -} - -bool -c_iscntrl (int c) -{ -#if C_CTYPE_ASCII - return ((c & ~0x1f) == 0 || c == 0x7f); -#else - switch (c) - { - case ' ': case '!': case '"': case '#': case '$': case '%': - case '&': case '\'': case '(': case ')': case '*': case '+': - case ',': case '-': case '.': case '/': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case ':': case ';': case '<': case '=': case '>': case '?': - case '@': - 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': - case '[': case '\\': case ']': case '^': case '_': case '`': - 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': - case '{': case '|': case '}': case '~': - return 0; - default: - return 1; - } -#endif -} - -bool -c_isdigit (int c) -{ -#if C_CTYPE_CONSECUTIVE_DIGITS - return (c >= '0' && c <= '9'); -#else - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - return 1; - default: - return 0; - } -#endif -} - -bool -c_islower (int c) -{ -#if C_CTYPE_CONSECUTIVE_LOWERCASE - return (c >= 'a' && c <= 'z'); -#else - 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': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isgraph (int c) -{ -#if C_CTYPE_ASCII - return (c >= '!' && c <= '~'); -#else - switch (c) - { - case '!': case '"': case '#': case '$': case '%': case '&': - case '\'': case '(': case ')': case '*': case '+': case ',': - case '-': case '.': case '/': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case ':': case ';': case '<': case '=': case '>': case '?': - case '@': - 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': - case '[': case '\\': case ']': case '^': case '_': case '`': - 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': - case '{': case '|': case '}': case '~': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isprint (int c) -{ -#if C_CTYPE_ASCII - return (c >= ' ' && c <= '~'); -#else - switch (c) - { - case ' ': case '!': case '"': case '#': case '$': case '%': - case '&': case '\'': case '(': case ')': case '*': case '+': - case ',': case '-': case '.': case '/': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case ':': case ';': case '<': case '=': case '>': case '?': - case '@': - 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': - case '[': case '\\': case ']': case '^': case '_': case '`': - 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': - case '{': case '|': case '}': case '~': - return 1; - default: - return 0; - } -#endif -} - -bool -c_ispunct (int c) -{ -#if C_CTYPE_ASCII - return ((c >= '!' && c <= '~') - && !((c >= '0' && c <= '9') - || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'))); -#else - 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 '~': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isspace (int c) -{ - return (c == ' ' || c == '\t' - || c == '\n' || c == '\v' || c == '\f' || c == '\r'); -} - -bool -c_isupper (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE - return (c >= 'A' && c <= 'Z'); -#else - 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': - return 1; - default: - return 0; - } -#endif -} - -bool -c_isxdigit (int c) -{ -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII - return ((c >= '0' && c <= '9') - || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F')); -#else - return ((c >= '0' && c <= '9') - || (c >= 'A' && c <= 'F') - || (c >= 'a' && c <= 'f')); -#endif -#else - 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': - return 1; - default: - return 0; - } -#endif -} - -int -c_tolower (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE - return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c); -#else - switch (c) - { - case 'A': return 'a'; - case 'B': return 'b'; - case 'C': return 'c'; - case 'D': return 'd'; - case 'E': return 'e'; - case 'F': return 'f'; - case 'G': return 'g'; - case 'H': return 'h'; - case 'I': return 'i'; - case 'J': return 'j'; - case 'K': return 'k'; - case 'L': return 'l'; - case 'M': return 'm'; - case 'N': return 'n'; - case 'O': return 'o'; - case 'P': return 'p'; - case 'Q': return 'q'; - case 'R': return 'r'; - case 'S': return 's'; - case 'T': return 't'; - case 'U': return 'u'; - case 'V': return 'v'; - case 'W': return 'w'; - case 'X': return 'x'; - case 'Y': return 'y'; - case 'Z': return 'z'; - default: return c; - } -#endif -} - -int -c_toupper (int c) -{ -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE - return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c); -#else - switch (c) - { - case 'a': return 'A'; - case 'b': return 'B'; - case 'c': return 'C'; - case 'd': return 'D'; - case 'e': return 'E'; - case 'f': return 'F'; - case 'g': return 'G'; - case 'h': return 'H'; - case 'i': return 'I'; - case 'j': return 'J'; - case 'k': return 'K'; - case 'l': return 'L'; - case 'm': return 'M'; - case 'n': return 'N'; - case 'o': return 'O'; - case 'p': return 'P'; - case 'q': return 'Q'; - case 'r': return 'R'; - case 's': return 'S'; - case 't': return 'T'; - case 'u': return 'U'; - case 'v': return 'V'; - case 'w': return 'W'; - case 'x': return 'X'; - case 'y': return 'Y'; - case 'z': return 'Z'; - default: return c; - } -#endif -} diff --git a/contrib/tools/m4/lib/c-ctype.h b/contrib/tools/m4/lib/c-ctype.h index ad589b5c20..717ae78bb6 100644 --- a/contrib/tools/m4/lib/c-ctype.h +++ b/contrib/tools/m4/lib/c-ctype.h @@ -5,7 +5,7 @@ <ctype.h> functions' behaviour depends on the current locale set via setlocale. - Copyright (C) 2000-2003, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 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 @@ -25,6 +25,13 @@ along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include <stdbool.h> +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif +_GL_INLINE_HEADER_BEGIN +#ifndef C_CTYPE_INLINE +# define C_CTYPE_INLINE _GL_INLINE +#endif #ifdef __cplusplus extern "C" { @@ -39,38 +46,6 @@ extern "C" { characters. */ -/* Check whether the ASCII optimizations apply. */ - -/* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that - '0', '1', ..., '9' have consecutive integer values. */ -#define C_CTYPE_CONSECUTIVE_DIGITS 1 - -#if ('A' <= 'Z') \ - && ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \ - && ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \ - && ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \ - && ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \ - && ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \ - && ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \ - && ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \ - && ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \ - && ('Y' + 1 == 'Z') -#define C_CTYPE_CONSECUTIVE_UPPERCASE 1 -#endif - -#if ('a' <= 'z') \ - && ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \ - && ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \ - && ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \ - && ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \ - && ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \ - && ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \ - && ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \ - && ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \ - && ('y' + 1 == 'z') -#define C_CTYPE_CONSECUTIVE_LOWERCASE 1 -#endif - #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ @@ -96,11 +71,84 @@ extern "C" { && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) /* The character set is ASCII or one of its variants or extensions, not EBCDIC. Testing the value of '\n' and '\r' is not relevant. */ -#define C_CTYPE_ASCII 1 +# define C_CTYPE_ASCII 1 +#elif ! (' ' == '\x40' && '0' == '\xf0' \ + && 'A' == '\xc1' && 'J' == '\xd1' && 'S' == '\xe2' \ + && 'a' == '\x81' && 'j' == '\x91' && 's' == '\xa2') +# error "Only ASCII and EBCDIC are supported" #endif +#if 'A' < 0 +# error "EBCDIC and char is signed -- not supported" +#endif + +/* Cases for control characters. */ + +#define _C_CTYPE_CNTRL \ + case '\a': case '\b': case '\f': case '\n': \ + case '\r': case '\t': case '\v': \ + _C_CTYPE_OTHER_CNTRL + +/* ASCII control characters other than those with \-letter escapes. */ + +#if C_CTYPE_ASCII +# define _C_CTYPE_OTHER_CNTRL \ + case '\x00': case '\x01': case '\x02': case '\x03': \ + case '\x04': case '\x05': case '\x06': case '\x0e': \ + case '\x0f': case '\x10': case '\x11': case '\x12': \ + case '\x13': case '\x14': case '\x15': case '\x16': \ + case '\x17': case '\x18': case '\x19': case '\x1a': \ + case '\x1b': case '\x1c': case '\x1d': case '\x1e': \ + case '\x1f': case '\x7f' +#else + /* Use EBCDIC code page 1047's assignments for ASCII control chars; + assume all EBCDIC code pages agree about these assignments. */ +# define _C_CTYPE_OTHER_CNTRL \ + case '\x00': case '\x01': case '\x02': case '\x03': \ + case '\x07': case '\x0e': case '\x0f': case '\x10': \ + case '\x11': case '\x12': case '\x13': case '\x18': \ + case '\x19': case '\x1c': case '\x1d': case '\x1e': \ + case '\x1f': case '\x26': case '\x27': case '\x2d': \ + case '\x2e': case '\x32': case '\x37': case '\x3c': \ + case '\x3d': case '\x3f' +#endif -/* Function declarations. */ +/* Cases for lowercase hex letters, and lowercase letters, all offset by N. */ + +#define _C_CTYPE_LOWER_A_THRU_F_N(n) \ + case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ + case 'e' + (n): case 'f' + (n) +#define _C_CTYPE_LOWER_N(n) \ + _C_CTYPE_LOWER_A_THRU_F_N(n): \ + case 'g' + (n): case 'h' + (n): case 'i' + (n): case 'j' + (n): \ + case 'k' + (n): case 'l' + (n): case 'm' + (n): case 'n' + (n): \ + case 'o' + (n): case 'p' + (n): case 'q' + (n): case 'r' + (n): \ + case 's' + (n): case 't' + (n): case 'u' + (n): case 'v' + (n): \ + case 'w' + (n): case 'x' + (n): case 'y' + (n): case 'z' + (n) + +/* Cases for hex letters, digits, lower, punct, and upper. */ + +#define _C_CTYPE_A_THRU_F \ + _C_CTYPE_LOWER_A_THRU_F_N (0): \ + _C_CTYPE_LOWER_A_THRU_F_N ('A' - 'a') +#define _C_CTYPE_DIGIT \ + case '0': case '1': case '2': case '3': \ + case '4': case '5': case '6': case '7': \ + case '8': case '9' +#define _C_CTYPE_LOWER _C_CTYPE_LOWER_N (0) +#define _C_CTYPE_PUNCT \ + 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 '~' +#define _C_CTYPE_UPPER _C_CTYPE_LOWER_N ('A' - 'a') + + +/* Function definitions. */ /* Unlike the functions in <ctype.h>, which require an argument in the range of the 'unsigned char' type, the functions here operate on values that are @@ -117,179 +165,202 @@ extern "C" { if (c_isalpha (*s)) ... */ -extern bool c_isascii (int c) _GL_ATTRIBUTE_CONST; /* not locale dependent */ - -extern bool c_isalnum (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isalpha (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isblank (int c) _GL_ATTRIBUTE_CONST; -extern bool c_iscntrl (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isdigit (int c) _GL_ATTRIBUTE_CONST; -extern bool c_islower (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isgraph (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isprint (int c) _GL_ATTRIBUTE_CONST; -extern bool c_ispunct (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isspace (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isupper (int c) _GL_ATTRIBUTE_CONST; -extern bool c_isxdigit (int c) _GL_ATTRIBUTE_CONST; - -extern int c_tolower (int c) _GL_ATTRIBUTE_CONST; -extern int c_toupper (int c) _GL_ATTRIBUTE_CONST; - - -#if (defined __GNUC__ && !defined __STRICT_ANSI__ && defined __OPTIMIZE__ \ - && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS) - -/* ASCII optimizations. */ - -#undef c_isascii -#define c_isascii(c) \ - ({ int __c = (c); \ - (__c >= 0x00 && __c <= 0x7f); \ - }) +C_CTYPE_INLINE bool +c_isalnum (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII -#undef c_isalnum -#define c_isalnum(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \ - }) -#else -#undef c_isalnum -#define c_isalnum(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || (__c >= 'A' && __c <= 'Z') \ - || (__c >= 'a' && __c <= 'z')); \ - }) -#endif -#endif +C_CTYPE_INLINE bool +c_isalpha (int c) +{ + switch (c) + { + _C_CTYPE_LOWER: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII -#undef c_isalpha -#define c_isalpha(c) \ - ({ int __c = (c); \ - ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \ - }) -#else -#undef c_isalpha -#define c_isalpha(c) \ - ({ int __c = (c); \ - ((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \ - }) -#endif -#endif +/* The function isascii is not locale dependent. + Its use in EBCDIC is questionable. */ +C_CTYPE_INLINE bool +c_isascii (int c) +{ + switch (c) + { + case ' ': + _C_CTYPE_CNTRL: + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#undef c_isblank -#define c_isblank(c) \ - ({ int __c = (c); \ - (__c == ' ' || __c == '\t'); \ - }) +C_CTYPE_INLINE bool +c_isblank (int c) +{ + return c == ' ' || c == '\t'; +} -#if C_CTYPE_ASCII -#undef c_iscntrl -#define c_iscntrl(c) \ - ({ int __c = (c); \ - ((__c & ~0x1f) == 0 || __c == 0x7f); \ - }) -#endif +C_CTYPE_INLINE bool +c_iscntrl (int c) +{ + switch (c) + { + _C_CTYPE_CNTRL: + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_DIGITS -#undef c_isdigit -#define c_isdigit(c) \ - ({ int __c = (c); \ - (__c >= '0' && __c <= '9'); \ - }) -#endif +C_CTYPE_INLINE bool +c_isdigit (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_LOWERCASE -#undef c_islower -#define c_islower(c) \ - ({ int __c = (c); \ - (__c >= 'a' && __c <= 'z'); \ - }) -#endif +C_CTYPE_INLINE bool +c_isgraph (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#if C_CTYPE_ASCII -#undef c_isgraph -#define c_isgraph(c) \ - ({ int __c = (c); \ - (__c >= '!' && __c <= '~'); \ - }) -#endif +C_CTYPE_INLINE bool +c_islower (int c) +{ + switch (c) + { + _C_CTYPE_LOWER: + return true; + default: + return false; + } +} -#if C_CTYPE_ASCII -#undef c_isprint -#define c_isprint(c) \ - ({ int __c = (c); \ - (__c >= ' ' && __c <= '~'); \ - }) -#endif +C_CTYPE_INLINE bool +c_isprint (int c) +{ + switch (c) + { + case ' ': + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#if C_CTYPE_ASCII -#undef c_ispunct -#define c_ispunct(c) \ - ({ int _c = (c); \ - (c_isgraph (_c) && ! c_isalnum (_c)); \ - }) -#endif +C_CTYPE_INLINE bool +c_ispunct (int c) +{ + switch (c) + { + _C_CTYPE_PUNCT: + return true; + default: + return false; + } +} -#undef c_isspace -#define c_isspace(c) \ - ({ int __c = (c); \ - (__c == ' ' || __c == '\t' \ - || __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \ - }) - -#if C_CTYPE_CONSECUTIVE_UPPERCASE -#undef c_isupper -#define c_isupper(c) \ - ({ int __c = (c); \ - (__c >= 'A' && __c <= 'Z'); \ - }) -#endif +C_CTYPE_INLINE bool +c_isspace (int c) +{ + switch (c) + { + case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_DIGITS \ - && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#if C_CTYPE_ASCII -#undef c_isxdigit -#define c_isxdigit(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \ - }) -#else -#undef c_isxdigit -#define c_isxdigit(c) \ - ({ int __c = (c); \ - ((__c >= '0' && __c <= '9') \ - || (__c >= 'A' && __c <= 'F') \ - || (__c >= 'a' && __c <= 'f')); \ - }) -#endif -#endif +C_CTYPE_INLINE bool +c_isupper (int c) +{ + switch (c) + { + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} -#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -#undef c_tolower -#define c_tolower(c) \ - ({ int __c = (c); \ - (__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \ - }) -#undef c_toupper -#define c_toupper(c) \ - ({ int __c = (c); \ - (__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \ - }) -#endif +C_CTYPE_INLINE bool +c_isxdigit (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + _C_CTYPE_A_THRU_F: + return true; + default: + return false; + } +} -#endif /* optimizing for speed */ +C_CTYPE_INLINE int +c_tolower (int c) +{ + switch (c) + { + _C_CTYPE_UPPER: + return c - 'A' + 'a'; + default: + return c; + } +} +C_CTYPE_INLINE int +c_toupper (int c) +{ + switch (c) + { + _C_CTYPE_LOWER: + return c - 'a' + 'A'; + default: + return c; + } +} #ifdef __cplusplus } #endif +_GL_INLINE_HEADER_END + #endif /* C_CTYPE_H */ diff --git a/contrib/tools/m4/lib/c-stack.c b/contrib/tools/m4/lib/c-stack.c index ac0aacba66..aab7d799f9 100644 --- a/contrib/tools/m4/lib/c-stack.c +++ b/contrib/tools/m4/lib/c-stack.c @@ -1,6 +1,6 @@ /* Stack overflow handling. - Copyright (C) 2002, 2004, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 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 @@ -78,6 +78,7 @@ typedef struct sigaltstack stack_t; #include "c-stack.h" #include "exitfail.h" #include "ignore-value.h" +#include "getprogname.h" #if defined SA_ONSTACK && defined SA_SIGINFO # define SIGINFO_WORKS 1 @@ -88,8 +89,6 @@ typedef struct sigaltstack stack_t; # endif #endif -extern char *program_name; - /* The user-specified action to take when a SEGV-related program error or stack overflow occurs. */ static void (* volatile segv_action) (int); @@ -116,7 +115,7 @@ die (int signo) #endif /* !SIGINFO_WORKS && !HAVE_LIBSIGSEGV */ segv_action (signo); message = signo ? program_error_message : stack_overflow_message; - ignore_value (write (STDERR_FILENO, program_name, strlen (program_name))); + ignore_value (write (STDERR_FILENO, getprogname (), strlen (getprogname ()))); ignore_value (write (STDERR_FILENO, ": ", 2)); ignore_value (write (STDERR_FILENO, message, strlen (message))); ignore_value (write (STDERR_FILENO, "\n", 1)); diff --git a/contrib/tools/m4/lib/c-stack.h b/contrib/tools/m4/lib/c-stack.h index 2e61bdf01d..efd3b8f0b7 100644 --- a/contrib/tools/m4/lib/c-stack.h +++ b/contrib/tools/m4/lib/c-stack.h @@ -1,6 +1,6 @@ /* Stack overflow handling. - Copyright (C) 2002, 2004, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 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 diff --git a/contrib/tools/m4/lib/c-strcase.h b/contrib/tools/m4/lib/c-strcase.h index 49e1bb03dd..7e570f59b8 100644 --- a/contrib/tools/m4/lib/c-strcase.h +++ b/contrib/tools/m4/lib/c-strcase.h @@ -1,5 +1,5 @@ /* Case-insensitive string comparison functions in C locale. - Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2013 Free Software + Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/c-strcasecmp.c b/contrib/tools/m4/lib/c-strcasecmp.c index ef85f0e67d..bd113b7a2c 100644 --- a/contrib/tools/m4/lib/c-strcasecmp.c +++ b/contrib/tools/m4/lib/c-strcasecmp.c @@ -1,5 +1,5 @@ /* c-strcasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 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 diff --git a/contrib/tools/m4/lib/c-strcaseeq.h b/contrib/tools/m4/lib/c-strcaseeq.h index afdea26ba9..ed5725165c 100644 --- a/contrib/tools/m4/lib/c-strcaseeq.h +++ b/contrib/tools/m4/lib/c-strcaseeq.h @@ -1,5 +1,5 @@ /* Optimized case-insensitive string comparison in C locale. - Copyright (C) 2001-2002, 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-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 @@ -33,9 +33,6 @@ # if C_CTYPE_ASCII # define CASEEQ(other,upper) \ (c_isupper (upper) ? ((other) & ~0x20) == (upper) : (other) == (upper)) -# elif C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE -# define CASEEQ(other,upper) \ - (c_isupper (upper) ? (other) == (upper) || (other) == (upper) - 'A' + 'a' : (other) == (upper)) # else # define CASEEQ(other,upper) \ (c_toupper (other) == (upper)) diff --git a/contrib/tools/m4/lib/c-strncasecmp.c b/contrib/tools/m4/lib/c-strncasecmp.c index 04404b00cd..c316929d0d 100644 --- a/contrib/tools/m4/lib/c-strncasecmp.c +++ b/contrib/tools/m4/lib/c-strncasecmp.c @@ -1,5 +1,5 @@ /* c-strncasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 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 diff --git a/contrib/tools/m4/lib/clean-temp.c b/contrib/tools/m4/lib/clean-temp.c index 1053312ecb..9e0fb27180 100644 --- a/contrib/tools/m4/lib/clean-temp.c +++ b/contrib/tools/m4/lib/clean-temp.c @@ -1,5 +1,5 @@ /* Temporary directories and temporary files with automatic cleanup. - Copyright (C) 2001, 2003, 2006-2007, 2009-2013 Free Software Foundation, + Copyright (C) 2001, 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. @@ -69,13 +69,6 @@ # define uintptr_t unsigned long #endif -#if !GNULIB_FCNTL_SAFER -/* The results of open() in this file are not used with fchdir, - therefore save some unnecessary work in fchdir.c. */ -# undef open -# undef close -#endif - /* The use of 'volatile' in the types below (and ISO C 99 section 5.1.2.3.(5)) ensure that while constructing or modifying the data structures, the field @@ -591,7 +584,7 @@ supports_delete_on_close () /* According to <http://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx> - this structure must be initialised as follows: */ + this structure must be initialized as follows: */ v.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); if (GetVersionEx (&v)) diff --git a/contrib/tools/m4/lib/clean-temp.h b/contrib/tools/m4/lib/clean-temp.h index 24aeca83eb..335e504bfa 100644 --- a/contrib/tools/m4/lib/clean-temp.h +++ b/contrib/tools/m4/lib/clean-temp.h @@ -1,5 +1,5 @@ /* Temporary directories and temporary files with automatic cleanup. - Copyright (C) 2006, 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2011-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/cloexec.c b/contrib/tools/m4/lib/cloexec.c index e3e42d2855..1202836f7c 100644 --- a/contrib/tools/m4/lib/cloexec.c +++ b/contrib/tools/m4/lib/cloexec.c @@ -1,6 +1,6 @@ /* closexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 1991, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1991, 2004-2006, 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 diff --git a/contrib/tools/m4/lib/cloexec.h b/contrib/tools/m4/lib/cloexec.h index 0c5935ba56..0e5843736c 100644 --- a/contrib/tools/m4/lib/cloexec.h +++ b/contrib/tools/m4/lib/cloexec.h @@ -1,6 +1,6 @@ /* closexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2004, 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 diff --git a/contrib/tools/m4/lib/close-stream.c b/contrib/tools/m4/lib/close-stream.c index d6a869287e..0c4beaec80 100644 --- a/contrib/tools/m4/lib/close-stream.c +++ b/contrib/tools/m4/lib/close-stream.c @@ -1,6 +1,6 @@ /* Close a stream, with nicer error checking than fclose's. - Copyright (C) 1998-2002, 2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004, 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 diff --git a/contrib/tools/m4/lib/close.c b/contrib/tools/m4/lib/close.c index f620e54bba..46a7aa5176 100644 --- a/contrib/tools/m4/lib/close.c +++ b/contrib/tools/m4/lib/close.c @@ -1,5 +1,5 @@ /* close replacement. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/closein.c b/contrib/tools/m4/lib/closein.c index 20d5035eec..7415b19f05 100644 --- a/contrib/tools/m4/lib/closein.c +++ b/contrib/tools/m4/lib/closein.c @@ -1,6 +1,6 @@ /* Close standard input, rewinding seekable stdin if necessary. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/closein.h b/contrib/tools/m4/lib/closein.h index 84bbeefceb..c5788398c5 100644 --- a/contrib/tools/m4/lib/closein.h +++ b/contrib/tools/m4/lib/closein.h @@ -1,6 +1,6 @@ /* Close standard input, rewinding seekable stdin if necessary. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/closeout.c b/contrib/tools/m4/lib/closeout.c index d4d3edca4e..311faf4c5a 100644 --- a/contrib/tools/m4/lib/closeout.c +++ b/contrib/tools/m4/lib/closeout.c @@ -1,6 +1,6 @@ /* Close standard output and standard error, exiting with a diagnostic on error. - Copyright (C) 1998-2002, 2004, 2006, 2008-2013 Free Software Foundation, + Copyright (C) 1998-2002, 2004, 2006, 2008-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/closeout.h b/contrib/tools/m4/lib/closeout.h index 131fe864ec..bde9bf0983 100644 --- a/contrib/tools/m4/lib/closeout.h +++ b/contrib/tools/m4/lib/closeout.h @@ -1,6 +1,6 @@ /* Close standard output and standard error. - Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2013 Free Software + Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/config-linux.h b/contrib/tools/m4/lib/config-linux.h index 8fa4b4f092..aa814feb46 100644 --- a/contrib/tools/m4/lib/config-linux.h +++ b/contrib/tools/m4/lib/config-linux.h @@ -31,6 +31,9 @@ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ +/* Define to 1 if the C locale may have encoding errors. */ +#define C_LOCALE_MAYBE_EILSEQ 1 + /* Define as the bit index in the word where to find bit 0 of the exponent of 'double'. */ #define DBL_EXPBIT0_BIT 20 @@ -44,6 +47,16 @@ /* Define as the word index where to find the sign of 'double'. */ /* #undef DBL_SIGNBIT_WORD */ +/* the name of the file descriptor member of DIR */ +/* #undef DIR_FD_MEMBER_NAME */ + +#ifdef DIR_FD_MEMBER_NAME +# define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME) +#else +# define DIR_TO_FD(Dir_p) -1 +#endif + + /* Define to 1 if // is a file system root distinct from /. */ /* #undef DOUBLE_SLASH_IS_DISTINCT_ROOT */ @@ -56,6 +69,15 @@ /* Define this to 1 if F_DUPFD behavior does not match POSIX */ /* #undef FCNTL_DUPFD_BUGGY */ +/* Define to nothing if C supports flexible array members, and to 1 if it does + not. That way, with a declaration like 'struct s { int n; double + d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 + compilers. When computing the size of such an object, don't use 'sizeof + (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)' + instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with + MSVC and with C++ compilers. */ +#define FLEXIBLE_ARRAY_MEMBER /**/ + /* Define as the bit index in the word where to find bit 0 of the exponent of 'float'. */ #define FLT_EXPBIT0_BIT 23 @@ -77,7 +99,7 @@ #if defined __OPTIMIZE__ && __OPTIMIZE__ # define _FORTIFY_SOURCE 2 #endif - + /* Define to 1 if the system's ftello function has the Solaris bug. */ /* #undef FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE */ @@ -101,7 +123,7 @@ /* Define this to 'void' or 'struct timezone' to match the system's declaration of the second argument to gettimeofday. */ -#define GETTIMEOFDAY_TIMEZONE struct timezone +#define GETTIMEOFDAY_TIMEZONE void /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module canonicalize-lgpl shall be considered present. */ @@ -140,13 +162,13 @@ #define GNULIB_LOCK 1 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending - whether the gnulib module malloc-gnu shall be considered present. */ -#define GNULIB_MALLOC_GNU 1 - -/* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module pipe2-safer shall be considered present. */ #define GNULIB_PIPE2_SAFER 1 +/* Define to 1 if printf and friends should be labeled with attribute + "__gnu_printf__" instead of "__printf__" */ +/* #undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU */ + /* Define to a C preprocessor expression that evaluates to 1 or 0, depending whether the gnulib module scanf shall be considered present. */ #define GNULIB_SCANF 1 @@ -182,6 +204,9 @@ /* Define to 1 when the gnulib module closedir should be tested. */ #define GNULIB_TEST_CLOSEDIR 1 +/* Define to 1 when the gnulib module dirfd should be tested. */ +#define GNULIB_TEST_DIRFD 1 + /* Define to 1 when the gnulib module dup should be tested. */ #define GNULIB_TEST_DUP 1 @@ -236,9 +261,6 @@ /* Define to 1 when the gnulib module getdtablesize should be tested. */ #define GNULIB_TEST_GETDTABLESIZE 1 -/* Define to 1 when the gnulib module getopt-gnu should be tested. */ -#define GNULIB_TEST_GETOPT_GNU 1 - /* Define to 1 when the gnulib module getpagesize should be tested. */ #define GNULIB_TEST_GETPAGESIZE 1 @@ -475,19 +497,9 @@ */ #define HAVE_DECL_ALARM 1 -#if defined(__linux__) - #define HAVE_UNLOCKED_IO 1 -#else - #define HAVE_UNLOCKED_IO 0 -#endif - /* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_CLEARERR_UNLOCKED 1 -#else - #define HAVE_DECL_CLEARERR_UNLOCKED 0 -#endif +#define HAVE_DECL_CLEARERR_UNLOCKED 1 /* Define to 1 if you have the declaration of `copysign', and to 0 if you don't. */ @@ -501,37 +513,25 @@ don't. */ /* #undef HAVE_DECL_COPYSIGNL */ +/* Define to 1 if you have the declaration of `dirfd', and to 0 if you don't. + */ +#define HAVE_DECL_DIRFD 1 + /* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_FEOF_UNLOCKED 1 -#else - #define HAVE_DECL_FEOF_UNLOCKED 0 -#endif +#define HAVE_DECL_FEOF_UNLOCKED 1 /* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_FERROR_UNLOCKED 1 -#else - #define HAVE_DECL_FERROR_UNLOCKED 0 -#endif +#define HAVE_DECL_FERROR_UNLOCKED 1 /* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_FFLUSH_UNLOCKED 1 -#else - #define HAVE_DECL_FFLUSH_UNLOCKED 0 -#endif +#define HAVE_DECL_FFLUSH_UNLOCKED 1 /* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_FGETS_UNLOCKED 1 -#else - #define HAVE_DECL_FGETS_UNLOCKED 0 -#endif +#define HAVE_DECL_FGETS_UNLOCKED 1 /* Define to 1 if you have the declaration of `fpurge', and to 0 if you don't. */ @@ -539,27 +539,15 @@ /* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_FPUTC_UNLOCKED 1 -#else - #define HAVE_DECL_FPUTC_UNLOCKED 0 -#endif +#define HAVE_DECL_FPUTC_UNLOCKED 1 /* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_FPUTS_UNLOCKED 1 -#else - #define HAVE_DECL_FPUTS_UNLOCKED 0 -#endif +#define HAVE_DECL_FPUTS_UNLOCKED 1 /* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_FREAD_UNLOCKED 1 -#else - #define HAVE_DECL_FREAD_UNLOCKED 0 -#endif +#define HAVE_DECL_FREAD_UNLOCKED 1 /* Define to 1 if you have the declaration of `fseeko', and to 0 if you don't. */ @@ -571,27 +559,19 @@ /* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_FWRITE_UNLOCKED 1 -#else - #define HAVE_DECL_FWRITE_UNLOCKED 0 -#endif +#define HAVE_DECL_FWRITE_UNLOCKED 1 /* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_GETCHAR_UNLOCKED 1 -#else - #define HAVE_DECL_GETCHAR_UNLOCKED 0 -#endif +#define HAVE_DECL_GETCHAR_UNLOCKED 1 /* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_GETC_UNLOCKED 1 -#else - #define HAVE_DECL_GETC_UNLOCKED 0 -#endif +#define HAVE_DECL_GETC_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `getdtablesize', and to 0 if you + don't. */ +#define HAVE_DECL_GETDTABLESIZE 1 /* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. */ @@ -609,7 +589,6 @@ don't. */ /* #undef HAVE_DECL_MBSINIT */ -#if defined(__linux__) /* Define to 1 if you have the declaration of `program_invocation_name', and to 0 if you don't. */ #define HAVE_DECL_PROGRAM_INVOCATION_NAME 1 @@ -617,31 +596,14 @@ /* Define to 1 if you have the declaration of `program_invocation_short_name', and to 0 if you don't. */ #define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1 -#else -/* Define to 1 if you have the declaration of `program_invocation_name', and - to 0 if you don't. */ -#define HAVE_DECL_PROGRAM_INVOCATION_NAME 0 - -/* Define to 1 if you have the declaration of `program_invocation_short_name', - and to 0 if you don't. */ -#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 0 -#endif /* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_PUTCHAR_UNLOCKED 1 -#else - #define HAVE_DECL_PUTCHAR_UNLOCKED 0 -#endif +#define HAVE_DECL_PUTCHAR_UNLOCKED 1 /* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you don't. */ -#if HAVE_UNLOCKED_IO - #define HAVE_DECL_PUTC_UNLOCKED 1 -#else - #define HAVE_DECL_PUTC_UNLOCKED 0 -#endif +#define HAVE_DECL_PUTC_UNLOCKED 1 /* Define to 1 if you have the declaration of `setenv', and to 0 if you don't. */ @@ -681,11 +643,7 @@ /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ -#if defined(_musl_) - #define HAVE_DECL_SYS_SIGLIST 0 -#else - #define HAVE_DECL_SYS_SIGLIST 1 -#endif +#define HAVE_DECL_SYS_SIGLIST 0 /* Define to 1 if you have the declaration of `towlower', and to 0 if you don't. */ @@ -715,9 +673,20 @@ don't. */ /* #undef HAVE_DECL__SYS_SIGLIST */ +/* Define to 1 if you have the declaration of `__argv', and to 0 if you don't. + */ +#define HAVE_DECL___ARGV 0 + +/* Define to 1 if you have the declaration of `__fpending', and to 0 if you + don't. */ +#define HAVE_DECL___FPENDING 1 + /* Define to 1 if you have the <dirent.h> header file. */ #define HAVE_DIRENT_H 1 +/* Define to 1 if you have the `dirfd' function. */ +#define HAVE_DIRFD 1 + /* Define to 1 if you have the 'dup2' function. */ #define HAVE_DUP2 1 @@ -728,11 +697,7 @@ #define HAVE_FCNTL 1 /* Define to 1 if you have the <features.h> header file. */ -#if defined(__linux__) - #define HAVE_FEATURES_H 1 -#else - #define HAVE_FEATURES_H 0 -#endif +#define HAVE_FEATURES_H 1 /* Define to 1 if you have the `fpurge' function. */ /* #undef HAVE_FPURGE */ @@ -752,6 +717,21 @@ /* Define to 1 if you have the `getdtablesize' function. */ #define HAVE_GETDTABLESIZE 1 +/* Define to 1 if you have the `getegid' function. */ +#define HAVE_GETEGID 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `getexecname' function. */ +/* #undef HAVE_GETEXECNAME */ + +/* Define to 1 if you have the `getgid' function. */ +#define HAVE_GETGID 1 + +/* Define to 1 if you have the `getlocalename_l' function. */ +/* #undef HAVE_GETLOCALENAME_L */ + /* Define to 1 if you have the <getopt.h> header file. */ #define HAVE_GETOPT_H 1 @@ -761,9 +741,15 @@ /* Define to 1 if you have the `getpagesize' function. */ #define HAVE_GETPAGESIZE 1 +/* Define to 1 if you have the `getprogname' function. */ +/* #undef HAVE_GETPROGNAME */ + /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 +/* Define to 1 if you have the `getuid' function. */ +#define HAVE_GETUID 1 + /* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */ #define HAVE_INTMAX_T 1 @@ -777,19 +763,14 @@ /* Define to 1 if you have the `isblank' function. */ #define HAVE_ISBLANK 1 -#if defined(_musl_) -#define HAVE_ISNAND_IN_LIBC 0 -#define HAVE_ISNANF_IN_LIBC 0 -#else /* Define if the isnan(double) function is available in libc. */ #define HAVE_ISNAND_IN_LIBC 1 /* Define if the isnan(float) function is available in libc. */ #define HAVE_ISNANF_IN_LIBC 1 -#endif /* Define if the isnan(long double) function is available in libc. */ -/* #undef HAVE_ISNANL_IN_LIBC */ +#define HAVE_ISNANL_IN_LIBC 1 /* Define to 1 if you have the `issetugid' function. */ /* #undef HAVE_ISSETUGID */ @@ -821,6 +802,9 @@ /* Define if you have the libsigsegv library. */ /* #undef HAVE_LIBSIGSEGV */ +/* Define to 1 if you have the <limits.h> header file. */ +#define HAVE_LIMITS_H 1 + /* Define to 1 if you have the `link' function. */ #define HAVE_LINK 1 @@ -830,9 +814,8 @@ /* Define to 1 if you have the `lstat' function. */ #define HAVE_LSTAT 1 -/* Define to 1 if your system has a GNU libc compatible 'malloc' function, and - to 0 otherwise. */ -#define HAVE_MALLOC_GNU 1 +/* Define to 1 if you have the <malloc.h> header file. */ +#define HAVE_MALLOC_H 1 /* Define if the 'malloc' function is POSIX compliant. */ #define HAVE_MALLOC_POSIX 1 @@ -857,9 +840,13 @@ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `mempcpy' function. */ -#if defined(__linux__) #define HAVE_MEMPCPY 1 -#endif + +/* Define to 1 if <limits.h> defines the MIN and MAX macros. */ +/* #undef HAVE_MINMAX_IN_LIMITS_H */ + +/* Define to 1 if <sys/param.h> defines the MIN and MAX macros. */ +#define HAVE_MINMAX_IN_SYS_PARAM_H 1 /* Define to 1 if you have the `mkdtemp' function. */ #define HAVE_MKDTEMP 1 @@ -880,10 +867,8 @@ /* Define to 1 if you have the `nl_langinfo' function. */ #define HAVE_NL_LANGINFO 1 -/* Define to 1 if libc includes obstacks. */ -#if !defined(_musl_) -#define HAVE_OBSTACK 1 -#endif +/* Define to 1 if the system has obstacks that work with any size object. */ +/* #undef HAVE_OBSTACK */ /* Define to 1 if you have the `opendir' function. */ #define HAVE_OPENDIR 1 @@ -934,7 +919,7 @@ /* #undef HAVE_SAME_LONG_DOUBLE_AS_DOUBLE */ /* Define to 1 if you have the <sched.h> header file. */ -#define HAVE_SCHED_H 1 +/* #undef HAVE_SCHED_H */ /* Define to 1 if you have the `sched_setparam' function. */ /* #undef HAVE_SCHED_SETPARAM */ @@ -946,7 +931,10 @@ #define HAVE_SEARCH_H 1 /* Define to 1 if you have the `secure_getenv' function. */ -/* #undef HAVE_SECURE_GETENV */ +#define HAVE_SECURE_GETENV 1 + +/* Define to 1 if you have the `setdtablesize' function. */ +/* #undef HAVE_SETDTABLESIZE */ /* Define to 1 if you have the `setegid' function. */ /* #undef HAVE_SETEGID */ @@ -1019,11 +1007,7 @@ #define HAVE_STDINT_H_WITH_UINTMAX 1 /* Define to 1 if you have the <stdio_ext.h> header file. */ -#if defined(__FreeBSD__) || defined(__MACH__) -#define HAVE_STDIO_EXT_H 0 -#else #define HAVE_STDIO_EXT_H 1 -#endif /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 @@ -1064,6 +1048,9 @@ /* Define to 1 if you have the <sys/bitypes.h> header file. */ /* #undef HAVE_SYS_BITYPES_H */ +/* Define to 1 if you have the <sys/cdefs.h> header file. */ +#define HAVE_SYS_CDEFS_H 1 + /* Define to 1 if you have the <sys/inttypes.h> header file. */ /* #undef HAVE_SYS_INTTYPES_H */ @@ -1112,6 +1099,9 @@ /* Define to 1 if you have the `uselocale' function. */ #define HAVE_USELOCALE 1 +/* Define if you have a global __progname variable */ +/* #undef HAVE_VAR___PROGNAME */ + /* Define to 1 if you have the `vasnprintf' function. */ /* #undef HAVE_VASNPRINTF */ @@ -1133,9 +1123,6 @@ /* Define to 1 if you have the `wcrtomb' function. */ #define HAVE_WCRTOMB 1 -/* Define to 1 if you have the `wcscoll' function. */ -#define HAVE_WCSCOLL 1 - /* Define to 1 if you have the `wcslen' function. */ #define HAVE_WCSLEN 1 @@ -1165,10 +1152,7 @@ #define HAVE_WORKING_POSIX_SPAWN 1 /* Define to 1 if you have the <xlocale.h> header file. */ -#define HAVE_XLOCALE_H 1 - -/* Define to 1 if the system has the type `clock_t'. */ -#define HAVE_CLOCK_T 1 +/* #undef HAVE_XLOCALE_H */ /* Define to 1 if extending the stack slightly past the limit causes a SIGSEGV, and an alternate stack can be established with sigaltstack, and @@ -1193,34 +1177,34 @@ /* Define to 1 if you have the `_set_invalid_parameter_handler' function. */ /* #undef HAVE__SET_INVALID_PARAMETER_HANDLER */ -/* Define to 1 if you have the `__fpurge' function. */ -#if HAVE_STDIO_EXT_H - #define HAVE___FPURGE 1 -#else - #define HAVE___FPURGE 0 +/* Define to 1 if the compiler supports __builtin_expect, + and to 2 if <builtins.h> does. */ +#define HAVE___BUILTIN_EXPECT 1 +#ifndef HAVE___BUILTIN_EXPECT +# define __builtin_expect(e, c) (e) +#elif HAVE___BUILTIN_EXPECT == 2 +# include <builtins.h> #endif + -#if defined(_musl_) - /* Define to 1 if you have the `__freadahead' function. */ - #define HAVE___FREADAHEAD 1 -#endif +/* Define to 1 if you have the `__fpurge' function. */ +#define HAVE___FPURGE 1 + +/* Define to 1 if you have the `__freadahead' function. */ +/* #undef HAVE___FREADAHEAD */ /* Define to 1 if you have the `__freading' function. */ -#if HAVE_STDIO_EXT_H - #define HAVE___FREADING 1 -#else - #define HAVE___FREADING 0 -#endif +#define HAVE___FREADING 1 /* Define to 1 if you have the `__secure_getenv' function. */ -//#define HAVE___SECURE_GETENV 1 +/* #undef HAVE___SECURE_GETENV */ /* Define as the bit index in the word where to find bit 0 of the exponent of 'long double'. */ -#define LDBL_EXPBIT0_BIT 0 +/* #undef LDBL_EXPBIT0_BIT */ /* Define as the word index where to find the exponent of 'long double'. */ -#define LDBL_EXPBIT0_WORD 2 +/* #undef LDBL_EXPBIT0_WORD */ /* Define as the bit index in the word where to find the sign of 'long double'. */ @@ -1242,6 +1226,10 @@ /* Define to a substitute value for mmap()'s MAP_ANONYMOUS flag. */ /* #undef MAP_ANONYMOUS */ +/* Define if the mbrtowc function does not return (size_t) -2 for empty input. + */ +/* #undef MBRTOWC_EMPTY_INPUT_BUG */ + /* Define if the mbrtowc function has the NULL pwc argument bug. */ /* #undef MBRTOWC_NULL_ARG1_BUG */ @@ -1254,6 +1242,12 @@ /* Define if the mbrtowc function returns a wrong return value. */ /* #undef MBRTOWC_RETVAL_BUG */ +/* Use GNU style printf and scanf. */ +#ifndef __USE_MINGW_ANSI_STDIO +# define __USE_MINGW_ANSI_STDIO 1 +#endif + + /* Define to 1 if assertions should be disabled. */ /* #undef NDEBUG */ @@ -1295,7 +1289,7 @@ /* Define if the vasnprintf implementation needs special code for infinite 'long double' arguments. */ -#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1 +/* #undef NEED_PRINTF_INFINITE_LONG_DOUBLE */ /* Define if the vasnprintf implementation needs special code for 'long double' arguments. */ @@ -1327,7 +1321,7 @@ /* #undef PACKAGE_PACKAGER_VERSION */ /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "GNU M4 3.0.0" +#define PACKAGE_STRING "GNU M4 1.4.18" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "m4" @@ -1336,10 +1330,7 @@ #define PACKAGE_URL "http://www.gnu.org/software/m4/" /* Define to the version of this package. */ -#define PACKAGE_VERSION "3.0.0" - -/* the number of pending output bytes on stream 'fp' */ -/* #undef PENDING_OUTPUT_N_BYTES */ +#define PACKAGE_VERSION "1.4.18" /* Define if <inttypes.h> exists and defines unusable PRI* macros. */ /* #undef PRI_MACROS_BROKEN */ @@ -1377,6 +1368,9 @@ such as on Solaris 9 or cygwin 1.5. */ /* #undef RENAME_TRAILING_SLASH_SOURCE_BUG */ +/* Define to 1 if gnulib's dirfd() replacement is used. */ +/* #undef REPLACE_DIRFD */ + /* Define to 1 if stat needs help when passed a directory name with a trailing slash */ /* #undef REPLACE_FUNC_STAT_DIR */ @@ -1434,11 +1428,11 @@ #define STRERROR_R_CHAR_P 1 /* Shell used by syscmd and esyscmd, must accept -c argument. */ -#define SYSCMD_SHELL "/bin/sh" +#define SYSCMD_SHELL "/var/empty/bash-4.4-p23/bin/bash" /* Define to the prefix of C symbols at the assembler and linker level, either an underscore or empty. */ -#define USER_LABEL_PREFIX +#define USER_LABEL_PREFIX /* Define if the POSIX multithreading library can be used. */ /* #undef USE_POSIX_THREADS */ @@ -1465,7 +1459,7 @@ #ifndef _ALL_SOURCE # define _ALL_SOURCE 1 #endif -/* Enable general extensions on OS X. */ +/* Enable general extensions on macOS. */ #ifndef _DARWIN_C_SOURCE # define _DARWIN_C_SOURCE 1 #endif @@ -1477,6 +1471,34 @@ #ifndef _POSIX_PTHREAD_SEMANTICS # define _POSIX_PTHREAD_SEMANTICS 1 #endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# define __STDC_WANT_IEC_60559_BFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# define __STDC_WANT_IEC_60559_DFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# define __STDC_WANT_LIB_EXT2__ 1 +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# define __STDC_WANT_MATH_SPEC_FUNCS__ 1 +#endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE 1 @@ -1502,7 +1524,7 @@ /* #undef USE_WINDOWS_THREADS */ /* Version number of package */ -#define VERSION "3.0.0" +#define VERSION "1.4.18" /* Define to 1 if unsetenv returns void instead of int. */ /* #undef VOID_UNSETENV */ @@ -1585,7 +1607,13 @@ /* Define to rpl_ if the getopt replacement functions and variables should be used. */ -#define __GETOPT_PREFIX rpl_ +/* #undef __GETOPT_PREFIX */ + +/* Define to 1 if the system <stdint.h> predates C++11. */ +/* #undef __STDC_CONSTANT_MACROS */ + +/* Define to 1 if the system <stdint.h> predates C++11. */ +/* #undef __STDC_LIMIT_MACROS */ /* Please see the Gnulib manual for how to use these macros. @@ -1598,29 +1626,50 @@ 'reference to static identifier "f" in extern inline function'. This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. - Suppress the use of extern inline on problematic Apple configurations, as - Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., - <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. - Perhaps Apple will fix this some day. */ -#if (defined __APPLE__ \ - && ((! defined _DONT_USE_CTYPE_INLINE_ \ - && (defined __GNUC__ || defined __cplusplus)) \ - || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ - && defined __GNUC__ && ! defined __cplusplus))) -# define _GL_EXTERN_INLINE_APPLE_BUG + Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) + on configurations that mistakenly use 'static inline' to implement + functions or macros in standard C headers like <ctype.h>. For example, + if isdigit is mistakenly implemented via a static inline function, + a program containing an extern inline function that calls isdigit + may not work since the C standard prohibits extern inline functions + from calling static functions. This bug is known to occur on: + + OS X 10.8 and earlier; see: + http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html + + DragonFly; see + http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log + + FreeBSD; see: + http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html + + OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and + for clang but remains for g++; see <http://trac.macports.org/ticket/41033>. + Assume DragonFly and FreeBSD will be similar. */ +#if (((defined __APPLE__ && defined __MACH__) \ + || defined __DragonFly__ || defined __FreeBSD__) \ + && (defined __header_inline \ + ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ + && ! defined __clang__) \ + : ((! defined _DONT_USE_CTYPE_INLINE_ \ + && (defined __GNUC__ || defined __cplusplus)) \ + || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ + && defined __GNUC__ && ! defined __cplusplus)))) +# define _GL_EXTERN_INLINE_STDHEADER_BUG #endif #if ((__GNUC__ \ ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ : (199901L <= __STDC_VERSION__ \ && !defined __HP_cc \ + && !defined __PGI \ && !(defined __SUNPRO_C && __STDC__))) \ - && !defined _GL_EXTERN_INLINE_APPLE_BUG) + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # define _GL_INLINE inline # define _GL_EXTERN_INLINE extern inline # define _GL_EXTERN_INLINE_IN_USE #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ - && !defined _GL_EXTERN_INLINE_APPLE_BUG) -# if __GNUC_GNU_INLINE__ + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) +# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) # else @@ -1633,17 +1682,19 @@ # define _GL_EXTERN_INLINE static _GL_UNUSED #endif -#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +/* In GCC 4.6 (inclusive) to 5.1 (exclusive), + suppress bogus "no previous prototype for 'FOO'" + and "no previous declaration for 'FOO'" diagnostics, + when FOO is an inline function in the header; see + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */ +#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ # define _GL_INLINE_HEADER_CONST_PRAGMA # else # define _GL_INLINE_HEADER_CONST_PRAGMA \ _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") # endif - /* Suppress GCC's bogus "no previous prototype for 'FOO'" - and "no previous declaration for 'FOO'" diagnostics, - when FOO is an inline function in the header; see - <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */ # define _GL_INLINE_HEADER_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ @@ -1662,9 +1713,6 @@ /* A replacement for va_copy, if needed. */ #define gl_va_copy(a,b) ((a) = (b)) -/* Define to rpl_gmtime if the replacement function should be used. */ -/* #undef gmtime */ - /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus @@ -1684,9 +1732,6 @@ # define __GNUC_STDC_INLINE__ 1 #endif -/* Define to rpl_localtime if the replacement function should be used. */ -/* #undef localtime */ - /* Define to a type if <wchar.h> does not define. */ /* #undef mbstate_t */ @@ -1787,6 +1832,16 @@ is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED +/* gcc supports the "unused" attribute on possibly unused labels, and + g++ has since version 4.5. Note to support C++ as well as C, + _GL_UNUSED_LABEL should be used with a trailing ; */ +#if !defined __cplusplus || __GNUC__ > 4 \ + || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# define _GL_UNUSED_LABEL _GL_UNUSED +#else +# define _GL_UNUSED_LABEL +#endif + /* The __pure__ attribute was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) @@ -1804,3 +1859,6 @@ /* Define as a macro for copying va_list variables. */ /* #undef va_copy */ +#undef HAVE_SYS_SINGLE_THREADED_H +#define __attribute_maybe_unused__ +#define __attribute_nonnull__(...) diff --git a/contrib/tools/m4/lib/config-musl.h b/contrib/tools/m4/lib/config-musl.h new file mode 100644 index 0000000000..0f38ff5efd --- /dev/null +++ b/contrib/tools/m4/lib/config-musl.h @@ -0,0 +1,9 @@ +#pragma once + +#define HAVE___FREADAHEAD 1 + +#define regcomp rpl_regcomp +#define regfree rpl_regfree + +#define _GL_ARG_NONNULL(...) +#define _GL_ATTRIBUTE_FORMAT_PRINTF(...) diff --git a/contrib/tools/m4/lib/config-osx.h b/contrib/tools/m4/lib/config-osx.h new file mode 100644 index 0000000000..56a4173a06 --- /dev/null +++ b/contrib/tools/m4/lib/config-osx.h @@ -0,0 +1,32 @@ +#pragma once + +#include "config-linux.h" + +#undef HAVE_STDIO_EXT_H +#undef HAVE_FEATURES_H +#undef HAVE_UCONTEXT_H + +#undef HAVE_SECURE_GETENV +#undef HAVE___FREADING + +#undef HAVE_DECL_PROGRAM_INVOCATION_NAME +#undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME +#define HAVE_VAR___PROGNAME 1 + +// fread_unlocked should be controlled by USE_UNLOCKED_IO, yet it is not +#undef USE_UNLOCKED_IO +#undef HAVE_DECL_FEOF_UNLOCKED +#undef HAVE_DECL_FERROR_UNLOCKED +#undef HAVE_DECL_FFLUSH_UNLOCKED +#undef HAVE_DECL_FGETS_UNLOCKED +#undef HAVE_DECL_FPUTC_UNLOCKED +#undef HAVE_DECL_FPUTS_UNLOCKED +#undef HAVE_DECL_FREAD_UNLOCKED +#undef HAVE_DECL_FWRITE_UNLOCKED +#undef HAVE_DECL_GETCHAR_UNLOCKED +#undef HAVE_DECL_GETC_UNLOCKED +#undef HAVE_DECL_PUTCHAR_UNLOCKED +#undef HAVE_DECL_PUTC_UNLOCKED + +#define _GL_ARG_NONNULL(...) +#define _GL_ATTRIBUTE_FORMAT_PRINTF(...) diff --git a/contrib/tools/m4/lib/config-win.h b/contrib/tools/m4/lib/config-win.h index ec0f1bc242..5470ade801 100644 --- a/contrib/tools/m4/lib/config-win.h +++ b/contrib/tools/m4/lib/config-win.h @@ -860,9 +860,6 @@ /* Define to 1 if you have the <search.h> header file. */ #define HAVE_SEARCH_H 1 -/* Define to 1 if you have the `secure_getenv' function. */ -/* #undef HAVE_SECURE_GETENV */ - /* Define to 1 if you have the `setegid' function. */ /* #undef HAVE_SETEGID */ @@ -1204,9 +1201,6 @@ char *strsignal (int signum); large precisions without arbitrary bounds. */ #define NEED_PRINTF_UNBOUNDED_PRECISION 1 -/* Define to 1 if open() fails to recognize a trailing slash. */ -/* #undef OPEN_TRAILING_SLASH_BUG */ - /* Name of package */ #define PACKAGE "m4" @@ -1226,7 +1220,7 @@ char *strsignal (int signum); /* #undef PACKAGE_PACKAGER_VERSION */ /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "GNU M4 3.0.0" +#define PACKAGE_STRING "GNU M4 1.4.18" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "m4" @@ -1235,7 +1229,7 @@ char *strsignal (int signum); #define PACKAGE_URL "http://www.gnu.org/software/m4/" /* Define to the version of this package. */ -#define PACKAGE_VERSION "3.0.0" +#define PACKAGE_VERSION "1.4.18" /* the number of pending output bytes on stream 'fp' */ #if WIN_SDK10 @@ -1405,7 +1399,7 @@ char *strsignal (int signum); /* #undef USE_WINDOWS_THREADS */ /* Version number of package */ -#define VERSION "3.0.0" +#define VERSION "1.4.18" /* Define to 1 if unsetenv returns void instead of int. */ /* #undef VOID_UNSETENV */ @@ -1708,5 +1702,12 @@ char *strsignal (int signum); /* Define as a macro for copying va_list variables. */ #define va_copy gl_va_copy +#undef HAVE_SECURE_GETENV +#define secure_getenv getenv + +#define HAVE_DECL___ARGV 1 #define HAVE_ISNANL_IN_LIBC 1 #define HAVE_ISNAND_IN_LIBC 1 + +#define _GL_ARG_NONNULL(...) +#define _GL_ATTRIBUTE_FORMAT_PRINTF(...) diff --git a/contrib/tools/m4/lib/config.h b/contrib/tools/m4/lib/config.h index 5623f311fa..ec0b9be893 100644 --- a/contrib/tools/m4/lib/config.h +++ b/contrib/tools/m4/lib/config.h @@ -1,7 +1,13 @@ #pragma once -#if defined(_MSC_VER) +#if defined(__APPLE__) +# include "config-osx.h" +#elif defined(_MSC_VER) # include "config-win.h" #else # include "config-linux.h" #endif + +#if defined(_musl_) +# include "config-musl.h" +#endif diff --git a/contrib/tools/m4/lib/configmake-linux.h b/contrib/tools/m4/lib/configmake-linux.h index 75ea1d7d03..b98a0b824a 100644 --- a/contrib/tools/m4/lib/configmake-linux.h +++ b/contrib/tools/m4/lib/configmake-linux.h @@ -1,3 +1,28 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ - -#define LIBDIR "/usr/local/lib" +#define PREFIX "/var/empty/gnum4-1.4.18" +#define EXEC_PREFIX "/var/empty/gnum4-1.4.18" +#define BINDIR "/var/empty/gnum4-1.4.18/bin" +#define SBINDIR "/var/empty/gnum4-1.4.18/sbin" +#define LIBEXECDIR "/var/empty/gnum4-1.4.18/libexec" +#define DATAROOTDIR "/var/empty/gnum4-1.4.18/share" +#define DATADIR "/var/empty/gnum4-1.4.18/share" +#define SYSCONFDIR "/var/empty/gnum4-1.4.18/etc" +#define SHAREDSTATEDIR "/var/empty/gnum4-1.4.18/com" +#define LOCALSTATEDIR "/var/empty/gnum4-1.4.18/var" +#define RUNSTATEDIR "/var/empty/gnum4-1.4.18/var/run" +#define INCLUDEDIR "/var/empty/gnum4-1.4.18/include" +#define OLDINCLUDEDIR "/usr/include" +#define DOCDIR "/var/empty/gnum4-1.4.18/share/doc/m4" +#define INFODIR "/var/empty/gnum4-1.4.18/share/info" +#define HTMLDIR "/var/empty/gnum4-1.4.18/share/doc/m4" +#define DVIDIR "/var/empty/gnum4-1.4.18/share/doc/m4" +#define PDFDIR "/var/empty/gnum4-1.4.18/share/doc/m4" +#define PSDIR "/var/empty/gnum4-1.4.18/share/doc/m4" +#define LIBDIR "/var/empty/gnum4-1.4.18/lib" +#define LISPDIR "/var/empty/gnum4-1.4.18/share/emacs/site-lisp" +#define LOCALEDIR "/var/empty/gnum4-1.4.18/share/locale" +#define MANDIR "/var/empty/gnum4-1.4.18/share/man" +#define PKGDATADIR "/var/empty/gnum4-1.4.18/share/m4" +#define PKGINCLUDEDIR "/var/empty/gnum4-1.4.18/include/m4" +#define PKGLIBDIR "/var/empty/gnum4-1.4.18/lib/m4" +#define PKGLIBEXECDIR "/var/empty/gnum4-1.4.18/libexec/m4" diff --git a/contrib/tools/m4/lib/dirname-lgpl.c b/contrib/tools/m4/lib/dirname-lgpl.c index 82f66301f2..a7aabf9416 100644 --- a/contrib/tools/m4/lib/dirname-lgpl.c +++ b/contrib/tools/m4/lib/dirname-lgpl.c @@ -1,6 +1,6 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/dirname.c b/contrib/tools/m4/lib/dirname.c index 1fb65888bb..07aac13402 100644 --- a/contrib/tools/m4/lib/dirname.c +++ b/contrib/tools/m4/lib/dirname.c @@ -1,6 +1,6 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/dirname.h b/contrib/tools/m4/lib/dirname.h index 4ad0312008..875b31bae5 100644 --- a/contrib/tools/m4/lib/dirname.h +++ b/contrib/tools/m4/lib/dirname.h @@ -1,6 +1,6 @@ /* Take file names apart into directory and base names. - Copyright (C) 1998, 2001, 2003-2006, 2009-2013 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -31,6 +31,10 @@ # define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 # endif +#ifdef __cplusplus +extern "C" { +#endif + # if GNULIB_DIRNAME char *base_name (char const *file); char *dir_name (char const *file); @@ -43,4 +47,8 @@ char *last_component (char const *file) _GL_ATTRIBUTE_PURE; bool strip_trailing_slashes (char *file); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* not DIRNAME_H_ */ diff --git a/contrib/tools/m4/lib/dosname.h b/contrib/tools/m4/lib/dosname.h index ba63ce4bd3..83a953f3c0 100644 --- a/contrib/tools/m4/lib/dosname.h +++ b/contrib/tools/m4/lib/dosname.h @@ -1,6 +1,6 @@ /* File names on MS-DOS/Windows systems. - Copyright (C) 2000-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2004-2006, 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 diff --git a/contrib/tools/m4/lib/dup-safer-flag.c b/contrib/tools/m4/lib/dup-safer-flag.c index 8a09821dc8..f5b81b733c 100644 --- a/contrib/tools/m4/lib/dup-safer-flag.c +++ b/contrib/tools/m4/lib/dup-safer-flag.c @@ -1,7 +1,7 @@ /* Duplicate a file descriptor result, avoiding clobbering STD{IN,OUT,ERR}_FILENO, with specific flags. - Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 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 diff --git a/contrib/tools/m4/lib/dup-safer.c b/contrib/tools/m4/lib/dup-safer.c index c20310785a..6ed8f79253 100644 --- a/contrib/tools/m4/lib/dup-safer.c +++ b/contrib/tools/m4/lib/dup-safer.c @@ -1,6 +1,6 @@ /* Invoke dup, but avoid some glitches. - Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 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 diff --git a/contrib/tools/m4/lib/dup2.c b/contrib/tools/m4/lib/dup2.c index 9219eb3823..13dda55eef 100644 --- a/contrib/tools/m4/lib/dup2.c +++ b/contrib/tools/m4/lib/dup2.c @@ -1,6 +1,6 @@ /* Duplicate an open file descriptor to a specified file descriptor. - Copyright (C) 1999, 2004-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-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 @@ -85,6 +85,57 @@ ms_windows_dup2 (int fd, int desired_fd) # define dup2 ms_windows_dup2 +# elif defined __KLIBC__ + +# error #include <InnoTekLIBC/backend.h> + +static int +klibc_dup2dirfd (int fd, int desired_fd) +{ + int tempfd; + int dupfd; + + tempfd = open ("NUL", O_RDONLY); + if (tempfd == -1) + return -1; + + if (tempfd == desired_fd) + { + close (tempfd); + + char path[_MAX_PATH]; + if (__libc_Back_ioFHToPath (fd, path, sizeof (path))) + return -1; + + return open(path, O_RDONLY); + } + + dupfd = klibc_dup2dirfd (fd, desired_fd); + + close (tempfd); + + return dupfd; +} + +static int +klibc_dup2 (int fd, int desired_fd) +{ + int dupfd; + struct stat sbuf; + + dupfd = dup2 (fd, desired_fd); + if (dupfd == -1 && errno == ENOTSUP \ + && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + close (desired_fd); + + return klibc_dup2dirfd (fd, desired_fd); + } + + return dupfd; +} + +# define dup2 klibc_dup2 # endif int @@ -96,7 +147,11 @@ rpl_dup2 (int fd, int desired_fd) /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF. On Cygwin 1.5.x, dup2 (1, 1) returns 0. On Cygwin 1.7.17, dup2 (1, -1) dumps core. + On Cygwin 1.7.25, dup2 (1, 256) can dump core. On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */ +# if HAVE_SETDTABLESIZE + setdtablesize (desired_fd + 1); +# endif if (desired_fd < 0) fd = desired_fd; if (fd == desired_fd) diff --git a/contrib/tools/m4/lib/error.c b/contrib/tools/m4/lib/error.c index ca9e61b41f..f77439ecdb 100644 --- a/contrib/tools/m4/lib/error.c +++ b/contrib/tools/m4/lib/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -39,6 +39,11 @@ # include <stdint.h> # include <wchar.h> # define mbsrtowcs __mbsrtowcs +# define USE_UNLOCKED_IO 0 +# define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b) +# define _GL_ARG_NONNULL(a) +#else +# include "getprogname.h" #endif #if USE_UNLOCKED_IO @@ -72,14 +77,14 @@ extern void __error (int status, int errnum, const char *message, ...) extern void __error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ...) - __attribute__ ((__format__ (__printf__, 5, 6)));; + __attribute__ ((__format__ (__printf__, 5, 6))); # define error __error # define error_at_line __error_at_line # include <libio/iolibio.h> -# define fflush(s) INTUSE(_IO_fflush) (s) +# define fflush(s) _IO_fflush (s) # undef putc -# define putc(c, fp) INTUSE(_IO_putc) (c, fp) +# define putc(c, fp) _IO_putc (c, fp) # error #include <bits/libc-lock.h> @@ -110,9 +115,7 @@ int strerror_r (); # endif # endif -/* The calling program should define program_name and set it to the - name of the executing program. */ -extern char *program_name; +#define program_name getprogname () # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r @@ -159,10 +162,8 @@ flush_stdout (void) /* POSIX states that fflush (stdout) after fclose is unspecified; it is safe in glibc, but not on all other platforms. fflush (NULL) is always defined, but too draconian. */ -#if !defined(_WIN32) && !defined(_WIN64) if (0 <= stdout_fd && is_open (stdout_fd)) #endif -#endif fflush (stdout); } @@ -173,7 +174,7 @@ print_errno_message (int errnum) #if defined HAVE_STRERROR_R || _LIBC char errbuf[1024]; -# if STRERROR_R_CHAR_P || _LIBC +# if _LIBC || STRERROR_R_CHAR_P s = __strerror_r (errnum, errbuf, sizeof errbuf); # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) @@ -197,13 +198,12 @@ print_errno_message (int errnum) #endif } -static void +static void _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3)) error_tail (int status, int errnum, const char *message, va_list args) { #if _LIBC if (_IO_fwide (stderr, 0) > 0) { -# define ALLOCA_LIMIT 2000 size_t len = strlen (message) + 1; wchar_t *wmessage = NULL; mbstate_t st; @@ -239,7 +239,7 @@ error_tail (int status, int errnum, const char *message, va_list args) if (res != len) break; - if (__builtin_expect (len >= SIZE_MAX / 2, 0)) + if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0)) { /* This really should not happen if everything is fine. */ res = (size_t) -1; @@ -344,7 +344,10 @@ error_at_line (int status, int errnum, const char *file_name, if (old_line_number == line_number && (file_name == old_file_name - || strcmp (old_file_name, file_name) == 0)) + || (old_file_name != NULL + && file_name != NULL + && strcmp (old_file_name, file_name) == 0))) + /* Simply return and print nothing. */ return; @@ -376,10 +379,10 @@ error_at_line (int status, int errnum, const char *file_name, } #if _LIBC - __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", + __fxprintf (NULL, file_name != NULL ? "%s:%u: " : " ", file_name, line_number); #else - fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", + fprintf (stderr, file_name != NULL ? "%s:%u: " : " ", file_name, line_number); #endif diff --git a/contrib/tools/m4/lib/error.h b/contrib/tools/m4/lib/error.h index afcb0e10c8..6a69db0935 100644 --- a/contrib/tools/m4/lib/error.h +++ b/contrib/tools/m4/lib/error.h @@ -1,5 +1,5 @@ /* Declaration for error-reporting function - Copyright (C) 1995-1997, 2003, 2006, 2008-2013 Free Software Foundation, + Copyright (C) 1995-1997, 2003, 2006, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -31,6 +31,16 @@ # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ #endif +/* On mingw, the flavor of printf depends on whether the extensions module + * is in use; the check for <stdio.h> determines the witness macro. */ +#ifndef _GL_ATTRIBUTE_SPEC_PRINTF +# if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU +# define _GL_ATTRIBUTE_SPEC_PRINTF __gnu_printf__ +# else +# define _GL_ATTRIBUTE_SPEC_PRINTF __printf__ +# endif +#endif + #ifdef __cplusplus extern "C" { #endif @@ -40,11 +50,11 @@ extern "C" { If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */ extern void error (int __status, int __errnum, const char *__format, ...) - _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 3, 4)); extern void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __lineno, const char *__format, ...) - _GL_ATTRIBUTE_FORMAT ((__printf__, 5, 6)); + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 5, 6)); /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this diff --git a/contrib/tools/m4/lib/execute.c b/contrib/tools/m4/lib/execute.c index 1bb577100e..e802e6aa02 100644 --- a/contrib/tools/m4/lib/execute.c +++ b/contrib/tools/m4/lib/execute.c @@ -1,5 +1,5 @@ /* Creation of autonomous subprocesses. - Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -28,7 +28,6 @@ #include <signal.h> #include <unistd.h> -#include "penviron.h" #include "error.h" #include "fatal-signal.h" #include "wait-process.h" @@ -49,11 +48,9 @@ #endif -/* The results of open() in this file are not used with fchdir, - therefore save some unnecessary work in fchdir.c. */ -#undef open -#undef close - +#if defined(__FreeBSD__) || defined(__MACH__) + extern char** environ; +#endif #if defined EINTR && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) diff --git a/contrib/tools/m4/lib/execute.h b/contrib/tools/m4/lib/execute.h index 1fdc2abbad..224141ec3b 100644 --- a/contrib/tools/m4/lib/execute.h +++ b/contrib/tools/m4/lib/execute.h @@ -1,5 +1,5 @@ /* Creation of autonomous subprocesses. - Copyright (C) 2001-2003, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/exitfail.c b/contrib/tools/m4/lib/exitfail.c index b0b4ebe45a..8033c22ab4 100644 --- a/contrib/tools/m4/lib/exitfail.c +++ b/contrib/tools/m4/lib/exitfail.c @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 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 diff --git a/contrib/tools/m4/lib/exitfail.h b/contrib/tools/m4/lib/exitfail.h index e54333bdd2..62311bd48c 100644 --- a/contrib/tools/m4/lib/exitfail.h +++ b/contrib/tools/m4/lib/exitfail.h @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002, 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 diff --git a/contrib/tools/m4/lib/fatal-signal.c b/contrib/tools/m4/lib/fatal-signal.c index 8f7cb8ea3b..2126a90a4b 100644 --- a/contrib/tools/m4/lib/fatal-signal.c +++ b/contrib/tools/m4/lib/fatal-signal.c @@ -1,5 +1,5 @@ /* Emergency actions in case of a fatal signal. - Copyright (C) 2003-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/fatal-signal.h b/contrib/tools/m4/lib/fatal-signal.h index f5df78a048..01b9ae036a 100644 --- a/contrib/tools/m4/lib/fatal-signal.h +++ b/contrib/tools/m4/lib/fatal-signal.h @@ -1,5 +1,5 @@ /* Emergency actions in case of a fatal signal. - Copyright (C) 2003-2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/fclose.c b/contrib/tools/m4/lib/fclose.c index 90ed653a0e..d4783f6d8d 100644 --- a/contrib/tools/m4/lib/fclose.c +++ b/contrib/tools/m4/lib/fclose.c @@ -1,5 +1,5 @@ /* fclose replacement. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/fcntl.c b/contrib/tools/m4/lib/fcntl.c index 735fa66f4d..360f1f0da6 100644 --- a/contrib/tools/m4/lib/fcntl.c +++ b/contrib/tools/m4/lib/fcntl.c @@ -1,6 +1,6 @@ /* Provide file descriptor control. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + 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 @@ -89,8 +89,25 @@ dupfd (int oldfd, int newfd, int flags) inherit, /* InheritHandle */ DUPLICATE_SAME_ACCESS)) /* Options */ { - /* TODO: Translate GetLastError () into errno. */ - errno = EMFILE; + switch (GetLastError ()) + { + case ERROR_TOO_MANY_OPEN_FILES: + errno = EMFILE; + break; + case ERROR_INVALID_HANDLE: + case ERROR_INVALID_TARGET_HANDLE: + case ERROR_DIRECT_ACCESS_HANDLE: + errno = EBADF; + break; + case ERROR_INVALID_PARAMETER: + case ERROR_INVALID_FUNCTION: + case ERROR_INVALID_ACCESS: + errno = EINVAL; + break; + default: + errno = EACCES; + break; + } result = -1; break; } @@ -98,7 +115,6 @@ dupfd (int oldfd, int newfd, int flags) if (duplicated_fd < 0) { CloseHandle (new_handle); - errno = EMFILE; result = -1; break; } @@ -146,6 +162,93 @@ dupfd (int oldfd, int newfd, int flags) } #endif /* W32 */ +#ifdef __KLIBC__ + +# define INCL_DOS +# error #include <os2.h> + +static int +klibc_fcntl (int fd, int action, /* arg */...) +{ + va_list arg_ptr; + int arg; + struct stat sbuf; + int result = -1; + + va_start (arg_ptr, action); + arg = va_arg (arg_ptr, int); + result = fcntl (fd, action, arg); + /* EPERM for F_DUPFD, ENOTSUP for others */ + if (result == -1 && (errno == EPERM || errno == ENOTSUP) + && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + ULONG ulMode; + + switch (action) + { + case F_DUPFD: + /* Find available fd */ + while (fcntl (arg, F_GETFL) != -1 || errno != EBADF) + arg++; + + result = dup2 (fd, arg); + break; + + /* Using underlying APIs is right ? */ + case F_GETFD: + if (DosQueryFHState (fd, &ulMode)) + break; + + result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0; + break; + + case F_SETFD: + if (arg & ~FD_CLOEXEC) + break; + + if (DosQueryFHState (fd, &ulMode)) + break; + + if (arg & FD_CLOEXEC) + ulMode |= OPEN_FLAGS_NOINHERIT; + else + ulMode &= ~OPEN_FLAGS_NOINHERIT; + + /* Filter supported flags. */ + ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR + | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT); + + if (DosSetFHState (fd, ulMode)) + break; + + result = 0; + break; + + case F_GETFL: + result = 0; + break; + + case F_SETFL: + if (arg != 0) + break; + + result = 0; + break; + + default : + errno = EINVAL; + break; + } + } + + va_end (arg_ptr); + + return result; +} + +# define fcntl klibc_fcntl +#endif + /* Perform the specified ACTION on the file descriptor FD, possibly using the argument ARG further described below. This replacement handles the following actions, and forwards all others on to the diff --git a/contrib/tools/m4/lib/fcntl.h b/contrib/tools/m4/lib/fcntl.h index 39b4f4d5eb..85c8a87362 100644 --- a/contrib/tools/m4/lib/fcntl.h +++ b/contrib/tools/m4/lib/fcntl.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Like <fcntl.h>, but with non-working flags defined to 0. - Copyright (C) 2006-2021 Free Software Foundation, Inc. + 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 @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* written by Paul Eggert */ @@ -40,12 +40,6 @@ #endif #include_next <fcntl.h> -/* Native Windows platforms declare open(), creat() in <io.h>. */ -#if (IN_M4_GNULIB_TESTS || 1 || defined GNULIB_POSIXCHECK) \ - && (defined _WIN32 && ! defined __CYGWIN__) -# include <io.h> -#endif - #else /* Normal invocation convention. */ @@ -66,12 +60,6 @@ /* The include_next requires a split double-inclusion guard. */ #include_next <fcntl.h> -/* Native Windows platforms declare open(), creat() in <io.h>. */ -#if (IN_M4_GNULIB_TESTS || 1 || defined GNULIB_POSIXCHECK) \ - && (defined _WIN32 && ! defined __CYGWIN__) -# include <io.h> -#endif - #ifndef _GL_M4_FCNTL_H #define _GL_M4_FCNTL_H @@ -79,24 +67,14 @@ # include <unistd.h> #endif +/* Native Windows platforms declare open(), creat() in <io.h>. */ +#if (1 || defined GNULIB_POSIXCHECK) \ + && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) +# include <io.h> +#endif -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ -/* C++ compatible function declaration macros. - Copyright (C) 2010-2021 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 <https://www.gnu.org/licenses/>. */ +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ #ifndef _GL_CXXDEFS_H #define _GL_CXXDEFS_H @@ -229,16 +207,6 @@ _GL_EXTERN_C int _gl_cxxalias_dummy #endif -/* _GL_CXXALIAS_MDA (func, rettype, parameters); - is to be used when func is a Microsoft deprecated alias, on native Windows. - It declares a C++ alias called GNULIB_NAMESPACE::func - that redirects to _func, if GNULIB_NAMESPACE is defined. - Example: - _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); - */ -#define _GL_CXXALIAS_MDA(func,rettype,parameters) \ - _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) - /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); except that the C function rpl_func may have a slightly different @@ -264,14 +232,6 @@ _GL_EXTERN_C int _gl_cxxalias_dummy #endif -/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); - is like _GL_CXXALIAS_MDA (func, rettype, parameters); - except that the C function func may have a slightly different declaration. - A cast is used to silence the "invalid conversion" error that would - otherwise occur. */ -#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ - _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) - /* _GL_CXXALIAS_SYS (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that redirects to the system provided function func, if GNULIB_NAMESPACE @@ -367,9 +327,9 @@ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) # define _GL_CXXALIASWARN_1(func,namespace) \ _GL_CXXALIASWARN_2 (func, namespace) -/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, +/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, we enable the warning only when not optimizing. */ -# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) +# if !__OPTIMIZE__ # define _GL_CXXALIASWARN_2(func,namespace) \ _GL_WARN_ON_USE (func, \ "The symbol ::" #func " refers to the system function. " \ @@ -395,13 +355,16 @@ GNULIB_NAMESPACE) # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) -/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, +/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, we enable the warning only when not optimizing. */ -# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) +# if !__OPTIMIZE__ # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ - _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ + _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ "The symbol ::" #func " refers to the system function. " \ "Use " #namespace "::" #func " instead.") +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + extern __typeof__ (func) func # else # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ _GL_EXTERN_C int _gl_cxxalias_dummy @@ -414,27 +377,11 @@ #endif /* _GL_CXXDEFS_H */ /* The definition of _GL_ARG_NONNULL is copied here. */ -/* A C macro for declaring that specific arguments must not be NULL. - Copyright (C) 2009-2021 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 <https://www.gnu.org/licenses/>. */ - /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools that the values passed as arguments n, ..., m must be non-NULL pointers. n = 1 stands for the first argument, n = 2 for the second argument etc. */ #ifndef _GL_ARG_NONNULL -# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ +# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) # else # define _GL_ARG_NONNULL(params) @@ -442,143 +389,40 @@ #endif /* The definition of _GL_WARN_ON_USE is copied here. */ -/* A C macro for emitting warnings if a function is used. - Copyright (C) 2010-2021 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 <https://www.gnu.org/licenses/>. */ - -/* _GL_WARN_ON_USE (function, "literal string") issues a declaration - for FUNCTION which will then trigger a compiler warning containing - the text of "literal string" anywhere that function is called, if - supported by the compiler. If the compiler does not support this - feature, the macro expands to an unused extern declaration. - - _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the - attribute used in _GL_WARN_ON_USE. If the compiler does not support - this feature, it expands to empty. - - These macros are useful for marking a function as a potential - portability trap, with the intent that "literal string" include - instructions on the replacement function that should be used - instead. - _GL_WARN_ON_USE is for functions with 'extern' linkage. - _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' - linkage. - - However, one of the reasons that a function is a portability trap is - if it has the wrong signature. Declaring FUNCTION with a different - signature in C is a compilation error, so this macro must use the - same type as any existing declaration so that programs that avoid - the problematic FUNCTION do not fail to compile merely because they - included a header that poisoned the function. But this implies that - _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already - have a declaration. Use of this macro implies that there must not - be any other macro hiding the declaration of FUNCTION; but - undefining FUNCTION first is part of the poisoning process anyway - (although for symbols that are provided only via a macro, the result - is a compilation error rather than a warning containing - "literal string"). Also note that in C++, it is only safe to use if - FUNCTION has no overloads. - - For an example, it is possible to poison 'getline' by: - - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], - [getline]) in configure.ac, which potentially defines - HAVE_RAW_DECL_GETLINE - - adding this code to a header that wraps the system <stdio.h>: - #undef getline - #if HAVE_RAW_DECL_GETLINE - _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" - "not universally present; use the gnulib module getline"); - #endif - - It is not possible to directly poison global variables. But it is - possible to write a wrapper accessor function, and poison that - (less common usage, like &environ, will cause a compilation error - rather than issue the nice warning, but the end result of informing - the developer about their portability problem is still achieved): - #if HAVE_RAW_DECL_ENVIRON - static char *** - rpl_environ (void) { return &environ; } - _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); - # undef environ - # define environ (*rpl_environ ()) - #endif - or better (avoiding contradictory use of 'static' and 'extern'): - #if HAVE_RAW_DECL_ENVIRON - static char *** - _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") - rpl_environ (void) { return &environ; } - # undef environ - # define environ (*rpl_environ ()) - #endif - */ #ifndef _GL_WARN_ON_USE # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) /* A compiler attribute is available in gcc versions 4.3.0 and later. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function __attribute__ ((__warning__ (message))) -# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ - __attribute__ ((__warning__ (message))) -# elif __clang_major__ >= 4 -/* Another compiler attribute is available in clang. */ -# define _GL_WARN_ON_USE(function, message) \ -extern __typeof__ (function) function \ - __attribute__ ((__diagnose_if__ (1, message, "warning"))) -# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ - __attribute__ ((__diagnose_if__ (1, message, "warning"))) # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function -# define _GL_WARN_ON_USE_ATTRIBUTE(message) # else /* Unsupported. */ # define _GL_WARN_ON_USE(function, message) \ _GL_WARN_EXTERN_C int _gl_warn_on_use -# define _GL_WARN_ON_USE_ATTRIBUTE(message) # endif #endif -/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") - is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the - function is declared with the given prototype, consisting of return type, - parameters, and attributes. +/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") + is like _GL_WARN_ON_USE (function, "string"), except that the function is + declared with the given prototype, consisting of return type, parameters, + and attributes. This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does not work in this case. */ #ifndef _GL_WARN_ON_USE_CXX -# if !defined __cplusplus -# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ - _GL_WARN_ON_USE (function, msg) -# else -# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) -/* A compiler attribute is available in gcc versions 4.3.0 and later. */ -# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ -extern rettype_gcc function parameters_and_attributes \ - __attribute__ ((__warning__ (msg))) -# elif __clang_major__ >= 4 -/* Another compiler attribute is available in clang. */ -# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ -extern rettype_clang function parameters_and_attributes \ - __attribute__ ((__diagnose_if__ (1, msg, "warning"))) -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +extern rettype function parameters_and_attributes \ + __attribute__ ((__warning__ (msg))) +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ -# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ -extern rettype_gcc function parameters_and_attributes -# else /* Unsupported. */ -# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +extern rettype function parameters_and_attributes +# else /* Unsupported. */ +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ _GL_WARN_EXTERN_C int _gl_warn_on_use -# endif # endif #endif @@ -595,47 +439,6 @@ _GL_WARN_EXTERN_C int _gl_warn_on_use /* Declare overridden functions. */ -#if IN_M4_GNULIB_TESTS -# if 0 -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef creat -# define creat rpl_creat -# endif -_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode)); -# elif defined _WIN32 && !defined __CYGWIN__ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef creat -# define creat _creat -# endif -_GL_CXXALIAS_MDA (creat, int, (const char *filename, mode_t mode)); -# else -_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); -# endif -_GL_CXXALIASWARN (creat); -#elif defined GNULIB_POSIXCHECK -# undef creat -/* Assume creat is always declared. */ -_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " - "use gnulib module creat for portability"); -#elif 1 -/* On native Windows, map 'creat' to '_creat', so that -loldnames is not - required. In C++ with GNULIB_NAMESPACE, avoid differences between - platforms by defining GNULIB_NAMESPACE::creat always. */ -# if defined _WIN32 && !defined __CYGWIN__ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef creat -# define creat _creat -# endif -/* Need to cast, because in mingw the last argument is 'int mode'. */ -_GL_CXXALIAS_MDA_CAST (creat, int, (const char *filename, mode_t mode)); -# else -_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); -# endif -_GL_CXXALIASWARN (creat); -#endif - #if 1 # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -644,15 +447,9 @@ _GL_CXXALIASWARN (creat); # endif _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...)); _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...)); -# if !GNULIB_defined_rpl_fcntl -# define GNULIB_defined_rpl_fcntl 1 -# endif # else # if !1 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...)); -# if !GNULIB_defined_fcntl -# define GNULIB_defined_fcntl 1 -# endif # endif _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...)); # endif @@ -674,12 +471,6 @@ _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); -# elif defined _WIN32 && !defined __CYGWIN__ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef open -# define open _open -# endif -_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); # else _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); # endif @@ -693,25 +484,9 @@ _GL_CXXALIASWARN (open); /* Assume open is always declared. */ _GL_WARN_ON_USE (open, "open is not always POSIX compliant - " "use gnulib module open for portability"); -#elif 1 -/* On native Windows, map 'open' to '_open', so that -loldnames is not - required. In C++ with GNULIB_NAMESPACE, avoid differences between - platforms by defining GNULIB_NAMESPACE::open always. */ -# if defined _WIN32 && !defined __CYGWIN__ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef open -# define open _open -# endif -_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); -# else -_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); -# endif -# if !defined __hpux -_GL_CXXALIASWARN (open); -# endif #endif -#if 1 +#if 0 # if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef openat @@ -795,10 +570,7 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " #endif #ifndef O_CLOEXEC -# define O_CLOEXEC 0x40000000 /* Try to not collide with system O_* flags. */ -# define GNULIB_defined_O_CLOEXEC 1 -#else -# define GNULIB_defined_O_CLOEXEC 0 +# define O_CLOEXEC 0 #endif #ifndef O_DIRECT diff --git a/contrib/tools/m4/lib/fd-hook.c b/contrib/tools/m4/lib/fd-hook.c index e158a52aa3..8676c6bdfc 100644 --- a/contrib/tools/m4/lib/fd-hook.c +++ b/contrib/tools/m4/lib/fd-hook.c @@ -1,5 +1,5 @@ /* Hook for making making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/contrib/tools/m4/lib/fd-hook.h b/contrib/tools/m4/lib/fd-hook.h index d15b577114..9568d07511 100644 --- a/contrib/tools/m4/lib/fd-hook.h +++ b/contrib/tools/m4/lib/fd-hook.h @@ -1,5 +1,5 @@ /* Hook for making making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/fd-safer-flag.c b/contrib/tools/m4/lib/fd-safer-flag.c index 8bc14bda2c..4b865839e9 100644 --- a/contrib/tools/m4/lib/fd-safer-flag.c +++ b/contrib/tools/m4/lib/fd-safer-flag.c @@ -1,7 +1,7 @@ /* Adjust a file descriptor result so that it avoids clobbering STD{IN,OUT,ERR}_FILENO, with specific flags. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 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 diff --git a/contrib/tools/m4/lib/fd-safer.c b/contrib/tools/m4/lib/fd-safer.c index 8ded8886a5..8a6bee2ee1 100644 --- a/contrib/tools/m4/lib/fd-safer.c +++ b/contrib/tools/m4/lib/fd-safer.c @@ -1,6 +1,6 @@ /* Return a safer copy of a file descriptor. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 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 diff --git a/contrib/tools/m4/lib/fflush.c b/contrib/tools/m4/lib/fflush.c deleted file mode 100644 index c182ac1fa4..0000000000 --- a/contrib/tools/m4/lib/fflush.c +++ /dev/null @@ -1,225 +0,0 @@ -/* fflush.c -- allow flushing input streams - Copyright (C) 2007-2013 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. */ - -#include <config.h> - -/* Specification. */ -#include "stdio--.h" - -#include <errno.h> -#include <unistd.h> - -#include "freading.h" - -#include "stdio-impl.h" - -#include "unused-parameter.h" - -#undef fflush - - -#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - -/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ -static void -clear_ungetc_buffer_preserving_position (FILE *fp) -{ - if (fp->_flags & _IO_IN_BACKUP) - /* _IO_free_backup_area is a bit complicated. Simply call fseek. */ - fseeko (fp, 0, SEEK_CUR); -} - -#else - -/* Clear the stream's ungetc buffer. May modify the value of ftello (fp). */ -static void -clear_ungetc_buffer (FILE *fp) -{ -# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */ - if (HASUB (fp)) - { - fp_->_p += fp_->_r; - fp_->_r = 0; - } -# elif defined __EMX__ /* emx+gcc */ - if (fp->_ungetc_count > 0) - { - fp->_ungetc_count = 0; - fp->_rcount = - fp->_rcount; - } -# elif defined _IOERR /* Minix, AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */ - /* Nothing to do. */ -# else /* other implementations */ - fseeko (fp, 0, SEEK_CUR); -# endif -} - -#endif - -#if ! (defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) - -# if (defined __sferror || defined __DragonFly__) && defined __SNPT /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */ - -static int -disable_seek_optimization (FILE *fp) -{ - int saved_flags = fp_->_flags & (__SOPT | __SNPT); - fp_->_flags = (fp_->_flags & ~__SOPT) | __SNPT; - return saved_flags; -} - -static void -restore_seek_optimization (FILE *fp, int saved_flags) -{ - fp_->_flags = (fp_->_flags & ~(__SOPT | __SNPT)) | saved_flags; -} - -# else - -static void -update_fpos_cache (FILE *fp _GL_UNUSED_PARAMETER, - off_t pos _GL_UNUSED_PARAMETER) -{ -# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */ -# if defined __CYGWIN__ - /* fp_->_offset is typed as an integer. */ - fp_->_offset = pos; -# else - /* fp_->_offset is an fpos_t. */ - /* Use a union, since on NetBSD, the compilation flags determine - whether fpos_t is typedef'd to off_t or a struct containing a - single off_t member. */ - union - { - fpos_t f; - off_t o; - } u; - u.o = pos; - fp_->_offset = u.f; -# endif - fp_->_flags |= __SOFF; -# endif -} -# endif -#endif - -/* Flush all pending data on STREAM according to POSIX rules. Both - output and seekable input streams are supported. */ -int -rpl_fflush (FILE *stream) -{ - /* When stream is NULL, POSIX and C99 only require flushing of "output - streams and update streams in which the most recent operation was not - input", and all implementations do this. - - When stream is "an output stream or an update stream in which the most - recent operation was not input", POSIX and C99 requires that fflush - writes out any buffered data, and all implementations do this. - - When stream is, however, an input stream or an update stream in - which the most recent operation was input, C99 specifies nothing, - and POSIX only specifies behavior if the stream is seekable. - mingw, in particular, drops the input buffer, leaving the file - descriptor positioned at the end of the input buffer. I.e. ftell - (stream) is lost. We don't want to call the implementation's - fflush in this case. - - We test ! freading (stream) here, rather than fwriting (stream), because - what we need to know is whether the stream holds a "read buffer", and on - mingw this is indicated by _IOREAD, regardless of _IOWRT. */ - if (stream == NULL || ! freading (stream)) - return fflush (stream); - -#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - - clear_ungetc_buffer_preserving_position (stream); - - return fflush (stream); - -#else - { - /* Notes about the file-position indicator: - 1) The file position indicator is incremented by fgetc() and decremented - by ungetc(): - <http://www.opengroup.org/susv3/functions/fgetc.html> - "... the fgetc() function shall ... advance the associated file - position indicator for the stream ..." - <http://www.opengroup.org/susv3/functions/ungetc.html> - "The file-position indicator is decremented by each successful - call to ungetc()..." - 2) <http://www.opengroup.org/susv3/functions/ungetc.html> says: - "The value of the file-position indicator for the stream after - reading or discarding all pushed-back bytes shall be the same - as it was before the bytes were pushed back." - Here we are discarding all pushed-back bytes. But more specifically, - 3) <http://www.opengroup.org/austin/aardvark/latest/xshbug3.txt> says: - "[After fflush(),] the file offset of the underlying open file - description shall be set to the file position of the stream, and - any characters pushed back onto the stream by ungetc() ... shall - be discarded." */ - - /* POSIX does not specify fflush behavior for non-seekable input - streams. Some implementations purge unread data, some return - EBADF, some do nothing. */ - off_t pos = ftello (stream); - if (pos == -1) - { - errno = EBADF; - return EOF; - } - - /* Clear the ungetc buffer. */ - clear_ungetc_buffer (stream); - - /* To get here, we must be flushing a seekable input stream, so the - semantics of fpurge are now appropriate to clear the buffer. To - avoid losing data, the lseek is also necessary. */ - { - int result = fpurge (stream); - if (result != 0) - return result; - } - -# if (defined __sferror || defined __DragonFly__) && defined __SNPT /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */ - - { - /* Disable seek optimization for the next fseeko call. This tells the - following fseeko call to seek to the desired position directly, rather - than to seek to a block-aligned boundary. */ - int saved_flags = disable_seek_optimization (stream); - int result = fseeko (stream, pos, SEEK_SET); - - restore_seek_optimization (stream, saved_flags); - return result; - } - -# else - - pos = lseek (fileno (stream), pos, SEEK_SET); - if (pos == -1) - return EOF; - /* After a successful lseek, update the file descriptor's position cache - in the stream. */ - update_fpos_cache (stream, pos); - - return 0; - -# endif - } -#endif -} diff --git a/contrib/tools/m4/lib/filenamecat-lgpl.c b/contrib/tools/m4/lib/filenamecat-lgpl.c index 60c4988b4d..4903fbf370 100644 --- a/contrib/tools/m4/lib/filenamecat-lgpl.c +++ b/contrib/tools/m4/lib/filenamecat-lgpl.c @@ -1,6 +1,6 @@ /* Concatenate two arbitrary file names. - Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1996-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 diff --git a/contrib/tools/m4/lib/filenamecat.c b/contrib/tools/m4/lib/filenamecat.c index 8809b571f5..06cfeae6ca 100644 --- a/contrib/tools/m4/lib/filenamecat.c +++ b/contrib/tools/m4/lib/filenamecat.c @@ -1,6 +1,6 @@ /* Concatenate two arbitrary file names. - Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1996-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 diff --git a/contrib/tools/m4/lib/filenamecat.h b/contrib/tools/m4/lib/filenamecat.h index 1476e14c74..791a0af9b7 100644 --- a/contrib/tools/m4/lib/filenamecat.h +++ b/contrib/tools/m4/lib/filenamecat.h @@ -1,6 +1,6 @@ /* Concatenate two arbitrary file names. - Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2013 Free Software + Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/float+.h b/contrib/tools/m4/lib/float+.h index 32fb790bb5..00fcc76322 100644 --- a/contrib/tools/m4/lib/float+.h +++ b/contrib/tools/m4/lib/float+.h @@ -1,5 +1,5 @@ /* Supplemental information about the floating-point formats. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-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 diff --git a/contrib/tools/m4/lib/fopen-safer.c b/contrib/tools/m4/lib/fopen-safer.c index 917920d904..6e7c08d64c 100644 --- a/contrib/tools/m4/lib/fopen-safer.c +++ b/contrib/tools/m4/lib/fopen-safer.c @@ -1,6 +1,6 @@ /* Invoke fopen, but avoid some glitches. - Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 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 diff --git a/contrib/tools/m4/lib/fpending.h b/contrib/tools/m4/lib/fpending.h index 4eca3f18e1..61008aa765 100644 --- a/contrib/tools/m4/lib/fpending.h +++ b/contrib/tools/m4/lib/fpending.h @@ -1,6 +1,6 @@ /* Declare __fpending. - Copyright (C) 2000, 2003, 2005-2006, 2009-2013 Free Software Foundation, + Copyright (C) 2000, 2003, 2005-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -24,6 +24,6 @@ # include <stdio_ext.h> #endif -#ifndef __fpending -size_t __fpending (FILE *); +#if !HAVE_DECL___FPENDING +size_t __fpending (FILE *) _GL_ATTRIBUTE_PURE; #endif diff --git a/contrib/tools/m4/lib/fpucw.h b/contrib/tools/m4/lib/fpucw.h index 0b7f5284a1..05ee0cac94 100644 --- a/contrib/tools/m4/lib/fpucw.h +++ b/contrib/tools/m4/lib/fpucw.h @@ -1,5 +1,5 @@ -/* Manipulating the FPU control word. - Copyright (C) 2007-2013 Free Software Foundation, Inc. +/* 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 diff --git a/contrib/tools/m4/lib/freadahead.h b/contrib/tools/m4/lib/freadahead.h index c691f89c0f..f8211afe14 100644 --- a/contrib/tools/m4/lib/freadahead.h +++ b/contrib/tools/m4/lib/freadahead.h @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/freading.h b/contrib/tools/m4/lib/freading.h index 88ea789ea4..949efd5b00 100644 --- a/contrib/tools/m4/lib/freading.h +++ b/contrib/tools/m4/lib/freading.h @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + 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 @@ -44,7 +44,7 @@ extern "C" { # endif -extern bool freading (FILE *stream); +extern bool freading (FILE *stream) _GL_ATTRIBUTE_PURE; # ifdef __cplusplus } diff --git a/contrib/tools/m4/lib/fstat.c b/contrib/tools/m4/lib/fstat.c deleted file mode 100644 index dc802f502b..0000000000 --- a/contrib/tools/m4/lib/fstat.c +++ /dev/null @@ -1,88 +0,0 @@ -/* fstat() replacement. - Copyright (C) 2011-2013 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/>. */ - -/* If the user's config.h happens to include <sys/stat.h>, let it include only - the system's <sys/stat.h> here, so that orig_fstat doesn't recurse to - rpl_fstat. */ -#define __need_system_sys_stat_h -#include <config.h> - -/* Get the original definition of fstat. It might be defined as a macro. */ -#include <sys/types.h> -#include <sys/stat.h> -#if _GL_WINDOWS_64_BIT_ST_SIZE -# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ -# define stat _stati64 -# undef fstat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ -# define fstat _fstati64 -#endif -#undef __need_system_sys_stat_h - -static int -orig_fstat (int fd, struct stat *buf) -{ - return fstat (fd, buf); -} - -/* Specification. */ -/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc - eliminates this include because of the preliminary #include <sys/stat.h> - above. */ -#include "sys/stat.h" - -#include <errno.h> -#include <unistd.h> - -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER -# include "msvc-inval.h" -#endif - -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER -static int -fstat_nothrow (int fd, struct stat *buf) -{ - int result; - - TRY_MSVC_INVAL - { - result = orig_fstat (fd, buf); - } - CATCH_MSVC_INVAL - { - result = -1; - errno = EBADF; - } - DONE_MSVC_INVAL; - - return result; -} -#else -# define fstat_nothrow orig_fstat -#endif - -int -rpl_fstat (int fd, struct stat *buf) -{ -#if REPLACE_FCHDIR && REPLACE_OPEN_DIRECTORY - /* Handle the case when rpl_open() used a dummy file descriptor to work - around an open() that can't normally visit directories. */ - const char *name = _gl_directory_name (fd); - if (name != NULL) - return stat (name, buf); -#endif - - return fstat_nothrow (fd, buf); -} diff --git a/contrib/tools/m4/lib/getdtablesize.c b/contrib/tools/m4/lib/getdtablesize.c index 212b3c0f96..d23405571b 100644 --- a/contrib/tools/m4/lib/getdtablesize.c +++ b/contrib/tools/m4/lib/getdtablesize.c @@ -1,5 +1,5 @@ /* getdtablesize() function for platforms that don't have it. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify @@ -22,11 +22,11 @@ #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -#include <stdio.h> +# include <stdio.h> -#include "msvc-inval.h" +# include "msvc-inval.h" -#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER static int _setmaxstdio_nothrow (int newmax) { @@ -44,10 +44,11 @@ _setmaxstdio_nothrow (int newmax) return result; } -# define _setmaxstdio _setmaxstdio_nothrow -#endif +# define _setmaxstdio _setmaxstdio_nothrow +# endif -/* Cache for the previous getdtablesize () result. */ +/* Cache for the previous getdtablesize () result. Safe to cache because + Windows also lacks setrlimit. */ static int dtablesize; int @@ -73,18 +74,48 @@ getdtablesize (void) FILE objects. The sanity check in _setmaxstdio reveals the maximum number of file descriptors. This too allocates memory, but it is freed when we call _setmaxstdio with the original value. */ -#if !defined(_WIN32) && !defined(_WIN64) int orig_max_stdio = _getmaxstdio (); unsigned int bound; for (bound = 0x10000; _setmaxstdio (bound) < 0; bound = bound / 2) ; _setmaxstdio (orig_max_stdio); dtablesize = bound; -#else - dtablesize = _getmaxstdio(); -#endif } return dtablesize; } +#else + +# include <limits.h> +# include <sys/resource.h> + +# ifndef RLIM_SAVED_CUR +# define RLIM_SAVED_CUR RLIM_INFINITY +# endif +# ifndef RLIM_SAVED_MAX +# define RLIM_SAVED_MAX RLIM_INFINITY +# endif + +# ifdef __CYGWIN__ + /* Cygwin 1.7.25 auto-increases the RLIMIT_NOFILE soft limit until it + hits the compile-time constant hard limit of 3200. We might as + well just report the hard limit. */ +# define rlim_cur rlim_max +# endif + +int +getdtablesize (void) +{ + struct rlimit lim; + + if (getrlimit (RLIMIT_NOFILE, &lim) == 0 + && 0 <= lim.rlim_cur && lim.rlim_cur <= INT_MAX + && lim.rlim_cur != RLIM_INFINITY + && lim.rlim_cur != RLIM_SAVED_CUR + && lim.rlim_cur != RLIM_SAVED_MAX) + return lim.rlim_cur; + + return INT_MAX; +} + #endif diff --git a/contrib/tools/m4/lib/getopt.c b/contrib/tools/m4/lib/getopt.c index 4b3d267067..8ccb9010ad 100644 --- a/contrib/tools/m4/lib/getopt.c +++ b/contrib/tools/m4/lib/getopt.c @@ -2,7 +2,7 @@ NOTE: getopt is part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! - Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2013 Free Software + Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -181,7 +181,7 @@ exchange (char **argv, struct _getopt_data *d) { /* Bottom segment is the short one. */ int len = middle - bottom; - int i; + register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) @@ -198,7 +198,7 @@ exchange (char **argv, struct _getopt_data *d) { /* Top segment is the short one. */ int len = top - middle; - int i; + register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) @@ -487,7 +487,20 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, const struct option *p; struct option_list *next; } *ambig_list = NULL; +#ifdef _LIBC +/* malloc() not used for _LIBC to simplify failure messages. */ +# define free_option_list(l) +#else +# define free_option_list(l) \ + while (l != NULL) \ + { \ + struct option_list *pn = l->next; \ + free (l); \ + l = pn; \ + } +#endif int exact = 0; + int ambig = 0; int indfound = -1; int option_index; @@ -514,22 +527,37 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, pfound = p; indfound = option_index; } + else if (ambig) + ; /* Taking simpler path to handling ambiguities. */ else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) { /* Second or later nonexact match found. */ +#ifdef _LIBC + struct option_list *newp = alloca (sizeof (*newp)); +#else struct option_list *newp = malloc (sizeof (*newp)); - newp->p = p; - newp->next = ambig_list; - ambig_list = newp; + if (newp == NULL) + { + free_option_list (ambig_list); + ambig_list = NULL; + ambig = 1; /* Use simpler fallback message. */ + } + else +#endif + { + newp->p = p; + newp->next = ambig_list; + ambig_list = newp; + } } } - if (ambig_list != NULL && !exact) + if ((ambig || ambig_list) && !exact) { - if (print_errors) + if (print_errors && ambig_list) { struct option_list first; first.p = pfound; @@ -585,18 +613,20 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, fputc ('\n', stderr); #endif } + else if (print_errors && ambig) + { + fprintf (stderr, + _("%s: option '%s' is ambiguous\n"), + argv[0], argv[d->optind]); + } d->__nextchar += strlen (d->__nextchar); d->optind++; d->optopt = 0; + free_option_list (ambig_list); return '?'; } - while (ambig_list != NULL) - { - struct option_list *pn = ambig_list->next; - free (ambig_list); - ambig_list = pn; - } + free_option_list (ambig_list); if (pfound != NULL) { diff --git a/contrib/tools/m4/lib/getopt1.c b/contrib/tools/m4/lib/getopt1.c index ca24eb811f..63db74f9f7 100644 --- a/contrib/tools/m4/lib/getopt1.c +++ b/contrib/tools/m4/lib/getopt1.c @@ -1,44 +1,56 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library and is also part of gnulib. - Patches to this file should be submitted to both projects. + Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2016 Free Software + Foundation, Inc. + This file is part of the GNU C Library. - The GNU C Library 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 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. - The GNU C Library is distributed in the hope that it will be useful, + 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. + 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 the GNU C Library; if not, see - <https://www.gnu.org/licenses/>. */ + 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 _LIBC +#ifdef _LIBC +# include <getopt.h> +#else # include <config.h> +# include "getopt.h" #endif - -#include "getopt.h" #include "getopt_int.h" +#include <stdio.h> + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include <stdlib.h> +#endif + +#ifndef NULL +#define NULL 0 +#endif + int getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, - const struct option *long_options, int *opt_index) + const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, - opt_index, 0, 0); + opt_index, 0, 0); } int _getopt_long_r (int argc, char **argv, const char *options, - const struct option *long_options, int *opt_index, - struct _getopt_data *d) + const struct option *long_options, int *opt_index, + struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, - 0, d, 0); + 0, d, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. @@ -48,27 +60,26 @@ _getopt_long_r (int argc, char **argv, const char *options, int getopt_long_only (int argc, char *__getopt_argv_const *argv, - const char *options, - const struct option *long_options, int *opt_index) + const char *options, + const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, - opt_index, 1, 0); + opt_index, 1, 0); } int _getopt_long_only_r (int argc, char **argv, const char *options, - const struct option *long_options, int *opt_index, - struct _getopt_data *d) + const struct option *long_options, int *opt_index, + struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, - 1, d, 0); + 1, d, 0); } #ifdef TEST #include <stdio.h> -#include <stdlib.h> int main (int argc, char **argv) @@ -82,74 +93,74 @@ main (int argc, char **argv) int option_index = 0; static const struct option long_options[] = { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); + long_options, &option_index); if (c == -1) - break; + break; switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value '%s'\n", optarg); - break; - - case 'd': - printf ("option d with value '%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value '%s'\n", optarg); + break; + + case 'd': + printf ("option d with value '%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) - printf ("%s ", argv[optind++]); + printf ("%s ", argv[optind++]); printf ("\n"); } diff --git a/contrib/tools/m4/lib/getopt_int.h b/contrib/tools/m4/lib/getopt_int.h index a6e4b9ea71..be4c22e215 100644 --- a/contrib/tools/m4/lib/getopt_int.h +++ b/contrib/tools/m4/lib/getopt_int.h @@ -1,5 +1,5 @@ /* Internal declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2013 Free Software + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/contrib/tools/m4/lib/getprogname.c b/contrib/tools/m4/lib/getprogname.c new file mode 100644 index 0000000000..16d3b6c208 --- /dev/null +++ b/contrib/tools/m4/lib/getprogname.c @@ -0,0 +1,151 @@ +/* Program name management. + Copyright (C) 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 "getprogname.h" + +#include <errno.h> /* get program_invocation_name declaration */ +#include <stdlib.h> /* get __argv declaration */ + +#ifdef _AIX +# include <unistd.h> +# include <procinfo.h> +# include <string.h> +#endif + +#ifdef __MVS__ +# ifndef _OPEN_SYS +# define _OPEN_SYS +# endif +# include <string.h> +# error #include <sys/ps.h> +#endif + +#ifdef __hpux +# include <unistd.h> +# include <sys/param.h> +# include <sys/pstat.h> +# include <string.h> +#endif + +#include "dirname.h" + +#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */ +char const * +getprogname (void) +{ +# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* glibc, BeOS */ + /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ + return program_invocation_short_name; +# elif HAVE_DECL_PROGRAM_INVOCATION_NAME /* glibc, BeOS */ + /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ + return last_component (program_invocation_name); +# elif HAVE_GETEXECNAME /* Solaris */ + /* http://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrb1/index.html */ + const char *p = getexecname (); + if (!p) + p = "?"; + return last_component (p); +# elif HAVE_DECL___ARGV /* mingw, MSVC */ + /* https://msdn.microsoft.com/en-us/library/dn727674.aspx */ + const char *p = __argv && __argv[0] ? __argv[0] : "?"; + return last_component (p); +# elif HAVE_VAR___PROGNAME /* OpenBSD, QNX */ + /* http://man.openbsd.org/style.9 */ + /* http://www.qnx.de/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_lib_ref%2Fp%2F__progname.html */ + /* Be careful to declare this only when we absolutely need it + (OpenBSD 5.1), rather than when it's available. Otherwise, + its mere declaration makes program_invocation_short_name + malfunction (have zero length) with Fedora 25's glibc. */ + extern char *__progname; + const char *p = __progname; + return p && p[0] ? p : "?"; +# elif _AIX /* AIX */ + /* Idea by Bastien ROUCARIÈS, + http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00095.html + Reference: http:// + ibm.biz/knowctr#ssw_aix_53/com.ibm.aix.basetechref/doc/basetrf1/getprocs.htm + */ + static char *p; + static int first = 1; + if (first) + { + first = 0; + pid_t pid = getpid (); + struct procentry64 procs; + p = (0 < getprocs64 (&procs, sizeof procs, NULL, 0, &pid, 1) + ? strdup (procs.pi_comm) + : NULL); + if (!p) + p = "?"; + } + return p; +# elif defined __hpux + static char *p; + static int first = 1; + if (first) + { + first = 0; + pid_t pid = getpid (); + struct pst_status status; + p = (0 < pstat_getproc (&status, sizeof status, 0, pid) + ? strdup (status.pst_ucomm) + : NULL); + if (!p) + p = "?"; + } + return p; +# elif __MVS__ /* z/OS */ + /* https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/rtwgetp.htm */ + static char *p = "?"; + static int first = 1; + if (first) + { + pid_t pid = getpid (); + int token; + W_PSPROC buf; + first = 0; + memset (&buf, 0, sizeof(buf)); + buf.ps_cmdptr = (char *) malloc (buf.ps_cmdlen = PS_CMDBLEN_LONG); + buf.ps_conttyptr = (char *) malloc (buf.ps_conttylen = PS_CONTTYBLEN); + buf.ps_pathptr = (char *) malloc (buf.ps_pathlen = PS_PATHBLEN); + if (buf.ps_cmdptr && buf.ps_conttyptr && buf.ps_pathptr) + { + for (token = 0; token >= 0; + token = w_getpsent (token, &buf, sizeof(buf))) + { + if (token > 0 && buf.ps_pid == pid) + { + char *s = strdup (last_component (buf.ps_pathptr)); + if (s) + p = s; + break; + } + } + } + free (buf.ps_cmdptr); + free (buf.ps_conttyptr); + free (buf.ps_pathptr); + } + return p; +# else +# error "getprogname module not ported to this OS" +# endif +} + +#endif diff --git a/contrib/tools/m4/lib/getprogname.h b/contrib/tools/m4/lib/getprogname.h new file mode 100644 index 0000000000..e8f9e978b1 --- /dev/null +++ b/contrib/tools/m4/lib/getprogname.h @@ -0,0 +1,40 @@ +/* Program name management. + Copyright (C) 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 _GL_GETPROGNAME_H +#define _GL_GETPROGNAME_H + +#include <stdlib.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Return the base name of the executing program. + On native Windows this will usually end in ".exe" or ".EXE". */ +#ifndef HAVE_GETPROGNAME +extern char const *getprogname (void) +# ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME + _GL_ATTRIBUTE_PURE +# endif + ; +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/contrib/tools/m4/lib/gettext.h b/contrib/tools/m4/lib/gettext.h index d0215715a9..9a232cc3a8 100644 --- a/contrib/tools/m4/lib/gettext.h +++ b/contrib/tools/m4/lib/gettext.h @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2013 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -225,15 +225,17 @@ dcpgettext_expr (const char *domain, if (msg_ctxt_id != NULL) #endif { + int found_translation; memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcgettext (domain, msg_ctxt_id, category); + found_translation = (translation != msg_ctxt_id); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif - if (translation != msg_ctxt_id) + if (found_translation) return translation; } return msgid; @@ -271,15 +273,17 @@ dcnpgettext_expr (const char *domain, if (msg_ctxt_id != NULL) #endif { + int found_translation; memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + found_translation = !(translation == msg_ctxt_id || translation == msgid_plural); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif - if (!(translation == msg_ctxt_id || translation == msgid_plural)) + if (found_translation) return translation; } return (n == 1 ? msgid : msgid_plural); diff --git a/contrib/tools/m4/lib/gettimeofday.c b/contrib/tools/m4/lib/gettimeofday.c index ad65c6da8b..224ca6a176 100644 --- a/contrib/tools/m4/lib/gettimeofday.c +++ b/contrib/tools/m4/lib/gettimeofday.c @@ -1,6 +1,6 @@ /* Provide gettimeofday for systems that don't have it or for which it's broken. - Copyright (C) 2001-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 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 diff --git a/contrib/tools/m4/lib/gl_anyhash_list1.h b/contrib/tools/m4/lib/gl_anyhash_list1.h index 57ead45073..de25706656 100644 --- a/contrib/tools/m4/lib/gl_anyhash_list1.h +++ b/contrib/tools/m4/lib/gl_anyhash_list1.h @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a hash table with another list. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_anyhash_list2.h b/contrib/tools/m4/lib/gl_anyhash_list2.h index 3791ae2432..cace8f85c0 100644 --- a/contrib/tools/m4/lib/gl_anyhash_list2.h +++ b/contrib/tools/m4/lib/gl_anyhash_list2.h @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a hash table with another list. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_anylinked_list1.h b/contrib/tools/m4/lib/gl_anylinked_list1.h index c8879f0f68..dcb66ec790 100644 --- a/contrib/tools/m4/lib/gl_anylinked_list1.h +++ b/contrib/tools/m4/lib/gl_anylinked_list1.h @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a linked list. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_anylinked_list2.h b/contrib/tools/m4/lib/gl_anylinked_list2.h index 45ca7c829a..a1037ede2f 100644 --- a/contrib/tools/m4/lib/gl_anylinked_list2.h +++ b/contrib/tools/m4/lib/gl_anylinked_list2.h @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a linked list. - Copyright (C) 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify @@ -163,13 +163,13 @@ gl_linked_nx_create (gl_list_implementation_t implementation, return NULL; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_linked_size (gl_list_t list) { return list->count; } -static const void * +static const void * _GL_ATTRIBUTE_PURE gl_linked_node_value (gl_list_t list, gl_list_node_t node) { return node->value; @@ -215,19 +215,19 @@ gl_linked_node_nx_set_value (gl_list_t list, gl_list_node_t node, return 0; } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_linked_next_node (gl_list_t list, gl_list_node_t node) { return (node->next != &list->root ? node->next : NULL); } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_linked_previous_node (gl_list_t list, gl_list_node_t node) { return (node->prev != &list->root ? node->prev : NULL); } -static const void * +static const void * _GL_ATTRIBUTE_PURE gl_linked_get_at (gl_list_t list, size_t position) { size_t count = list->count; @@ -312,7 +312,7 @@ gl_linked_nx_set_at (gl_list_t list, size_t position, const void *elt) return node; } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_linked_search_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) { @@ -465,7 +465,7 @@ gl_linked_search_from_to (gl_list_t list, size_t start_index, size_t end_index, } } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_linked_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) { @@ -923,7 +923,7 @@ gl_linked_iterator (gl_list_t list) result.list = list; result.p = list->root.next; result.q = &list->root; -#ifdef lint +#if defined GCC_LINT || defined lint result.i = 0; result.j = 0; result.count = 0; @@ -994,7 +994,7 @@ gl_linked_iterator_from_to (gl_list_t list, result.q = node; } -#ifdef lint +#if defined GCC_LINT || defined lint result.i = 0; result.j = 0; result.count = 0; @@ -1027,7 +1027,7 @@ gl_linked_iterator_free (gl_list_iterator_t *iterator) /* ---------------------- Sorted gl_list_t Data Type ---------------------- */ -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_linked_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { @@ -1045,7 +1045,7 @@ gl_linked_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, return NULL; } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_linked_sortedlist_search_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t low, size_t high, @@ -1093,7 +1093,7 @@ gl_linked_sortedlist_search_from_to (gl_list_t list, return NULL; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_linked_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { @@ -1114,7 +1114,7 @@ gl_linked_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, return (size_t)(-1); } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_linked_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t low, size_t high, diff --git a/contrib/tools/m4/lib/gl_anytree_oset.h b/contrib/tools/m4/lib/gl_anytree_oset.h index e1f90a99a2..127f4e338e 100644 --- a/contrib/tools/m4/lib/gl_anytree_oset.h +++ b/contrib/tools/m4/lib/gl_anytree_oset.h @@ -1,5 +1,5 @@ /* Ordered set data type implemented by a binary tree. - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify @@ -255,7 +255,7 @@ gl_tree_iterator (gl_oset_t set) result.p = node; /* End point is past the rightmost node. */ result.q = NULL; -#ifdef lint +#if defined GCC_LINT || defined lint result.i = 0; result.j = 0; result.count = 0; diff --git a/contrib/tools/m4/lib/gl_avltree_oset.c b/contrib/tools/m4/lib/gl_avltree_oset.c index 09202ae0cc..ac7183bbd8 100644 --- a/contrib/tools/m4/lib/gl_avltree_oset.c +++ b/contrib/tools/m4/lib/gl_avltree_oset.c @@ -1,5 +1,5 @@ /* Ordered set data type implemented by a binary tree. - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_avltree_oset.h b/contrib/tools/m4/lib/gl_avltree_oset.h index abac895f08..6229c84c3a 100644 --- a/contrib/tools/m4/lib/gl_avltree_oset.h +++ b/contrib/tools/m4/lib/gl_avltree_oset.h @@ -1,5 +1,5 @@ /* Ordered set data type implemented by a binary tree. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_linkedhash_list.c b/contrib/tools/m4/lib/gl_linkedhash_list.c index 2f4e05f3a7..33d9bcf769 100644 --- a/contrib/tools/m4/lib/gl_linkedhash_list.c +++ b/contrib/tools/m4/lib/gl_linkedhash_list.c @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a hash table with a linked list. - Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_linkedhash_list.h b/contrib/tools/m4/lib/gl_linkedhash_list.h index 577756c9d4..9d740ea7ed 100644 --- a/contrib/tools/m4/lib/gl_linkedhash_list.h +++ b/contrib/tools/m4/lib/gl_linkedhash_list.h @@ -1,5 +1,5 @@ /* Sequential list data type implemented by a hash table with a linked list. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_list.h b/contrib/tools/m4/lib/gl_list.h index 9094723fe5..c9d05b0d4d 100644 --- a/contrib/tools/m4/lib/gl_list.h +++ b/contrib/tools/m4/lib/gl_list.h @@ -1,5 +1,5 @@ -/* Abstract sequential list data type. - Copyright (C) 2006-2013 Free Software Foundation, Inc. +/* Abstract sequential list data type. -*- coding: utf-8 -*- + Copyright (C) 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_oset.h b/contrib/tools/m4/lib/gl_oset.h index 5134065e5e..ffca315fa6 100644 --- a/contrib/tools/m4/lib/gl_oset.h +++ b/contrib/tools/m4/lib/gl_oset.h @@ -1,5 +1,5 @@ /* Abstract ordered set data type. - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_xlist.h b/contrib/tools/m4/lib/gl_xlist.h index 1c9451c1ab..06824fcbd1 100644 --- a/contrib/tools/m4/lib/gl_xlist.h +++ b/contrib/tools/m4/lib/gl_xlist.h @@ -1,5 +1,5 @@ /* Abstract sequential list data type, with out-of-memory checking. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/gl_xoset.h b/contrib/tools/m4/lib/gl_xoset.h index b30b2ced83..34191971e2 100644 --- a/contrib/tools/m4/lib/gl_xoset.h +++ b/contrib/tools/m4/lib/gl_xoset.h @@ -1,5 +1,5 @@ /* Abstract ordered set data type, with out-of-memory checking. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/glthread/lock.c b/contrib/tools/m4/lib/glthread/lock.c index f62aa301fe..935043b1a2 100644 --- a/contrib/tools/m4/lib/glthread/lock.c +++ b/contrib/tools/m4/lib/glthread/lock.c @@ -1,5 +1,5 @@ /* Locking in multithreaded situations. - Copyright (C) 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2005-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 diff --git a/contrib/tools/m4/lib/glthread/lock.h b/contrib/tools/m4/lib/glthread/lock.h index 42228df80f..035accd1a9 100644 --- a/contrib/tools/m4/lib/glthread/lock.h +++ b/contrib/tools/m4/lib/glthread/lock.h @@ -1,5 +1,5 @@ /* Locking in multithreaded situations. - Copyright (C) 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2005-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 diff --git a/contrib/tools/m4/lib/glthread/threadlib.c b/contrib/tools/m4/lib/glthread/threadlib.c index b447657302..be6371306d 100644 --- a/contrib/tools/m4/lib/glthread/threadlib.c +++ b/contrib/tools/m4/lib/glthread/threadlib.c @@ -1,5 +1,5 @@ /* Multithreading primitives. - Copyright (C) 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2005-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 diff --git a/contrib/tools/m4/lib/glthread/tls.c b/contrib/tools/m4/lib/glthread/tls.c index bcd285c273..7c1916a817 100644 --- a/contrib/tools/m4/lib/glthread/tls.c +++ b/contrib/tools/m4/lib/glthread/tls.c @@ -1,5 +1,5 @@ /* Thread-local storage in multithreaded situations. - Copyright (C) 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2005-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 diff --git a/contrib/tools/m4/lib/glthread/tls.h b/contrib/tools/m4/lib/glthread/tls.h index 2afe0b43c3..63955a2496 100644 --- a/contrib/tools/m4/lib/glthread/tls.h +++ b/contrib/tools/m4/lib/glthread/tls.h @@ -1,5 +1,5 @@ /* Thread-local storage in multithreaded situations. - Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/hard-locale.c b/contrib/tools/m4/lib/hard-locale.c new file mode 100644 index 0000000000..c7d9da526f --- /dev/null +++ b/contrib/tools/m4/lib/hard-locale.c @@ -0,0 +1,72 @@ +/* hard-locale.c -- Determine whether a locale is hard. + + Copyright (C) 1997-1999, 2002-2004, 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/>. */ + +#include <config.h> + +#include "hard-locale.h" + +#include <locale.h> +#include <stdlib.h> +#include <string.h> + +#ifdef __GLIBC__ +# define GLIBC_VERSION __GLIBC__ +#elif defined __UCLIBC__ +# define GLIBC_VERSION 2 +#else +# define GLIBC_VERSION 0 +#endif + +/* Return true if the current CATEGORY locale is hard, i.e. if you + can't get away with assuming traditional C or POSIX behavior. */ +bool +hard_locale (int category) +{ + bool hard = true; + char const *p = setlocale (category, NULL); + + if (p) + { + if (2 <= GLIBC_VERSION) + { + if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0) + hard = false; + } + else + { + char *locale = strdup (p); + if (locale) + { + /* Temporarily set the locale to the "C" and "POSIX" locales + to find their names, so that we can determine whether one + or the other is the caller's locale. */ + if (((p = setlocale (category, "C")) + && strcmp (p, locale) == 0) + || ((p = setlocale (category, "POSIX")) + && strcmp (p, locale) == 0)) + hard = false; + + /* Restore the caller's locale. */ + setlocale (category, locale); + free (locale); + } + } + } + + return hard; +} diff --git a/contrib/tools/m4/lib/hard-locale.h b/contrib/tools/m4/lib/hard-locale.h new file mode 100644 index 0000000000..7644afa37f --- /dev/null +++ b/contrib/tools/m4/lib/hard-locale.h @@ -0,0 +1,25 @@ +/* Determine whether a locale is hard. + + Copyright (C) 1999, 2003-2004, 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 HARD_LOCALE_H_ +# define HARD_LOCALE_H_ 1 + +# include <stdbool.h> + +bool hard_locale (int); + +#endif /* HARD_LOCALE_H_ */ diff --git a/contrib/tools/m4/lib/ignore-value.h b/contrib/tools/m4/lib/ignore-value.h index ebd6bf42f5..6713d96f84 100644 --- a/contrib/tools/m4/lib/ignore-value.h +++ b/contrib/tools/m4/lib/ignore-value.h @@ -1,6 +1,6 @@ -/* ignore a function return without a compiler warning +/* ignore a function return without a compiler warning. -*- coding: utf-8 -*- - Copyright (C) 2008-2013 Free Software Foundation, Inc. + 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 @@ -35,9 +35,11 @@ #ifndef _GL_IGNORE_VALUE_H #define _GL_IGNORE_VALUE_H -/* The __attribute__((__warn_unused_result__)) feature - is available in gcc versions 3.4 and newer, - while the typeof feature has been available since 2.7 at least. */ +/* Normally casting an expression to void discards its value, but GCC + versions 3.4 and newer have __attribute__ ((__warn_unused_result__)) + which may cause unwanted diagnostics in that case. Use __typeof__ + and __extension__ to work around the problem, if the workaround is + known to be needed. */ #if 3 < __GNUC__ + (4 <= __GNUC_MINOR__) # define ignore_value(x) \ (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; })) diff --git a/contrib/tools/m4/lib/intprops.h b/contrib/tools/m4/lib/intprops.h new file mode 100644 index 0000000000..8add5def8e --- /dev/null +++ b/contrib/tools/m4/lib/intprops.h @@ -0,0 +1,464 @@ +/* intprops.h -- properties of integer types + + Copyright (C) 2001-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. */ + +#ifndef _GL_INTPROPS_H +#define _GL_INTPROPS_H + +#include <limits.h> +#include <verify.h> + +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif + +/* Return a value with the common real type of E and V and the value of V. */ +#define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) + +/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>. */ +#define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v)) + +/* The extra casts in the following macros work around compiler bugs, + e.g., in Cray C 5.0.3.0. */ + +/* True if the arithmetic type T is an integer type. bool counts as + an integer. */ +#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) + +/* True if the real type T is signed. */ +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) + +/* Return 1 if the real expression E, after promotion, has a + signed or floating type. */ +#define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) + + +/* Minimum and maximum values for integer types and expressions. */ + +/* The width in bits of the integer type or expression T. + Padding bits are not supported; this is checked at compile-time below. */ +#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) + +/* The maximum and minimum values for the integer type T. */ +#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t)) +#define TYPE_MAXIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ + : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) + +/* The maximum and minimum values for the type of the expression E, + after integer promotion. E should not have side effects. */ +#define _GL_INT_MINIMUM(e) \ + (EXPR_SIGNED (e) \ + ? ~ _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_CONVERT (e, 0)) +#define _GL_INT_MAXIMUM(e) \ + (EXPR_SIGNED (e) \ + ? _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_NEGATE_CONVERT (e, 1)) +#define _GL_SIGNED_INT_MAXIMUM(e) \ + (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1) + +/* Work around OpenVMS incompatibility with C99. */ +#if !defined LLONG_MAX && defined __INT64_MAX +# define LLONG_MAX __INT64_MAX +# define LLONG_MIN __INT64_MIN +#endif + +/* This include file assumes that signed types are two's complement without + padding bits; the above macros have undefined behavior otherwise. + If this is a problem for you, please let us know how to fix it for your host. + As a sanity check, test the assumption for some signed types that + <limits.h> bounds. */ +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 (int) == INT_MIN); +verify (TYPE_MAXIMUM (int) == INT_MAX); +verify (TYPE_MINIMUM (long int) == LONG_MIN); +verify (TYPE_MAXIMUM (long int) == LONG_MAX); +#ifdef LLONG_MAX +verify (TYPE_MINIMUM (long long int) == LLONG_MIN); +verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); +#endif +/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */ +#ifdef UINT_WIDTH +verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); +#endif + +/* Does the __typeof__ keyword work? This could be done by + 'configure', but for now it's easier to do it by hand. */ +#if (2 <= __GNUC__ \ + || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ + || (0x5110 <= __SUNPRO_C && !__STDC__)) +# define _GL_HAVE___TYPEOF__ 1 +#else +# define _GL_HAVE___TYPEOF__ 0 +#endif + +/* Return 1 if the integer type or expression T might be signed. Return 0 + if it is definitely unsigned. This macro does not evaluate its argument, + and expands to an integer constant expression. */ +#if _GL_HAVE___TYPEOF__ +# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t)) +#else +# define _GL_SIGNED_TYPE_OR_EXPR(t) 1 +#endif + +/* Bound on length of the string representing an unsigned integer + value representable in B bits. log10 (2.0) < 146/485. The + smallest value of B where this bound is not tight is 2621. */ +#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) + +/* Bound on length of the string representing an integer type or expression T. + Subtract 1 for the sign bit if T is signed, and then add 1 more for + a minus sign if needed. + + Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is + signed, this macro may overestimate the true bound by one byte when + applied to unsigned types of size 2, 4, 16, ... bytes. */ +#define INT_STRLEN_BOUND(t) \ + (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \ + + _GL_SIGNED_TYPE_OR_EXPR (t)) + +/* Bound on buffer size needed to represent an integer type or expression T, + including the terminating null. */ +#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) + + +/* Range overflow checks. + + The INT_<op>_RANGE_OVERFLOW macros return 1 if the corresponding C + operators might not yield numerically correct answers due to + arithmetic overflow. They do not rely on undefined or + implementation-defined behavior. Their implementations are simple + and straightforward, but they are a bit harder to use than the + INT_<op>_OVERFLOW macros described below. + + Example usage: + + long int i = ...; + long int j = ...; + if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX)) + printf ("multiply would overflow"); + else + printf ("product is %ld", i * j); + + Restrictions on *_RANGE_OVERFLOW macros: + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, + so the arguments should not have side effects. The arithmetic + arguments (including the MIN and MAX arguments) must be of the same + integer type after the usual arithmetic conversions, and the type + must have minimum value MIN and maximum MAX. Unsigned types should + use a zero MIN of the proper type. + + These macros are tuned for constant MIN and MAX. For commutative + operations such as A + B, they are also tuned for constant B. */ + +/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_ADD_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (a) < (min) - (b) \ + : (max) - (b) < (a)) + +/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (max) + (b) < (a) \ + : (a) < (min) + (b)) + +/* Return 1 if - A would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_NEGATE_RANGE_OVERFLOW(a, min, max) \ + ((min) < 0 \ + ? (a) < - (max) \ + : 0 < (a)) + +/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Avoid && and || as they tickle + bugs in Sun C 5.11 2010/08/13 and other compilers; see + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */ +#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? ((a) < 0 \ + ? (a) < (max) / (b) \ + : (b) == -1 \ + ? 0 \ + : (min) / (b) < (a)) \ + : (b) == 0 \ + ? 0 \ + : ((a) < 0 \ + ? (a) < (min) / (b) \ + : (max) / (b) < (a))) + +/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. */ +#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max) \ + ((min) < 0 && (b) == -1 && (a) < - (max)) + +/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. + Mathematically, % should never overflow, but on x86-like hosts + INT_MIN % -1 traps, and the C standard permits this, so treat this + as an overflow too. */ +#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max) \ + INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max) + +/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Here, MIN and MAX are for A only, and B need + not be of the same type as the other arguments. The C standard says that + behavior is undefined for shifts unless 0 <= B < wordwidth, and that when + A is negative then A << B has undefined behavior and A >> B has + implementation-defined behavior, but do not check these other + restrictions. */ +#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max) \ + ((a) < 0 \ + ? (a) < (min) >> (b) \ + : (max) >> (b) < (a)) + +/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ +#define _GL_HAS_BUILTIN_OVERFLOW \ + (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)) + +/* True if __builtin_add_overflow_p (A, B, C) works. */ +#define _GL_HAS_BUILTIN_OVERFLOW_P \ + (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) + +/* The _GL*_OVERFLOW macros have the same restrictions as the + *_RANGE_OVERFLOW macros, except that they do not assume that operands + (e.g., A and B) have the same type as MIN and MAX. Instead, they assume + that the result (e.g., A + B) has that type. */ +#if _GL_HAS_BUILTIN_OVERFLOW_P +# define _GL_ADD_OVERFLOW(a, b, min, max) \ + __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) +# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0) +# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0) +#else +# define _GL_ADD_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? (b) <= (a) + (b) \ + : (b) < 0 ? (a) <= (a) + (b) \ + : (a) + (b) < (b)) +# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? 1 \ + : (b) < 0 ? (a) - (b) <= (a) \ + : (a) < (b)) +# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ + || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) +#endif +#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + : (a) < 0 ? (b) <= (a) + (b) - 1 \ + : (b) < 0 && (a) + (b) <= (a)) +#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \ + : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max)) + +/* Return a nonzero value if A is a mathematical multiple of B, where + A is unsigned, B is negative, and MAX is the maximum value of A's + type. A's type must be the same as (A % B)'s type. Normally (A % + -B == 0) suffices, but things get tricky if -B would overflow. */ +#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max) \ + (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \ + ? (_GL_SIGNED_INT_MAXIMUM (b) == (max) \ + ? (a) \ + : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1)) \ + : (a) % - (b)) \ + == 0) + +/* Check for integer overflow, and report low order bits of answer. + + The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators + might not yield numerically correct answers due to arithmetic overflow. + The INT_<op>_WRAPV macros also store the low-order bits of the answer. + These macros work correctly on all known practical hosts, and do not rely + on undefined behavior due to signed arithmetic overflow. + + Example usage, assuming A and B are long int: + + if (INT_MULTIPLY_OVERFLOW (a, b)) + printf ("result would overflow\n"); + else + printf ("result is %ld (no overflow)\n", a * b); + + Example usage with WRAPV flavor: + + long int result; + bool overflow = INT_MULTIPLY_WRAPV (a, b, &result); + printf ("result is %ld (%s)\n", result, + overflow ? "after overflow" : "no overflow"); + + Restrictions on these macros: + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, so the + arguments should not have side effects. + + The WRAPV macros are not constant expressions. They support only + +, binary -, and *. The result type must be signed. + + These macros are tuned for their last argument being a constant. + + Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B, + A % B, and A << B would overflow, respectively. */ + +#define INT_ADD_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) +#define INT_SUBTRACT_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) +#if _GL_HAS_BUILTIN_OVERFLOW_P +# define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a) +#else +# define INT_NEGATE_OVERFLOW(a) \ + INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) +#endif +#define INT_MULTIPLY_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW) +#define INT_DIVIDE_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW) +#define INT_REMAINDER_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW) +#define INT_LEFT_SHIFT_OVERFLOW(a, b) \ + INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \ + _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) + +/* Return 1 if the expression A <op> B would overflow, + where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test, + assuming MIN and MAX are the minimum and maximum for the result type. + Arguments should be free of side effects. */ +#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \ + op_result_overflow (a, b, \ + _GL_INT_MINIMUM (0 * (b) + (a)), \ + _GL_INT_MAXIMUM (0 * (b) + (a))) + +/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R. + Return 1 if the result overflows. See above for restrictions. */ +#define INT_ADD_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, +, __builtin_add_overflow, INT_ADD_OVERFLOW) +#define INT_SUBTRACT_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, -, __builtin_sub_overflow, INT_SUBTRACT_OVERFLOW) +#define INT_MULTIPLY_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW) + +/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 + https://llvm.org/bugs/show_bug.cgi?id=25390 + For now, assume all versions of GCC-like compilers generate bogus + warnings for _Generic. This matters only for older compilers that + lack __builtin_add_overflow. */ +#if __GNUC__ +# define _GL__GENERIC_BOGUS 1 +#else +# define _GL__GENERIC_BOGUS 0 +#endif + +/* Store the low-order bits of A <op> B into *R, where OP specifies + the operation. BUILTIN is the builtin operation, and OVERFLOW the + overflow predicate. Return 1 if the result overflows. See above + for restrictions. */ +#if _GL_HAS_BUILTIN_OVERFLOW +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r) +#elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ + (_Generic \ + (*(r), \ + signed char: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ + signed char, SCHAR_MIN, SCHAR_MAX), \ + short int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ + short int, SHRT_MIN, SHRT_MAX), \ + int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX), \ + long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX), \ + long long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX))) +#else +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ + (sizeof *(r) == sizeof (signed char) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ + signed char, SCHAR_MIN, SCHAR_MAX) \ + : sizeof *(r) == sizeof (short int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ + short int, SHRT_MIN, SHRT_MAX) \ + : sizeof *(r) == sizeof (int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX) \ + : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow)) +# ifdef LLONG_MAX +# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ + (sizeof *(r) == sizeof (long int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX)) +# else +# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) +# endif +#endif + +/* Store the low-order bits of A <op> B into *R, where the operation + is given by OP. Use the unsigned type UT for calculation to avoid + overflow problems. *R's type is T, with extremal values TMIN and + TMAX. T must be a signed integer type. Return 1 if the result + overflows. */ +#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \ + (sizeof ((a) op (b)) < sizeof (t) \ + ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \ + : _GL_INT_OP_CALC1 (a, b, r, op, overflow, ut, t, tmin, tmax)) +#define _GL_INT_OP_CALC1(a, b, r, op, overflow, ut, t, tmin, tmax) \ + ((overflow (a, b) \ + || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \ + || (tmax) < ((a) op (b))) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 1) \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0)) + +/* Return A <op> B, where the operation is given by OP. Use the + unsigned type UT for calculation to avoid overflow problems. + Convert the result to type T without overflow by subtracting TMIN + from large values before converting, and adding it afterwards. + Compilers can optimize all the operations except OP. */ +#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t, tmin, tmax) \ + (((ut) (a) op (ut) (b)) <= (tmax) \ + ? (t) ((ut) (a) op (ut) (b)) \ + : ((t) (((ut) (a) op (ut) (b)) - (tmin)) + (tmin))) + +#endif /* _GL_INTPROPS_H */ diff --git a/contrib/tools/m4/lib/isnan.c b/contrib/tools/m4/lib/isnan.c deleted file mode 100644 index d95e4bac77..0000000000 --- a/contrib/tools/m4/lib/isnan.c +++ /dev/null @@ -1,177 +0,0 @@ -/* Test for NaN that does not need libm. - Copyright (C) 2007-2013 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> - -/* Specification. */ -#ifdef USE_LONG_DOUBLE -/* Specification found in math.h or isnanl-nolibm.h. */ -extern int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST; -#elif ! defined USE_FLOAT -/* Specification found in math.h or isnand-nolibm.h. */ -extern int rpl_isnand (double x); -#else /* defined USE_FLOAT */ -/* Specification found in math.h or isnanf-nolibm.h. */ -extern int rpl_isnanf (float x); -#endif - -#include <float.h> -#include <string.h> - -#include "float+.h" - -#ifdef USE_LONG_DOUBLE -# define FUNC rpl_isnanl -# define DOUBLE long double -# define MAX_EXP LDBL_MAX_EXP -# define MIN_EXP LDBL_MIN_EXP -# if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT -# define KNOWN_EXPBIT0_LOCATION -# define EXPBIT0_WORD LDBL_EXPBIT0_WORD -# define EXPBIT0_BIT LDBL_EXPBIT0_BIT -# endif -# define SIZE SIZEOF_LDBL -# define L_(literal) literal##L -#elif ! defined USE_FLOAT -# define FUNC rpl_isnand -# define DOUBLE double -# define MAX_EXP DBL_MAX_EXP -# define MIN_EXP DBL_MIN_EXP -# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT -# define KNOWN_EXPBIT0_LOCATION -# define EXPBIT0_WORD DBL_EXPBIT0_WORD -# define EXPBIT0_BIT DBL_EXPBIT0_BIT -# endif -# define SIZE SIZEOF_DBL -# define L_(literal) literal -#else /* defined USE_FLOAT */ -# define FUNC rpl_isnanf -# define DOUBLE float -# define MAX_EXP FLT_MAX_EXP -# define MIN_EXP FLT_MIN_EXP -# if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT -# define KNOWN_EXPBIT0_LOCATION -# define EXPBIT0_WORD FLT_EXPBIT0_WORD -# define EXPBIT0_BIT FLT_EXPBIT0_BIT -# endif -# define SIZE SIZEOF_FLT -# define L_(literal) literal##f -#endif - -#define EXP_MASK ((MAX_EXP - MIN_EXP) | 7) - -#define NWORDS \ - ((sizeof (DOUBLE) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { DOUBLE value; unsigned int word[NWORDS]; } memory_double; - -int -FUNC (DOUBLE x) -{ -#ifdef KNOWN_EXPBIT0_LOCATION -# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE - /* Special CPU dependent code is needed to treat bit patterns outside the - IEEE 754 specification (such as Pseudo-NaNs, Pseudo-Infinities, - Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals) as NaNs. - These bit patterns are: - - exponent = 0x0001..0x7FFF, mantissa bit 63 = 0, - - exponent = 0x0000, mantissa bit 63 = 1. - The NaN bit pattern is: - - exponent = 0x7FFF, mantissa >= 0x8000000000000001. */ - memory_double m; - unsigned int exponent; - - m.value = x; - exponent = (m.word[EXPBIT0_WORD] >> EXPBIT0_BIT) & EXP_MASK; -# ifdef WORDS_BIGENDIAN - /* Big endian: EXPBIT0_WORD = 0, EXPBIT0_BIT = 16. */ - if (exponent == 0) - return 1 & (m.word[0] >> 15); - else if (exponent == EXP_MASK) - return (((m.word[0] ^ 0x8000U) << 16) | m.word[1] | (m.word[2] >> 16)) != 0; - else - return 1 & ~(m.word[0] >> 15); -# else - /* Little endian: EXPBIT0_WORD = 2, EXPBIT0_BIT = 0. */ - if (exponent == 0) - return (m.word[1] >> 31); - else if (exponent == EXP_MASK) - return ((m.word[1] ^ 0x80000000U) | m.word[0]) != 0; - else - return (m.word[1] >> 31) ^ 1; -# endif -# else - /* Be careful to not do any floating-point operation on x, such as x == x, - because x may be a signaling NaN. */ -# if defined __SUNPRO_C || defined __ICC || defined _MSC_VER \ - || defined __DECC || defined __TINYC__ \ - || (defined __sgi && !defined __GNUC__) - /* The Sun C 5.0, Intel ICC 10.0, Microsoft Visual C/C++ 9.0, Compaq (ex-DEC) - 6.4, and TinyCC compilers don't recognize the initializers as constant - expressions. The Compaq compiler also fails when constant-folding - 0.0 / 0.0 even when constant-folding is not required. The Microsoft - Visual C/C++ compiler also fails when constant-folding 1.0 / 0.0 even - when constant-folding is not required. The SGI MIPSpro C compiler - complains about "floating-point operation result is out of range". */ - static DOUBLE zero = L_(0.0); - memory_double nan; - DOUBLE plus_inf = L_(1.0) / zero; - DOUBLE minus_inf = -L_(1.0) / zero; - nan.value = zero / zero; -# else - static memory_double nan = { L_(0.0) / L_(0.0) }; - static DOUBLE plus_inf = L_(1.0) / L_(0.0); - static DOUBLE minus_inf = -L_(1.0) / L_(0.0); -# endif - { - memory_double m; - - /* A NaN can be recognized through its exponent. But exclude +Infinity and - -Infinity, which have the same exponent. */ - m.value = x; - if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD]) - & (EXP_MASK << EXPBIT0_BIT)) - == 0) - return (memcmp (&m.value, &plus_inf, SIZE) != 0 - && memcmp (&m.value, &minus_inf, SIZE) != 0); - else - return 0; - } -# endif -#else - /* The configuration did not find sufficient information. Give up about - the signaling NaNs, handle only the quiet NaNs. */ - if (x == x) - { -# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE - /* Detect any special bit patterns that pass ==; see comment above. */ - memory_double m1; - memory_double m2; - - memset (&m1.value, 0, SIZE); - memset (&m2.value, 0, SIZE); - m1.value = x; - m2.value = x + (x ? 0.0L : -0.0L); - if (memcmp (&m1.value, &m2.value, SIZE) != 0) - return 1; -# endif - return 0; - } - else - return 1; -#endif -} diff --git a/contrib/tools/m4/lib/isnand-nolibm.h b/contrib/tools/m4/lib/isnand-nolibm.h index 8a84ff8140..dc4726464a 100644 --- a/contrib/tools/m4/lib/isnand-nolibm.h +++ b/contrib/tools/m4/lib/isnand-nolibm.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/isnanf-nolibm.h b/contrib/tools/m4/lib/isnanf-nolibm.h index 804c65f06c..4e68cada3a 100644 --- a/contrib/tools/m4/lib/isnanf-nolibm.h +++ b/contrib/tools/m4/lib/isnanf-nolibm.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + 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 @@ -17,7 +17,7 @@ #if HAVE_ISNANF_IN_LIBC /* Get declaration of isnan macro or (older) isnanf function. */ # include <math.h> -# if __GNUC__ >= 4 && !__clang__ +# if __GNUC__ >= 4 /* GCC 4.0 and newer provides three built-ins for isnan. */ # undef isnanf # define isnanf(x) __builtin_isnanf ((float)(x)) diff --git a/contrib/tools/m4/lib/isnanl-nolibm.h b/contrib/tools/m4/lib/isnanl-nolibm.h index a011374da7..efd919959b 100644 --- a/contrib/tools/m4/lib/isnanl-nolibm.h +++ b/contrib/tools/m4/lib/isnanl-nolibm.h @@ -1,5 +1,5 @@ /* Test for NaN that does not need libm. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + 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 @@ -17,7 +17,7 @@ #if HAVE_ISNANL_IN_LIBC /* Get declaration of isnan macro or (older) isnanl function. */ # include <math.h> -# if __GNUC__ >= 4 && !__clang__ +# if __GNUC__ >= 4 /* GCC 4.0 and newer provides three built-ins for isnan. */ # undef isnanl # define isnanl(x) __builtin_isnanl ((long double)(x)) diff --git a/contrib/tools/m4/lib/localcharset.c b/contrib/tools/m4/lib/localcharset.c index 212eb12e1f..252c451390 100644 --- a/contrib/tools/m4/lib/localcharset.c +++ b/contrib/tools/m4/lib/localcharset.c @@ -1,6 +1,6 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 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 @@ -34,6 +34,7 @@ #if defined _WIN32 || defined __WIN32__ # define WINDOWS_NATIVE +# include <locale.h> #endif #if defined __EMX__ @@ -127,7 +128,7 @@ get_charset_aliases (void) cp = charset_aliases; if (cp == NULL) { -#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__) +#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__ || defined OS2) const char *dir; const char *base = "charset.alias"; char *file_name; @@ -341,6 +342,36 @@ get_charset_aliases (void) "CP54936" "\0" "GB18030" "\0" "CP65001" "\0" "UTF-8" "\0"; # endif +# if defined OS2 + /* To avoid the troubles of installing a separate file in the same + directory as the DLL and of retrieving the DLL's directory at + runtime, simply inline the aliases here. */ + + /* The list of encodings is taken from "List of OS/2 Codepages" + by Alex Taylor: + <http://altsan.org/os2/toolkits/uls/index.html#codepages>. + See also "IBM Globalization - Code page identifiers": + <http://www-01.ibm.com/software/globalization/cp/cp_cpgid.html>. */ + cp = "CP813" "\0" "ISO-8859-7" "\0" + "CP878" "\0" "KOI8-R" "\0" + "CP819" "\0" "ISO-8859-1" "\0" + "CP912" "\0" "ISO-8859-2" "\0" + "CP913" "\0" "ISO-8859-3" "\0" + "CP914" "\0" "ISO-8859-4" "\0" + "CP915" "\0" "ISO-8859-5" "\0" + "CP916" "\0" "ISO-8859-8" "\0" + "CP920" "\0" "ISO-8859-9" "\0" + "CP921" "\0" "ISO-8859-13" "\0" + "CP923" "\0" "ISO-8859-15" "\0" + "CP954" "\0" "EUC-JP" "\0" + "CP964" "\0" "EUC-TW" "\0" + "CP970" "\0" "EUC-KR" "\0" + "CP1089" "\0" "ISO-8859-6" "\0" + "CP1208" "\0" "UTF-8" "\0" + "CP1381" "\0" "GB2312" "\0" + "CP1386" "\0" "GBK" "\0" + "CP3372" "\0" "EUC-JP" "\0"; +# endif #endif charset_aliases = cp; @@ -461,14 +492,34 @@ locale_charset (void) static char buf[2 + 10 + 1]; - /* The Windows API has a function returning the locale's codepage as a - number: GetACP(). - When the output goes to a console window, it needs to be provided in - GetOEMCP() encoding if the console is using a raster font, or in - GetConsoleOutputCP() encoding if it is using a TrueType font. - But in GUI programs and for output sent to files and pipes, GetACP() - encoding is the best bet. */ - sprintf (buf, "CP%u", GetACP ()); + /* The Windows API has a function returning the locale's codepage as + a number, but the value doesn't change according to what the + 'setlocale' call specified. So we use it as a last resort, in + case the string returned by 'setlocale' doesn't specify the + codepage. */ + char *current_locale = setlocale (LC_ALL, NULL); + char *pdot; + + /* If they set different locales for different categories, + 'setlocale' will return a semi-colon separated list of locale + values. To make sure we use the correct one, we choose LC_CTYPE. */ + if (strchr (current_locale, ';')) + current_locale = setlocale (LC_CTYPE, NULL); + + pdot = strrchr (current_locale, '.'); + if (pdot && 2 + strlen (pdot + 1) + 1 <= sizeof (buf)) + sprintf (buf, "CP%s", pdot + 1); + else + { + /* The Windows API has a function returning the locale's codepage as a + number: GetACP(). + When the output goes to a console window, it needs to be provided in + GetOEMCP() encoding if the console is using a raster font, or in + GetConsoleOutputCP() encoding if it is using a TrueType font. + But in GUI programs and for output sent to files and pipes, GetACP() + encoding is the best bet. */ + sprintf (buf, "CP%u", GetACP ()); + } codeset = buf; #elif defined OS2 @@ -478,6 +529,8 @@ locale_charset (void) ULONG cp[3]; ULONG cplen; + codeset = NULL; + /* Allow user to override the codeset, as set in the operating system, with standard language environment variables. */ locale = getenv ("LC_ALL"); @@ -509,10 +562,12 @@ locale_charset (void) } } - /* Resolve through the charset.alias file. */ - codeset = locale; + /* For the POSIX locale, don't use the system's codepage. */ + if (strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0) + codeset = ""; } - else + + if (codeset == NULL) { /* OS/2 has a function returning the locale's codepage as a number. */ if (DosQueryCp (sizeof (cp), cp, &cplen)) diff --git a/contrib/tools/m4/lib/localcharset.h b/contrib/tools/m4/lib/localcharset.h index c209829867..915182e328 100644 --- a/contrib/tools/m4/lib/localcharset.h +++ b/contrib/tools/m4/lib/localcharset.h @@ -1,5 +1,5 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/localeconv.c b/contrib/tools/m4/lib/localeconv.c index 7c7c77cfd4..8a1d6d77cc 100644 --- a/contrib/tools/m4/lib/localeconv.c +++ b/contrib/tools/m4/lib/localeconv.c @@ -1,5 +1,5 @@ /* Query locale dependent information for formatting numbers. - Copyright (C) 2012-2013 Free Software Foundation, Inc. + Copyright (C) 2012-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 diff --git a/contrib/tools/m4/lib/malloca.c b/contrib/tools/m4/lib/malloca.c index 311be569bc..a6132775b1 100644 --- a/contrib/tools/m4/lib/malloca.c +++ b/contrib/tools/m4/lib/malloca.c @@ -1,5 +1,5 @@ /* Safe automatic memory allocation. - Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/malloca.h b/contrib/tools/m4/lib/malloca.h index 6fbe45eab6..7996d1bcbf 100644 --- a/contrib/tools/m4/lib/malloca.h +++ b/contrib/tools/m4/lib/malloca.h @@ -1,5 +1,5 @@ /* Safe automatic memory allocation. - Copyright (C) 2003-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software; you can redistribute it and/or modify @@ -21,6 +21,9 @@ #include <alloca.h> #include <stddef.h> #include <stdlib.h> +#include <stdint.h> + +#include "xalloc-oversized.h" #ifdef __cplusplus @@ -73,15 +76,7 @@ extern void freea (void *p); It allocates an array of N objects, each with S bytes of memory, on the stack. S must be positive and N must be nonnegative. The array must be freed using freea() before the function returns. */ -#if 1 -/* Cf. the definition of xalloc_oversized. */ -# define nmalloca(n, s) \ - ((n) > (size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) \ - ? NULL \ - : malloca ((n) * (s))) -#else -extern void * nmalloca (size_t n, size_t s); -#endif +#define nmalloca(n, s) (xalloc_oversized (n, s) ? NULL : malloca ((n) * (s))) #ifdef __cplusplus diff --git a/contrib/tools/m4/lib/math.c b/contrib/tools/m4/lib/math.c index ddb2ded530..ba2a6abd62 100644 --- a/contrib/tools/m4/lib/math.c +++ b/contrib/tools/m4/lib/math.c @@ -1,3 +1,4 @@ #include <config.h> #define _GL_MATH_INLINE _GL_EXTERN_INLINE #include "math.h" +typedef int dummy; diff --git a/contrib/tools/m4/lib/mbrtowc.c b/contrib/tools/m4/lib/mbrtowc.c new file mode 100644 index 0000000000..11dddc065f --- /dev/null +++ b/contrib/tools/m4/lib/mbrtowc.c @@ -0,0 +1,407 @@ +/* Convert multibyte character to wide character. + Copyright (C) 1999-2002, 2005-2016 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2008. + + 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 <wchar.h> + +#if C_LOCALE_MAYBE_EILSEQ +# include "hard-locale.h" +# include <locale.h> +#endif + +#if GNULIB_defined_mbstate_t +/* Implement mbrtowc() on top of mbtowc(). */ + +# include <errno.h> +# include <stdlib.h> + +# include "localcharset.h" +# error #include "streq.h" +# include "verify.h" + + +verify (sizeof (mbstate_t) >= 4); + +static char internal_state[4]; + +size_t +mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) +{ + char *pstate = (char *)ps; + + if (s == NULL) + { + pwc = NULL; + s = ""; + n = 1; + } + + if (n == 0) + return (size_t)(-2); + + /* Here n > 0. */ + + if (pstate == NULL) + pstate = internal_state; + + { + size_t nstate = pstate[0]; + char buf[4]; + const char *p; + size_t m; + + switch (nstate) + { + case 0: + p = s; + m = n; + break; + case 3: + buf[2] = pstate[3]; + /*FALLTHROUGH*/ + case 2: + buf[1] = pstate[2]; + /*FALLTHROUGH*/ + case 1: + buf[0] = pstate[1]; + p = buf; + m = nstate; + buf[m++] = s[0]; + if (n >= 2 && m < 4) + { + buf[m++] = s[1]; + if (n >= 3 && m < 4) + buf[m++] = s[2]; + } + break; + default: + errno = EINVAL; + return (size_t)(-1); + } + + /* Here m > 0. */ + +# if __GLIBC__ || defined __UCLIBC__ + /* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */ + mbtowc (NULL, NULL, 0); +# endif + { + int res = mbtowc (pwc, p, m); + + if (res >= 0) + { + if (pwc != NULL && ((*pwc == 0) != (res == 0))) + abort (); + if (nstate >= (res > 0 ? res : 1)) + abort (); + res -= nstate; + pstate[0] = 0; + return res; + } + + /* mbtowc does not distinguish between invalid and incomplete multibyte + sequences. But mbrtowc needs to make this distinction. + There are two possible approaches: + - Use iconv() and its return value. + - Use built-in knowledge about the possible encodings. + Given the low quality of implementation of iconv() on the systems that + lack mbrtowc(), we use the second approach. + The possible encodings are: + - 8-bit encodings, + - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS, + - UTF-8. + Use specialized code for each. */ + if (m >= 4 || m >= MB_CUR_MAX) + goto invalid; + /* Here MB_CUR_MAX > 1 and 0 < m < 4. */ + { + const char *encoding = locale_charset (); + + if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) + { + /* Cf. unistr/u8-mblen.c. */ + unsigned char c = (unsigned char) p[0]; + + if (c >= 0xc2) + { + if (c < 0xe0) + { + if (m == 1) + goto incomplete; + } + else if (c < 0xf0) + { + if (m == 1) + goto incomplete; + if (m == 2) + { + unsigned char c2 = (unsigned char) p[1]; + + if ((c2 ^ 0x80) < 0x40 + && (c >= 0xe1 || c2 >= 0xa0) + && (c != 0xed || c2 < 0xa0)) + goto incomplete; + } + } + else if (c <= 0xf4) + { + if (m == 1) + goto incomplete; + else /* m == 2 || m == 3 */ + { + unsigned char c2 = (unsigned char) p[1]; + + if ((c2 ^ 0x80) < 0x40 + && (c >= 0xf1 || c2 >= 0x90) + && (c < 0xf4 || (c == 0xf4 && c2 < 0x90))) + { + if (m == 2) + goto incomplete; + else /* m == 3 */ + { + unsigned char c3 = (unsigned char) p[2]; + + if ((c3 ^ 0x80) < 0x40) + goto incomplete; + } + } + } + } + } + goto invalid; + } + + /* As a reference for this code, you can use the GNU libiconv + implementation. Look for uses of the RET_TOOFEW macro. */ + + if (STREQ_OPT (encoding, + "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f) + goto incomplete; + } + if (m == 2) + { + unsigned char c = (unsigned char) p[0]; + + if (c == 0x8f) + { + unsigned char c2 = (unsigned char) p[1]; + + if (c2 >= 0xa1 && c2 < 0xff) + goto incomplete; + } + } + goto invalid; + } + if (STREQ_OPT (encoding, + "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) + || STREQ_OPT (encoding, + "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) + || STREQ_OPT (encoding, + "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if (c >= 0xa1 && c < 0xff) + goto incomplete; + } + goto invalid; + } + if (STREQ_OPT (encoding, + "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0xa1 && c < 0xff) || c == 0x8e) + goto incomplete; + } + else /* m == 2 || m == 3 */ + { + unsigned char c = (unsigned char) p[0]; + + if (c == 0x8e) + goto incomplete; + } + goto invalid; + } + if (STREQ_OPT (encoding, + "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe)) + goto incomplete; + } + else /* m == 2 || m == 3 */ + { + unsigned char c = (unsigned char) p[0]; + + if (c >= 0x90 && c <= 0xe3) + { + unsigned char c2 = (unsigned char) p[1]; + + if (c2 >= 0x30 && c2 <= 0x39) + { + if (m == 2) + goto incomplete; + else /* m == 3 */ + { + unsigned char c3 = (unsigned char) p[2]; + + if (c3 >= 0x81 && c3 <= 0xfe) + goto incomplete; + } + } + } + } + goto invalid; + } + if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0)) + { + if (m == 1) + { + unsigned char c = (unsigned char) p[0]; + + if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea) + || (c >= 0xf0 && c <= 0xf9)) + goto incomplete; + } + goto invalid; + } + + /* An unknown multibyte encoding. */ + goto incomplete; + } + + incomplete: + { + size_t k = nstate; + /* Here 0 <= k < m < 4. */ + pstate[++k] = s[0]; + if (k < m) + { + pstate[++k] = s[1]; + if (k < m) + pstate[++k] = s[2]; + } + if (k != m) + abort (); + } + pstate[0] = m; + return (size_t)(-2); + + invalid: + errno = EILSEQ; + /* The conversion state is undefined, says POSIX. */ + return (size_t)(-1); + } + } +} + +#else +/* Override the system's mbrtowc() function. */ + +# undef mbrtowc + +size_t +rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) +{ + size_t ret; + wchar_t wc; + +# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG || MBRTOWC_EMPTY_INPUT_BUG + if (s == NULL) + { + pwc = NULL; + s = ""; + n = 1; + } +# endif + +# if MBRTOWC_EMPTY_INPUT_BUG + if (n == 0) + return (size_t) -2; +# endif + + if (! pwc) + pwc = &wc; + +# if MBRTOWC_RETVAL_BUG + { + static mbstate_t internal_state; + + /* Override mbrtowc's internal state. We cannot call mbsinit() on the + hidden internal state, but we can call it on our variable. */ + if (ps == NULL) + ps = &internal_state; + + if (!mbsinit (ps)) + { + /* Parse the rest of the multibyte character byte for byte. */ + size_t count = 0; + for (; n > 0; s++, n--) + { + ret = mbrtowc (&wc, s, 1, ps); + + if (ret == (size_t)(-1)) + return (size_t)(-1); + count++; + if (ret != (size_t)(-2)) + { + /* The multibyte character has been completed. */ + *pwc = wc; + return (wc == 0 ? 0 : count); + } + } + return (size_t)(-2); + } + } +# endif + + ret = mbrtowc (pwc, s, n, ps); + +# if MBRTOWC_NUL_RETVAL_BUG + if (ret < (size_t) -2 && !*pwc) + return 0; +# endif + +# if C_LOCALE_MAYBE_EILSEQ + if ((size_t) -2 <= ret && n != 0 && ! hard_locale (LC_CTYPE)) + { + unsigned char uc = *s; + *pwc = uc; + return 1; + } +# endif + + return ret; +} + +#endif diff --git a/contrib/tools/m4/lib/memchr2.c b/contrib/tools/m4/lib/memchr2.c index 8b105b7f27..66a217dd80 100644 --- a/contrib/tools/m4/lib/memchr2.c +++ b/contrib/tools/m4/lib/memchr2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2013 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2016 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), diff --git a/contrib/tools/m4/lib/memchr2.h b/contrib/tools/m4/lib/memchr2.h index cc04889f12..27f2c86116 100644 --- a/contrib/tools/m4/lib/memchr2.h +++ b/contrib/tools/m4/lib/memchr2.h @@ -1,5 +1,5 @@ /* Scan memory for the first of two bytes. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/minmax.h b/contrib/tools/m4/lib/minmax.h new file mode 100644 index 0000000000..be6b321ee1 --- /dev/null +++ b/contrib/tools/m4/lib/minmax.h @@ -0,0 +1,60 @@ +/* MIN, MAX macros. + Copyright (C) 1995, 1998, 2001, 2003, 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, 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 _MINMAX_H +#define _MINMAX_H + +/* Note: MIN, MAX are also defined in <sys/param.h> on some systems + (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about + MIN, MAX macro redefinitions on some systems; the workaround is to + #include this file as the last one among the #include list. */ + +/* Before we define the following symbols we get the <limits.h> file + since otherwise we get redefinitions on some systems if <limits.h> is + included after this file. Likewise for <sys/param.h>. + If more than one of these system headers define MIN and MAX, pick just + one of the headers (because the definitions most likely are the same). */ +#if HAVE_MINMAX_IN_LIMITS_H +# include <limits.h> +#elif HAVE_MINMAX_IN_SYS_PARAM_H +# include <sys/param.h> +#endif + +/* Note: MIN and MAX should be used with two arguments of the + same type. They might not return the minimum and maximum of their two + arguments, if the arguments have different types or have unusual + floating-point values. For example, on a typical host with 32-bit 'int', + 64-bit 'long long', and 64-bit IEEE 754 'double' types: + + MAX (-1, 2147483648) returns 4294967295. + MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0. + MAX (NaN, 0.0) returns 0.0. + MAX (+0.0, -0.0) returns -0.0. + + and in each case the answer is in some sense bogus. */ + +/* MAX(a,b) returns the maximum of A and B. */ +#ifndef MAX +# define MAX(a,b) ((a) > (b) ? (a) : (b)) +#endif + +/* MIN(a,b) returns the minimum of A and B. */ +#ifndef MIN +# define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + +#endif /* _MINMAX_H */ diff --git a/contrib/tools/m4/lib/mkdtemp.c b/contrib/tools/m4/lib/mkdtemp.c index 6ba8b65d52..c1b05fd8ad 100644 --- a/contrib/tools/m4/lib/mkdtemp.c +++ b/contrib/tools/m4/lib/mkdtemp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2013 Free Software +/* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/contrib/tools/m4/lib/mkstemp-safer.c b/contrib/tools/m4/lib/mkstemp-safer.c index 9ddf86fb60..560c0c10a6 100644 --- a/contrib/tools/m4/lib/mkstemp-safer.c +++ b/contrib/tools/m4/lib/mkstemp-safer.c @@ -1,6 +1,6 @@ /* Invoke mkstemp, but avoid some glitches. - Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/msvc-inval.c b/contrib/tools/m4/lib/msvc-inval.c index 396031e4c2..baaf39eda1 100644 --- a/contrib/tools/m4/lib/msvc-inval.c +++ b/contrib/tools/m4/lib/msvc-inval.c @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/msvc-inval.h b/contrib/tools/m4/lib/msvc-inval.h index dcb0353dcd..027c94972a 100644 --- a/contrib/tools/m4/lib/msvc-inval.h +++ b/contrib/tools/m4/lib/msvc-inval.h @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/msvc-nothrow.c b/contrib/tools/m4/lib/msvc-nothrow.c index 8d65472a82..ba75bbfb27 100644 --- a/contrib/tools/m4/lib/msvc-nothrow.c +++ b/contrib/tools/m4/lib/msvc-nothrow.c @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/msvc-nothrow.h b/contrib/tools/m4/lib/msvc-nothrow.h index 5f521813df..3493b84a86 100644 --- a/contrib/tools/m4/lib/msvc-nothrow.h +++ b/contrib/tools/m4/lib/msvc-nothrow.h @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/nl_langinfo.c b/contrib/tools/m4/lib/nl_langinfo.c index 771c9533ae..1c110def13 100644 --- a/contrib/tools/m4/lib/nl_langinfo.c +++ b/contrib/tools/m4/lib/nl_langinfo.c @@ -1,6 +1,6 @@ /* nl_langinfo() replacement: query locale dependent information. - Copyright (C) 2007-2013 Free Software Foundation, Inc. + 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 @@ -20,13 +20,71 @@ /* Specification. */ #include <langinfo.h> +#include <locale.h> +#include <string.h> +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ +# include <windows.h> +# include <stdio.h> +#endif + +/* Return the codeset of the current locale, if this is easily deducible. + Otherwise, return "". */ +static char * +ctype_codeset (void) +{ + static char buf[2 + 10 + 1]; + char const *locale = setlocale (LC_CTYPE, NULL); + char *codeset = buf; + size_t codesetlen; + codeset[0] = '\0'; + + if (locale && locale[0]) + { + /* If the locale name contains an encoding after the dot, return it. */ + char *dot = strchr (locale, '.'); + + if (dot) + { + /* Look for the possible @... trailer and remove it, if any. */ + char *codeset_start = dot + 1; + char const *modifier = strchr (codeset_start, '@'); + + if (! modifier) + codeset = codeset_start; + else + { + codesetlen = modifier - codeset_start; + if (codesetlen < sizeof buf) + { + codeset = memcpy (buf, codeset_start, codesetlen); + codeset[codesetlen] = '\0'; + } + } + } + } + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + /* If setlocale is successful, it returns the number of the + codepage, as a string. Otherwise, fall back on Windows API + GetACP, which returns the locale's codepage as a number (although + this doesn't change according to what the 'setlocale' call specified). + Either way, prepend "CP" to make it a valid codeset name. */ + codesetlen = strlen (codeset); + if (0 < codesetlen && codesetlen < sizeof buf - 2) + memmove (buf + 2, codeset, codesetlen + 1); + else + sprintf (buf + 2, "%u", GetACP ()); + codeset = memcpy (buf, "CP", 2); +#endif + return codeset; +} + + #if REPLACE_NL_LANGINFO /* Override nl_langinfo with support for added nl_item values. */ -# include <locale.h> -# include <string.h> - # undef nl_langinfo char * @@ -36,47 +94,18 @@ rpl_nl_langinfo (nl_item item) { # if GNULIB_defined_CODESET case CODESET: - { - const char *locale; - static char buf[2 + 10 + 1]; - - locale = setlocale (LC_CTYPE, NULL); - if (locale != NULL && locale[0] != '\0') - { - /* If the locale name contains an encoding after the dot, return - it. */ - const char *dot = strchr (locale, '.'); - - if (dot != NULL) - { - const char *modifier; - - dot++; - /* Look for the possible @... trailer and remove it, if any. */ - modifier = strchr (dot, '@'); - if (modifier == NULL) - return dot; - if (modifier - dot < sizeof (buf)) - { - memcpy (buf, dot, modifier - dot); - buf [modifier - dot] = '\0'; - return buf; - } - } - } - return ""; - } + return ctype_codeset (); # endif # if GNULIB_defined_T_FMT_AMPM case T_FMT_AMPM: - return "%I:%M:%S %p"; + return (char *) "%I:%M:%S %p"; # endif # if GNULIB_defined_ERA case ERA: /* The format is not standardized. In glibc it is a sequence of strings of the form "direction:offset:start_date:end_date:era_name:era_format" with an empty string at the end. */ - return ""; + return (char *) ""; case ERA_D_FMT: /* The %Ex conversion in strftime behaves like %x if the locale does not have an alternative time format. */ @@ -95,13 +124,13 @@ rpl_nl_langinfo (nl_item item) case ALT_DIGITS: /* The format is not standardized. In glibc it is a sequence of 10 strings, appended in memory. */ - return "\0\0\0\0\0\0\0\0\0\0"; + return (char *) "\0\0\0\0\0\0\0\0\0\0"; # endif # if GNULIB_defined_YESEXPR || !FUNC_NL_LANGINFO_YESEXPR_WORKS case YESEXPR: - return "^[yY]"; + return (char *) "^[yY]"; case NOEXPR: - return "^[nN]"; + return (char *) "^[nN]"; # endif default: break; @@ -111,45 +140,31 @@ rpl_nl_langinfo (nl_item item) #else -/* Provide nl_langinfo from scratch. */ - -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* Provide nl_langinfo from scratch, either for native MS-Windows, or + for old Unix platforms without locales, such as Linux libc5 or + BeOS. */ -/* Native Windows platforms. */ - -# define WIN32_LEAN_AND_MEAN /* avoid including junk */ -# include <windows.h> - -# include <stdio.h> - -# else - -/* An old Unix platform without locales, such as Linux libc5 or BeOS. */ - -# endif - -# include <locale.h> +# include <time.h> char * nl_langinfo (nl_item item) { + static char nlbuf[100]; + struct tm tmm = { 0 }; + switch (item) { /* nl_langinfo items of the LC_CTYPE category */ case CODESET: -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ { - static char buf[2 + 10 + 1]; - - /* The Windows API has a function returning the locale's codepage as - a number. */ - sprintf (buf, "CP%u", GetACP ()); - return buf; + char *codeset = ctype_codeset (); + if (*codeset) + return codeset; } -# elif defined __BEOS__ - return "UTF-8"; +# ifdef __BEOS__ + return (char *) "UTF-8"; # else - return "ISO-8859-1"; + return (char *) "ISO-8859-1"; # endif /* nl_langinfo items of the LC_NUMERIC category */ case RADIXCHAR: @@ -160,111 +175,146 @@ nl_langinfo (nl_item item) TODO: Really use the locale. */ case D_T_FMT: case ERA_D_T_FMT: - return "%a %b %e %H:%M:%S %Y"; + return (char *) "%a %b %e %H:%M:%S %Y"; case D_FMT: case ERA_D_FMT: - return "%m/%d/%y"; + return (char *) "%m/%d/%y"; case T_FMT: case ERA_T_FMT: - return "%H:%M:%S"; + return (char *) "%H:%M:%S"; case T_FMT_AMPM: - return "%I:%M:%S %p"; + return (char *) "%I:%M:%S %p"; case AM_STR: - return "AM"; + if (!strftime (nlbuf, sizeof nlbuf, "%p", &tmm)) + return (char *) "AM"; + return nlbuf; case PM_STR: - return "PM"; + tmm.tm_hour = 12; + if (!strftime (nlbuf, sizeof nlbuf, "%p", &tmm)) + return (char *) "PM"; + return nlbuf; case DAY_1: - return "Sunday"; case DAY_2: - return "Monday"; case DAY_3: - return "Tuesday"; case DAY_4: - return "Wednesday"; case DAY_5: - return "Thursday"; case DAY_6: - return "Friday"; case DAY_7: - return "Saturday"; + { + static char const days[][sizeof "Wednesday"] = { + "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", + "Friday", "Saturday" + }; + tmm.tm_wday = item - DAY_1; + if (!strftime (nlbuf, sizeof nlbuf, "%A", &tmm)) + return (char *) days[item - DAY_1]; + return nlbuf; + } case ABDAY_1: - return "Sun"; case ABDAY_2: - return "Mon"; case ABDAY_3: - return "Tue"; case ABDAY_4: - return "Wed"; case ABDAY_5: - return "Thu"; case ABDAY_6: - return "Fri"; case ABDAY_7: - return "Sat"; + { + static char const abdays[][sizeof "Sun"] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + tmm.tm_wday = item - ABDAY_1; + if (!strftime (nlbuf, sizeof nlbuf, "%a", &tmm)) + return (char *) abdays[item - ABDAY_1]; + return nlbuf; + } case MON_1: - return "January"; case MON_2: - return "February"; case MON_3: - return "March"; case MON_4: - return "April"; case MON_5: - return "May"; case MON_6: - return "June"; case MON_7: - return "July"; case MON_8: - return "August"; case MON_9: - return "September"; case MON_10: - return "October"; case MON_11: - return "November"; case MON_12: - return "December"; + { + static char const months[][sizeof "September"] = { + "January", "February", "March", "April", "May", "June", "July", + "September", "October", "November", "December" + }; + tmm.tm_mon = item - MON_1; + if (!strftime (nlbuf, sizeof nlbuf, "%B", &tmm)) + return (char *) months[item - MON_1]; + return nlbuf; + } case ABMON_1: - return "Jan"; case ABMON_2: - return "Feb"; case ABMON_3: - return "Mar"; case ABMON_4: - return "Apr"; case ABMON_5: - return "May"; case ABMON_6: - return "Jun"; case ABMON_7: - return "Jul"; case ABMON_8: - return "Aug"; case ABMON_9: - return "Sep"; case ABMON_10: - return "Oct"; case ABMON_11: - return "Nov"; case ABMON_12: - return "Dec"; + { + static char const abmonths[][sizeof "Jan"] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", + "Sep", "Oct", "Nov", "Dec" + }; + tmm.tm_mon = item - ABMON_1; + if (!strftime (nlbuf, sizeof nlbuf, "%b", &tmm)) + return (char *) abmonths[item - ABMON_1]; + return nlbuf; + } case ERA: - return ""; + return (char *) ""; case ALT_DIGITS: - return "\0\0\0\0\0\0\0\0\0\0"; - /* nl_langinfo items of the LC_MONETARY category - TODO: Really use the locale. */ + return (char *) "\0\0\0\0\0\0\0\0\0\0"; + /* nl_langinfo items of the LC_MONETARY category. */ case CRNCYSTR: - return "-"; + return localeconv () ->currency_symbol; +#if 0 + case INT_CURR_SYMBOL: + return localeconv () ->int_curr_symbol; + case MON_DECIMAL_POINT: + return localeconv () ->mon_decimal_point; + case MON_THOUSANDS_SEP: + return localeconv () ->mon_thousands_sep; + case MON_GROUPING: + return localeconv () ->mon_grouping; + case POSITIVE_SIGN: + return localeconv () ->positive_sign; + case NEGATIVE_SIGN: + return localeconv () ->negative_sign; + case FRAC_DIGITS: + return & localeconv () ->frac_digits; + case INT_FRAC_DIGITS: + return & localeconv () ->int_frac_digits; + case P_CS_PRECEDES: + return & localeconv () ->p_cs_precedes; + case N_CS_PRECEDES: + return & localeconv () ->n_cs_precedes; + case P_SEP_BY_SPACE: + return & localeconv () ->p_sep_by_space; + case N_SEP_BY_SPACE: + return & localeconv () ->n_sep_by_space; + case P_SIGN_POSN: + return & localeconv () ->p_sign_posn; + case N_SIGN_POSN: + return & localeconv () ->n_sign_posn; +#endif /* nl_langinfo items of the LC_MESSAGES category TODO: Really use the locale. */ case YESEXPR: - return "^[yY]"; + return (char *) "^[yY]"; case NOEXPR: - return "^[nN]"; + return (char *) "^[nN]"; default: - return ""; + return (char *) ""; } } diff --git a/contrib/tools/m4/lib/obstack.c b/contrib/tools/m4/lib/obstack.c index d915449def..b485b615a4 100644 --- a/contrib/tools/m4/lib/obstack.c +++ b/contrib/tools/m4/lib/obstack.c @@ -1,32 +1,32 @@ /* obstack.c - subroutines used implicitly by object stack macros + Copyright (C) 1988-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. - Copyright (C) 1988-1994, 1996-2006, 2009-2013 Free Software Foundation, Inc. + The GNU C Library 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 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, + The GNU C Library 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. + 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 the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifdef _LIBC # include <obstack.h> -# include <shlib-compat.h> #else # include <config.h> # include "obstack.h" #endif -/* NOTE BEFORE MODIFYING THIS FILE: This version number must be - incremented whenever callers compiled using an old obstack.h can no - longer properly call the functions in this obstack.c. */ -#define OBSTACK_INTERFACE_VERSION 1 +/* NOTE BEFORE MODIFYING THIS FILE: _OBSTACK_INTERFACE_VERSION in + obstack.h must be incremented whenever callers compiled using an old + obstack.h can no longer properly call the functions in this file. */ /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself, and the installed library @@ -36,114 +36,76 @@ (especially if it is a shared library). Rather than having every GNU program understand 'configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ - -#include <stdio.h> /* Random thing to get __GNU_LIBRARY__. */ #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 # include <gnu-versions.h> -# if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION -# define ELIDE_CODE +# if (_GNU_OBSTACK_INTERFACE_VERSION == _OBSTACK_INTERFACE_VERSION \ + || (_GNU_OBSTACK_INTERFACE_VERSION == 1 \ + && _OBSTACK_INTERFACE_VERSION == 2 \ + && defined SIZEOF_INT && defined SIZEOF_SIZE_T \ + && SIZEOF_INT == SIZEOF_SIZE_T)) +# define _OBSTACK_ELIDE_CODE # endif #endif -#include <stddef.h> - -#ifndef ELIDE_CODE - +#ifndef _OBSTACK_ELIDE_CODE +/* If GCC, or if an oddball (testing?) host that #defines __alignof__, + use the already-supplied __alignof__. Otherwise, this must be Gnulib + (as glibc assumes GCC); defer to Gnulib's alignof_type. */ +# include <stdlib.h> # include <stdint.h> -/* Determine default alignment. */ -union fooround -{ - uintmax_t i; - long double d; - void *p; -}; -struct fooalign -{ - char c; - union fooround u; -}; -/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. - But in fact it might be less smart and round addresses to as much as - DEFAULT_ROUNDING. So we prepare for it to do that. */ -enum - { - DEFAULT_ALIGNMENT = offsetof (struct fooalign, u), - DEFAULT_ROUNDING = sizeof (union fooround) - }; - -/* When we copy a long block of data, this is the unit to do it with. - On some machines, copying successive ints does not work; - in such a case, redefine COPYING_UNIT to 'long' (if that works) - or 'char' as a last resort. */ -# ifndef COPYING_UNIT -# define COPYING_UNIT int +# ifndef MAX +# define MAX(a,b) ((a) > (b) ? (a) : (b)) # endif +/* Determine default alignment. */ -/* The functions allocating more room by calling 'obstack_chunk_alloc' - jump to the handler pointed to by 'obstack_alloc_failed_handler'. - This can be set to a user defined function which should either - abort gracefully or use longjump - but shouldn't return. This - variable by default points to the internal function - 'print_and_abort'. */ -static _Noreturn void print_and_abort (void); -void (*obstack_alloc_failed_handler) (void) = print_and_abort; +/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. + But in fact it might be less smart and round addresses to as much as + DEFAULT_ROUNDING. So we prepare for it to do that. + + DEFAULT_ALIGNMENT cannot be an enum constant; see gnulib's alignof.h. */ +#define DEFAULT_ALIGNMENT MAX (__alignof__ (long double), \ + MAX (__alignof__ (uintmax_t), \ + __alignof__ (void *))) +#define DEFAULT_ROUNDING MAX (sizeof (long double), \ + MAX (sizeof (uintmax_t), \ + sizeof (void *))) + +/* Call functions with either the traditional malloc/free calling + interface, or the mmalloc/mfree interface (that adds an extra first + argument), based on the value of use_extra_arg. */ + +static void * +call_chunkfun (struct obstack *h, size_t size) +{ + if (h->use_extra_arg) + return h->chunkfun.extra (h->extra_arg, size); + else + return h->chunkfun.plain (size); +} -/* Exit value used when 'print_and_abort' is used. */ -# include <stdlib.h> -# ifdef _LIBC -int obstack_exit_failure = EXIT_FAILURE; -# else -# include "exitfail.h" -# define obstack_exit_failure exit_failure -# endif +static void +call_freefun (struct obstack *h, void *old_chunk) +{ + if (h->use_extra_arg) + h->freefun.extra (h->extra_arg, old_chunk); + else + h->freefun.plain (old_chunk); +} -# ifdef _LIBC -# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) -/* A looong time ago (before 1994, anyway; we're not sure) this global variable - was used by non-GNU-C macros to avoid multiple evaluation. The GNU C - library still exports it because somebody might use it. */ -struct obstack *_obstack_compat; -compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0); -# endif -# endif -/* Define a macro that either calls functions with the traditional malloc/free - calling interface, or calls functions with the mmalloc/mfree interface - (that adds an extra first argument), based on the state of use_extra_arg. - For free, do not use ?:, since some compilers, like the MIPS compilers, - do not allow (expr) ? void : void. */ - -# define CALL_CHUNKFUN(h, size) \ - (((h) -> use_extra_arg) \ - ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ - : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size))) - -# define CALL_FREEFUN(h, old_chunk) \ - do { \ - if ((h) -> use_extra_arg) \ - (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ - else \ - (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \ - } while (0) - - /* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). Objects start on multiples of ALIGNMENT (0 means use default). - CHUNKFUN is the function to use to allocate chunks, - and FREEFUN the function to free them. Return nonzero if successful, calls obstack_alloc_failed_handler if allocation fails. */ -int -_obstack_begin (struct obstack *h, - int size, int alignment, - void *(*chunkfun) (long), - void (*freefun) (void *)) +static int +_obstack_begin_worker (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment) { - register struct _obstack_chunk *chunk; /* points to new chunk */ + struct _obstack_chunk *chunk; /* points to new chunk */ if (alignment == 0) alignment = DEFAULT_ALIGNMENT; @@ -164,19 +126,15 @@ _obstack_begin (struct obstack *h, size = 4096 - extra; } - h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun; - h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; h->chunk_size = size; h->alignment_mask = alignment - 1; - h->use_extra_arg = 0; - chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); + chunk = h->chunk = call_chunkfun (h, h->chunk_size); if (!chunk) (*obstack_alloc_failed_handler) (); h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, alignment - 1); - h->chunk_limit = chunk->limit - = (char *) chunk + h->chunk_size; + h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; /* The initial chunk now contains no empty object. */ h->maybe_empty_object = 0; @@ -185,51 +143,29 @@ _obstack_begin (struct obstack *h, } int -_obstack_begin_1 (struct obstack *h, int size, int alignment, - void *(*chunkfun) (void *, long), +_obstack_begin (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment, + void *(*chunkfun) (size_t), + void (*freefun) (void *)) +{ + h->chunkfun.plain = chunkfun; + h->freefun.plain = freefun; + h->use_extra_arg = 0; + return _obstack_begin_worker (h, size, alignment); +} + +int +_obstack_begin_1 (struct obstack *h, + _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment, + void *(*chunkfun) (void *, size_t), void (*freefun) (void *, void *), void *arg) { - register struct _obstack_chunk *chunk; /* points to new chunk */ - - if (alignment == 0) - alignment = DEFAULT_ALIGNMENT; - if (size == 0) - /* Default size is what GNU malloc can fit in a 4096-byte block. */ - { - /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. - Use the values for range checking, because if range checking is off, - the extra bytes won't be missed terribly, but if range checking is on - and we used a larger request, a whole extra 4096 bytes would be - allocated. - - These number are irrelevant to the new GNU malloc. I suspect it is - less sensitive to the size of the request. */ - int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) - + 4 + DEFAULT_ROUNDING - 1) - & ~(DEFAULT_ROUNDING - 1)); - size = 4096 - extra; - } - - h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun; - h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; - h->chunk_size = size; - h->alignment_mask = alignment - 1; + h->chunkfun.extra = chunkfun; + h->freefun.extra = freefun; h->extra_arg = arg; h->use_extra_arg = 1; - - chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); - if (!chunk) - (*obstack_alloc_failed_handler) (); - h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, - alignment - 1); - h->chunk_limit = chunk->limit - = (char *) chunk + h->chunk_size; - chunk->prev = 0; - /* The initial chunk now contains no empty object. */ - h->maybe_empty_object = 0; - h->alloc_failed = 0; - return 1; + return _obstack_begin_worker (h, size, alignment); } /* Allocate a new current chunk for the obstack *H @@ -239,25 +175,27 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment, to the beginning of the new one. */ void -_obstack_newchunk (struct obstack *h, int length) +_obstack_newchunk (struct obstack *h, _OBSTACK_SIZE_T length) { - register struct _obstack_chunk *old_chunk = h->chunk; - register struct _obstack_chunk *new_chunk; - register long new_size; - register long obj_size = h->next_free - h->object_base; - register long i; - long already; + struct _obstack_chunk *old_chunk = h->chunk; + struct _obstack_chunk *new_chunk = 0; + size_t obj_size = h->next_free - h->object_base; char *object_base; /* Compute size for new chunk. */ - new_size = (obj_size + length) + (obj_size >> 3) + h->alignment_mask + 100; + size_t sum1 = obj_size + length; + size_t sum2 = sum1 + h->alignment_mask; + size_t new_size = sum2 + (obj_size >> 3) + 100; + if (new_size < sum2) + new_size = sum2; if (new_size < h->chunk_size) new_size = h->chunk_size; /* Allocate and initialize the new chunk. */ - new_chunk = CALL_CHUNKFUN (h, new_size); + if (obj_size <= sum1 && sum1 <= sum2) + new_chunk = call_chunkfun (h, new_size); if (!new_chunk) - (*obstack_alloc_failed_handler) (); + (*obstack_alloc_failed_handler)(); h->chunk = new_chunk; new_chunk->prev = old_chunk; new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; @@ -266,36 +204,19 @@ _obstack_newchunk (struct obstack *h, int length) object_base = __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask); - /* Move the existing object to the new chunk. - Word at a time is fast and is safe if the object - is sufficiently aligned. */ - if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) - { - for (i = obj_size / sizeof (COPYING_UNIT) - 1; - i >= 0; i--) - ((COPYING_UNIT *)object_base)[i] - = ((COPYING_UNIT *)h->object_base)[i]; - /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT, - but that can cross a page boundary on a machine - which does not do strict alignment for COPYING_UNITS. */ - already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); - } - else - already = 0; - /* Copy remaining bytes one by one. */ - for (i = already; i < obj_size; i++) - object_base[i] = h->object_base[i]; + /* Move the existing object to the new chunk. */ + memcpy (object_base, h->object_base, obj_size); /* If the object just copied was the only data in OLD_CHUNK, free that chunk and remove it from the chain. But not if that chunk might contain an empty object. */ - if (! h->maybe_empty_object + if (!h->maybe_empty_object && (h->object_base == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, h->alignment_mask))) { new_chunk->prev = old_chunk->prev; - CALL_FREEFUN (h, old_chunk); + call_freefun (h, old_chunk); } h->object_base = object_base; @@ -303,9 +224,6 @@ _obstack_newchunk (struct obstack *h, int length) /* The new chunk certainly contains no empty object yet. */ h->maybe_empty_object = 0; } -# ifdef _LIBC -libc_hidden_def (_obstack_newchunk) -# endif /* Return nonzero if object OBJ has been allocated from obstack H. This is here for debugging. @@ -313,13 +231,13 @@ libc_hidden_def (_obstack_newchunk) /* Suppress -Wmissing-prototypes warning. We don't want to declare this in obstack.h because it is just for debugging. */ -int _obstack_allocated_p (struct obstack *h, void *obj); +int _obstack_allocated_p (struct obstack *h, void *obj) __attribute_pure__; int _obstack_allocated_p (struct obstack *h, void *obj) { - register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk *plp; /* point to previous chunk if any */ + struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + struct _obstack_chunk *plp; /* point to previous chunk if any */ lp = (h)->chunk; /* We use >= rather than > since the object cannot be exactly at @@ -332,17 +250,15 @@ _obstack_allocated_p (struct obstack *h, void *obj) } return lp != 0; } - + /* Free objects in obstack H, including OBJ and everything allocate more recently than OBJ. If OBJ is zero, free everything in H. */ -# undef obstack_free - void -__obstack_free (struct obstack *h, void *obj) +_obstack_free (struct obstack *h, void *obj) { - register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk *plp; /* point to previous chunk if any */ + struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + struct _obstack_chunk *plp; /* point to previous chunk if any */ lp = h->chunk; /* We use >= because there cannot be an object at the beginning of a chunk. @@ -351,7 +267,7 @@ __obstack_free (struct obstack *h, void *obj) while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj)) { plp = lp->prev; - CALL_FREEFUN (h, lp); + call_freefun (h, lp); lp = plp; /* If we switch chunks, we can't tell whether the new current chunk contains an empty object, so assume that it may. */ @@ -368,17 +284,11 @@ __obstack_free (struct obstack *h, void *obj) abort (); } -# ifdef _LIBC -/* Older versions of libc used a function _obstack_free intended to be - called by non-GCC compilers. */ -strong_alias (obstack_free, _obstack_free) -# endif - -int +_OBSTACK_SIZE_T _obstack_memory_used (struct obstack *h) { - register struct _obstack_chunk* lp; - register int nbytes = 0; + struct _obstack_chunk *lp; + _OBSTACK_SIZE_T nbytes = 0; for (lp = h->chunk; lp != 0; lp = lp->prev) { @@ -386,20 +296,31 @@ _obstack_memory_used (struct obstack *h) } return nbytes; } - + +# ifndef _OBSTACK_NO_ERROR_HANDLER /* Define the error handler. */ -# ifdef _LIBC -# include <libintl.h> -# else -# include "gettext.h" -# endif -# ifndef _ -# define _(msgid) gettext (msgid) -# endif +# include <stdio.h> -# ifdef _LIBC -# include <libio/iolibio.h> -# endif +/* Exit value used when 'print_and_abort' is used. */ +# ifdef _LIBC +int obstack_exit_failure = EXIT_FAILURE; +# else +# include "exitfail.h" +# define obstack_exit_failure exit_failure +# endif + +# ifdef _LIBC +# include <libintl.h> +# else +# include "gettext.h" +# endif +# ifndef _ +# define _(msgid) gettext (msgid) +# endif + +# ifdef _LIBC +# include <libio/iolibio.h> +# endif static _Noreturn void print_and_abort (void) @@ -409,12 +330,21 @@ print_and_abort (void) happen because the "memory exhausted" message appears in other places like this and the translation should be reused instead of creating a very similar string which requires a separate translation. */ -# ifdef _LIBC +# ifdef _LIBC (void) __fxprintf (NULL, "%s\n", _("memory exhausted")); -# else +# else fprintf (stderr, "%s\n", _("memory exhausted")); -# endif +# endif exit (obstack_exit_failure); } -#endif /* !ELIDE_CODE */ +/* The functions allocating more room by calling 'obstack_chunk_alloc' + jump to the handler pointed to by 'obstack_alloc_failed_handler'. + This can be set to a user defined function which should either + abort gracefully or use longjump - but shouldn't return. This + variable by default points to the internal function + 'print_and_abort'. */ +__attribute_noreturn__ void (*obstack_alloc_failed_handler) (void) + = print_and_abort; +# endif /* !_OBSTACK_NO_ERROR_HANDLER */ +#endif /* !_OBSTACK_ELIDE_CODE */ diff --git a/contrib/tools/m4/lib/obstack.h b/contrib/tools/m4/lib/obstack.h index 7cf98edbd2..e558133de8 100644 --- a/contrib/tools/m4/lib/obstack.h +++ b/contrib/tools/m4/lib/obstack.h @@ -1,90 +1,90 @@ /* obstack.h - object stack macros - Copyright (C) 1988-1994, 1996-1999, 2003-2006, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 1988-2016 Free Software Foundation, Inc. This file is part of the GNU C 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. + The GNU C Library 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, + The GNU C Library 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. + 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/>. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* Summary: -All the apparent functions defined here are macros. The idea -is that you would use these pre-tested macros to solve a -very specific set of problems, and they would run fast. -Caution: no side-effects in arguments please!! They may be -evaluated MANY times!! - -These macros operate a stack of objects. Each object starts life -small, and may grow to maturity. (Consider building a word syllable -by syllable.) An object can move while it is growing. Once it has -been "finished" it never changes address again. So the "top of the -stack" is typically an immature growing object, while the rest of the -stack is of mature, fixed size and fixed address objects. - -These routines grab large chunks of memory, using a function you -supply, called 'obstack_chunk_alloc'. On occasion, they free chunks, -by calling 'obstack_chunk_free'. You must define them and declare -them before using any obstack macros. - -Each independent stack is represented by a 'struct obstack'. -Each of the obstack macros expects a pointer to such a structure -as the first argument. - -One motivation for this package is the problem of growing char strings -in symbol tables. Unless you are "fascist pig with a read-only mind" ---Gosper's immortal quote from HAKMEM item 154, out of context--you -would not like to put any arbitrary upper limit on the length of your -symbols. - -In practice this often means you will build many short symbols and a -few long symbols. At the time you are reading a symbol you don't know -how long it is. One traditional method is to read a symbol into a -buffer, realloc()ating the buffer every time you try to read a symbol -that is longer than the buffer. This is beaut, but you still will -want to copy the symbol from the buffer to a more permanent -symbol-table entry say about half the time. - -With obstacks, you can work differently. Use one obstack for all symbol -names. As you read a symbol, grow the name in the obstack gradually. -When the name is complete, finalize it. Then, if the symbol exists already, -free the newly read name. - -The way we do this is to take a large chunk, allocating memory from -low addresses. When you want to build a symbol in the chunk you just -add chars above the current "high water mark" in the chunk. When you -have finished adding chars, because you got to the end of the symbol, -you know how long the chars are, and you can create a new object. -Mostly the chars will not burst over the highest address of the chunk, -because you would typically expect a chunk to be (say) 100 times as -long as an average object. - -In case that isn't clear, when we have enough chars to make up -the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) -so we just point to it where it lies. No moving of chars is -needed and this is the second win: potentially long strings need -never be explicitly shuffled. Once an object is formed, it does not -change its address during its lifetime. - -When the chars burst over a chunk boundary, we allocate a larger -chunk, and then copy the partly formed object from the end of the old -chunk to the beginning of the new larger chunk. We then carry on -accreting characters to the end of the object as we normally would. - -A special macro is provided to add a single char at a time to a -growing object. This allows the use of register variables, which -break the ordinary 'growth' macro. - -Summary: + All the apparent functions defined here are macros. The idea + is that you would use these pre-tested macros to solve a + very specific set of problems, and they would run fast. + Caution: no side-effects in arguments please!! They may be + evaluated MANY times!! + + These macros operate a stack of objects. Each object starts life + small, and may grow to maturity. (Consider building a word syllable + by syllable.) An object can move while it is growing. Once it has + been "finished" it never changes address again. So the "top of the + stack" is typically an immature growing object, while the rest of the + stack is of mature, fixed size and fixed address objects. + + These routines grab large chunks of memory, using a function you + supply, called 'obstack_chunk_alloc'. On occasion, they free chunks, + by calling 'obstack_chunk_free'. You must define them and declare + them before using any obstack macros. + + Each independent stack is represented by a 'struct obstack'. + Each of the obstack macros expects a pointer to such a structure + as the first argument. + + One motivation for this package is the problem of growing char strings + in symbol tables. Unless you are "fascist pig with a read-only mind" + --Gosper's immortal quote from HAKMEM item 154, out of context--you + would not like to put any arbitrary upper limit on the length of your + symbols. + + In practice this often means you will build many short symbols and a + few long symbols. At the time you are reading a symbol you don't know + how long it is. One traditional method is to read a symbol into a + buffer, realloc()ating the buffer every time you try to read a symbol + that is longer than the buffer. This is beaut, but you still will + want to copy the symbol from the buffer to a more permanent + symbol-table entry say about half the time. + + With obstacks, you can work differently. Use one obstack for all symbol + names. As you read a symbol, grow the name in the obstack gradually. + When the name is complete, finalize it. Then, if the symbol exists already, + free the newly read name. + + The way we do this is to take a large chunk, allocating memory from + low addresses. When you want to build a symbol in the chunk you just + add chars above the current "high water mark" in the chunk. When you + have finished adding chars, because you got to the end of the symbol, + you know how long the chars are, and you can create a new object. + Mostly the chars will not burst over the highest address of the chunk, + because you would typically expect a chunk to be (say) 100 times as + long as an average object. + + In case that isn't clear, when we have enough chars to make up + the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) + so we just point to it where it lies. No moving of chars is + needed and this is the second win: potentially long strings need + never be explicitly shuffled. Once an object is formed, it does not + change its address during its lifetime. + + When the chars burst over a chunk boundary, we allocate a larger + chunk, and then copy the partly formed object from the end of the old + chunk to the beginning of the new larger chunk. We then carry on + accreting characters to the end of the object as we normally would. + + A special macro is provided to add a single char at a time to a + growing object. This allows the use of register variables, which + break the ordinary 'growth' macro. + + Summary: We allocate large chunks. We carve out one object at a time from the current chunk. Once carved, an object never moves. @@ -96,24 +96,38 @@ Summary: Because of the way we do it, you can "unwind" an obstack back to a previous state. (You may remove objects much as you would with a stack.) -*/ + */ /* Don't do the contents of this file more than once. */ #ifndef _OBSTACK_H #define _OBSTACK_H 1 - -/* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is - defined, as with GNU C, use that; that way we don't pollute the - namespace with <stddef.h>'s symbols. Otherwise, include <stddef.h> - and use ptrdiff_t. */ - -#ifdef __PTRDIFF_TYPE__ -# define PTR_INT_TYPE __PTRDIFF_TYPE__ + +#ifndef _OBSTACK_INTERFACE_VERSION +# define _OBSTACK_INTERFACE_VERSION 2 +#endif + +#include <stddef.h> /* For size_t and ptrdiff_t. */ +#include <string.h> /* For __GNU_LIBRARY__, and memcpy. */ + +#if __STDC_VERSION__ < 199901L +# define __FLEXIBLE_ARRAY_MEMBER 1 #else -# include <stddef.h> -# define PTR_INT_TYPE ptrdiff_t +# define __FLEXIBLE_ARRAY_MEMBER +#endif + +#if _OBSTACK_INTERFACE_VERSION == 1 +/* For binary compatibility with obstack version 1, which used "int" + and "long" for these two types. */ +# define _OBSTACK_SIZE_T unsigned int +# define _CHUNK_SIZE_T unsigned long +# define _OBSTACK_CAST(type, expr) ((type) (expr)) +#else +/* Version 2 with sane types, especially for 64-bit hosts. */ +# define _OBSTACK_SIZE_T size_t +# define _CHUNK_SIZE_T size_t +# define _OBSTACK_CAST(type, expr) (expr) #endif /* If B is the base of an object addressed by P, return the result of @@ -122,18 +136,29 @@ Summary: #define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A))) -/* Similar to _BPTR_ALIGN (B, P, A), except optimize the common case +/* Similar to __BPTR_ALIGN (B, P, A), except optimize the common case where pointers can be converted to integers, aligned as integers, - and converted back again. If PTR_INT_TYPE is narrower than a + and converted back again. If ptrdiff_t is narrower than a pointer (e.g., the AS/400), play it safe and compute the alignment relative to B. Otherwise, use the faster strategy of computing the alignment relative to 0. */ -#define __PTR_ALIGN(B, P, A) \ - __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \ +#define __PTR_ALIGN(B, P, A) \ + __BPTR_ALIGN (sizeof (ptrdiff_t) < sizeof (void *) ? (B) : (char *) 0, \ P, A) -#include <string.h> +#ifndef __attribute_pure__ +# define __attribute_pure__ _GL_ATTRIBUTE_PURE +#endif + +/* Not the same as _Noreturn, since it also works with function pointers. */ +#ifndef __attribute_noreturn__ +# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C +# define __attribute_noreturn__ __attribute__ ((__noreturn__)) +# else +# define __attribute_noreturn__ +# endif +#endif #ifdef __cplusplus extern "C" { @@ -141,67 +166,72 @@ extern "C" { struct _obstack_chunk /* Lives at front of each chunk. */ { - char *limit; /* 1 past end of this chunk */ + char *limit; /* 1 past end of this chunk */ struct _obstack_chunk *prev; /* address of prior chunk or NULL */ - char contents[4]; /* objects begin here */ + char contents[__FLEXIBLE_ARRAY_MEMBER]; /* objects begin here */ }; struct obstack /* control current object in current chunk */ { - long chunk_size; /* preferred size to allocate chunks in */ + _CHUNK_SIZE_T chunk_size; /* preferred size to allocate chunks in */ struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ - char *object_base; /* address of object we are building */ - char *next_free; /* where to add next char to current object */ - char *chunk_limit; /* address of char after current chunk */ + char *object_base; /* address of object we are building */ + char *next_free; /* where to add next char to current object */ + char *chunk_limit; /* address of char after current chunk */ union { - PTR_INT_TYPE tempint; - void *tempptr; + _OBSTACK_SIZE_T i; + void *p; } temp; /* Temporary for some macros. */ - int alignment_mask; /* Mask of alignment for each object. */ - /* These prototypes vary based on 'use_extra_arg', and we use - casts to the prototypeless function type in all assignments, - but having prototypes here quiets -Wstrict-prototypes. */ - struct _obstack_chunk *(*chunkfun) (void *, long); - void (*freefun) (void *, struct _obstack_chunk *); + _OBSTACK_SIZE_T alignment_mask; /* Mask of alignment for each object. */ + + /* These prototypes vary based on 'use_extra_arg'. */ + union + { + void *(*plain) (size_t); + void *(*extra) (void *, size_t); + } chunkfun; + union + { + void (*plain) (void *); + void (*extra) (void *, void *); + } freefun; + void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ - unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ - unsigned maybe_empty_object:1;/* There is a possibility that the current - chunk contains a zero-length object. This - prevents freeing the chunk if we allocate - a bigger chunk to replace it. */ - unsigned alloc_failed:1; /* No longer used, as we now call the failed - handler on error, but retained for binary - compatibility. */ + unsigned use_extra_arg : 1; /* chunk alloc/dealloc funcs take extra arg */ + unsigned maybe_empty_object : 1; /* There is a possibility that the current + chunk contains a zero-length object. This + prevents freeing the chunk if we allocate + a bigger chunk to replace it. */ + unsigned alloc_failed : 1; /* No longer used, as we now call the failed + handler on error, but retained for binary + compatibility. */ }; /* Declare the external functions we use; they are in obstack.c. */ -extern void _obstack_newchunk (struct obstack *, int); -extern int _obstack_begin (struct obstack *, int, int, - void *(*) (long), void (*) (void *)); -extern int _obstack_begin_1 (struct obstack *, int, int, - void *(*) (void *, long), +extern void _obstack_newchunk (struct obstack *, _OBSTACK_SIZE_T); +extern void _obstack_free (struct obstack *, void *); +extern int _obstack_begin (struct obstack *, + _OBSTACK_SIZE_T, _OBSTACK_SIZE_T, + void *(*) (size_t), void (*) (void *)); +extern int _obstack_begin_1 (struct obstack *, + _OBSTACK_SIZE_T, _OBSTACK_SIZE_T, + void *(*) (void *, size_t), void (*) (void *, void *), void *); -extern int _obstack_memory_used (struct obstack *); +extern _OBSTACK_SIZE_T _obstack_memory_used (struct obstack *) + __attribute_pure__; -/* The default name of the function for freeing a chunk is 'obstack_free', - but gnulib users can override this by defining '__obstack_free'. */ -#ifndef __obstack_free -# define __obstack_free obstack_free -#endif -extern void __obstack_free (struct obstack *obstack, void *block); - /* Error handler called when 'obstack_chunk_alloc' failed to allocate more memory. This can be set to a user defined function which should either abort gracefully or use longjump - but shouldn't return. The default action is to print a message and abort. */ -extern void (*obstack_alloc_failed_handler) (void); +extern __attribute_noreturn__ void (*obstack_alloc_failed_handler) (void); /* Exit value used when 'print_and_abort' is used. */ extern int obstack_exit_failure; - + /* Pointer to beginning of object being allocated or to be allocated next. Note that this might not be the final address of the object because a new chunk might be needed to hold the final size. */ @@ -214,50 +244,47 @@ extern int obstack_exit_failure; /* Pointer to next byte not yet allocated in current chunk. */ -#define obstack_next_free(h) ((h)->next_free) +#define obstack_next_free(h) ((void *) (h)->next_free) /* Mask specifying low bits that should be clear in address of an object. */ #define obstack_alignment_mask(h) ((h)->alignment_mask) /* To prevent prototype warnings provide complete argument list. */ -#define obstack_init(h) \ - _obstack_begin ((h), 0, 0, \ - (void *(*) (long)) obstack_chunk_alloc, \ - (void (*) (void *)) obstack_chunk_free) +#define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \ + _OBSTACK_CAST (void (*) (void *), obstack_chunk_free)) -#define obstack_begin(h, size) \ - _obstack_begin ((h), (size), 0, \ - (void *(*) (long)) obstack_chunk_alloc, \ - (void (*) (void *)) obstack_chunk_free) +#define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \ + _OBSTACK_CAST (void (*) (void *), obstack_chunk_free)) -#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ - _obstack_begin ((h), (size), (alignment), \ - (void *(*) (long)) (chunkfun), \ - (void (*) (void *)) (freefun)) +#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + _OBSTACK_CAST (void *(*) (size_t), chunkfun), \ + _OBSTACK_CAST (void (*) (void *), freefun)) #define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ - _obstack_begin_1 ((h), (size), (alignment), \ - (void *(*) (void *, long)) (chunkfun), \ - (void (*) (void *, void *)) (freefun), (arg)) + _obstack_begin_1 ((h), (size), (alignment), \ + _OBSTACK_CAST (void *(*) (void *, size_t), chunkfun), \ + _OBSTACK_CAST (void (*) (void *, void *), freefun), arg) -#define obstack_chunkfun(h, newchunkfun) \ - ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun)) +#define obstack_chunkfun(h, newchunkfun) \ + ((void) ((h)->chunkfun.extra = (void *(*) (void *, size_t)) (newchunkfun))) -#define obstack_freefun(h, newfreefun) \ - ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) +#define obstack_freefun(h, newfreefun) \ + ((void) ((h)->freefun.extra = (void *(*) (void *, void *)) (newfreefun))) -#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar)) +#define obstack_1grow_fast(h, achar) ((void) (*((h)->next_free)++ = (achar))) -#define obstack_blank_fast(h,n) ((h)->next_free += (n)) +#define obstack_blank_fast(h, n) ((void) ((h)->next_free += (n))) #define obstack_memory_used(h) _obstack_memory_used (h) - + #if defined __GNUC__ -/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and - does not implement __extension__. But that compiler doesn't define - __GNUC_MINOR__. */ -# if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) +# if !defined __GNUC_MINOR__ || __GNUC__ * 1000 + __GNUC_MINOR__ < 2008 # define __extension__ # endif @@ -266,160 +293,161 @@ extern int obstack_exit_failure; without using a global variable. Also, we can avoid using the 'temp' slot, to make faster code. */ -# define obstack_object_size(OBSTACK) \ - __extension__ \ - ({ struct obstack const *__o = (OBSTACK); \ - (unsigned) (__o->next_free - __o->object_base); }) - -# define obstack_room(OBSTACK) \ - __extension__ \ - ({ struct obstack const *__o = (OBSTACK); \ - (unsigned) (__o->chunk_limit - __o->next_free); }) - -# define obstack_make_room(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->chunk_limit - __o->next_free < __len) \ - _obstack_newchunk (__o, __len); \ - (void) 0; }) - -# define obstack_empty_p(OBSTACK) \ - __extension__ \ - ({ struct obstack const *__o = (OBSTACK); \ - (__o->chunk->prev == 0 \ - && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ - __o->chunk->contents, \ - __o->alignment_mask)); }) - -# define obstack_grow(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->next_free + __len > __o->chunk_limit) \ - _obstack_newchunk (__o, __len); \ - memcpy (__o->next_free, where, __len); \ - __o->next_free += __len; \ - (void) 0; }) - -# define obstack_grow0(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->next_free + __len + 1 > __o->chunk_limit) \ - _obstack_newchunk (__o, __len + 1); \ - memcpy (__o->next_free, where, __len); \ - __o->next_free += __len; \ - *(__o->next_free)++ = 0; \ - (void) 0; }) - -# define obstack_1grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + 1 > __o->chunk_limit) \ - _obstack_newchunk (__o, 1); \ - obstack_1grow_fast (__o, datum); \ - (void) 0; }) +# define obstack_object_size(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o = (OBSTACK); \ + (_OBSTACK_SIZE_T) (__o->next_free - __o->object_base); }) + +/* The local variable is named __o1 to avoid a shadowed variable + warning when invoked from other obstack macros. */ +# define obstack_room(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o1 = (OBSTACK); \ + (_OBSTACK_SIZE_T) (__o1->chunk_limit - __o1->next_free); }) + +# define obstack_make_room(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + (void) 0; }) + +# define obstack_empty_p(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o = (OBSTACK); \ + (__o->chunk->prev == 0 \ + && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ + __o->chunk->contents, \ + __o->alignment_mask)); }) + +# define obstack_grow(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + memcpy (__o->next_free, where, __len); \ + __o->next_free += __len; \ + (void) 0; }) + +# define obstack_grow0(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len + 1) \ + _obstack_newchunk (__o, __len + 1); \ + memcpy (__o->next_free, where, __len); \ + __o->next_free += __len; \ + *(__o->next_free)++ = 0; \ + (void) 0; }) + +# define obstack_1grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < 1) \ + _obstack_newchunk (__o, 1); \ + obstack_1grow_fast (__o, datum); }) /* These assume that the obstack alignment is good enough for pointers or ints, and that the data added so far to the current object shares that much alignment. */ -# define obstack_ptr_grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ - _obstack_newchunk (__o, sizeof (void *)); \ - obstack_ptr_grow_fast (__o, datum); }) \ - -# define obstack_int_grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + sizeof (int) > __o->chunk_limit) \ - _obstack_newchunk (__o, sizeof (int)); \ - obstack_int_grow_fast (__o, datum); }) - -# define obstack_ptr_grow_fast(OBSTACK,aptr) \ -__extension__ \ -({ struct obstack *__o1 = (OBSTACK); \ - void *__p1 = __o1->next_free; \ - *(const void **) __p1 = (aptr); \ - __o1->next_free += sizeof (const void *); \ - (void) 0; }) - -# define obstack_int_grow_fast(OBSTACK,aint) \ -__extension__ \ -({ struct obstack *__o1 = (OBSTACK); \ - void *__p1 = __o1->next_free; \ - *(int *) __p1 = (aint); \ - __o1->next_free += sizeof (int); \ - (void) 0; }) - -# define obstack_blank(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->chunk_limit - __o->next_free < __len) \ - _obstack_newchunk (__o, __len); \ - obstack_blank_fast (__o, __len); \ - (void) 0; }) - -# define obstack_alloc(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_blank (__h, (length)); \ - obstack_finish (__h); }) - -# define obstack_copy(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow (__h, (where), (length)); \ - obstack_finish (__h); }) - -# define obstack_copy0(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow0 (__h, (where), (length)); \ - obstack_finish (__h); }) - -/* The local variable is named __o1 to avoid a name conflict - when obstack_blank is called. */ -# define obstack_finish(OBSTACK) \ -__extension__ \ -({ struct obstack *__o1 = (OBSTACK); \ - void *__value = (void *) __o1->object_base; \ - if (__o1->next_free == __value) \ - __o1->maybe_empty_object = 1; \ - __o1->next_free \ - = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ - __o1->alignment_mask); \ - if (__o1->next_free - (char *)__o1->chunk \ - > __o1->chunk_limit - (char *)__o1->chunk) \ - __o1->next_free = __o1->chunk_limit; \ - __o1->object_base = __o1->next_free; \ - __value; }) - -# define obstack_free(OBSTACK, OBJ) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - void *__obj = (OBJ); \ - if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ - __o->next_free = __o->object_base = (char *)__obj; \ - else (__obstack_free) (__o, __obj); }) - +# define obstack_ptr_grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < sizeof (void *)) \ + _obstack_newchunk (__o, sizeof (void *)); \ + obstack_ptr_grow_fast (__o, datum); }) + +# define obstack_int_grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < sizeof (int)) \ + _obstack_newchunk (__o, sizeof (int)); \ + obstack_int_grow_fast (__o, datum); }) + +# define obstack_ptr_grow_fast(OBSTACK, aptr) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__p1 = __o1->next_free; \ + *(const void **) __p1 = (aptr); \ + __o1->next_free += sizeof (const void *); \ + (void) 0; }) + +# define obstack_int_grow_fast(OBSTACK, aint) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__p1 = __o1->next_free; \ + *(int *) __p1 = (aint); \ + __o1->next_free += sizeof (int); \ + (void) 0; }) + +# define obstack_blank(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + obstack_blank_fast (__o, __len); }) + +# define obstack_alloc(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_blank (__h, (length)); \ + obstack_finish (__h); }) + +# define obstack_copy(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_grow (__h, (where), (length)); \ + obstack_finish (__h); }) + +# define obstack_copy0(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_grow0 (__h, (where), (length)); \ + obstack_finish (__h); }) + +/* The local variable is named __o1 to avoid a shadowed variable + warning when invoked from other obstack macros, typically obstack_free. */ +# define obstack_finish(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__value = (void *) __o1->object_base; \ + if (__o1->next_free == __value) \ + __o1->maybe_empty_object = 1; \ + __o1->next_free \ + = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ + __o1->alignment_mask); \ + if ((size_t) (__o1->next_free - (char *) __o1->chunk) \ + > (size_t) (__o1->chunk_limit - (char *) __o1->chunk)) \ + __o1->next_free = __o1->chunk_limit; \ + __o1->object_base = __o1->next_free; \ + __value; }) + +# define obstack_free(OBSTACK, OBJ) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + void *__obj = (void *) (OBJ); \ + if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit) \ + __o->next_free = __o->object_base = (char *) __obj; \ + else \ + _obstack_free (__o, __obj); }) + #else /* not __GNUC__ */ -# define obstack_object_size(h) \ - (unsigned) ((h)->next_free - (h)->object_base) +# define obstack_object_size(h) \ + ((_OBSTACK_SIZE_T) ((h)->next_free - (h)->object_base)) -# define obstack_room(h) \ - (unsigned) ((h)->chunk_limit - (h)->next_free) +# define obstack_room(h) \ + ((_OBSTACK_SIZE_T) ((h)->chunk_limit - (h)->next_free)) -# define obstack_empty_p(h) \ - ((h)->chunk->prev == 0 \ - && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ - (h)->chunk->contents, \ - (h)->alignment_mask)) +# define obstack_empty_p(h) \ + ((h)->chunk->prev == 0 \ + && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ + (h)->chunk->contents, \ + (h)->alignment_mask)) /* Note that the call to _obstack_newchunk is enclosed in (..., 0) so that we can avoid having void expressions @@ -427,83 +455,87 @@ __extension__ \ Casting the third operand to void was tried before, but some compilers won't accept it. */ -# define obstack_make_room(h,length) \ -( (h)->temp.tempint = (length), \ - (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0)) - -# define obstack_grow(h,where,length) \ -( (h)->temp.tempint = (length), \ - (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ - memcpy ((h)->next_free, where, (h)->temp.tempint), \ - (h)->next_free += (h)->temp.tempint) - -# define obstack_grow0(h,where,length) \ -( (h)->temp.tempint = (length), \ - (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \ - memcpy ((h)->next_free, where, (h)->temp.tempint), \ - (h)->next_free += (h)->temp.tempint, \ - *((h)->next_free)++ = 0) - -# define obstack_1grow(h,datum) \ -( (((h)->next_free + 1 > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), 1), 0) : 0), \ - obstack_1grow_fast (h, datum)) - -# define obstack_ptr_grow(h,datum) \ -( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ - obstack_ptr_grow_fast (h, datum)) - -# define obstack_int_grow(h,datum) \ -( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ - obstack_int_grow_fast (h, datum)) - -# define obstack_ptr_grow_fast(h,aptr) \ - (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr)) - -# define obstack_int_grow_fast(h,aint) \ - (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint)) - -# define obstack_blank(h,length) \ -( (h)->temp.tempint = (length), \ - (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \ - ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ - obstack_blank_fast (h, (h)->temp.tempint)) - -# define obstack_alloc(h,length) \ - (obstack_blank ((h), (length)), obstack_finish ((h))) - -# define obstack_copy(h,where,length) \ - (obstack_grow ((h), (where), (length)), obstack_finish ((h))) - -# define obstack_copy0(h,where,length) \ - (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) - -# define obstack_finish(h) \ -( ((h)->next_free == (h)->object_base \ - ? (((h)->maybe_empty_object = 1), 0) \ - : 0), \ - (h)->temp.tempptr = (h)->object_base, \ - (h)->next_free \ - = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ - (h)->alignment_mask), \ - (((h)->next_free - (char *) (h)->chunk \ - > (h)->chunk_limit - (char *) (h)->chunk) \ - ? ((h)->next_free = (h)->chunk_limit) : 0), \ - (h)->object_base = (h)->next_free, \ - (h)->temp.tempptr) - -# define obstack_free(h,obj) \ -( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \ - ((((h)->temp.tempint > 0 \ - && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \ - ? (int) ((h)->next_free = (h)->object_base \ - = (h)->temp.tempint + (char *) (h)->chunk) \ - : (((__obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0))) +# define obstack_make_room(h, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk (h, (h)->temp.i), 0) : 0), \ + (void) 0) + +# define obstack_grow(h, where, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \ + memcpy ((h)->next_free, where, (h)->temp.i), \ + (h)->next_free += (h)->temp.i, \ + (void) 0) + +# define obstack_grow0(h, where, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i + 1) \ + ? (_obstack_newchunk ((h), (h)->temp.i + 1), 0) : 0), \ + memcpy ((h)->next_free, where, (h)->temp.i), \ + (h)->next_free += (h)->temp.i, \ + *((h)->next_free)++ = 0, \ + (void) 0) + +# define obstack_1grow(h, datum) \ + (((obstack_room (h) < 1) \ + ? (_obstack_newchunk ((h), 1), 0) : 0), \ + obstack_1grow_fast (h, datum)) + +# define obstack_ptr_grow(h, datum) \ + (((obstack_room (h) < sizeof (char *)) \ + ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ + obstack_ptr_grow_fast (h, datum)) + +# define obstack_int_grow(h, datum) \ + (((obstack_room (h) < sizeof (int)) \ + ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ + obstack_int_grow_fast (h, datum)) + +# define obstack_ptr_grow_fast(h, aptr) \ + (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr), \ + (void) 0) + +# define obstack_int_grow_fast(h, aint) \ + (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint), \ + (void) 0) + +# define obstack_blank(h, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \ + obstack_blank_fast (h, (h)->temp.i)) + +# define obstack_alloc(h, length) \ + (obstack_blank ((h), (length)), obstack_finish ((h))) + +# define obstack_copy(h, where, length) \ + (obstack_grow ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_copy0(h, where, length) \ + (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_finish(h) \ + (((h)->next_free == (h)->object_base \ + ? (((h)->maybe_empty_object = 1), 0) \ + : 0), \ + (h)->temp.p = (h)->object_base, \ + (h)->next_free \ + = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ + (h)->alignment_mask), \ + (((size_t) ((h)->next_free - (char *) (h)->chunk) \ + > (size_t) ((h)->chunk_limit - (char *) (h)->chunk)) \ + ? ((h)->next_free = (h)->chunk_limit) : 0), \ + (h)->object_base = (h)->next_free, \ + (h)->temp.p) + +# define obstack_free(h, obj) \ + ((h)->temp.p = (void *) (obj), \ + (((h)->temp.p > (void *) (h)->chunk \ + && (h)->temp.p < (void *) (h)->chunk_limit) \ + ? (void) ((h)->next_free = (h)->object_base = (char *) (h)->temp.p) \ + : _obstack_free ((h), (h)->temp.p))) #endif /* not __GNUC__ */ @@ -511,4 +543,4 @@ __extension__ \ } /* C++ */ #endif -#endif /* obstack.h */ +#endif /* _OBSTACK_H */ diff --git a/contrib/tools/m4/lib/palloca.h b/contrib/tools/m4/lib/palloca.h deleted file mode 100644 index a7ed8a2f9c..0000000000 --- a/contrib/tools/m4/lib/palloca.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#if defined(__FreeBSD__) - #include <stdlib.h> -#else - #include <alloca.h> -#endif diff --git a/contrib/tools/m4/lib/pathmax.h b/contrib/tools/m4/lib/pathmax.h index a9ddc33d17..aee22f8640 100644 --- a/contrib/tools/m4/lib/pathmax.h +++ b/contrib/tools/m4/lib/pathmax.h @@ -1,5 +1,5 @@ /* Define PATH_MAX somehow. Requires sys/types.h. - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2013 Free Software + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/penviron.h b/contrib/tools/m4/lib/penviron.h deleted file mode 100644 index fd83197378..0000000000 --- a/contrib/tools/m4/lib/penviron.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#if defined(__FreeBSD__) || defined(__MACH__) - extern char** environ; -#endif diff --git a/contrib/tools/m4/lib/pipe-safer.c b/contrib/tools/m4/lib/pipe-safer.c index f2e0ad6fb0..fc6144e5ea 100644 --- a/contrib/tools/m4/lib/pipe-safer.c +++ b/contrib/tools/m4/lib/pipe-safer.c @@ -1,5 +1,5 @@ /* Invoke pipe, but avoid some glitches. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 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 diff --git a/contrib/tools/m4/lib/pipe2-safer.c b/contrib/tools/m4/lib/pipe2-safer.c index e831d0c6c1..4b7084ff0b 100644 --- a/contrib/tools/m4/lib/pipe2-safer.c +++ b/contrib/tools/m4/lib/pipe2-safer.c @@ -1,5 +1,5 @@ /* Invoke pipe2, but avoid some glitches. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 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 diff --git a/contrib/tools/m4/lib/pipe2.c b/contrib/tools/m4/lib/pipe2.c index 211d75545c..f8912f2813 100644 --- a/contrib/tools/m4/lib/pipe2.c +++ b/contrib/tools/m4/lib/pipe2.c @@ -1,5 +1,5 @@ /* Create a pipe, with specific opening flags. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/platform/win64/sys/stat.h b/contrib/tools/m4/lib/platform/win64/sys/stat.h index 14f1f4cc32..3b5764884c 100644 --- a/contrib/tools/m4/lib/platform/win64/sys/stat.h +++ b/contrib/tools/m4/lib/platform/win64/sys/stat.h @@ -654,7 +654,7 @@ _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " #if 1 -# if 1 +# if 0 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fstat # define fstat rpl_fstat diff --git a/contrib/tools/m4/lib/printf-args.c b/contrib/tools/m4/lib/printf-args.c index c27e6bc6b7..cfaed994a1 100644 --- a/contrib/tools/m4/lib/printf-args.c +++ b/contrib/tools/m4/lib/printf-args.c @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2013 Free Software + Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/printf-args.h b/contrib/tools/m4/lib/printf-args.h index 2a9c2a3f87..256c413112 100644 --- a/contrib/tools/m4/lib/printf-args.h +++ b/contrib/tools/m4/lib/printf-args.h @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2013 Free Software + Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/printf-frexp.c b/contrib/tools/m4/lib/printf-frexp.c index 1a7b0c438e..1841b86b68 100644 --- a/contrib/tools/m4/lib/printf-frexp.c +++ b/contrib/tools/m4/lib/printf-frexp.c @@ -1,5 +1,5 @@ /* Split a double into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/printf-frexp.h b/contrib/tools/m4/lib/printf-frexp.h index 3976b73686..ec75c606fd 100644 --- a/contrib/tools/m4/lib/printf-frexp.h +++ b/contrib/tools/m4/lib/printf-frexp.h @@ -1,5 +1,5 @@ /* Split a double into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/printf-frexpl.c b/contrib/tools/m4/lib/printf-frexpl.c index 26987a7bd1..3d0ce9b740 100644 --- a/contrib/tools/m4/lib/printf-frexpl.c +++ b/contrib/tools/m4/lib/printf-frexpl.c @@ -1,5 +1,5 @@ /* Split a 'long double' into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/printf-frexpl.h b/contrib/tools/m4/lib/printf-frexpl.h index 3768b0915e..344f37abd1 100644 --- a/contrib/tools/m4/lib/printf-frexpl.h +++ b/contrib/tools/m4/lib/printf-frexpl.h @@ -1,5 +1,5 @@ /* Split a 'long double' into fraction and mantissa, for hexadecimal printf. - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/printf-parse.c b/contrib/tools/m4/lib/printf-parse.c index 23cacc1dab..fad5d3d24c 100644 --- a/contrib/tools/m4/lib/printf-parse.c +++ b/contrib/tools/m4/lib/printf-parse.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002-2003, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 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 diff --git a/contrib/tools/m4/lib/printf-parse.h b/contrib/tools/m4/lib/printf-parse.h index d8474bee15..a46d946241 100644 --- a/contrib/tools/m4/lib/printf-parse.h +++ b/contrib/tools/m4/lib/printf-parse.h @@ -1,5 +1,5 @@ /* Parse printf format string. - Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2013 Free Software + Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/progname.c b/contrib/tools/m4/lib/progname.c index 0c195e521a..debb76026d 100644 --- a/contrib/tools/m4/lib/progname.c +++ b/contrib/tools/m4/lib/progname.c @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/progname.h b/contrib/tools/m4/lib/progname.h index b4f3c2778a..0a574071bf 100644 --- a/contrib/tools/m4/lib/progname.h +++ b/contrib/tools/m4/lib/progname.h @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2001-2004, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/quote.h b/contrib/tools/m4/lib/quote.h index 1679796763..b53d0ea117 100644 --- a/contrib/tools/m4/lib/quote.h +++ b/contrib/tools/m4/lib/quote.h @@ -1,6 +1,6 @@ /* quote.h - prototypes for quote.c - Copyright (C) 1998-2001, 2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2001, 2003, 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 diff --git a/contrib/tools/m4/lib/quotearg.c b/contrib/tools/m4/lib/quotearg.c index 40114d7fbd..07658b24f5 100644 --- a/contrib/tools/m4/lib/quotearg.c +++ b/contrib/tools/m4/lib/quotearg.c @@ -1,6 +1,6 @@ /* quotearg.c - quote arguments for output - Copyright (C) 1998-2002, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004-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 @@ -29,6 +29,7 @@ #include "quotearg.h" #include "quote.h" +#include "minmax.h" #include "xalloc.h" #include "c-strcaseeq.h" #include "localcharset.h" @@ -37,6 +38,7 @@ #include <errno.h> #include <limits.h> #include <stdbool.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <wchar.h> @@ -77,6 +79,8 @@ char const *const quoting_style_args[] = "literal", "shell", "shell-always", + "shell-escape", + "shell-escape-always", "c", "c-maybe", "escape", @@ -91,6 +95,8 @@ enum quoting_style const quoting_style_vals[] = literal_quoting_style, shell_quoting_style, shell_always_quoting_style, + shell_escape_quoting_style, + shell_escape_always_quoting_style, c_quoting_style, c_maybe_quoting_style, escape_quoting_style, @@ -116,7 +122,7 @@ clone_quoting_options (struct quoting_options *o) /* Get the value of O's quoting style. If O is null, use the default. */ enum quoting_style -get_quoting_style (struct quoting_options *o) +get_quoting_style (struct quoting_options const *o) { return (o ? o : &default_quoting_options)->style; } @@ -178,7 +184,7 @@ set_custom_quoting (struct quoting_options *o, static struct quoting_options /* NOT PURE!! */ quoting_options_from_style (enum quoting_style style) { - struct quoting_options o = { 0, 0, { 0 }, NULL, NULL }; + struct quoting_options o = { literal_quoting_style, 0, { 0 }, NULL, NULL }; if (style == custom_quoting_style) abort (); o.style = style; @@ -248,11 +254,15 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, { size_t i; size_t len = 0; + size_t orig_buffersize = 0; char const *quote_string = 0; size_t quote_string_len = 0; bool backslash_escapes = false; bool unibyte_locale = MB_CUR_MAX == 1; bool elide_outer_quotes = (flags & QA_ELIDE_OUTER_QUOTES) != 0; + bool pending_shell_escape_end = false; + bool encountered_single_quote = false; + bool all_c_and_shell_quote_compat = true; #define STORE(c) \ do \ @@ -263,6 +273,38 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, } \ while (0) +#define START_ESC() \ + do \ + { \ + if (elide_outer_quotes) \ + goto force_outer_quoting_style; \ + escaping = true; \ + if (quoting_style == shell_always_quoting_style \ + && ! pending_shell_escape_end) \ + { \ + STORE ('\''); \ + STORE ('$'); \ + STORE ('\''); \ + pending_shell_escape_end = true; \ + } \ + STORE ('\\'); \ + } \ + while (0) + +#define END_ESC() \ + do \ + { \ + if (pending_shell_escape_end && ! escaping) \ + { \ + STORE ('\''); \ + STORE ('\''); \ + pending_shell_escape_end = false; \ + } \ + } \ + while (0) + + process_input: + switch (quoting_style) { case c_maybe_quoting_style: @@ -321,11 +363,18 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, } break; + case shell_escape_quoting_style: + backslash_escapes = true; + /* Fall through. */ case shell_quoting_style: - quoting_style = shell_always_quoting_style; elide_outer_quotes = true; /* Fall through. */ + case shell_escape_always_quoting_style: + if (!elide_outer_quotes) + backslash_escapes = true; + /* Fall through. */ case shell_always_quoting_style: + quoting_style = shell_always_quoting_style; if (!elide_outer_quotes) STORE ('\''); quote_string = "'"; @@ -345,8 +394,11 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, unsigned char c; unsigned char esc; bool is_right_quote = false; + bool escaping = false; + bool c_and_shell_quote_compat = false; if (backslash_escapes + && quoting_style != shell_always_quoting_style && quote_string_len && (i + quote_string_len <= (argsize == SIZE_MAX && 1 < quote_string_len @@ -367,15 +419,15 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, case '\0': if (backslash_escapes) { - if (elide_outer_quotes) - goto force_outer_quoting_style; - STORE ('\\'); + START_ESC (); /* If quote_string were to begin with digits, we'd need to test for the end of the arg as well. However, it's hard to imagine any locale that would use digits in quotes, and set_custom_quoting is documented not to - accept them. */ - if (i + 1 < argsize && '0' <= arg[i + 1] && arg[i + 1] <= '9') + accept them. Use only a single \0 with shell-escape + as currently digits are not printed within $'...' */ + if (quoting_style != shell_always_quoting_style + && i + 1 < argsize && '0' <= arg[i + 1] && arg[i + 1] <= '9') { STORE ('0'); STORE ('0'); @@ -436,6 +488,14 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, case '\t': esc = 't'; goto c_and_shell_escape; case '\v': esc = 'v'; goto c_escape; case '\\': esc = c; + /* Never need to escape '\' in shell case. */ + if (quoting_style == shell_always_quoting_style) + { + if (elide_outer_quotes) + goto force_outer_quoting_style; + goto store_c; + } + /* No need to escape the escape if we are trying to elide outer quotes and nothing else is problematic. */ if (backslash_escapes && elide_outer_quotes && quote_string_len) @@ -463,6 +523,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, break; /* Fall through. */ case ' ': + c_and_shell_quote_compat = true; + /* Fall through. */ case '!': /* special in bash */ case '"': case '$': case '&': case '(': case ')': case '*': case ';': @@ -481,13 +543,26 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, break; case '\'': + encountered_single_quote = true; + c_and_shell_quote_compat = true; if (quoting_style == shell_always_quoting_style) { if (elide_outer_quotes) goto force_outer_quoting_style; + + if (buffersize && ! orig_buffersize) + { + /* Just scan string to see if supports a more concise + representation, rather than writing a longer string + but returning the length of the more concise form. */ + orig_buffersize = buffersize; + buffersize = 0; + } + STORE ('\''); STORE ('\\'); STORE ('\''); + pending_shell_escape_end = false; } break; @@ -513,6 +588,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, them. Also, a digit or a special letter would cause trouble if it appeared in quote_these_too, but that's also documented as not accepting them. */ + c_and_shell_quote_compat = true; break; default: @@ -591,6 +667,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, while (! mbsinit (&mbstate)); } + c_and_shell_quote_compat = printable; + if (1 < m || (backslash_escapes && ! printable)) { /* Output a multibyte sequence, or an escaped @@ -601,9 +679,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, { if (backslash_escapes && ! printable) { - if (elide_outer_quotes) - goto force_outer_quoting_style; - STORE ('\\'); + START_ESC (); STORE ('0' + (c >> 6)); STORE ('0' + ((c >> 3) & 7)); c = '0' + (c & 7); @@ -615,6 +691,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, } if (ilim <= i + 1) break; + END_ESC (); STORE (c); c = arg[++i]; } @@ -624,25 +701,49 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, } } - if (! ((backslash_escapes || elide_outer_quotes) + if (! (((backslash_escapes && quoting_style != shell_always_quoting_style) + || elide_outer_quotes) && quote_these_too - && quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))) + && quote_these_too[c / INT_BITS] >> (c % INT_BITS) & 1) && !is_right_quote) goto store_c; store_escape: - if (elide_outer_quotes) - goto force_outer_quoting_style; - STORE ('\\'); + START_ESC (); store_c: + END_ESC (); STORE (c); + + if (! c_and_shell_quote_compat) + all_c_and_shell_quote_compat = false; } if (len == 0 && quoting_style == shell_always_quoting_style && elide_outer_quotes) goto force_outer_quoting_style; + /* Single shell quotes (') are commonly enough used as an apostrophe, + that we attempt to minimize the quoting in this case. Note itʼs + better to use the apostrophe modifier "\u02BC" if possible, as that + renders better and works with the word match regex \W+ etc. */ + if (quoting_style == shell_always_quoting_style && ! elide_outer_quotes + && encountered_single_quote) + { + if (all_c_and_shell_quote_compat) + return quotearg_buffer_restyled (buffer, orig_buffersize, arg, argsize, + c_quoting_style, + flags, quote_these_too, + left_quote, right_quote); + else if (! buffersize && orig_buffersize) + { + /* Disable read-only scan, and reprocess to write quoted string. */ + buffersize = orig_buffersize; + len = 0; + goto process_input; + } + } + if (quote_string && !elide_outer_quotes) for (; *quote_string; quote_string++) STORE (*quote_string); @@ -654,6 +755,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, force_outer_quoting_style: /* Don't reuse quote_these_too, since the addition of outer quotes sufficiently quotes the specified characters. */ + if (quoting_style == shell_always_quoting_style && backslash_escapes) + quoting_style = shell_escape_always_quoting_style; return quotearg_buffer_restyled (buffer, buffersize, arg, argsize, quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, NULL, @@ -729,7 +832,7 @@ struct slotvec /* Preallocate a slot 0 buffer, so that the caller can always quote one small component of a "memory exhausted" message in slot 0. */ static char slot0[256]; -static unsigned int nslots = 1; +static int nslots = 1; static struct slotvec slotvec0 = {sizeof slot0, slot0}; static struct slotvec *slotvec = &slotvec0; @@ -737,7 +840,7 @@ void quotearg_free (void) { struct slotvec *sv = slotvec; - unsigned int i; + int i; for (i = 1; i < nslots; i++) free (sv[i].val); if (sv[0].val != slot0) @@ -768,30 +871,23 @@ quotearg_n_options (int n, char const *arg, size_t argsize, { int e = errno; - unsigned int n0 = n; struct slotvec *sv = slotvec; if (n < 0) abort (); - if (nslots <= n0) + if (nslots <= n) { - /* FIXME: technically, the type of n1 should be 'unsigned int', - but that evokes an unsuppressible warning from gcc-4.0.1 and - older. If gcc ever provides an option to suppress that warning, - revert to the original type, so that the test in xalloc_oversized - is once again performed only at compile time. */ - size_t n1 = n0 + 1; bool preallocated = (sv == &slotvec0); - if (xalloc_oversized (n1, sizeof *sv)) + if (MIN (INT_MAX, MIN (PTRDIFF_MAX, SIZE_MAX) / sizeof *sv) <= n) xalloc_die (); - slotvec = sv = xrealloc (preallocated ? NULL : sv, n1 * sizeof *sv); + slotvec = sv = xrealloc (preallocated ? NULL : sv, (n + 1) * sizeof *sv); if (preallocated) *sv = slotvec0; - memset (sv + nslots, 0, (n1 - nslots) * sizeof *sv); - nslots = n1; + memset (sv + nslots, 0, (n + 1 - nslots) * sizeof *sv); + nslots = n + 1; } { @@ -901,6 +997,15 @@ quotearg_colon_mem (char const *arg, size_t argsize) } char * +quotearg_n_style_colon (int n, enum quoting_style s, char const *arg) +{ + struct quoting_options options; + options = quoting_options_from_style (s); + set_char_quoting (&options, ':', 1); + return quotearg_n_options (n, arg, SIZE_MAX, &options); +} + +char * quotearg_n_custom (int n, char const *left_quote, char const *right_quote, char const *arg) { diff --git a/contrib/tools/m4/lib/quotearg.h b/contrib/tools/m4/lib/quotearg.h index 58ee3f6089..bc29052b00 100644 --- a/contrib/tools/m4/lib/quotearg.h +++ b/contrib/tools/m4/lib/quotearg.h @@ -1,6 +1,6 @@ /* quotearg.h - quote arguments for output - Copyright (C) 1998-2002, 2004, 2006, 2008-2013 Free Software Foundation, + Copyright (C) 1998-2002, 2004, 2006, 2008-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -73,6 +73,37 @@ enum quoting_style */ shell_always_quoting_style, + /* Quote names for the shell if they contain shell metacharacters + or other problematic characters (ls --quoting-style=shell-escape). + Non printable characters are quoted using the $'...' syntax, + which originated in ksh93 and is widely supported by most shells, + and proposed for inclusion in POSIX. + + quotearg_buffer: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "a:b" + quotearg: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "a:b" + quotearg_colon: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "'a:b'" + */ + shell_escape_quoting_style, + + /* Quote names for the shell even if they would normally not + require quoting (ls --quoting-style=shell-escape). + Non printable characters are quoted using the $'...' syntax, + which originated in ksh93 and is widely supported by most shells, + and proposed for inclusion in POSIX. Behaves like + shell_escape_quoting_style if QA_ELIDE_OUTER_QUOTES is in effect. + + quotearg_buffer: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "a:b" + quotearg: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "a:b" + quotearg_colon: + "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "'a:b'" + */ + shell_escape_always_quoting_style, + /* Quote names as for a C language string (ls --quoting-style=c). Behaves like c_maybe_quoting_style if QA_ELIDE_OUTER_QUOTES is in effect. Split into consecutive strings if @@ -247,7 +278,7 @@ struct quoting_options; struct quoting_options *clone_quoting_options (struct quoting_options *o); /* Get the value of O's quoting style. If O is null, use the default. */ -enum quoting_style get_quoting_style (struct quoting_options *o); +enum quoting_style get_quoting_style (struct quoting_options const *o); /* In O (or in the default if O is null), set the value of the quoting style to S. */ @@ -362,6 +393,9 @@ char *quotearg_colon (char const *arg); /* Like quotearg_colon (ARG), except it can quote null bytes. */ char *quotearg_colon_mem (char const *arg, size_t argsize); +/* Like quotearg_n_style, except with ':' quoting enabled. */ +char *quotearg_n_style_colon (int n, enum quoting_style s, char const *arg); + /* Like quotearg_n_style (N, S, ARG) but with S as custom_quoting_style with left quote as LEFT_QUOTE and right quote as RIGHT_QUOTE. See set_custom_quoting for a description of acceptable LEFT_QUOTE and diff --git a/contrib/tools/m4/lib/raise.c b/contrib/tools/m4/lib/raise.c index 5b546d2b8d..bf24c3ee79 100644 --- a/contrib/tools/m4/lib/raise.c +++ b/contrib/tools/m4/lib/raise.c @@ -1,6 +1,6 @@ /* Provide a non-threads replacement for the POSIX raise function. - Copyright (C) 2002-2003, 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2006, 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 diff --git a/contrib/tools/m4/lib/regcomp.c b/contrib/tools/m4/lib/regcomp.c index f0b2e52216..aaa66b9f55 100644 --- a/contrib/tools/m4/lib/regcomp.c +++ b/contrib/tools/m4/lib/regcomp.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -17,6 +17,10 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#ifdef _LIBC +# include <locale/weight.h> +#endif + static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, size_t length, reg_syntax_t syntax); static void re_compile_fastmap_iter (regex_t *bufp, @@ -149,9 +153,9 @@ static const char __re_error_msgid[] = gettext_noop ("Invalid back reference") /* REG_ESUBREG */ "\0" #define REG_EBRACK_IDX (REG_ESUBREG_IDX + sizeof "Invalid back reference") - gettext_noop ("Unmatched [ or [^") /* REG_EBRACK */ + gettext_noop ("Unmatched [, [^, [:, [., or [=") /* REG_EBRACK */ "\0" -#define REG_EPAREN_IDX (REG_EBRACK_IDX + sizeof "Unmatched [ or [^") +#define REG_EPAREN_IDX (REG_EBRACK_IDX + sizeof "Unmatched [, [^, [:, [., or [=") gettext_noop ("Unmatched ( or \\(") /* REG_EPAREN */ "\0" #define REG_EBRACE_IDX (REG_EPAREN_IDX + sizeof "Unmatched ( or \\(") @@ -209,17 +213,9 @@ static const size_t __re_error_msgid_idx[] = Assumes the 'allocated' (and perhaps 'buffer') and 'translate' fields are set in BUFP on entry. */ -#ifdef _LIBC -const char * -re_compile_pattern (pattern, length, bufp) - const char *pattern; - size_t length; - struct re_pattern_buffer *bufp; -#else /* size_t might promote */ const char * re_compile_pattern (const char *pattern, size_t length, struct re_pattern_buffer *bufp) -#endif { reg_errcode_t ret; @@ -257,8 +253,7 @@ reg_syntax_t re_syntax_options; defined in regex.h. We return the old syntax. */ reg_syntax_t -re_set_syntax (syntax) - reg_syntax_t syntax; +re_set_syntax (reg_syntax_t syntax) { reg_syntax_t ret = re_syntax_options; @@ -270,8 +265,7 @@ weak_alias (__re_set_syntax, re_set_syntax) #endif int -re_compile_fastmap (bufp) - struct re_pattern_buffer *bufp; +re_compile_fastmap (struct re_pattern_buffer *bufp) { re_dfa_t *dfa = bufp->buffer; char *fastmap = bufp->fastmap; @@ -335,7 +329,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, memset (&state, '\0', sizeof (state)); if (__mbrtowc (&wc, (const char *) buf, p - buf, &state) == p - buf - && (__wcrtomb ((char *) buf, towlower (wc), &state) + && (__wcrtomb ((char *) buf, __towlower (wc), &state) != (size_t) -1)) re_set_fastmap (fastmap, false, buf[0]); } @@ -411,7 +405,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, re_set_fastmap (fastmap, icase, *(unsigned char *) buf); if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1) { - if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state) + if (__wcrtomb (buf, __towlower (cset->mbchars[i]), &state) != (size_t) -1) re_set_fastmap (fastmap, false, *(unsigned char *) buf); } @@ -470,10 +464,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, the return codes and their meanings.) */ int -regcomp (preg, pattern, cflags) - regex_t *_Restrict_ preg; - const char *_Restrict_ pattern; - int cflags; +regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ pattern, int cflags) { reg_errcode_t ret; reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED @@ -531,18 +522,9 @@ weak_alias (__regcomp, regcomp) /* Returns a message corresponding to an error code, ERRCODE, returned from either regcomp or regexec. We don't use PREG here. */ -#ifdef _LIBC -size_t -regerror (errcode, preg, errbuf, errbuf_size) - int errcode; - const regex_t *_Restrict_ preg; - char *_Restrict_ errbuf; - size_t errbuf_size; -#else /* size_t might promote */ size_t -regerror (int errcode, const regex_t *_Restrict_ preg, - char *_Restrict_ errbuf, size_t errbuf_size) -#endif +regerror (int errcode, const regex_t *_Restrict_ preg, char *_Restrict_ errbuf, + size_t errbuf_size) { const char *msg; size_t msg_size; @@ -658,8 +640,7 @@ free_dfa_content (re_dfa_t *dfa) /* Free dynamically allocated space used by PREG. */ void -regfree (preg) - regex_t *preg; +regfree (regex_t *preg) { re_dfa_t *dfa = preg->buffer; if (BE (dfa != NULL, 1)) @@ -695,8 +676,7 @@ char * regcomp/regexec above without link errors. */ weak_function # endif -re_comp (s) - const char *s; +re_comp (const char *s) { reg_errcode_t ret; char *fastmap; @@ -1417,7 +1397,7 @@ calc_first (void *extra, bin_tree_t *node) { node->first = node; node->node_idx = re_dfa_add_node (dfa, node->token); - if (BE (node->node_idx == REG_MISSING, 0)) + if (BE (node->node_idx == -1, 0)) return REG_ESPACE; if (node->token.type == ANCHOR) dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type; @@ -1478,8 +1458,8 @@ link_nfa_nodes (void *extra, bin_tree_t *node) right = node->right->first->node_idx; else right = node->next->node_idx; - assert (REG_VALID_INDEX (left)); - assert (REG_VALID_INDEX (right)); + assert (left > -1); + assert (right > -1); err = re_node_set_init_2 (dfa->edests + idx, left, right); } break; @@ -1529,7 +1509,7 @@ duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node, org_dest = dfa->nexts[org_node]; re_node_set_empty (dfa->edests + clone_node); clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == REG_MISSING, 0)) + if (BE (clone_dest == -1, 0)) return REG_ESPACE; dfa->nexts[clone_node] = dfa->nexts[org_node]; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); @@ -1562,7 +1542,7 @@ duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node, /* In case the node has another constraint, append it. */ constraint |= dfa->nodes[org_node].constraint; clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == REG_MISSING, 0)) + if (BE (clone_dest == -1, 0)) return REG_ESPACE; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); if (BE (! ok, 0)) @@ -1576,12 +1556,12 @@ duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node, re_node_set_empty (dfa->edests + clone_node); /* Search for a duplicated node which satisfies the constraint. */ clone_dest = search_duplicated_node (dfa, org_dest, constraint); - if (clone_dest == REG_MISSING) + if (clone_dest == -1) { /* There is no such duplicated node, create a new one. */ reg_errcode_t err; clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == REG_MISSING, 0)) + if (BE (clone_dest == -1, 0)) return REG_ESPACE; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); if (BE (! ok, 0)) @@ -1602,7 +1582,7 @@ duplicate_node_closure (re_dfa_t *dfa, Idx top_org_node, Idx top_clone_node, org_dest = dfa->edests[org_node].elems[1]; clone_dest = duplicate_node (dfa, org_dest, constraint); - if (BE (clone_dest == REG_MISSING, 0)) + if (BE (clone_dest == -1, 0)) return REG_ESPACE; ok = re_node_set_insert (dfa->edests + clone_node, clone_dest); if (BE (! ok, 0)) @@ -1628,18 +1608,18 @@ search_duplicated_node (const re_dfa_t *dfa, Idx org_node, && constraint == dfa->nodes[idx].constraint) return idx; /* Found. */ } - return REG_MISSING; /* Not found. */ + return -1; /* Not found. */ } /* Duplicate the node whose index is ORG_IDX and set the constraint CONSTRAINT. - Return the index of the new node, or REG_MISSING if insufficient storage is + Return the index of the new node, or -1 if insufficient storage is available. */ static Idx duplicate_node (re_dfa_t *dfa, Idx org_idx, unsigned int constraint) { Idx dup_idx = re_dfa_add_node (dfa, dfa->nodes[org_idx]); - if (BE (dup_idx != REG_MISSING, 1)) + if (BE (dup_idx != -1, 1)) { dfa->nodes[dup_idx].constraint = constraint; dfa->nodes[dup_idx].constraint |= dfa->nodes[org_idx].constraint; @@ -1698,7 +1678,7 @@ calc_eclosure (re_dfa_t *dfa) } #ifdef DEBUG - assert (dfa->eclosures[node_idx].nelem != REG_MISSING); + assert (dfa->eclosures[node_idx].nelem != -1); #endif /* If we have already calculated, skip it. */ @@ -1734,7 +1714,7 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) /* This indicates that we are calculating this node now. We reference this value to avoid infinite loop. */ - dfa->eclosures[node].nelem = REG_MISSING; + dfa->eclosures[node].nelem = -1; /* If the current node has constraints, duplicate all nodes since they must inherit the constraints. */ @@ -1756,7 +1736,7 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) Idx edest = dfa->edests[node].elems[i]; /* If calculating the epsilon closure of 'edest' is in progress, return intermediate result. */ - if (dfa->eclosures[edest].nelem == REG_MISSING) + if (dfa->eclosures[edest].nelem == -1) { incomplete = true; continue; @@ -2187,6 +2167,7 @@ parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, { re_dfa_t *dfa = preg->buffer; bin_tree_t *tree, *branch = NULL; + bitset_word_t initial_bkref_map = dfa->completed_bkref_map; tree = parse_branch (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; @@ -2197,9 +2178,16 @@ parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, if (token->type != OP_ALT && token->type != END_OF_RE && (nest == 0 || token->type != OP_CLOSE_SUBEXP)) { + bitset_word_t accumulated_bkref_map = dfa->completed_bkref_map; + dfa->completed_bkref_map = initial_bkref_map; branch = parse_branch (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && branch == NULL, 0)) - return NULL; + { + if (tree != NULL) + postorder (tree, free_tree, NULL); + return NULL; + } + dfa->completed_bkref_map |= accumulated_bkref_map; } else branch = NULL; @@ -2460,14 +2448,22 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS || token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM) { - tree = parse_dup_op (tree, regexp, dfa, token, syntax, err); - if (BE (*err != REG_NOERROR && tree == NULL, 0)) - return NULL; + bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token, + syntax, err); + if (BE (*err != REG_NOERROR && dup_tree == NULL, 0)) + { + if (tree != NULL) + postorder (tree, free_tree, NULL); + return NULL; + } + tree = dup_tree; /* In BRE consecutive duplications are not allowed. */ if ((syntax & RE_CONTEXT_INVALID_DUP) && (token->type == OP_DUP_ASTERISK || token->type == OP_OPEN_DUP_NUM)) { + if (tree != NULL) + postorder (tree, free_tree, NULL); *err = REG_BADRPT; return NULL; } @@ -2537,7 +2533,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, { end = 0; start = fetch_number (regexp, token, syntax); - if (start == REG_MISSING) + if (start == -1) { if (token->type == CHARACTER && token->opr.c == ',') start = 0; /* We treat "{,m}" as "{0,m}". */ @@ -2547,14 +2543,14 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, return NULL; } } - if (BE (start != REG_ERROR, 1)) + if (BE (start != -2, 1)) { /* We treat "{n}" as "{n,n}". */ end = ((token->type == OP_CLOSE_DUP_NUM) ? start : ((token->type == CHARACTER && token->opr.c == ',') - ? fetch_number (regexp, token, syntax) : REG_ERROR)); + ? fetch_number (regexp, token, syntax) : -2)); } - if (BE (start == REG_ERROR || end == REG_ERROR, 0)) + if (BE (start == -2 || end == -2, 0)) { /* Invalid sequence. */ if (BE (!(syntax & RE_INVALID_INTERVAL_ORD), 0)) @@ -2576,7 +2572,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, return elem; } - if (BE ((end != REG_MISSING && start > end) + if (BE ((end != -1 && start > end) || token->type != OP_CLOSE_DUP_NUM, 0)) { /* First number greater than second. */ @@ -2584,7 +2580,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, return NULL; } - if (BE (RE_DUP_MAX < (end == REG_MISSING ? start : end), 0)) + if (BE (RE_DUP_MAX < (end == -1 ? start : end), 0)) { *err = REG_ESIZE; return NULL; @@ -2593,7 +2589,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, else { start = (token->type == OP_DUP_PLUS) ? 1 : 0; - end = (token->type == OP_DUP_QUESTION) ? 1 : REG_MISSING; + end = (token->type == OP_DUP_QUESTION) ? 1 : -1; } fetch_token (token, regexp, syntax); @@ -2623,6 +2619,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, /* Duplicate ELEM before it is marked optional. */ elem = duplicate_tree (elem, dfa); + if (BE (elem == NULL, 0)) + goto parse_dup_op_espace; old_tree = tree; } else @@ -2635,7 +2633,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, } tree = create_tree (dfa, elem, NULL, - (end == REG_MISSING ? OP_DUP_ASTERISK : OP_ALT)); + (end == -1 ? OP_DUP_ASTERISK : OP_ALT)); if (BE (tree == NULL, 0)) goto parse_dup_op_espace; @@ -2643,10 +2641,10 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, True if the arithmetic type T is signed. */ #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) - /* This loop is actually executed only when end != REG_MISSING, + /* This loop is actually executed only when end != -1, to rewrite <re>{0,n} as (<re>(<re>...<re>?)?)?... We have already created the start+1-th copy. */ - if (TYPE_SIGNED (Idx) || end != REG_MISSING) + if (TYPE_SIGNED (Idx) || end != -1) for (i = start + 2; i <= end; ++i) { elem = duplicate_tree (elem, dfa); @@ -2674,6 +2672,19 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, #define BRACKET_NAME_BUF_SIZE 32 #ifndef _LIBC + +# ifdef RE_ENABLE_I18N +/* Convert the byte B to the corresponding wide character. In a + unibyte locale, treat B as itself if it is an encoding error. + In a multibyte locale, return WEOF if B is an encoding error. */ +static wint_t +parse_byte (unsigned char b, re_charset_t *mbcset) +{ + wint_t wc = __btowc (b); + return wc == WEOF && !mbcset ? b : wc; +} +#endif + /* Local function for parse_bracket_exp only used in case of NOT _LIBC. Build the range expression which starts from START_ELEM, and ends at END_ELEM. The result are written to MBCSET and SBCSET. @@ -2725,9 +2736,9 @@ build_range_exp (const reg_syntax_t syntax, : ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0] : 0)); start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM) - ? __btowc (start_ch) : start_elem->opr.wch); + ? parse_byte (start_ch, mbcset) : start_elem->opr.wch); end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM) - ? __btowc (end_ch) : end_elem->opr.wch); + ? parse_byte (end_ch, mbcset) : end_elem->opr.wch); if (start_wc == WEOF || end_wc == WEOF) return REG_ECOLLATE; else if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_wc > end_wc, 0)) @@ -2757,7 +2768,11 @@ build_range_exp (const reg_syntax_t syntax, new_nranges); if (BE (new_array_start == NULL || new_array_end == NULL, 0)) - return REG_ESPACE; + { + re_free (new_array_start); + re_free (new_array_end); + return REG_ESPACE; + } mbcset->range_starts = new_array_start; mbcset->range_ends = new_array_end; @@ -3161,6 +3176,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, re_token_t token2; start_elem.opr.name = start_name_buf; + start_elem.type = COLL_SYM; ret = parse_bracket_element (&start_elem, regexp, token, token_len, dfa, syntax, first_round); if (BE (ret != REG_NOERROR, 0)) @@ -3204,6 +3220,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, if (is_range_exp == true) { end_elem.opr.name = end_name_buf; + end_elem.type = COLL_SYM; ret = parse_bracket_element (&end_elem, regexp, &token2, token_len2, dfa, syntax, true); if (BE (ret != REG_NOERROR, 0)) @@ -3478,8 +3495,6 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name) int32_t idx1, idx2; unsigned int ch; size_t len; - /* This #include defines a local function! */ -# include <locale/weight.h> /* Calculate the index for equivalence class. */ cp = name; table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB); @@ -3489,7 +3504,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name) _NL_COLLATE_EXTRAMB); indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); - idx1 = findidx (&cp, -1); + idx1 = findidx (table, indirect, extra, &cp, -1); if (BE (idx1 == 0 || *cp != '\0', 0)) /* This isn't a valid character. */ return REG_ECOLLATE; @@ -3500,7 +3515,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name) { char_buf[0] = ch; cp = char_buf; - idx2 = findidx (&cp, 1); + idx2 = findidx (table, indirect, extra, &cp, 1); /* idx2 = table[ch]; */ @@ -3654,26 +3669,21 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, bin_tree_t *tree; sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); -#ifdef RE_ENABLE_I18N - mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); -#endif /* RE_ENABLE_I18N */ - -#ifdef RE_ENABLE_I18N - if (BE (sbcset == NULL || mbcset == NULL, 0)) -#else /* not RE_ENABLE_I18N */ if (BE (sbcset == NULL, 0)) -#endif /* not RE_ENABLE_I18N */ { *err = REG_ESPACE; return NULL; } - - if (non_match) - { #ifdef RE_ENABLE_I18N - mbcset->non_match = 1; -#endif /* not RE_ENABLE_I18N */ + mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); + if (BE (mbcset == NULL, 0)) + { + re_free (sbcset); + *err = REG_ESPACE; + return NULL; } + mbcset->non_match = non_match; +#endif /* RE_ENABLE_I18N */ /* We don't care the syntax in this case. */ ret = build_charclass (trans, sbcset, @@ -3706,6 +3716,9 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, #endif /* Build a tree for simple bracket. */ +#if defined GCC_LINT || defined lint + memset (&br_token, 0, sizeof br_token); +#endif br_token.type = SIMPLE_BRACKET; br_token.opr.sbcset = sbcset; tree = create_token_tree (dfa, NULL, NULL, &br_token); @@ -3748,27 +3761,26 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, /* This is intended for the expressions like "a{1,3}". Fetch a number from 'input', and return the number. - Return REG_MISSING if the number field is empty like "{,1}". + Return -1 if the number field is empty like "{,1}". Return RE_DUP_MAX + 1 if the number field is too large. - Return REG_ERROR if an error occurred. */ + Return -2 if an error occurred. */ static Idx fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax) { - Idx num = REG_MISSING; + Idx num = -1; unsigned char c; while (1) { fetch_token (token, input, syntax); c = token->opr.c; if (BE (token->type == END_OF_RE, 0)) - return REG_ERROR; + return -2; if (token->type == OP_CLOSE_DUP_NUM || c == ',') break; - num = ((token->type != CHARACTER || c < '0' || '9' < c - || num == REG_ERROR) - ? REG_ERROR - : num == REG_MISSING + num = ((token->type != CHARACTER || c < '0' || '9' < c || num == -2) + ? -2 + : num == -1 ? c - '0' : MIN (RE_DUP_MAX + 1, num * 10 + c - '0')); } @@ -3800,6 +3812,9 @@ create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, re_token_type_t type) { re_token_t t; +#if defined GCC_LINT || defined lint + memset (&t, 0, sizeof t); +#endif t.type = type; return create_token_tree (dfa, left, right, &t); } @@ -3829,7 +3844,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, tree->token.opt_subexp = 0; tree->first = NULL; tree->next = NULL; - tree->node_idx = REG_MISSING; + tree->node_idx = -1; if (left != NULL) left->parent = tree; diff --git a/contrib/tools/m4/lib/regex.c b/contrib/tools/m4/lib/regex.c index 85091669c7..a96d82aa87 100644 --- a/contrib/tools/m4/lib/regex.c +++ b/contrib/tools/m4/lib/regex.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. diff --git a/contrib/tools/m4/lib/regex.h b/contrib/tools/m4/lib/regex.h index 854c6edaf7..b7496f9d7d 100644 --- a/contrib/tools/m4/lib/regex.h +++ b/contrib/tools/m4/lib/regex.h @@ -1,6 +1,6 @@ /* Definitions for data structures and routines for the regular expression library. - Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2013 Free Software + Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -42,11 +42,6 @@ extern "C" { supported within glibc itself, and glibc users should not define _REGEX_LARGE_OFFSETS. */ -/* The type of nonnegative object indexes. Traditionally, GNU regex - uses 'int' for these. Code that uses __re_idx_t should work - regardless of whether the type is signed. */ -typedef size_t __re_idx_t; - /* The type of object sizes. */ typedef size_t __re_size_t; @@ -58,7 +53,6 @@ typedef size_t __re_long_size_t; /* The traditional GNU regex implementation mishandles strings longer than INT_MAX. */ -typedef int __re_idx_t; typedef unsigned int __re_size_t; typedef unsigned long int __re_long_size_t; @@ -244,19 +238,16 @@ extern reg_syntax_t re_syntax_options; | RE_INVALID_INTERVAL_ORD) # define RE_SYNTAX_GREP \ - (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ - | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ - | RE_NEWLINE_ALT) + ((RE_SYNTAX_POSIX_BASIC | RE_NEWLINE_ALT) \ + & ~(RE_CONTEXT_INVALID_DUP | RE_DOT_NOT_NULL)) # define RE_SYNTAX_EGREP \ - (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ - | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ - | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ - | RE_NO_BK_VBAR) + ((RE_SYNTAX_POSIX_EXTENDED | RE_INVALID_INTERVAL_ORD | RE_NEWLINE_ALT) \ + & ~(RE_CONTEXT_INVALID_OPS | RE_DOT_NOT_NULL)) +/* POSIX grep -E behavior is no longer incompatible with GNU. */ # define RE_SYNTAX_POSIX_EGREP \ - (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \ - | RE_INVALID_INTERVAL_ORD) + RE_SYNTAX_EGREP /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */ # define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC @@ -491,7 +482,8 @@ typedef struct re_pattern_buffer regex_t; #ifdef _REGEX_LARGE_OFFSETS /* POSIX 1003.1-2008 requires that regoff_t be at least as wide as ptrdiff_t and ssize_t. We don't know of any hosts where ptrdiff_t - is wider than ssize_t, so ssize_t is safe. */ + is wider than ssize_t, so ssize_t is safe. ptrdiff_t is not + visible here, so use ssize_t. */ typedef ssize_t regoff_t; #else /* The traditional GNU regex implementation mishandles strings longer @@ -541,7 +533,7 @@ extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax); BUFFER. Return NULL if successful, and an error string if not. To free the allocated storage, you must call 'regfree' on BUFFER. - Note that the translate table must either have been initialised by + Note that the translate table must either have been initialized by 'regcomp', with a malloc'ed value, or set to NULL before calling 'regfree'. */ extern const char *re_compile_pattern (const char *__pattern, size_t __length, @@ -560,34 +552,34 @@ extern int re_compile_fastmap (struct re_pattern_buffer *__buffer); match, or -2 for an internal error. Also return register information in REGS (if REGS and BUFFER->no_sub are nonzero). */ extern regoff_t re_search (struct re_pattern_buffer *__buffer, - const char *__string, __re_idx_t __length, - __re_idx_t __start, regoff_t __range, + const char *__String, regoff_t __length, + regoff_t __start, regoff_t __range, struct re_registers *__regs); /* Like 're_search', but search in the concatenation of STRING1 and STRING2. Also, stop searching at index START + STOP. */ extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer, - const char *__string1, __re_idx_t __length1, - const char *__string2, __re_idx_t __length2, - __re_idx_t __start, regoff_t __range, + const char *__string1, regoff_t __length1, + const char *__string2, regoff_t __length2, + regoff_t __start, regoff_t __range, struct re_registers *__regs, - __re_idx_t __stop); + regoff_t __stop); /* Like 're_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ extern regoff_t re_match (struct re_pattern_buffer *__buffer, - const char *__string, __re_idx_t __length, - __re_idx_t __start, struct re_registers *__regs); + const char *__String, regoff_t __length, + regoff_t __start, struct re_registers *__regs); /* Relates to 're_match' as 're_search_2' relates to 're_search'. */ extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer, - const char *__string1, __re_idx_t __length1, - const char *__string2, __re_idx_t __length2, - __re_idx_t __start, struct re_registers *__regs, - __re_idx_t __stop); + const char *__string1, regoff_t __length1, + const char *__string2, regoff_t __length2, + regoff_t __start, struct re_registers *__regs, + regoff_t __stop); /* Set REGS to hold NUM_REGS registers, storing them in STARTS and @@ -608,7 +600,7 @@ extern void re_set_registers (struct re_pattern_buffer *__buffer, regoff_t *__starts, regoff_t *__ends); #endif /* Use GNU */ -#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_BSD) +#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_MISC) # ifndef _CRAY /* 4.2 bsd compatibility. */ extern char *re_comp (const char *); @@ -650,7 +642,7 @@ extern int regcomp (regex_t *_Restrict_ __preg, int __cflags); extern int regexec (const regex_t *_Restrict_ __preg, - const char *_Restrict_ __string, size_t __nmatch, + const char *_Restrict_ __String, size_t __nmatch, regmatch_t __pmatch[_Restrict_arr_], int __eflags); diff --git a/contrib/tools/m4/lib/regex_internal.c b/contrib/tools/m4/lib/regex_internal.c index 899b0ae67e..a3b10ddcc9 100644 --- a/contrib/tools/m4/lib/regex_internal.c +++ b/contrib/tools/m4/lib/regex_internal.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -311,13 +311,12 @@ build_wcs_upper_buffer (re_string_t *pstr) + byte_idx), remain_len, &pstr->cur_state); if (BE (mbclen < (size_t) -2, 1)) { - wchar_t wcu = wc; - if (iswlower (wc)) + wchar_t wcu = __towupper (wc); + if (wcu != wc) { size_t mbcdlen; - wcu = towupper (wc); - mbcdlen = wcrtomb (buf, wcu, &prev_st); + mbcdlen = __wcrtomb (buf, wcu, &prev_st); if (BE (mbclen == mbcdlen, 1)) memcpy (pstr->mbs + byte_idx, buf, mbclen); else @@ -381,12 +380,11 @@ build_wcs_upper_buffer (re_string_t *pstr) mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state); if (BE (mbclen < (size_t) -2, 1)) { - wchar_t wcu = wc; - if (iswlower (wc)) + wchar_t wcu = __towupper (wc); + if (wcu != wc) { size_t mbcdlen; - wcu = towupper (wc); mbcdlen = wcrtomb ((char *) buf, wcu, &prev_st); if (BE (mbclen == mbcdlen, 1)) memcpy (pstr->mbs + byte_idx, buf, mbclen); @@ -538,10 +536,7 @@ build_upper_buffer (re_string_t *pstr) int ch = pstr->raw_mbs[pstr->raw_mbs_idx + char_idx]; if (BE (pstr->trans != NULL, 0)) ch = pstr->trans[ch]; - if (islower (ch)) - pstr->mbs[char_idx] = toupper (ch); - else - pstr->mbs[char_idx] = ch; + pstr->mbs[char_idx] = toupper (ch); } pstr->valid_len = char_idx; pstr->valid_raw_len = char_idx; @@ -682,7 +677,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) pstr->valid_len - offset); pstr->valid_len -= offset; pstr->valid_raw_len -= offset; -#if DEBUG +#if defined DEBUG && DEBUG assert (pstr->valid_len > 0); #endif } @@ -927,7 +922,7 @@ internal_function re_string_context_at (const re_string_t *input, Idx idx, int eflags) { int c; - if (BE (! REG_VALID_INDEX (idx), 0)) + if (BE (idx < 0, 0)) /* In this case, we use the value stored in input->tip_context, since we can't know the character in input->mbs[-1] here. */ return input->tip_context; @@ -941,12 +936,12 @@ re_string_context_at (const re_string_t *input, Idx idx, int eflags) Idx wc_idx = idx; while(input->wcs[wc_idx] == WEOF) { -#ifdef DEBUG +#if defined DEBUG && DEBUG /* It must not happen. */ - assert (REG_VALID_INDEX (wc_idx)); + assert (wc_idx >= 0); #endif --wc_idx; - if (! REG_VALID_INDEX (wc_idx)) + if (wc_idx < 0) return input->tip_context; } wc = input->wcs[wc_idx]; @@ -1082,25 +1077,25 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, if (src1->elems[i1] == src2->elems[i2]) { /* Try to find the item in DEST. Maybe we could binary search? */ - while (REG_VALID_INDEX (id) && dest->elems[id] > src1->elems[i1]) + while (id >= 0 && dest->elems[id] > src1->elems[i1]) --id; - if (! REG_VALID_INDEX (id) || dest->elems[id] != src1->elems[i1]) + if (id < 0 || dest->elems[id] != src1->elems[i1]) dest->elems[--sbase] = src1->elems[i1]; - if (! REG_VALID_INDEX (--i1) || ! REG_VALID_INDEX (--i2)) + if (--i1 < 0 || --i2 < 0) break; } /* Lower the highest of the two items. */ else if (src1->elems[i1] < src2->elems[i2]) { - if (! REG_VALID_INDEX (--i2)) + if (--i2 < 0) break; } else { - if (! REG_VALID_INDEX (--i1)) + if (--i1 < 0) break; } } @@ -1113,7 +1108,7 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, DEST elements are already in place; this is more or less the same loop that is in re_node_set_merge. */ dest->nelem += delta; - if (delta > 0 && REG_VALID_INDEX (id)) + if (delta > 0 && id >= 0) for (;;) { if (dest->elems[is] > dest->elems[id]) @@ -1127,7 +1122,7 @@ re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, { /* Slide from the bottom. */ dest->elems[id + delta] = dest->elems[id]; - if (! REG_VALID_INDEX (--id)) + if (--id < 0) break; } } @@ -1221,8 +1216,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src) /* Copy into the top of DEST the items of SRC that are not found in DEST. Maybe we could binary search in DEST? */ for (sbase = dest->nelem + 2 * src->nelem, - is = src->nelem - 1, id = dest->nelem - 1; - REG_VALID_INDEX (is) && REG_VALID_INDEX (id); ) + is = src->nelem - 1, id = dest->nelem - 1; is >= 0 && id >= 0; ) { if (dest->elems[id] == src->elems[is]) is--, id--; @@ -1232,7 +1226,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src) --id; } - if (REG_VALID_INDEX (is)) + if (is >= 0) { /* If DEST is exhausted, the remaining items of SRC must be unique. */ sbase -= is + 1; @@ -1261,7 +1255,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src) { /* Slide from the bottom. */ dest->elems[id + delta] = dest->elems[id]; - if (! REG_VALID_INDEX (--id)) + if (--id < 0) { /* Copy remaining SRC elements. */ memcpy (dest->elems, dest->elems + sbase, @@ -1360,7 +1354,7 @@ re_node_set_compare (const re_node_set *set1, const re_node_set *set2) Idx i; if (set1 == NULL || set2 == NULL || set1->nelem != set2->nelem) return false; - for (i = set1->nelem ; REG_VALID_INDEX (--i) ; ) + for (i = set1->nelem ; --i >= 0 ; ) if (set1->elems[i] != set2->elems[i]) return false; return true; @@ -1373,7 +1367,7 @@ internal_function __attribute__ ((pure)) re_node_set_contains (const re_node_set *set, Idx elem) { __re_size_t idx, right, mid; - if (! REG_VALID_NONZERO_INDEX (set->nelem)) + if (set->nelem <= 0) return 0; /* Binary search the element. */ @@ -1403,7 +1397,7 @@ re_node_set_remove_at (re_node_set *set, Idx idx) /* Add the token TOKEN to dfa->nodes, and return the index of the token. - Or return REG_MISSING if an error occurred. */ + Or return -1 if an error occurred. */ static Idx internal_function @@ -1421,11 +1415,11 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token) MAX (sizeof (re_node_set), sizeof (Idx))); if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_nodes_alloc, 0)) - return REG_MISSING; + return -1; new_nodes = re_realloc (dfa->nodes, re_token_t, new_nodes_alloc); if (BE (new_nodes == NULL, 0)) - return REG_MISSING; + return -1; dfa->nodes = new_nodes; new_nexts = re_realloc (dfa->nexts, Idx, new_nodes_alloc); new_indices = re_realloc (dfa->org_indices, Idx, new_nodes_alloc); @@ -1433,7 +1427,13 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token) new_eclosures = re_realloc (dfa->eclosures, re_node_set, new_nodes_alloc); if (BE (new_nexts == NULL || new_indices == NULL || new_edests == NULL || new_eclosures == NULL, 0)) - return REG_MISSING; + { + re_free (new_nexts); + re_free (new_indices); + re_free (new_edests); + re_free (new_eclosures); + return -1; + } dfa->nexts = new_nexts; dfa->org_indices = new_indices; dfa->edests = new_edests; @@ -1447,7 +1447,7 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token) ((token.type == OP_PERIOD && dfa->mb_cur_max > 1) || token.type == COMPLEX_BRACKET); #endif - dfa->nexts[dfa->nodes_len] = REG_MISSING; + dfa->nexts[dfa->nodes_len] = -1; re_node_set_init_empty (dfa->edests + dfa->nodes_len); re_node_set_init_empty (dfa->eclosures + dfa->nodes_len); return dfa->nodes_len++; @@ -1482,7 +1482,7 @@ re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa, re_dfastate_t *new_state; struct re_state_table_entry *spot; Idx i; -#ifdef lint +#if defined GCC_LINT || defined lint /* Suppress bogus uninitialized-variable warnings. */ *err = REG_NOERROR; #endif @@ -1530,7 +1530,7 @@ re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa, re_dfastate_t *new_state; struct re_state_table_entry *spot; Idx i; -#ifdef lint +#if defined GCC_LINT || defined lint /* Suppress bogus uninitialized-variable warnings. */ *err = REG_NOERROR; #endif diff --git a/contrib/tools/m4/lib/regex_internal.h b/contrib/tools/m4/lib/regex_internal.h index 6185d1f832..16eb228b76 100644 --- a/contrib/tools/m4/lib/regex_internal.h +++ b/contrib/tools/m4/lib/regex_internal.h @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -33,14 +33,16 @@ #include <stdbool.h> #include <stdint.h> +#include "intprops.h" + #ifdef _LIBC -# error #include <bits/libc-lock.h> +# error #include <libc-lock.h> # define lock_define(name) __libc_lock_define (, name) # define lock_init(lock) (__libc_lock_init (lock), 0) # define lock_fini(lock) 0 # define lock_lock(lock) __libc_lock_lock (lock) # define lock_unlock(lock) __libc_lock_unlock (lock) -#elif defined GNULIB_LOCK +#elif defined GNULIB_LOCK && !defined USE_UNLOCKED_IO # include "glthread/lock.h" /* Use gl_lock_define if empty macro arguments are known to work. Otherwise, fall back on less-portable substitutes. */ @@ -62,7 +64,7 @@ # define lock_fini(lock) glthread_lock_destroy (&(lock)) # define lock_lock(lock) glthread_lock_lock (&(lock)) # define lock_unlock(lock) glthread_lock_unlock (&(lock)) -#elif defined GNULIB_PTHREAD +#elif defined GNULIB_PTHREAD && !defined USE_UNLOCKED_IO # include <pthread.h> # define lock_define(name) pthread_mutex_t name; # define lock_init(lock) pthread_mutex_init (&(lock), 0) @@ -87,7 +89,6 @@ # ifndef _RE_DEFINE_LOCALE_FUNCTIONS # define _RE_DEFINE_LOCALE_FUNCTIONS 1 # include <locale/localeinfo.h> -# include <locale/elem-hash.h> # include <locale/coll-lookup.h> # endif #endif @@ -110,15 +111,11 @@ # define gettext_noop(String) String #endif -#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC +#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE) || _LIBC # define RE_ENABLE_I18N #endif -#if __GNUC__ >= 3 -# define BE(expr, val) __builtin_expect (expr, val) -#else -# define BE(expr, val) (expr) -#endif +#define BE(expr, val) __builtin_expect (expr, val) /* Number of ASCII characters. */ #define ASCII_CHARS 0x80 @@ -137,7 +134,10 @@ # undef __wctype # undef __iswctype # define __wctype wctype +# define __iswalnum iswalnum # define __iswctype iswctype +# define __towlower towlower +# define __towupper towupper # define __btowc btowc # define __mbrtowc mbrtowc # define __wcrtomb wcrtomb @@ -149,31 +149,22 @@ # define __attribute__(arg) #endif -typedef __re_idx_t Idx; -#ifdef _REGEX_LARGE_OFFSETS -# define IDX_MAX (SIZE_MAX - 2) -#else -# define IDX_MAX INT_MAX -#endif - -/* Special return value for failure to match. */ -#define REG_MISSING ((Idx) -1) - -/* Special return value for internal error. */ -#define REG_ERROR ((Idx) -2) - -/* Test whether N is a valid index, and is not one of the above. */ -#ifdef _REGEX_LARGE_OFFSETS -# define REG_VALID_INDEX(n) ((Idx) (n) < REG_ERROR) -#else -# define REG_VALID_INDEX(n) (0 <= (n)) +#ifndef SSIZE_MAX +# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) #endif -/* Test whether N is a valid nonzero index. */ +/* The type of indexes into strings. This is signed, not size_t, + since the API requires indexes to fit in regoff_t anyway, and using + signed integers makes the code a bit smaller and presumably faster. + The traditional GNU regex implementation uses int for indexes. + The POSIX-compatible implementation uses a possibly-wider type. + The name 'Idx' is three letters to minimize the hassle of + reindenting a lot of regex code that formerly used 'int'. */ +typedef regoff_t Idx; #ifdef _REGEX_LARGE_OFFSETS -# define REG_VALID_NONZERO_INDEX(n) ((Idx) ((n) - 1) < (Idx) (REG_ERROR - 1)) +# define IDX_MAX SSIZE_MAX #else -# define REG_VALID_NONZERO_INDEX(n) (0 < (n)) +# define IDX_MAX INT_MAX #endif /* A hash value, suitable for computing hash tables. */ @@ -447,23 +438,23 @@ typedef struct re_dfa_t re_dfa_t; #ifndef _LIBC # define internal_function +# define IS_IN(libc) false #endif -#ifndef NOT_IN_libc static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len) internal_function; -# ifdef RE_ENABLE_I18N +#ifdef RE_ENABLE_I18N static void build_wcs_buffer (re_string_t *pstr) internal_function; static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr) internal_function; -# endif /* RE_ENABLE_I18N */ +#endif /* RE_ENABLE_I18N */ static void build_upper_buffer (re_string_t *pstr) internal_function; static void re_string_translate_buffer (re_string_t *pstr) internal_function; static unsigned int re_string_context_at (const re_string_t *input, Idx idx, int eflags) internal_function __attribute__ ((pure)); -#endif + #define re_string_peek_byte(pstr, offset) \ ((pstr)->mbs[(pstr)->cur_idx + offset]) #define re_string_fetch_byte(pstr) \ @@ -482,7 +473,7 @@ static unsigned int re_string_context_at (const re_string_t *input, Idx idx, #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) #if defined _LIBC || HAVE_ALLOCA -# include "palloca.h" +# include <alloca.h> #endif #ifndef _LIBC @@ -556,7 +547,7 @@ typedef struct bin_tree_storage_t bin_tree_storage_t; #define IS_WORD_CHAR(ch) (isalnum (ch) || (ch) == '_') #define IS_NEWLINE(ch) ((ch) == NEWLINE_CHAR) -#define IS_WIDE_WORD_CHAR(ch) (iswalnum (ch) || (ch) == L'_') +#define IS_WIDE_WORD_CHAR(ch) (__iswalnum (ch) || (ch) == L'_') #define IS_WIDE_NEWLINE(ch) ((ch) == WIDE_NEWLINE_CHAR) #define NOT_SATISFY_PREV_CONSTRAINT(constraint,context) \ @@ -860,15 +851,17 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx) return (wint_t) pstr->wcs[idx]; } -# ifndef NOT_IN_libc +# ifdef _LIBC +# include <locale/weight.h> +# endif + static int internal_function __attribute__ ((pure, unused)) re_string_elem_size_at (const re_string_t *pstr, Idx idx) { -# ifdef _LIBC +# ifdef _LIBC const unsigned char *p, *extra; const int32_t *table, *indirect; -# include <locale/weight.h> uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); if (nrules != 0) @@ -879,14 +872,13 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx) indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); p = pstr->mbs + idx; - findidx (&p, pstr->len - idx); + findidx (table, indirect, extra, &p, pstr->len - idx); return p - pstr->mbs - idx; } else -# endif /* _LIBC */ +# endif /* _LIBC */ return 1; } -# endif #endif /* RE_ENABLE_I18N */ #ifndef __GNUC_PREREQ diff --git a/contrib/tools/m4/lib/regexec.c b/contrib/tools/m4/lib/regexec.c index d29d442baf..895db8208b 100644 --- a/contrib/tools/m4/lib/regexec.c +++ b/contrib/tools/m4/lib/regexec.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -219,12 +219,8 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len) We return 0 if we find a match and REG_NOMATCH if not. */ int -regexec (preg, string, nmatch, pmatch, eflags) - const regex_t *_Restrict_ preg; - const char *_Restrict_ string; - size_t nmatch; - regmatch_t pmatch[_Restrict_arr_]; - int eflags; +regexec (const regex_t *_Restrict_ preg, const char *_Restrict_ string, + size_t nmatch, regmatch_t pmatch[], int eflags) { reg_errcode_t err; Idx start, length; @@ -305,11 +301,8 @@ compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0); match was found and -2 indicates an internal error. */ regoff_t -re_match (bufp, string, length, start, regs) - struct re_pattern_buffer *bufp; - const char *string; - Idx length, start; - struct re_registers *regs; +re_match (struct re_pattern_buffer *bufp, const char *string, Idx length, + Idx start, struct re_registers *regs) { return re_search_stub (bufp, string, length, start, 0, length, regs, true); } @@ -318,12 +311,8 @@ weak_alias (__re_match, re_match) #endif regoff_t -re_search (bufp, string, length, start, range, regs) - struct re_pattern_buffer *bufp; - const char *string; - Idx length, start; - regoff_t range; - struct re_registers *regs; +re_search (struct re_pattern_buffer *bufp, const char *string, Idx length, + Idx start, regoff_t range, struct re_registers *regs) { return re_search_stub (bufp, string, length, start, range, length, regs, false); @@ -333,11 +322,9 @@ weak_alias (__re_search, re_search) #endif regoff_t -re_match_2 (bufp, string1, length1, string2, length2, start, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - Idx length1, length2, start, stop; - struct re_registers *regs; +re_match_2 (struct re_pattern_buffer *bufp, const char *string1, Idx length1, + const char *string2, Idx length2, Idx start, + struct re_registers *regs, Idx stop) { return re_search_2_stub (bufp, string1, length1, string2, length2, start, 0, regs, stop, true); @@ -347,12 +334,9 @@ weak_alias (__re_match_2, re_match_2) #endif regoff_t -re_search_2 (bufp, string1, length1, string2, length2, start, range, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - Idx length1, length2, start, stop; - regoff_t range; - struct re_registers *regs; +re_search_2 (struct re_pattern_buffer *bufp, const char *string1, Idx length1, + const char *string2, Idx length2, Idx start, regoff_t range, + struct re_registers *regs, Idx stop) { return re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, stop, false); @@ -362,18 +346,20 @@ weak_alias (__re_search_2, re_search_2) #endif static regoff_t -re_search_2_stub (struct re_pattern_buffer *bufp, - const char *string1, Idx length1, - const char *string2, Idx length2, - Idx start, regoff_t range, struct re_registers *regs, +internal_function +re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, + Idx length1, const char *string2, Idx length2, Idx start, + regoff_t range, struct re_registers *regs, Idx stop, bool ret_len) { const char *str; regoff_t rval; - Idx len = length1 + length2; + Idx len; char *s = NULL; - if (BE (length1 < 0 || length2 < 0 || stop < 0 || len < length1, 0)) + if (BE ((length1 < 0 || length2 < 0 || stop < 0 + || INT_ADD_WRAPV (length1, length2, &len)), + 0)) return -2; /* Concatenate the strings. */ @@ -409,8 +395,8 @@ re_search_2_stub (struct re_pattern_buffer *bufp, otherwise the position of the match is returned. */ static regoff_t -re_search_stub (struct re_pattern_buffer *bufp, - const char *string, Idx length, +internal_function +re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, regoff_t range, Idx stop, struct re_registers *regs, bool ret_len) { @@ -499,6 +485,7 @@ re_search_stub (struct re_pattern_buffer *bufp, } static unsigned +internal_function re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs, int regs_allocated) { @@ -577,11 +564,8 @@ re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs, freeing the old data. */ void -re_set_registers (bufp, regs, num_regs, starts, ends) - struct re_pattern_buffer *bufp; - struct re_registers *regs; - __re_size_t num_regs; - regoff_t *starts, *ends; +re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs, + __re_size_t num_regs, regoff_t *starts, regoff_t *ends) { if (num_regs) { @@ -609,8 +593,7 @@ int # ifdef _LIBC weak_function # endif -re_exec (s) - const char *s; +re_exec (const char *s) { return 0 == regexec (&re_comp_buf, s, 0, NULL, 0); } @@ -628,12 +611,10 @@ re_exec (s) (0 <= LAST_START && LAST_START <= LENGTH) */ static reg_errcode_t -__attribute_warn_unused_result__ -re_search_internal (const regex_t *preg, - const char *string, Idx length, - Idx start, Idx last_start, Idx stop, - size_t nmatch, regmatch_t pmatch[], - int eflags) +__attribute_warn_unused_result__ internal_function +re_search_internal (const regex_t *preg, const char *string, Idx length, + Idx start, Idx last_start, Idx stop, size_t nmatch, + regmatch_t pmatch[], int eflags) { reg_errcode_t err; const re_dfa_t *dfa = preg->buffer; @@ -642,7 +623,7 @@ re_search_internal (const regex_t *preg, bool fl_longest_match; int match_kind; Idx match_first; - Idx match_last = REG_MISSING; + Idx match_last = -1; Idx extra_nmatch; bool sb; int ch; @@ -851,9 +832,9 @@ re_search_internal (const regex_t *preg, mctx.state_log_top = mctx.nbkref_ents = mctx.max_mb_elem_len = 0; match_last = check_matching (&mctx, fl_longest_match, start <= last_start ? &match_first : NULL); - if (match_last != REG_MISSING) + if (match_last != -1) { - if (BE (match_last == REG_ERROR, 0)) + if (BE (match_last == -2, 0)) { err = REG_ESPACE; goto free_return; @@ -875,7 +856,7 @@ re_search_internal (const regex_t *preg, break; if (BE (err != REG_NOMATCH, 0)) goto free_return; - match_last = REG_MISSING; + match_last = -1; } else break; /* We found a match. */ @@ -886,7 +867,7 @@ re_search_internal (const regex_t *preg, } #ifdef DEBUG - assert (match_last != REG_MISSING); + assert (match_last != -1); assert (err == REG_NOERROR); #endif @@ -964,7 +945,7 @@ re_search_internal (const regex_t *preg, } static reg_errcode_t -__attribute_warn_unused_result__ +internal_function __attribute_warn_unused_result__ prune_impossible_nodes (re_match_context_t *mctx) { const re_dfa_t *const dfa = mctx->dfa; @@ -1012,7 +993,7 @@ prune_impossible_nodes (re_match_context_t *mctx) do { --match_last; - if (! REG_VALID_INDEX (match_last)) + if (match_last < 0) { ret = REG_NOMATCH; goto free_return; @@ -1093,8 +1074,8 @@ acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, } /* Check whether the regular expression match input string INPUT or not, - and return the index where the matching end. Return REG_MISSING if - there is no match, and return REG_ERROR in case of an error. + and return the index where the matching end. Return -1 if + there is no match, and return -2 in case of an error. FL_LONGEST_MATCH means we want the POSIX longest matching. If P_MATCH_FIRST is not NULL, and the match fails, it is set to the next place where we may want to try matching. @@ -1109,7 +1090,7 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, const re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; Idx match = 0; - Idx match_last = REG_MISSING; + Idx match_last = -1; Idx cur_str_idx = re_string_cur_idx (&mctx->input); re_dfastate_t *cur_state; bool at_init_state = p_match_first != NULL; @@ -1121,7 +1102,7 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, if (BE (cur_state == NULL, 0)) { assert (err == REG_ESPACE); - return REG_ERROR; + return -2; } if (mctx->state_log != NULL) @@ -1176,7 +1157,7 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, if (BE (err != REG_NOERROR, 0)) { assert (err == REG_ESPACE); - return REG_ERROR; + return -2; } } @@ -1190,7 +1171,7 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, state using the state log, if available and if we have not already found a valid (even if not the longest) match. */ if (BE (err != REG_NOERROR, 0)) - return REG_ERROR; + return -2; if (mctx->state_log == NULL || (match && !fl_longest_match) @@ -1273,7 +1254,7 @@ check_halt_state_context (const re_match_context_t *mctx, /* Compute the next node to which "NFA" transit from NODE("NFA" is a NFA corresponding to the DFA). Return the destination node, and update EPS_VIA_NODES; - return REG_MISSING in case of errors. */ + return -1 in case of errors. */ static Idx internal_function @@ -1291,15 +1272,15 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, Idx dest_node; ok = re_node_set_insert (eps_via_nodes, node); if (BE (! ok, 0)) - return REG_ERROR; - /* Pick up a valid destination, or return REG_MISSING if none + return -2; + /* Pick up a valid destination, or return -1 if none is found. */ - for (dest_node = REG_MISSING, i = 0; i < edests->nelem; ++i) + for (dest_node = -1, i = 0; i < edests->nelem; ++i) { Idx candidate = edests->elems[i]; if (!re_node_set_contains (cur_nodes, candidate)) continue; - if (dest_node == REG_MISSING) + if (dest_node == -1) dest_node = candidate; else @@ -1313,7 +1294,7 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, else if (fs != NULL && push_fail_stack (fs, *pidx, candidate, nregs, regs, eps_via_nodes)) - return REG_ERROR; + return -2; /* We know we are going to exit. */ break; @@ -1338,13 +1319,13 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, if (fs != NULL) { if (regs[subexp_idx].rm_so == -1 || regs[subexp_idx].rm_eo == -1) - return REG_MISSING; + return -1; else if (naccepted) { char *buf = (char *) re_string_get_buffer (&mctx->input); if (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, naccepted) != 0) - return REG_MISSING; + return -1; } } @@ -1353,7 +1334,7 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, Idx dest_node; ok = re_node_set_insert (eps_via_nodes, node); if (BE (! ok, 0)) - return REG_ERROR; + return -2; dest_node = dfa->edests[node].elems[0]; if (re_node_set_contains (&mctx->state_log[*pidx]->nodes, dest_node)) @@ -1369,12 +1350,12 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, if (fs && (*pidx > mctx->match_last || mctx->state_log[*pidx] == NULL || !re_node_set_contains (&mctx->state_log[*pidx]->nodes, dest_node))) - return REG_MISSING; + return -1; re_node_set_empty (eps_via_nodes); return dest_node; } } - return REG_MISSING; + return -1; } static reg_errcode_t @@ -1410,7 +1391,7 @@ pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes) { Idx num = --fs->num; - assert (REG_VALID_INDEX (num)); + assert (num >= 0); *pidx = fs->stack[num].idx; memcpy (regs, fs->stack[num].regs, sizeof (regmatch_t) * nregs); re_node_set_free (eps_via_nodes); @@ -1503,9 +1484,9 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, cur_node = proceed_next_node (mctx, nmatch, pmatch, &idx, cur_node, &eps_via_nodes, fs); - if (BE (! REG_VALID_INDEX (cur_node), 0)) + if (BE (cur_node < 0, 0)) { - if (BE (cur_node == REG_ERROR, 0)) + if (BE (cur_node == -2, 0)) { re_node_set_free (&eps_via_nodes); if (prev_idx_match_malloced) @@ -1889,10 +1870,10 @@ sub_epsilon_src_nodes (const re_dfa_t *dfa, Idx node, re_node_set *dest_nodes, { Idx edst1 = dfa->edests[cur_node].elems[0]; Idx edst2 = ((dfa->edests[cur_node].nelem > 1) - ? dfa->edests[cur_node].elems[1] : REG_MISSING); + ? dfa->edests[cur_node].elems[1] : -1); if ((!re_node_set_contains (inv_eclosure, edst1) && re_node_set_contains (dest_nodes, edst1)) - || (REG_VALID_NONZERO_INDEX (edst2) + || (edst2 > 0 && !re_node_set_contains (inv_eclosure, edst2) && re_node_set_contains (dest_nodes, edst2))) { @@ -1972,7 +1953,7 @@ check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries, switch (dfa->nodes[node].type) { case OP_BACK_REF: - if (bkref_idx != REG_MISSING) + if (bkref_idx != -1) { struct re_backref_cache_entry *ent = mctx->bkref_ents + bkref_idx; do @@ -2088,8 +2069,8 @@ check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, subexp_idx = dfa->nodes[ent->node].opr.idx; if (ent->subexp_to == str_idx) { - Idx ops_node = REG_MISSING; - Idx cls_node = REG_MISSING; + Idx ops_node = -1; + Idx cls_node = -1; for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { Idx node = dest_nodes->elems[node_idx]; @@ -2104,7 +2085,7 @@ check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, /* Check the limitation of the open subexpression. */ /* Note that (ent->subexp_to = str_idx != ent->subexp_from). */ - if (REG_VALID_INDEX (ops_node)) + if (ops_node >= 0) { err = sub_epsilon_src_nodes (dfa, ops_node, dest_nodes, candidates); @@ -2113,7 +2094,7 @@ check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, } /* Check the limitation of the close subexpression. */ - if (REG_VALID_INDEX (cls_node)) + if (cls_node >= 0) for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { Idx node = dest_nodes->elems[node_idx]; @@ -2166,7 +2147,7 @@ sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx, re_sift_context_t local_sctx; Idx first_idx = search_cur_bkref_entry (mctx, str_idx); - if (first_idx == REG_MISSING) + if (first_idx == -1) return REG_NOERROR; local_sctx.sifted_states = NULL; /* Mark that it hasn't been initialized. */ @@ -2570,7 +2551,7 @@ transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate) if (BE (err != REG_NOERROR, 0)) return err; #ifdef DEBUG - assert (dfa->nexts[cur_node_idx] != REG_MISSING); + assert (dfa->nexts[cur_node_idx] != -1); #endif new_nodes = dfa->eclosures + dfa->nexts[cur_node_idx]; @@ -2636,7 +2617,7 @@ transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes) /* And add the epsilon closures (which is 'new_dest_nodes') of the backreference to appropriate state_log. */ #ifdef DEBUG - assert (dfa->nexts[node_idx] != REG_MISSING); + assert (dfa->nexts[node_idx] != -1); #endif for (; bkc_idx < mctx->nbkref_ents; ++bkc_idx) { @@ -2720,7 +2701,7 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx) const char *buf = (const char *) re_string_get_buffer (&mctx->input); /* Return if we have already checked BKREF_NODE at BKREF_STR_IDX. */ Idx cache_idx = search_cur_bkref_entry (mctx, bkref_str_idx); - if (cache_idx != REG_MISSING) + if (cache_idx != -1) { const struct re_backref_cache_entry *entry = mctx->bkref_ents + cache_idx; @@ -2825,7 +2806,7 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx) nodes = &mctx->state_log[sl_str]->nodes; cls_node = find_subexp_node (dfa, nodes, subexp_num, OP_CLOSE_SUBEXP); - if (cls_node == REG_MISSING) + if (cls_node == -1) continue; /* No. */ if (sub_top->path == NULL) { @@ -2904,7 +2885,7 @@ find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, && node->opr.idx == subexp_idx) return cls_node; } - return REG_MISSING; + return -1; } /* Check whether the node TOP_NODE at TOP_STR can arrive to the node @@ -3180,7 +3161,7 @@ check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes, Idx cur_node = cur_nodes->elems[idx]; const re_node_set *eclosure = dfa->eclosures + cur_node; outside_node = find_subexp_node (dfa, eclosure, ex_subexp, type); - if (outside_node == REG_MISSING) + if (outside_node == -1) { /* There are no problematic nodes, just merge them. */ err = re_node_set_merge (&new_nodes, eclosure); @@ -3266,7 +3247,7 @@ expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes, Idx cache_idx_start = search_cur_bkref_entry (mctx, cur_str); struct re_backref_cache_entry *ent; - if (cache_idx_start == REG_MISSING) + if (cache_idx_start == -1) return REG_NOERROR; restart: @@ -3391,7 +3372,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) /* At first, group all nodes belonging to 'state' into several destinations. */ ndests = group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch); - if (BE (! REG_VALID_NONZERO_INDEX (ndests), 0)) + if (BE (ndests <= 0, 0)) { if (dests_node_malloced) free (dests_alloc); @@ -3453,7 +3434,7 @@ out_free: for (j = 0; j < dests_node[i].nelem; ++j) { next_node = dfa->nexts[dests_node[i].elems[j]]; - if (next_node != REG_MISSING) + if (next_node != -1) { err = re_node_set_merge (&follows, dfa->eclosures + next_node); if (BE (err != REG_NOERROR, 0)) @@ -3764,7 +3745,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, error_return: for (j = 0; j < ndests; ++j) re_node_set_free (dests_node + j); - return REG_MISSING; + return -1; } #ifdef RE_ENABLE_I18N @@ -3776,6 +3757,10 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, one collating element like '.', '[a-z]', opposite to the other nodes can only accept one byte. */ +# ifdef _LIBC +# include <locale/weight.h> +# endif + static int internal_function check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, @@ -3895,8 +3880,6 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, const int32_t *table, *indirect; const unsigned char *weights, *extra; const char *collseqwc; - /* This #include defines a local function! */ -# include <locale/weight.h> /* match with collating_symbol? */ if (cset->ncoll_syms) @@ -3953,7 +3936,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB); indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); - int32_t idx = findidx (&cp, elem_len); + int32_t idx = findidx (table, indirect, extra, &cp, elem_len); if (idx > 0) for (i = 0; i < cset->nequiv_classes; ++i) { @@ -4193,7 +4176,7 @@ internal_function __attribute_warn_unused_result__ match_ctx_init (re_match_context_t *mctx, int eflags, Idx n) { mctx->eflags = eflags; - mctx->match_last = REG_MISSING; + mctx->match_last = -1; if (n > 0) { /* Avoid overflow. */ @@ -4314,7 +4297,7 @@ match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from, return REG_NOERROR; } -/* Return the first entry with the same str_idx, or REG_MISSING if none is +/* Return the first entry with the same str_idx, or -1 if none is found. Note that MCTX->BKREF_ENTS is already sorted by MCTX->STR_IDX. */ static Idx @@ -4334,7 +4317,7 @@ search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx) if (left < last && mctx->bkref_ents[left].str_idx == str_idx) return left; else - return REG_MISSING; + return -1; } /* Register the node NODE, whose type is OP_OPEN_SUBEXP, and which matches diff --git a/contrib/tools/m4/lib/secure_getenv.c b/contrib/tools/m4/lib/secure_getenv.c index 6c11c5e0ed..88a60dc33c 100644 --- a/contrib/tools/m4/lib/secure_getenv.c +++ b/contrib/tools/m4/lib/secure_getenv.c @@ -1,6 +1,6 @@ -/* Look up an environment variable more securely. +/* Look up an environment variable, returning NULL in insecure situations. - Copyright 2013 Free Software Foundation, Inc. + Copyright 2013-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 @@ -20,22 +20,35 @@ #include <stdlib.h> #if !HAVE___SECURE_GETENV -# if HAVE_ISSETUGID +# if HAVE_ISSETUGID || (HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID) # include <unistd.h> -# else -# undef issetugid -# define issetugid() 1 # endif #endif char * secure_getenv (char const *name) { -#if HAVE___SECURE_GETENV +#if HAVE___SECURE_GETENV /* glibc */ return __secure_getenv (name); -#else +#elif HAVE_ISSETUGID /* OS X, FreeBSD, NetBSD, OpenBSD */ if (issetugid ()) - return 0; + return NULL; + return getenv (name); +#elif HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID /* other Unix */ + if (geteuid () != getuid () || getegid () != getgid ()) + return NULL; return getenv (name); +#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* native Windows */ + /* On native Windows, there is no such concept as setuid or setgid binaries. + - Programs launched as system services have high privileges, but they don't + inherit environment variables from a user. + - Programs launched by a user with "Run as Administrator" have high + privileges and use the environment variables, but the user has been asked + whether he agrees. + - Programs launched by a user without "Run as Administrator" cannot gain + high privileges, therefore there is no risk. */ + return getenv (name); +#else + return NULL; #endif } diff --git a/contrib/tools/m4/lib/sig-handler.h b/contrib/tools/m4/lib/sig-handler.h index 67d061d599..ad8c1dd8e7 100644 --- a/contrib/tools/m4/lib/sig-handler.h +++ b/contrib/tools/m4/lib/sig-handler.h @@ -1,6 +1,6 @@ /* Convenience declarations when working with <signal.h>. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + 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 @@ -34,7 +34,7 @@ typedef void (*sa_handler_t) (int); /* Return the handler of a signal, as a sa_handler_t value regardless of its true type. The resulting function can be compared to special values like SIG_IGN but it is not portable to call it. */ -SIG_HANDLER_INLINE sa_handler_t +SIG_HANDLER_INLINE sa_handler_t _GL_ATTRIBUTE_PURE get_handler (struct sigaction const *a) { #ifdef SA_SIGINFO diff --git a/contrib/tools/m4/lib/sigaction.c b/contrib/tools/m4/lib/sigaction.c index 97eb76d92e..529b612f88 100644 --- a/contrib/tools/m4/lib/sigaction.c +++ b/contrib/tools/m4/lib/sigaction.c @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking. - Copyright (C) 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2008-2016 Free Software Foundation, Inc. Written by Eric Blake <ebb9@byu.net>, 2008. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/siglist.h b/contrib/tools/m4/lib/siglist.h index 7817c95b31..7e1da0bde5 100644 --- a/contrib/tools/m4/lib/siglist.h +++ b/contrib/tools/m4/lib/siglist.h @@ -1,5 +1,5 @@ /* Canonical list of all signal names. - Copyright (C) 1996-1999, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 1996-1999, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/sigprocmask.c b/contrib/tools/m4/lib/sigprocmask.c index 8de3777db3..fcbf032637 100644 --- a/contrib/tools/m4/lib/sigprocmask.c +++ b/contrib/tools/m4/lib/sigprocmask.c @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking. - Copyright (C) 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/spawn-pipe.c b/contrib/tools/m4/lib/spawn-pipe.c index 86b929a7f4..6e6513047f 100644 --- a/contrib/tools/m4/lib/spawn-pipe.c +++ b/contrib/tools/m4/lib/spawn-pipe.c @@ -1,5 +1,5 @@ /* Creation of subprocesses, communicating via pipes. - Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -27,7 +27,6 @@ #include <signal.h> #include <unistd.h> -#include "penviron.h" #include "error.h" #include "fatal-signal.h" #include "unistd-safer.h" @@ -36,7 +35,8 @@ #define _(str) gettext (str) -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if (((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ + || defined __KLIBC__) /* Native Windows API. */ # include <process.h> @@ -49,11 +49,9 @@ #endif -/* The results of open() in this file are not used with fchdir, - therefore save some unnecessary work in fchdir.c. */ -#undef open -#undef close - +#if defined(__FreeBSD__) || defined(__MACH__) + extern char** environ; +#endif #ifdef EINTR @@ -115,7 +113,8 @@ create_pipe (const char *progname, bool slave_process, bool exit_on_error, int fd[2]) { -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +#if (((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ + || defined __KLIBC__) /* Native Windows API. This uses _pipe(), dup2(), and spawnv(). It could also be implemented diff --git a/contrib/tools/m4/lib/spawn-pipe.h b/contrib/tools/m4/lib/spawn-pipe.h index ea8284f268..96e7bebc8b 100644 --- a/contrib/tools/m4/lib/spawn-pipe.h +++ b/contrib/tools/m4/lib/spawn-pipe.h @@ -1,5 +1,5 @@ /* Creation of subprocesses, communicating via pipes. - Copyright (C) 2001-2003, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/stdio--.h b/contrib/tools/m4/lib/stdio--.h index 5d9b19b50a..8e238171af 100644 --- a/contrib/tools/m4/lib/stdio--.h +++ b/contrib/tools/m4/lib/stdio--.h @@ -1,6 +1,6 @@ /* Like stdio.h, but redefine some names to avoid glitches. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 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 @@ -18,15 +18,8 @@ /* Written by Paul Eggert. */ #include <stdio.h> -#include <unistd.h> #include "stdio-safer.h" -#if defined(_WIN32) -int fpurge(FILE *stream); -int fseeko(FILE *stream, off_t offset, int whence); -off_t ftello(FILE *stream); -#endif - #if GNULIB_FOPEN_SAFER # undef fopen # define fopen fopen_safer diff --git a/contrib/tools/m4/lib/stdio-safer.h b/contrib/tools/m4/lib/stdio-safer.h index 7b67ae059d..4231609741 100644 --- a/contrib/tools/m4/lib/stdio-safer.h +++ b/contrib/tools/m4/lib/stdio-safer.h @@ -1,6 +1,6 @@ /* Invoke stdio functions, but avoid some glitches. - Copyright (C) 2001, 2003, 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2006, 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 diff --git a/contrib/tools/m4/lib/stdlib--.h b/contrib/tools/m4/lib/stdlib--.h index 28360a2707..af83455aa3 100644 --- a/contrib/tools/m4/lib/stdlib--.h +++ b/contrib/tools/m4/lib/stdlib--.h @@ -1,6 +1,6 @@ /* Like stdlib.h, but redefine some names to avoid glitches. - Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc. + 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 @@ -20,12 +20,6 @@ #include <stdlib.h> #include "stdlib-safer.h" -#if defined(_WIN32) -char *mkdtemp(char *template); -int mkstemp(char*); -char *secure_getenv(const char *name); -#endif - #undef mkstemp #define mkstemp mkstemp_safer diff --git a/contrib/tools/m4/lib/stdlib-safer.h b/contrib/tools/m4/lib/stdlib-safer.h index 1e3149370e..91294f4ef4 100644 --- a/contrib/tools/m4/lib/stdlib-safer.h +++ b/contrib/tools/m4/lib/stdlib-safer.h @@ -1,6 +1,6 @@ /* Invoke stdlib.h functions, but avoid some glitches. - Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/stripslash.c b/contrib/tools/m4/lib/stripslash.c index 0e452a95ef..0453e36cc6 100644 --- a/contrib/tools/m4/lib/stripslash.c +++ b/contrib/tools/m4/lib/stripslash.c @@ -1,6 +1,6 @@ /* stripslash.c -- remove redundant trailing slashes from a file name - Copyright (C) 1990, 2001, 2003-2006, 2009-2013 Free Software Foundation, + Copyright (C) 1990, 2001, 2003-2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/strsignal.c b/contrib/tools/m4/lib/strsignal.c index f26ece6ba6..8c64c4e3dd 100644 --- a/contrib/tools/m4/lib/strsignal.c +++ b/contrib/tools/m4/lib/strsignal.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1994-2002, 2005, 2008-2013 Free Software Foundation, +/* Copyright (C) 1991, 1994-2002, 2005, 2008-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -44,11 +44,7 @@ # define __libc_key_t gl_tls_key_t # define __libc_getspecific(NAME) gl_tls_get ((NAME)) # define __libc_setspecific(NAME, POINTER) gl_tls_set ((NAME), (POINTER)) -#if defined(_MSC_VER) -# define __snprintf _snprintf -#else # define __snprintf snprintf -#endif #endif /* _LIBC */ #ifdef _LIBC diff --git a/contrib/tools/m4/lib/tempname.c b/contrib/tools/m4/lib/tempname.c index 087b79b31f..b1e9880f7b 100644 --- a/contrib/tools/m4/lib/tempname.c +++ b/contrib/tools/m4/lib/tempname.c @@ -1,6 +1,6 @@ /* tempname.c - generate the name of a temporary file. - Copyright (C) 1991-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1991-2003, 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 @@ -62,6 +62,7 @@ # define struct_stat64 struct stat64 #else # define struct_stat64 struct stat +# define __try_tempname try_tempname # define __gen_tempname gen_tempname # define __getpid getpid # define __gettimeofday gettimeofday @@ -176,21 +177,9 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; -/* Generate a temporary file name based on TMPL. TMPL must match the - rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix). - The name constructed does not exist at the time of the call to - __gen_tempname. TMPL is overwritten with the result. - - KIND may be one of: - __GT_NOCREATE: simply verify that the name does not exist - at the time of the call. - __GT_FILE: create the file using open(O_CREAT|O_EXCL) - and return a read-write fd. The file is mode 0600. - __GT_DIR: create a directory, which will be mode 0700. - - We use a clever algorithm to get hard-to-predict names. */ int -__gen_tempname (char *tmpl, int suffixlen, int flags, int kind) +__try_tempname (char *tmpl, int suffixlen, void *args, + int (*tryfunc) (char *, void *)) { int len; char *XXXXXX; @@ -199,7 +188,6 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) unsigned int count; int fd = -1; int save_errno = errno; - struct_stat64 st; /* A lower bound on the number of temporary files to attempt to generate. The maximum total number of temporary file names that @@ -256,41 +244,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) v /= 62; XXXXXX[5] = letters[v % 62]; - switch (kind) - { - case __GT_FILE: - fd = __open (tmpl, - (flags & ~O_ACCMODE) - | O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); - break; - - case __GT_DIR: - fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR); - break; - - case __GT_NOCREATE: - /* This case is backward from the other three. __gen_tempname - succeeds if __xstat fails because the name does not exist. - Note the continue to bypass the common logic at the bottom - of the loop. */ - if (__lxstat64 (_STAT_VER, tmpl, &st) < 0) - { - if (errno == ENOENT) - { - __set_errno (save_errno); - return 0; - } - else - /* Give up now. */ - return -1; - } - continue; - - default: - assert (! "invalid KIND in __gen_tempname"); - abort (); - } - + fd = tryfunc (tmpl, args); if (fd >= 0) { __set_errno (save_errno); @@ -304,3 +258,67 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) __set_errno (EEXIST); return -1; } + +static int +try_file (char *tmpl, void *flags) +{ + int *openflags = flags; + return __open (tmpl, + (*openflags & ~O_ACCMODE) + | O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); +} + +static int +try_dir (char *tmpl, void *flags _GL_UNUSED) +{ + return __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR); +} + +static int +try_nocreate (char *tmpl, void *flags _GL_UNUSED) +{ + struct_stat64 st; + + if (__lxstat64 (_STAT_VER, tmpl, &st) == 0) + __set_errno (EEXIST); + return errno == ENOENT ? 0 : -1; +} + +/* Generate a temporary file name based on TMPL. TMPL must match the + rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix). + The name constructed does not exist at the time of the call to + __gen_tempname. TMPL is overwritten with the result. + + KIND may be one of: + __GT_NOCREATE: simply verify that the name does not exist + at the time of the call. + __GT_FILE: create the file using open(O_CREAT|O_EXCL) + and return a read-write fd. The file is mode 0600. + __GT_DIR: create a directory, which will be mode 0700. + + We use a clever algorithm to get hard-to-predict names. */ +int +__gen_tempname (char *tmpl, int suffixlen, int flags, int kind) +{ + int (*tryfunc) (char *, void *); + + switch (kind) + { + case __GT_FILE: + tryfunc = try_file; + break; + + case __GT_DIR: + tryfunc = try_dir; + break; + + case __GT_NOCREATE: + tryfunc = try_nocreate; + break; + + default: + assert (! "invalid KIND in __gen_tempname"); + abort (); + } + return __try_tempname (tmpl, suffixlen, &flags, tryfunc); +} diff --git a/contrib/tools/m4/lib/tempname.h b/contrib/tools/m4/lib/tempname.h index 333267dfd0..be01c51436 100644 --- a/contrib/tools/m4/lib/tempname.h +++ b/contrib/tools/m4/lib/tempname.h @@ -1,6 +1,6 @@ /* Create a temporary file or directory. - Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2006, 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 @@ -32,6 +32,10 @@ # define GT_NOCREATE 2 # endif +#ifdef __cplusplus +extern "C" { +#endif + /* Generate a temporary file name based on TMPL. TMPL must match the rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix). The name constructed does not exist at the time of the call to @@ -47,4 +51,15 @@ We use a clever algorithm to get hard-to-predict names. */ extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind); +/* Similar to gen_tempname, but TRYFUNC is called for each temporary + name to try. If TRYFUNC returns a non-negative number, TRY_GEN_TEMPNAME + returns with this value. Otherwise, if errno is set to EEXIST, another + name is tried, or else TRY_GEN_TEMPNAME returns -1. */ +extern int try_tempname (char *tmpl, int suffixlen, void *args, + int (*tryfunc) (char *, void *)); + +#ifdef __cplusplus +} +#endif + #endif /* GL_TEMPNAME_H */ diff --git a/contrib/tools/m4/lib/tmpdir.c b/contrib/tools/m4/lib/tmpdir.c index 97fc3ff888..1cc01fb1c2 100644 --- a/contrib/tools/m4/lib/tmpdir.c +++ b/contrib/tools/m4/lib/tmpdir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001-2002, 2006, 2009-2013 Free Software Foundation, +/* Copyright (C) 1999, 2001-2002, 2006, 2009-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/contrib/tools/m4/lib/tmpdir.h b/contrib/tools/m4/lib/tmpdir.h index ff7c70f346..ef615fcb23 100644 --- a/contrib/tools/m4/lib/tmpdir.h +++ b/contrib/tools/m4/lib/tmpdir.h @@ -1,5 +1,5 @@ /* Determine a temporary directory. - Copyright (C) 2001-2002, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 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 diff --git a/contrib/tools/m4/lib/unistd--.h b/contrib/tools/m4/lib/unistd--.h index fee7ecf03d..bd1d0fb252 100644 --- a/contrib/tools/m4/lib/unistd--.h +++ b/contrib/tools/m4/lib/unistd--.h @@ -1,6 +1,6 @@ /* Like unistd.h, but redefine some names to avoid glitches. - Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc. + 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 @@ -20,10 +20,6 @@ #include <unistd.h> #include "unistd-safer.h" -#if defined(_WIN32) -# include <process.h> -#endif - #undef dup #define dup dup_safer diff --git a/contrib/tools/m4/lib/unistd-safer.h b/contrib/tools/m4/lib/unistd-safer.h index 5c2b55ae2f..c8179ce376 100644 --- a/contrib/tools/m4/lib/unistd-safer.h +++ b/contrib/tools/m4/lib/unistd-safer.h @@ -1,6 +1,6 @@ /* Invoke unistd-like functions, but avoid some glitches. - Copyright (C) 2001, 2003, 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 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 diff --git a/contrib/tools/m4/lib/unistd.c b/contrib/tools/m4/lib/unistd.c index 6c6a8e268c..72bad1c052 100644 --- a/contrib/tools/m4/lib/unistd.c +++ b/contrib/tools/m4/lib/unistd.c @@ -1,3 +1,4 @@ #include <config.h> #define _GL_UNISTD_INLINE _GL_EXTERN_INLINE #include "unistd.h" +typedef int dummy; diff --git a/contrib/tools/m4/lib/unlocked-io.h b/contrib/tools/m4/lib/unlocked-io.h index df3e13911e..c0ece50787 100644 --- a/contrib/tools/m4/lib/unlocked-io.h +++ b/contrib/tools/m4/lib/unlocked-io.h @@ -1,6 +1,6 @@ /* Prefer faster, non-thread-safe stdio functions if available. - Copyright (C) 2001-2004, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 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 diff --git a/contrib/tools/m4/lib/vasnprintf.c b/contrib/tools/m4/lib/vasnprintf.c index 184937d6f1..2f39b38734 100644 --- a/contrib/tools/m4/lib/vasnprintf.c +++ b/contrib/tools/m4/lib/vasnprintf.c @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-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 @@ -195,7 +195,7 @@ /* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized" warnings in this file. Use -Dlint to suppress them. */ -#ifdef lint +#if defined GCC_LINT || defined lint # define IF_LINT(Code) Code #else # define IF_LINT(Code) /* empty */ @@ -1886,7 +1886,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, else { do - result[length++] = (unsigned char) *cp++; + result[length++] = *cp++; while (--n > 0); } } @@ -1957,15 +1957,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; - width = (unsigned int) (-arg); + width = -width; } - else - width = arg; } else { @@ -2073,8 +2072,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, characters = 0; } - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) + if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2127,8 +2125,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } # endif - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) + if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2201,8 +2198,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, characters = 0; } - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) + if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2255,8 +2251,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } # endif - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) + if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2329,8 +2324,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, characters = 0; } - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) + if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2383,8 +2377,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } # endif - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) + if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2435,15 +2428,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; - width = (unsigned int) (-arg); + width = -width; } - else - width = arg; } else { @@ -2573,8 +2565,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, characters = 0; } - if (has_width && width > characters - && !(dp->flags & FLAG_LEFT)) + if (characters < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2635,8 +2626,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } } - if (has_width && width > characters - && (dp->flags & FLAG_LEFT)) + if (characters < width && (dp->flags & FLAG_LEFT)) { size_t n = width - characters; ENSURE_ALLOCATION (xsum (length, n)); @@ -2827,8 +2817,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* w doesn't matter. */ w = 0; - if (has_width && width > w - && !(dp->flags & FLAG_LEFT)) + if (w < width && !(dp->flags & FLAG_LEFT)) { size_t n = width - w; ENSURE_ALLOCATION (xsum (length, n)); @@ -2911,8 +2900,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, length += tmpdst_len; # endif - if (has_width && width > w - && (dp->flags & FLAG_LEFT)) + if (w < width && (dp->flags & FLAG_LEFT)) { size_t n = width - w; ENSURE_ALLOCATION (xsum (length, n)); @@ -2939,17 +2927,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; - int has_width; size_t width; int has_precision; size_t precision; size_t tmp_length; + size_t count; DCHAR_T tmpbuf[700]; DCHAR_T *tmp; DCHAR_T *pad_ptr; DCHAR_T *p; - has_width = 0; width = 0; if (dp->width_start != dp->width_end) { @@ -2960,15 +2947,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; - width = (unsigned int) (-arg); + width = -width; } - else - width = arg; } else { @@ -2978,7 +2964,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } - has_width = 1; } has_precision = 0; @@ -3354,11 +3339,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, abort (); # endif } + /* The generated string now extends from tmp to p, with the zero padding insertion point being at pad_ptr. */ - if (has_width && p - tmp < width) + count = p - tmp; + + if (count < width) { - size_t pad = width - (p - tmp); + size_t pad = width - count; DCHAR_T *end = p + pad; if (flags & FLAG_LEFT) @@ -3391,28 +3379,26 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, p = end; } - { - size_t count = p - tmp; + count = p - tmp; - if (count >= tmp_length) - /* tmp_length was incorrectly calculated - fix the - code above! */ - abort (); + if (count >= tmp_length) + /* tmp_length was incorrectly calculated - fix the + code above! */ + abort (); - /* Make room for the result. */ - if (count >= allocated - length) - { - size_t n = xsum (length, count); + /* Make room for the result. */ + if (count >= allocated - length) + { + size_t n = xsum (length, count); - ENSURE_ALLOCATION (n); - } + ENSURE_ALLOCATION (n); + } - /* Append the result. */ - memcpy (result + length, tmp, count * sizeof (DCHAR_T)); - if (tmp != tmpbuf) - free (tmp); - length += count; - } + /* Append the result. */ + memcpy (result + length, tmp, count * sizeof (DCHAR_T)); + if (tmp != tmpbuf) + free (tmp); + length += count; } #endif #if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL @@ -3446,8 +3432,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, arg_type type = a.arg[dp->arg_index].type; # endif int flags = dp->flags; - int has_width; size_t width; + size_t count; int has_precision; size_t precision; size_t tmp_length; @@ -3456,7 +3442,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, DCHAR_T *pad_ptr; DCHAR_T *p; - has_width = 0; width = 0; if (dp->width_start != dp->width_end) { @@ -3467,15 +3452,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; - width = (unsigned int) (-arg); + width = -width; } - else - width = arg; } else { @@ -3485,7 +3469,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } - has_width = 1; } has_precision = 0; @@ -3925,9 +3908,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, digits without trailing zeroes. */ if (exponent >= 0) { - size_t count = exponent + 1; + size_t ecount = exponent + 1; /* Note: count <= precision = ndigits. */ - for (; count > 0; count--) + for (; ecount > 0; ecount--) *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { @@ -3941,10 +3924,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } else { - size_t count = -exponent - 1; + size_t ecount = -exponent - 1; *p++ = '0'; *p++ = decimal_point_char (); - for (; count > 0; count--) + for (; ecount > 0; ecount--) *p++ = '0'; while (ndigits > nzeroes) { @@ -4395,9 +4378,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, digits without trailing zeroes. */ if (exponent >= 0) { - size_t count = exponent + 1; - /* Note: count <= precision = ndigits. */ - for (; count > 0; count--) + size_t ecount = exponent + 1; + /* Note: ecount <= precision = ndigits. */ + for (; ecount > 0; ecount--) *p++ = digits[--ndigits]; if ((flags & FLAG_ALT) || ndigits > nzeroes) { @@ -4411,10 +4394,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } else { - size_t count = -exponent - 1; + size_t ecount = -exponent - 1; *p++ = '0'; *p++ = decimal_point_char (); - for (; count > 0; count--) + for (; ecount > 0; ecount--) *p++ = '0'; while (ndigits > nzeroes) { @@ -4542,9 +4525,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* The generated string now extends from tmp to p, with the zero padding insertion point being at pad_ptr. */ - if (has_width && p - tmp < width) + count = p - tmp; + + if (count < width) { - size_t pad = width - (p - tmp); + size_t pad = width - count; DCHAR_T *end = p + pad; if (flags & FLAG_LEFT) @@ -4577,36 +4562,36 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, p = end; } - { - size_t count = p - tmp; + count = p - tmp; - if (count >= tmp_length) - /* tmp_length was incorrectly calculated - fix the - code above! */ - abort (); + if (count >= tmp_length) + /* tmp_length was incorrectly calculated - fix the + code above! */ + abort (); - /* Make room for the result. */ - if (count >= allocated - length) - { - size_t n = xsum (length, count); + /* Make room for the result. */ + if (count >= allocated - length) + { + size_t n = xsum (length, count); - ENSURE_ALLOCATION (n); - } + ENSURE_ALLOCATION (n); + } - /* Append the result. */ - memcpy (result + length, tmp, count * sizeof (DCHAR_T)); - if (tmp != tmpbuf) - free (tmp); - length += count; - } + /* Append the result. */ + memcpy (result + length, tmp, count * sizeof (DCHAR_T)); + if (tmp != tmpbuf) + free (tmp); + length += count; } #endif else { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION int has_width; +#endif +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION size_t width; #endif #if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION @@ -4635,8 +4620,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, TCHAR_T *tmp; #endif -#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION has_width = 0; +#endif +#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION width = 0; if (dp->width_start != dp->width_end) { @@ -4647,15 +4634,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; if (arg < 0) { /* "A negative field width is taken as a '-' flag followed by a positive field width." */ flags |= FLAG_LEFT; - width = (unsigned int) (-arg); + width = -width; } - else - width = arg; } else { @@ -4665,7 +4651,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION has_width = 1; +#endif } #endif @@ -4805,7 +4793,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { const FCHAR_T *mp = dp->width_start; do - *fbp++ = (unsigned char) *mp++; + *fbp++ = *mp++; while (--n > 0); } } @@ -4826,7 +4814,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { const FCHAR_T *mp = dp->precision_start; do - *fbp++ = (unsigned char) *mp++; + *fbp++ = *mp++; while (--n > 0); } } @@ -4844,9 +4832,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, break; # else *fbp++ = 'l'; - /*FALLTHROUGH*/ # endif #endif + /*FALLTHROUGH*/ case TYPE_LONGINT: case TYPE_ULONGINT: #if HAVE_WINT_T @@ -5153,7 +5141,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, size_t tmp_length = MAX_ROOM_NEEDED (&a, dp->arg_index, dp->conversion, type, flags, - has_width ? width : 0, + width, has_precision, precision, pad_ourselves); @@ -5191,18 +5179,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* SNPRINTF or sprintf failed. Save and use the errno that it has set, if any. */ int saved_errno = errno; + if (saved_errno == 0) + { + if (dp->conversion == 'c' || dp->conversion == 's') + saved_errno = EILSEQ; + else + saved_errno = EINVAL; + } if (!(result == resultbuf || result == NULL)) free (result); if (buf_malloced != NULL) free (buf_malloced); CLEANUP (); - errno = - (saved_errno != 0 - ? saved_errno - : (dp->conversion == 'c' || dp->conversion == 's' - ? EILSEQ - : EINVAL)); + + errno = saved_errno; return NULL; } @@ -5391,7 +5382,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, tmpsrc += count; tmpdst += count; for (n = count; n > 0; n--) - *--tmpdst = (unsigned char) *--tmpsrc; + *--tmpdst = *--tmpsrc; } } #endif diff --git a/contrib/tools/m4/lib/vasnprintf.h b/contrib/tools/m4/lib/vasnprintf.h index 7658f505e5..8e9d84f015 100644 --- a/contrib/tools/m4/lib/vasnprintf.h +++ b/contrib/tools/m4/lib/vasnprintf.h @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 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 diff --git a/contrib/tools/m4/lib/vasprintf.c b/contrib/tools/m4/lib/vasprintf.c index d0d4a11bf7..a5dc1beb4e 100644 --- a/contrib/tools/m4/lib/vasprintf.c +++ b/contrib/tools/m4/lib/vasprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 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 diff --git a/contrib/tools/m4/lib/verify.h b/contrib/tools/m4/lib/verify.h index d42d0750ee..5c8381d290 100644 --- a/contrib/tools/m4/lib/verify.h +++ b/contrib/tools/m4/lib/verify.h @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 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 @@ -250,6 +250,30 @@ template <int w> #define verify(R) _GL_VERIFY (R, "verify (" #R ")") +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif + +/* Assume that R always holds. This lets the compiler optimize + accordingly. R should not have side-effects; it may or may not be + evaluated. Behavior is undefined if R is false. */ + +#if (__has_builtin (__builtin_unreachable) \ + || 4 < __GNUC__ + (5 <= __GNUC_MINOR__)) +# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) +#elif 1200 <= _MSC_VER +# define assume(R) __assume (R) +#elif ((defined GCC_LINT || defined lint) \ + && (__has_builtin (__builtin_trap) \ + || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)))) + /* Doing it this way helps various packages when configured with + --enable-gcc-warnings, which compiles with -Dlint. It's nicer + when 'assume' silences warnings even with older GCCs. */ +# define assume(R) ((R) ? (void) 0 : __builtin_trap ()) +#else +# define assume(R) ((void) (0 && (R))) +#endif + /* @assert.h omit end@ */ #endif diff --git a/contrib/tools/m4/lib/verror.c b/contrib/tools/m4/lib/verror.c index 5f899c1b7a..1abf3fe1e3 100644 --- a/contrib/tools/m4/lib/verror.c +++ b/contrib/tools/m4/lib/verror.c @@ -1,5 +1,5 @@ /* va_list error handler for noninteractive utilities - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/verror.h b/contrib/tools/m4/lib/verror.h index 7e7284ad82..6d5123aa84 100644 --- a/contrib/tools/m4/lib/verror.h +++ b/contrib/tools/m4/lib/verror.h @@ -1,5 +1,5 @@ /* Declaration for va_list error-reporting function - Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/version-etc-fsf.c b/contrib/tools/m4/lib/version-etc-fsf.c index e1c69da94a..baaebb61c7 100644 --- a/contrib/tools/m4/lib/version-etc-fsf.c +++ b/contrib/tools/m4/lib/version-etc-fsf.c @@ -1,5 +1,5 @@ /* Variable with FSF copyright information, for version-etc. - Copyright (C) 1999-2006, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2006, 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 diff --git a/contrib/tools/m4/lib/version-etc.c b/contrib/tools/m4/lib/version-etc.c index b7d23ab597..a9a0fdb0ad 100644 --- a/contrib/tools/m4/lib/version-etc.c +++ b/contrib/tools/m4/lib/version-etc.c @@ -1,5 +1,5 @@ /* Print --version and bug-reporting information in a consistent format. - Copyright (C) 1999-2013 Free Software Foundation, Inc. + Copyright (C) 1999-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 @@ -38,7 +38,7 @@ # define PACKAGE PACKAGE_TARNAME #endif -enum { COPYRIGHT_YEAR = 2013 }; +enum { COPYRIGHT_YEAR = 2016 }; /* The three functions below display the --version information the standard way. diff --git a/contrib/tools/m4/lib/version-etc.h b/contrib/tools/m4/lib/version-etc.h index 6c3d08431c..1a5f603c04 100644 --- a/contrib/tools/m4/lib/version-etc.h +++ b/contrib/tools/m4/lib/version-etc.h @@ -1,5 +1,5 @@ /* Print --version and bug-reporting information in a consistent format. - Copyright (C) 1999, 2003, 2005, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2003, 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 diff --git a/contrib/tools/m4/lib/vfprintf.c b/contrib/tools/m4/lib/vfprintf.c deleted file mode 100644 index 635e36eb59..0000000000 --- a/contrib/tools/m4/lib/vfprintf.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Formatted output to a stream. - Copyright (C) 2004, 2006-2013 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/>. */ - -#if 1 -# include <config.h> -#endif - -/* Specification. */ -#include <stdio.h> - -#include <errno.h> -#include <limits.h> -#include <stdarg.h> -#include <stdlib.h> - -#include "fseterr.h" -#include "vasnprintf.h" - -/* Print formatted output to the stream FP. - Return string length of formatted string. On error, return a negative - value. */ -int -vfprintf (FILE *fp, const char *format, va_list args) -{ - char buf[2000]; - char *output; - size_t len; - size_t lenbuf = sizeof (buf); - - output = vasnprintf (buf, &lenbuf, format, args); - len = lenbuf; - - if (!output) - { - fseterr (fp); - return -1; - } - - if (fwrite (output, 1, len, fp) < len) - { - if (output != buf) - { - int saved_errno = errno; - free (output); - errno = saved_errno; - } - return -1; - } - - if (output != buf) - free (output); - - if (len > INT_MAX) - { - errno = EOVERFLOW; - fseterr (fp); - return -1; - } - - return len; -} diff --git a/contrib/tools/m4/lib/w32spawn.h b/contrib/tools/m4/lib/w32spawn.h index 3b5c08afcd..389054aa6d 100644 --- a/contrib/tools/m4/lib/w32spawn.h +++ b/contrib/tools/m4/lib/w32spawn.h @@ -1,5 +1,5 @@ /* Auxiliary functions for the creation of subprocesses. Native Windows API. - Copyright (C) 2001, 2003-2013 Free Software Foundation, Inc. + Copyright (C) 2001, 2003-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify @@ -15,9 +15,11 @@ 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 __KLIBC__ /* Get declarations of the native Windows API functions. */ -#define WIN32_LEAN_AND_MEAN -#include <windows.h> +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +#endif /* Get _open_osfhandle(). */ #include <io.h> @@ -123,8 +125,13 @@ undup_safer_noinherit (int tempfd, int origfd) - mingw programs that have a global variable 'int _CRT_glob = 0;', - Cygwin programs, when invoked from a Cygwin program. */ -#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037*?" -#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#ifndef __KLIBC__ +# define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037*?" +# define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#else +# define SHELL_SPECIAL_CHARS "" +# define SHELL_SPACE_CHARS "" +#endif static char ** prepare_spawn (char **argv) { diff --git a/contrib/tools/m4/lib/wait-process.c b/contrib/tools/m4/lib/wait-process.c index 17a2430f91..d081385eee 100644 --- a/contrib/tools/m4/lib/wait-process.c +++ b/contrib/tools/m4/lib/wait-process.c @@ -1,5 +1,5 @@ /* Waiting for a subprocess to finish. - Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/wait-process.h b/contrib/tools/m4/lib/wait-process.h index 6d8f0d2b94..50dbb895d0 100644 --- a/contrib/tools/m4/lib/wait-process.h +++ b/contrib/tools/m4/lib/wait-process.h @@ -1,5 +1,5 @@ /* Waiting for a subprocess to finish. - Copyright (C) 2001-2003, 2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2008-2016 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/waitpid.c b/contrib/tools/m4/lib/waitpid.c index d28a70b3ea..162ade87d4 100644 --- a/contrib/tools/m4/lib/waitpid.c +++ b/contrib/tools/m4/lib/waitpid.c @@ -1,5 +1,5 @@ /* Wait for process state change. - Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-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 diff --git a/contrib/tools/m4/lib/xalloc-die.c b/contrib/tools/m4/lib/xalloc-die.c index daa403b9c8..4c7994bf1e 100644 --- a/contrib/tools/m4/lib/xalloc-die.c +++ b/contrib/tools/m4/lib/xalloc-die.c @@ -1,6 +1,6 @@ /* Report a memory allocation failure and exit. - Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2013 Free Software + Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/xalloc-oversized.h b/contrib/tools/m4/lib/xalloc-oversized.h index a971c78ad3..503bb37801 100644 --- a/contrib/tools/m4/lib/xalloc-oversized.h +++ b/contrib/tools/m4/lib/xalloc-oversized.h @@ -1,6 +1,6 @@ /* xalloc-oversized.h -- memory allocation size checking - Copyright (C) 1990-2000, 2003-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 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 @@ -16,23 +16,53 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef XALLOC_OVERSIZED_H_ -# define XALLOC_OVERSIZED_H_ +#define XALLOC_OVERSIZED_H_ -# include <stddef.h> +#include <stddef.h> +#include <stdint.h> -/* Return 1 if an array of N objects, each of size S, cannot exist due - to size arithmetic overflow. S must be positive and N must be - nonnegative. This is a macro, not a function, so that it - works correctly even when SIZE_MAX < N. +/* Default for (non-Clang) compilers that lack __has_builtin. */ +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif +/* True if N * S would overflow in a size_t calculation, + or would generate a value larger than PTRDIFF_MAX. + This expands to a constant expression if N and S are both constants. By gnulib convention, SIZE_MAX represents overflow in size - calculations, so the conservative dividend to use here is - SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. - However, malloc (SIZE_MAX) fails on all known hosts where - sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for - exactly-SIZE_MAX allocations on such hosts; this avoids a test and - branch when S is known to be 1. */ + calculations, so the conservative size_t-based dividend to use here + is SIZE_MAX - 1. */ +#define __xalloc_oversized(n, s) \ + ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n)) + +#if PTRDIFF_MAX < SIZE_MAX +typedef ptrdiff_t __xalloc_count_type; +#else +typedef size_t __xalloc_count_type; +#endif + +/* Return 1 if an array of N objects, each of size S, cannot exist + reliably due to size or ptrdiff_t arithmetic overflow. S must be + positive and N must be nonnegative. This is a macro, not a + function, so that it works correctly even when SIZE_MAX < N. */ + +#if 7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p) # define xalloc_oversized(n, s) \ - ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) + __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) +#elif ((5 <= __GNUC__ \ + || (__has_builtin (__builtin_mul_overflow) \ + && __has_builtin (__builtin_constant_p))) \ + && !__STRICT_ANSI__) +# define xalloc_oversized(n, s) \ + (__builtin_constant_p (n) && __builtin_constant_p (s) \ + ? __xalloc_oversized (n, s) \ + : ({ __xalloc_count_type __xalloc_count; \ + __builtin_mul_overflow (n, s, &__xalloc_count); })) + +/* Other compilers use integer division; this may be slower but is + more portable. */ +#else +# define xalloc_oversized(n, s) __xalloc_oversized (n, s) +#endif #endif /* !XALLOC_OVERSIZED_H_ */ diff --git a/contrib/tools/m4/lib/xalloc.h b/contrib/tools/m4/lib/xalloc.h index 6c9b53bf6f..3aad4e3110 100644 --- a/contrib/tools/m4/lib/xalloc.h +++ b/contrib/tools/m4/lib/xalloc.h @@ -1,6 +1,6 @@ /* xalloc.h -- malloc with out-of-memory checking - Copyright (C) 1990-2000, 2003-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 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 @@ -19,6 +19,7 @@ #define XALLOC_H_ #include <stddef.h> +#include <stdint.h> #include "xalloc-oversized.h" @@ -41,7 +42,8 @@ extern "C" { # define _GL_ATTRIBUTE_MALLOC #endif -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if ! defined __clang__ && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) #else # define _GL_ATTRIBUTE_ALLOC_SIZE(args) @@ -64,7 +66,7 @@ void *xrealloc (void *p, size_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2)); void *x2realloc (void *p, size_t *pn); void *xmemdup (void const *p, size_t s) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((2)); + _GL_ATTRIBUTE_ALLOC_SIZE ((2)); char *xstrdup (char const *str) _GL_ATTRIBUTE_MALLOC; @@ -122,10 +124,9 @@ xnrealloc (void *p, size_t n, size_t s) /* If P is null, allocate a block of at least *PN such objects; otherwise, reallocate P so that it contains more than *PN objects - each of S bytes. *PN must be nonzero unless P is null, and S must - be nonzero. Set *PN to the new number of objects, and return the - pointer to the new block. *PN is never set to zero, and the - returned pointer is never null. + each of S bytes. S must be nonzero. Set *PN to the new number of + objects, and return the pointer to the new block. *PN is never set + to zero, and the returned pointer is never null. Repeated reallocations are guaranteed to make progress, either by allocating an initial block with a nonzero size, or by allocating a @@ -196,13 +197,14 @@ x2nrealloc (void *p, size_t *pn, size_t s) } else { - /* Set N = ceil (1.5 * N) so that progress is made if N == 1. - Check for overflow, so that N * S stays in size_t range. - The check is slightly conservative, but an exact check isn't - worth the trouble. */ - if ((size_t) -1 / 3 * 2 / s <= n) + /* Set N = floor (1.5 * N) + 1 so that progress is made even if N == 0. + Check for overflow, so that N * S stays in both ptrdiff_t and + size_t range. The check may be slightly conservative, but an + exact check isn't worth the trouble. */ + if ((PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX) / 3 * 2 / s + <= n) xalloc_die (); - n += (n + 1) / 2; + n += n / 2 + 1; } *pn = n; @@ -259,5 +261,6 @@ xmemdup (T const *p, size_t s) #endif +_GL_INLINE_HEADER_END #endif /* !XALLOC_H_ */ diff --git a/contrib/tools/m4/lib/xasprintf.c b/contrib/tools/m4/lib/xasprintf.c index 1808b70182..e9e83ef9b0 100644 --- a/contrib/tools/m4/lib/xasprintf.c +++ b/contrib/tools/m4/lib/xasprintf.c @@ -1,5 +1,5 @@ /* vasprintf and asprintf with out-of-memory checking. - Copyright (C) 1999, 2002-2004, 2006, 2009-2013 Free Software Foundation, + Copyright (C) 1999, 2002-2004, 2006, 2009-2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/xmalloc.c b/contrib/tools/m4/lib/xmalloc.c index 57e34b7cdb..7d9c077729 100644 --- a/contrib/tools/m4/lib/xmalloc.c +++ b/contrib/tools/m4/lib/xmalloc.c @@ -1,6 +1,6 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990-2000, 2002-2006, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2002-2006, 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 @@ -93,11 +93,11 @@ void * xcalloc (size_t n, size_t s) { void *p; - /* Test for overflow, since some calloc implementations don't have - proper overflow checks. But omit overflow and size-zero tests if - HAVE_GNU_CALLOC, since GNU calloc catches overflow and never - returns NULL if successful. */ - if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s)) + /* Test for overflow, since objects with size greater than + PTRDIFF_MAX cause pointer subtraction to go awry. Omit size-zero + tests if HAVE_GNU_CALLOC, since GNU calloc never returns NULL if + successful. */ + if (xalloc_oversized (n, s) || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0))) xalloc_die (); return p; diff --git a/contrib/tools/m4/lib/xmalloca.c b/contrib/tools/m4/lib/xmalloca.c index 50ee4807fb..bcbed77f58 100644 --- a/contrib/tools/m4/lib/xmalloca.c +++ b/contrib/tools/m4/lib/xmalloca.c @@ -1,5 +1,5 @@ /* Safe automatic memory allocation with out of memory checking. - Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/xmalloca.h b/contrib/tools/m4/lib/xmalloca.h index 2f7567d498..f90fa9f72a 100644 --- a/contrib/tools/m4/lib/xmalloca.h +++ b/contrib/tools/m4/lib/xmalloca.h @@ -1,5 +1,5 @@ /* Safe automatic memory allocation with out of memory checking. - Copyright (C) 2003, 2005, 2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 2005, 2007, 2009-2016 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify diff --git a/contrib/tools/m4/lib/xprintf.c b/contrib/tools/m4/lib/xprintf.c index e24b4f1875..eed2269ef3 100644 --- a/contrib/tools/m4/lib/xprintf.c +++ b/contrib/tools/m4/lib/xprintf.c @@ -1,5 +1,5 @@ /* printf wrappers that fail immediately for non-file-related errors - Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/xprintf.h b/contrib/tools/m4/lib/xprintf.h index 62986a8cee..31ae6f9272 100644 --- a/contrib/tools/m4/lib/xprintf.h +++ b/contrib/tools/m4/lib/xprintf.h @@ -1,5 +1,5 @@ /* printf wrappers that fail immediately for non-file-related errors - Copyright (C) 2007-2013 Free Software Foundation, Inc. + 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 diff --git a/contrib/tools/m4/lib/xsize.h b/contrib/tools/m4/lib/xsize.h index 5675593f54..202a87e086 100644 --- a/contrib/tools/m4/lib/xsize.h +++ b/contrib/tools/m4/lib/xsize.h @@ -1,6 +1,6 @@ /* xsize.h -- Checked size_t computations. - Copyright (C) 2003, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 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 diff --git a/contrib/tools/m4/lib/xstrndup.c b/contrib/tools/m4/lib/xstrndup.c index eae92d039d..3d605ef88b 100644 --- a/contrib/tools/m4/lib/xstrndup.c +++ b/contrib/tools/m4/lib/xstrndup.c @@ -1,6 +1,6 @@ /* Duplicate a bounded initial segment of a string, with out-of-memory checking. - Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 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 diff --git a/contrib/tools/m4/lib/xstrndup.h b/contrib/tools/m4/lib/xstrndup.h index 59673b0489..0d3021c885 100644 --- a/contrib/tools/m4/lib/xstrndup.h +++ b/contrib/tools/m4/lib/xstrndup.h @@ -1,6 +1,6 @@ /* Duplicate a bounded initial segment of a string, with out-of-memory checking. - Copyright (C) 2003, 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2003, 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 diff --git a/contrib/tools/m4/lib/xvasprintf.c b/contrib/tools/m4/lib/xvasprintf.c index 702b5e6b1a..9deaad0f43 100644 --- a/contrib/tools/m4/lib/xvasprintf.c +++ b/contrib/tools/m4/lib/xvasprintf.c @@ -1,5 +1,5 @@ /* vasprintf and asprintf with out-of-memory checking. - Copyright (C) 1999, 2002-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2004, 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 diff --git a/contrib/tools/m4/lib/xvasprintf.h b/contrib/tools/m4/lib/xvasprintf.h index 1208fa193c..d62d7b7313 100644 --- a/contrib/tools/m4/lib/xvasprintf.h +++ b/contrib/tools/m4/lib/xvasprintf.h @@ -1,5 +1,5 @@ /* vasprintf and asprintf with out-of-memory checking. - Copyright (C) 2002-2004, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 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 diff --git a/contrib/tools/m4/lib/ya.make b/contrib/tools/m4/lib/ya.make index 08270b4b33..6a13ee0518 100644 --- a/contrib/tools/m4/lib/ya.make +++ b/contrib/tools/m4/lib/ya.make @@ -1,45 +1,27 @@ -LIBRARY() +# Generated by devtools/yamaker. -VERSION(1.4.17) +LIBRARY() LICENSE( - BSD-3-Clause AND GPL-3.0-or-later AND LGPL-2.0-or-later ) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -IF (NOT MUSL) - NO_RUNTIME() -ENDIF() +VERSION(1.4.18) -NO_COMPILER_WARNINGS() +PEERDIR( + contrib/libs/libc_compat +) ADDINCL( - GLOBAL contrib/tools/m4/lib + contrib/tools/m4/lib ) -IF (OS_WINDOWS) - ADDINCL( - GLOBAL contrib/tools/m4/lib/platform/win64 - ) -ENDIF() - -IF (OS_DARWIN) - CFLAGS( - -D_XOPEN_SOURCE=600 - ) -ENDIF() +NO_COMPILER_WARNINGS() -IF (NOT OS_WINDOWS) - CFLAGS( - GLOBAL -Dregcomp=gnu_regcomp - GLOBAL -Dregerror=gnu_regerror - GLOBAL -Dregfree=gnu_regfree - GLOBAL -Dregexec=gnu_regexec - ) -ENDIF() +NO_RUNTIME() SRCS( asnprintf.c @@ -53,15 +35,12 @@ SRCS( clean-temp.c cloexec.c close-stream.c - close.c closein.c closeout.c dirname-lgpl.c dirname.c dup-safer-flag.c dup-safer.c - dup2.c - error.c execute.c exitfail.c fatal-signal.c @@ -70,34 +49,35 @@ SRCS( fd-hook.c fd-safer-flag.c fd-safer.c - fflush.c filenamecat-lgpl.c filenamecat.c fopen-safer.c - fstat.c - getdtablesize.c + getprogname.c gl_avltree_oset.c gl_linkedhash_list.c gl_list.c gl_oset.c gl_xlist.c gl_xoset.c + glthread/lock.c + glthread/threadlib.c + glthread/tls.c + hard-locale.c localcharset.c malloca.c + math.c + mbrtowc.c memchr2.c mkstemp-safer.c - nl_langinfo.c pipe-safer.c pipe2-safer.c + pipe2.c printf-args.c printf-frexp.c printf-frexpl.c printf-parse.c progname.c quotearg.c - raise.c - regex.c - secure_getenv.c sig-handler.c spawn-pipe.c stripslash.c @@ -105,6 +85,7 @@ SRCS( tmpdir.c unistd.c vasnprintf.c + vasprintf.c verror.c version-etc-fsf.c version-etc.c @@ -120,47 +101,52 @@ SRCS( xvasprintf.c ) -IF (NOT MUSL) +IF (MUSL) SRCS( - freadahead.c + error.c + obstack.c + regex.c ) -ENDIF() - -IF (NOT OS_LINUX) +ELSEIF (OS_DARWIN) SRCS( - pipe2.c + error.c + fpending.c + obstack.c + regex.c + secure_getenv.c + ) +ELSEIF (OS_WINDOWS) + ADDINCL( + GLOBAL contrib/tools/m4/lib/platform/win64 ) -ENDIF() - -IF (OS_WINDOWS) SRCS( - vasprintf.c - strsignal.c - mkdtemp.c + close.c + dup2.c + error.c + fpending.c fseeko.c + getdtablesize.c getopt.c getopt1.c gettimeofday.c localeconv.c + mkdtemp.c msvc-inval.c msvc-nothrow.c + nl_langinfo.c + obstack.c + raise.c + regex.c sigaction.c sigprocmask.c + strsignal.c waitpid.c ) ENDIF() -IF (NOT OS_LINUX OR MUSL) - SRCS( - obstack.c - ) -ENDIF() - -IF (OS_CYGWIN OR OS_LINUX) - #not need it -ELSE() +IF (NOT MUSL) SRCS( - fpending.c + freadahead.c ) ENDIF() diff --git a/contrib/tools/m4/patches/config.patch b/contrib/tools/m4/patches/config.patch new file mode 100644 index 0000000000..343cbda917 --- /dev/null +++ b/contrib/tools/m4/patches/config.patch @@ -0,0 +1,8 @@ +--- contrib/tools/m4/lib/config-linux.h (index) ++++ contrib/tools/m4/lib/config-linux.h (working tree) +@@ -2902,2 +2902,5 @@ + /* Define as a macro for copying va_list variables. */ + /* #undef va_copy */ ++#undef HAVE_SYS_SINGLE_THREADED_H ++#define __attribute_maybe_unused__ ++#define __attribute_nonnull__(...) diff --git a/contrib/tools/m4/patches/darwin-extern-environ.patch b/contrib/tools/m4/patches/darwin-extern-environ.patch new file mode 100644 index 0000000000..a7ffbaec01 --- /dev/null +++ b/contrib/tools/m4/patches/darwin-extern-environ.patch @@ -0,0 +1,25 @@ +--- a/lib/execute.c (index) ++++ b/lib/execute.c (working tree) +@@ -48,6 +48,9 @@ + + #endif + ++#if defined(__FreeBSD__) || defined(__MACH__) ++ extern char** environ; ++#endif + + #if defined EINTR && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) + +--- a/lib/spawn-pipe.c (index) ++++ b/lib/spawn-pipe.c (working tree) +@@ -53,7 +53,10 @@ + # include <spawn.h> + + #endif + ++#if defined(__FreeBSD__) || defined(__MACH__) ++ extern char** environ; ++#endif + + #ifdef EINTR + diff --git a/contrib/tools/m4/patches/darwin-segfaults.patch b/contrib/tools/m4/patches/darwin-segfaults.patch new file mode 100644 index 0000000000..cd88b7e72e --- /dev/null +++ b/contrib/tools/m4/patches/darwin-segfaults.patch @@ -0,0 +1,11 @@ +--- a/lib/vasnprintf.c (ef06a7dccff68bd15f669606131c541d158d4b1a) ++++ b/lib/vasnprintf.c (1efd2cc9274f1f5a222e759093d27c8d38825028) +@@ -4870,7 +4870,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, + #endif + *fbp = dp->conversion; + #if USE_SNPRINTF +-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) ++# if !defined(__APPLE__) && !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) + fbp[1] = '%'; + fbp[2] = 'n'; + fbp[3] = '\0'; diff --git a/contrib/tools/m4/patches/disable-includes.patch b/contrib/tools/m4/patches/disable-includes.patch new file mode 100644 index 0000000000..3650e4adca --- /dev/null +++ b/contrib/tools/m4/patches/disable-includes.patch @@ -0,0 +1,13 @@ +--- a/lib/obstack.c (index) ++++ b/lib/obstack.c (working tree) +@@ -51,10 +51,6 @@ + /* If GCC, or if an oddball (testing?) host that #defines __alignof__, + use the already-supplied __alignof__. Otherwise, this must be Gnulib + (as glibc assumes GCC); defer to Gnulib's alignof_type. */ +-# if !defined __GNUC__ && !defined __alignof__ +-# include <alignof.h> +-# define __alignof__(type) alignof_type (type) +-# endif + # include <stdlib.h> + # include <stdint.h> + diff --git a/contrib/tools/m4/patches/langinfo-windows.patch b/contrib/tools/m4/patches/langinfo-windows.patch new file mode 100644 index 0000000000..737fa39d4d --- /dev/null +++ b/contrib/tools/m4/patches/langinfo-windows.patch @@ -0,0 +1,27 @@ +--- contrib/tools/m4/lib/nl_langinfo.c (index) ++++ contrib/tools/m4/lib/nl_langinfo.c (working tree) +@@ -171,8 +171,6 @@ nl_langinfo (nl_item item) + return localeconv () ->decimal_point; + case THOUSEP: + return localeconv () ->thousands_sep; +- case GROUPING: +- return localeconv () ->grouping; + /* nl_langinfo items of the LC_TIME category. + TODO: Really use the locale. */ + case D_T_FMT: +@@ -279,6 +277,7 @@ nl_langinfo (nl_item item) + /* nl_langinfo items of the LC_MONETARY category. */ + case CRNCYSTR: + return localeconv () ->currency_symbol; ++#if 0 + case INT_CURR_SYMBOL: + return localeconv () ->int_curr_symbol; + case MON_DECIMAL_POINT: +@@ -307,6 +306,7 @@ nl_langinfo (nl_item item) + return & localeconv () ->p_sign_posn; + case N_SIGN_POSN: + return & localeconv () ->n_sign_posn; ++#endif + /* nl_langinfo items of the LC_MESSAGES category + TODO: Really use the locale. */ + case YESEXPR: diff --git a/contrib/tools/m4/patches/mkstemp-windows.patch b/contrib/tools/m4/patches/mkstemp-windows.patch new file mode 100644 index 0000000000..573676c184 --- /dev/null +++ b/contrib/tools/m4/patches/mkstemp-windows.patch @@ -0,0 +1,14 @@ +--- contrib/tools/m4/lib/mkstemp-safer.c (73a968936fc7a168adec50944afcde54a6274f7b) ++++ contrib/tools/m4/lib/mkstemp-safer.c (index) +@@ -21,9 +21,10 @@ + + #include "stdlib-safer.h" + +-#include <stdlib.h> ++#include "stdlib--.h" + #include "unistd-safer.h" + ++ + /* Like mkstemp, but do not return STDIN_FILENO, STDOUT_FILENO, or + STDERR_FILENO. */ + diff --git a/contrib/tools/m4/src/Makefile.am b/contrib/tools/m4/src/Makefile.am deleted file mode 100644 index 29e05c0def..0000000000 --- a/contrib/tools/m4/src/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -## Makefile.am - template for generating Makefile via Automake -## -## Copyright (C) 2006-2013 Free Software Foundation, Inc. -## -## This file is part of GNU M4. -## -## GNU M4 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. -## -## GNU M4 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 written by Eric Blake <ebb9@byu.net> - -AUTOMAKE_OPTIONS = nostdinc -AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib -AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) -bin_PROGRAMS = m4 -noinst_HEADERS = m4.h -m4_SOURCES = m4.c builtin.c debug.c eval.c format.c freeze.c input.c \ -macro.c output.c path.c symtab.c -m4_LDADD = ../lib/libm4.a $(LIBM4_LIBDEPS) $(LIBCSTACK) $(LIBTHREAD) diff --git a/contrib/tools/m4/src/builtin.c b/contrib/tools/m4/src/builtin.c index b3700c3219..302a86a495 100644 --- a/contrib/tools/m4/src/builtin.c +++ b/contrib/tools/m4/src/builtin.c @@ -1,6 +1,6 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2000, 2004, 2006-2013 Free Software + Copyright (C) 1989-1994, 2000, 2004, 2006-2014, 2016 Free Software Foundation, Inc. This file is part of GNU M4. @@ -1019,7 +1019,13 @@ m4_esyscmd (struct obstack *obs, int argc, token_data **argv) sysval = 127; return; } +#if OS2 + /* On OS/2 kLIBC, fdopen() creates a stream in a mode of a file descriptor. + So include "t" to open a stream in a text mode explicitly on OS/2. */ + pin = fdopen (fd, "rt"); +#else pin = fdopen (fd, "r"); +#endif if (pin == NULL) { M4ERROR ((warning_status, errno, "cannot run command `%s'", cmd)); @@ -1420,7 +1426,7 @@ mkstemp_helper (struct obstack *obs, const char *me, const char *pattern, { close (fd); /* Remove NUL, then finish quote. */ - obstack_blank (obs, -1); + obstack_blank_fast (obs, -1); obstack_grow (obs, rquote.string, rquote.length); } } diff --git a/contrib/tools/m4/src/debug.c b/contrib/tools/m4/src/debug.c index c13a205b89..70a5b806f2 100644 --- a/contrib/tools/m4/src/debug.c +++ b/contrib/tools/m4/src/debug.c @@ -1,7 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1991-1994, 2004, 2006-2007, 2009-2013 Free Software - Foundation, Inc. + Copyright (C) 1991-1994, 2004, 2006-2007, 2009-2014, 2016 Free + Software Foundation, Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/eval.c b/contrib/tools/m4/src/eval.c index 8b4b05afb1..64b389a810 100644 --- a/contrib/tools/m4/src/eval.c +++ b/contrib/tools/m4/src/eval.c @@ -1,6 +1,6 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2006-2007, 2009-2013 Free Software + Copyright (C) 1989-1994, 2006-2007, 2009-2014, 2016 Free Software Foundation, Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/format.c b/contrib/tools/m4/src/format.c index fd8830ed7c..608ac72e5d 100644 --- a/contrib/tools/m4/src/format.c +++ b/contrib/tools/m4/src/format.c @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2006-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/freeze.c b/contrib/tools/m4/src/freeze.c index edc0568b96..fd7623d1a4 100644 --- a/contrib/tools/m4/src/freeze.c +++ b/contrib/tools/m4/src/freeze.c @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2006-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2006-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/input.c b/contrib/tools/m4/src/input.c index 579faddf4f..74891a0540 100644 --- a/contrib/tools/m4/src/input.c +++ b/contrib/tools/m4/src/input.c @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/m4.c b/contrib/tools/m4/src/m4.c index 2c03154471..79946b90a3 100644 --- a/contrib/tools/m4/src/m4.c +++ b/contrib/tools/m4/src/m4.c @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. @@ -307,7 +308,9 @@ static const struct option long_options[] = {"trace", required_argument, NULL, 't'}, {"traditional", no_argument, NULL, 'G'}, {"undefine", required_argument, NULL, 'U'}, +#ifdef ENABLE_CHANGEWORD {"word-regexp", required_argument, NULL, 'W'}, +#endif {"debugfile", optional_argument, NULL, DEBUGFILE_OPTION}, {"diversions", required_argument, NULL, DIVERSIONS_OPTION}, @@ -364,9 +367,7 @@ process_file (const char *name) int main (int argc, char *const *argv) { -#if !defined(_WIN32) && !defined(_WIN64) struct sigaction act; -#endif macro_definition *head; /* head of deferred argument list */ macro_definition *tail; macro_definition *defn; @@ -402,9 +403,7 @@ main (int argc, char *const *argv) signal_message[SIGFPE] = xstrdup (strsignal (SIGFPE)); if (SIGBUS != SIGILL && SIGBUS != SIGSEGV) signal_message[SIGBUS] = xstrdup (strsignal (SIGBUS)); -#if !defined(_WIN32) && !defined(_WIN64) - // No such signals on Windows - sigemptyset(&act.sa_mask); + sigemptyset (&act.sa_mask); /* One-shot - if we fault while handling a fault, we want to revert to default signal behavior. */ act.sa_flags = SA_NODEFER | SA_RESETHAND; @@ -414,7 +413,6 @@ main (int argc, char *const *argv) sigaction (SIGILL, &act, NULL); sigaction (SIGFPE, &act, NULL); sigaction (SIGBUS, &act, NULL); -#endif if (c_stack_action (fault_handler) == 0) nesting_limit = 0; diff --git a/contrib/tools/m4/src/m4.h b/contrib/tools/m4/src/m4.h index 96e549eb76..9a13257fbc 100644 --- a/contrib/tools/m4/src/m4.h +++ b/contrib/tools/m4/src/m4.h @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/macro.c b/contrib/tools/m4/src/macro.c index 0e7624372e..81218e78bc 100644 --- a/contrib/tools/m4/src/macro.c +++ b/contrib/tools/m4/src/macro.c @@ -1,6 +1,6 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2006-2007, 2009-2013 Free Software + Copyright (C) 1989-1994, 2006-2007, 2009-2014, 2016 Free Software Foundation, Inc. This file is part of GNU M4. @@ -46,8 +46,8 @@ static struct obstack argc_stack; /* The shared stack of pointers to collected arguments for macro calls. This object is never finished; we exploit the fact that - obstack_blank is documented to take a negative size to reduce the - size again. */ + obstack_blank_fast is documented to take a negative size to reduce + the size again. */ static struct obstack argv_stack; /*----------------------------------------------------------------------. @@ -387,5 +387,5 @@ expand_macro (symbol *sym) obstack_free (&argc_stack, argv[0]); else obstack_free (&arguments, NULL); - obstack_blank (&argv_stack, -argc * sizeof (token_data *)); + obstack_blank_fast (&argv_stack, -argc * sizeof (token_data *)); } diff --git a/contrib/tools/m4/src/output.c b/contrib/tools/m4/src/output.c index c378afebdb..9c916d9233 100644 --- a/contrib/tools/m4/src/output.c +++ b/contrib/tools/m4/src/output.c @@ -1,6 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2004-2013 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 2004-2014, 2016 Free Software Foundation, + Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/src/path.c b/contrib/tools/m4/src/path.c index 278200b782..8b81e29f2c 100644 --- a/contrib/tools/m4/src/path.c +++ b/contrib/tools/m4/src/path.c @@ -1,7 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1993, 2004, 2006-2013 Free Software Foundation, - Inc. + Copyright (C) 1989-1993, 2004, 2006-2014, 2016 Free Software + Foundation, Inc. This file is part of GNU M4. @@ -23,6 +23,7 @@ and "sinclude". */ #include "m4.h" +#include "sys/stat.h" struct includes { diff --git a/contrib/tools/m4/src/symtab.c b/contrib/tools/m4/src/symtab.c index fe37bee694..26a722f2af 100644 --- a/contrib/tools/m4/src/symtab.c +++ b/contrib/tools/m4/src/symtab.c @@ -1,7 +1,7 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989-1994, 2003, 2006-2013 Free Software Foundation, - Inc. + Copyright (C) 1989-1994, 2003, 2006-2014, 2016 Free Software + Foundation, Inc. This file is part of GNU M4. diff --git a/contrib/tools/m4/ya.make b/contrib/tools/m4/ya.make index 881de5781e..e8e1c4ed4a 100644 --- a/contrib/tools/m4/ya.make +++ b/contrib/tools/m4/ya.make @@ -1,22 +1,31 @@ -PROGRAM() +# Generated by devtools/yamaker from nixpkgs 21.05. -LICENSE(GPL-3.0-or-later) +PROGRAM(m4) -VERSION(1.4.17) - -ORIGINAL_SOURCE(https://github.com/tar-mirror/gnu-m4/archive/refs/tags/v1.4.17.tar.gz) +LICENSE( + FSFAP AND + GFDL-1.3-or-later AND + GPL-3.0-only AND + GPL-3.0-or-later +) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -NO_RUNTIME() +VERSION(1.4.18) + +ORIGINAL_SOURCE(mirror://gnu/m4/m4-1.4.18.tar.bz2) + +PEERDIR( + contrib/tools/m4/lib +) + +ADDINCL( + contrib/tools/m4/lib +) NO_COMPILER_WARNINGS() -IF (MUSL) - CFLAGS( - -DO_BINARY=0 - ) -ENDIF() +NO_RUNTIME() SRCS( src/builtin.c @@ -32,8 +41,8 @@ SRCS( src/symtab.c ) -PEERDIR( - contrib/tools/m4/lib -) - END() + +RECURSE( + lib +) diff --git a/library/cpp/tld/tlds-alpha-by-domain.txt b/library/cpp/tld/tlds-alpha-by-domain.txt index 055d440b6e..0e38681a50 100644 --- a/library/cpp/tld/tlds-alpha-by-domain.txt +++ b/library/cpp/tld/tlds-alpha-by-domain.txt @@ -1,4 +1,4 @@ -# Version 2024101600, Last Updated Wed Oct 16 07:07:02 2024 UTC +# Version 2024101900, Last Updated Sat Oct 19 07:07:02 2024 UTC AAA AARP ABB diff --git a/library/cpp/yt/logging/backends/stream/stream_log_manager.cpp b/library/cpp/yt/logging/backends/stream/stream_log_manager.cpp index 62269dc0c0..62fa3e91d0 100644 --- a/library/cpp/yt/logging/backends/stream/stream_log_manager.cpp +++ b/library/cpp/yt/logging/backends/stream/stream_log_manager.cpp @@ -28,10 +28,8 @@ public: anchor->Registered = true; } - virtual void UpdateAnchor(TLoggingAnchor* anchor) override - { - anchor->Enabled = true; - } + virtual void UpdateAnchor(TLoggingAnchor* /*anchor*/) override + { } virtual void Enqueue(TLogEvent&& event) override { diff --git a/library/cpp/yt/logging/logger-inl.h b/library/cpp/yt/logging/logger-inl.h index f3993a4c48..f1be10827f 100644 --- a/library/cpp/yt/logging/logger-inl.h +++ b/library/cpp/yt/logging/logger-inl.h @@ -14,11 +14,11 @@ namespace NYT::NLogging { //////////////////////////////////////////////////////////////////////////////// -inline bool TLogger::IsAnchorUpToDate(const TLoggingAnchor& position) const +inline bool TLogger::IsAnchorUpToDate(const TLoggingAnchor& anchor) const { return !Category_ || - position.CurrentVersion == Category_->ActualVersion->load(std::memory_order::relaxed); + anchor.CurrentVersion == Category_->ActualVersion->load(std::memory_order::relaxed); } template <class... TArgs> @@ -49,6 +49,17 @@ TLogger TLogger::WithStructuredTag(TStringBuf key, TType value) const return result; } +Y_FORCE_INLINE ELogLevel TLogger::GetEffectiveLoggingLevel(ELogLevel level, const TLoggingAnchor& anchor) +{ + // Check if anchor is suppressed. + if (anchor.Suppressed.load(std::memory_order::relaxed)) { + return ELogLevel::Minimum; + } + + // Compute the actual level taking anchor override into account. + return anchor.LevelOverride.load(std::memory_order::relaxed).value_or(level); +} + Y_FORCE_INLINE bool TLogger::IsLevelEnabled(ELogLevel level) const { // This is the first check which is intended to be inlined next to diff --git a/library/cpp/yt/logging/logger.h b/library/cpp/yt/logging/logger.h index 4f0ed44ab7..35aba4eb4c 100644 --- a/library/cpp/yt/logging/logger.h +++ b/library/cpp/yt/logging/logger.h @@ -47,12 +47,17 @@ struct TLoggingCategory struct TLoggingAnchor { std::atomic<bool> Registered = false; + TLoggingAnchor* NextAnchor = nullptr; + ::TSourceLocation SourceLocation = {TStringBuf{}, 0}; TString AnchorMessage; - TLoggingAnchor* NextAnchor = nullptr; std::atomic<int> CurrentVersion = 0; - std::atomic<bool> Enabled = false; + + std::atomic<bool> Suppressed = false; + + std::atomic<std::optional<ELogLevel>> LevelOverride; + static_assert(decltype(LevelOverride)::is_always_lock_free); struct TCounter { @@ -189,6 +194,9 @@ public: const TLoggingCategory* GetCategory() const; + //! Combines given #level and the override from #anchor. + static ELogLevel GetEffectiveLoggingLevel(ELogLevel level, const TLoggingAnchor& anchor); + //! Validate that level is admitted by logger's own min level //! and by category's min level. bool IsLevelEnabled(ELogLevel level) const; @@ -300,40 +308,38 @@ void LogStructuredEvent( do { \ const auto& logger__ = (logger)(); \ auto level__ = (level); \ - \ - if (!logger__.IsLevelEnabled(level__)) { \ - break; \ - } \ - \ auto location__ = __LOCATION__; \ \ ::NYT::NLogging::TLoggingAnchor* anchor__ = (anchor); \ - if (!anchor__) { \ + [[unlikely]] if (!anchor__) { \ static ::NYT::TLeakyStorage<::NYT::NLogging::TLoggingAnchor> staticAnchor__; \ anchor__ = staticAnchor__.Get(); \ } \ \ bool anchorUpToDate__ = logger__.IsAnchorUpToDate(*anchor__); \ - if (anchorUpToDate__ && !anchor__->Enabled.load(std::memory_order::relaxed)) { \ - break; \ + [[likely]] if (anchorUpToDate__) { \ + auto effectiveLevel__ = ::NYT::NLogging::TLogger::GetEffectiveLoggingLevel(level__, *anchor__); \ + if (!logger__.IsLevelEnabled(effectiveLevel__)) { \ + break; \ + } \ } \ \ auto loggingContext__ = ::NYT::NLogging::GetLoggingContext(); \ auto message__ = ::NYT::NLogging::NDetail::BuildLogMessage(loggingContext__, logger__, __VA_ARGS__); \ \ - if (!anchorUpToDate__) { \ + [[unlikely]] if (!anchorUpToDate__) { \ logger__.RegisterStaticAnchor(anchor__, location__, message__.Anchor); \ - logger__.UpdateAnchor(anchor__); \ } \ \ - if (!anchor__->Enabled.load(std::memory_order::relaxed)) { \ + auto effectiveLevel__ = ::NYT::NLogging::TLogger::GetEffectiveLoggingLevel(level__, *anchor__); \ + if (!logger__.IsLevelEnabled(effectiveLevel__)) { \ break; \ } \ \ ::NYT::NLogging::NDetail::LogEventImpl( \ loggingContext__, \ logger__, \ - level__, \ + effectiveLevel__, \ location__, \ anchor__, \ std::move(message__.MessageRef)); \ @@ -39,33 +39,33 @@ REGISTRY_ENDPOINT = os.environ.get("YA_REGISTRY_ENDPOINT", "https://devtools-reg PLATFORM_MAP = { "data": { "darwin": { - "md5": "5297384a223a0ed1c98213d34a969f78", + "md5": "a5d56883364c50cc9cfe956ea123fe29", "urls": [ - f"{REGISTRY_ENDPOINT}/7268433161" + f"{REGISTRY_ENDPOINT}/7303160249" ] }, "darwin-arm64": { - "md5": "cbc5c1d4622af0d0230795bae3e512fe", + "md5": "958f4a35e5f4aea32a2587eb5cf2fe44", "urls": [ - f"{REGISTRY_ENDPOINT}/7268432517" + f"{REGISTRY_ENDPOINT}/7303159815" ] }, "linux-aarch64": { - "md5": "b6d28021b272e40508eff84be1812bb3", + "md5": "009365bb2ee328d5e55711b995855304", "urls": [ - f"{REGISTRY_ENDPOINT}/7268431573" + f"{REGISTRY_ENDPOINT}/7303159260" ] }, "win32-clang-cl": { - "md5": "1db1f3100b6665aeed59df56c6b264df", + "md5": "a29c6a99b22e0cb2e3f8e54fc62fb5f2", "urls": [ - f"{REGISTRY_ENDPOINT}/7268433632" + f"{REGISTRY_ENDPOINT}/7303160609" ] }, "linux": { - "md5": "6f81320770fa4fc857a93845b8f1eb46", + "md5": "6331f2b92f5c3db13d9cd544a7d517eb", "urls": [ - f"{REGISTRY_ENDPOINT}/7268434247" + f"{REGISTRY_ENDPOINT}/7303160933" ] } } diff --git a/yt/cpp/mapreduce/interface/logging/yt_log.cpp b/yt/cpp/mapreduce/interface/logging/yt_log.cpp index 6b1e8ff049..4ff38d4c58 100644 --- a/yt/cpp/mapreduce/interface/logging/yt_log.cpp +++ b/yt/cpp/mapreduce/interface/logging/yt_log.cpp @@ -30,8 +30,6 @@ public: return; } - anchor->Enabled.store(true); - auto guard = Guard(Mutex_); anchor->SourceLocation = sourceLocation; anchor->AnchorMessage = anchorMessage; diff --git a/yt/yt/client/object_client/helpers.cpp b/yt/yt/client/object_client/helpers.cpp index 795c0fb34c..6fe11c337e 100644 --- a/yt/yt/client/object_client/helpers.cpp +++ b/yt/yt/client/object_client/helpers.cpp @@ -211,6 +211,7 @@ bool IsChunkOwnerType(EObjectType type) bool IsCellType(EObjectType type) { return + type == EObjectType::MasterCell || type == EObjectType::TabletCell || type == EObjectType::ChaosCell; } diff --git a/yt/yt/core/logging/config.cpp b/yt/yt/core/logging/config.cpp index 4acde166a9..4fc2823945 100644 --- a/yt/yt/core/logging/config.cpp +++ b/yt/yt/core/logging/config.cpp @@ -196,13 +196,16 @@ void TLogManagerConfig::Register(TRegistrar registrar) registrar.Parameter("shutdown_busy_timeout", &TThis::ShutdownGraceTimeout) .Default(TDuration::Zero()); - registrar.Parameter("writers", &TThis::Writers); registrar.Parameter("rules", &TThis::Rules); - registrar.Parameter("suppressed_messages", &TThis::SuppressedMessages) - .Default(); + registrar.Parameter("writers", &TThis::Writers); registrar.Parameter("category_rate_limits", &TThis::CategoryRateLimits) .Default(); + registrar.Parameter("suppressed_messages", &TThis::SuppressedMessages) + .Optional(); + registrar.Parameter("message_level_overrides", &TThis::MessageLevelOverrides) + .Optional(); + registrar.Parameter("request_suppression_timeout", &TThis::RequestSuppressionTimeout) .Alias("trace_suppression_timeout") .Default(TDuration::Zero()); @@ -235,8 +238,12 @@ TLogManagerConfigPtr TLogManagerConfig::ApplyDynamic(const TLogManagerDynamicCon mergedConfig->ShutdownGraceTimeout = ShutdownGraceTimeout; mergedConfig->Rules = CloneYsonStructs(dynamicConfig->Rules.value_or(Rules)); mergedConfig->Writers = CloneYsonStructs(Writers); - mergedConfig->SuppressedMessages = dynamicConfig->SuppressedMessages.value_or(SuppressedMessages); mergedConfig->CategoryRateLimits = dynamicConfig->CategoryRateLimits.value_or(CategoryRateLimits); + mergedConfig->SuppressedMessages = dynamicConfig->SuppressedMessages.value_or(SuppressedMessages); + mergedConfig->MessageLevelOverrides = MessageLevelOverrides; + for (const auto& [message, level] : dynamicConfig->MessageLevelOverrides) { + mergedConfig->MessageLevelOverrides[message] = level; + } mergedConfig->RequestSuppressionTimeout = dynamicConfig->RequestSuppressionTimeout.value_or(RequestSuppressionTimeout); mergedConfig->EnableAnchorProfiling = dynamicConfig->EnableAnchorProfiling.value_or(EnableAnchorProfiling); mergedConfig->MinLoggedMessageRateToProfile = dynamicConfig->MinLoggedMessageRateToProfile.value_or(MinLoggedMessageRateToProfile); @@ -459,9 +466,12 @@ void TLogManagerDynamicConfig::Register(TRegistrar registrar) registrar.Parameter("rules", &TThis::Rules) .Optional(); + registrar.Parameter("category_rate_limits", &TThis::CategoryRateLimits) + .Optional(); + registrar.Parameter("suppressed_messages", &TThis::SuppressedMessages) .Optional(); - registrar.Parameter("category_rate_limits", &TThis::CategoryRateLimits) + registrar.Parameter("message_level_overrides", &TThis::MessageLevelOverrides) .Optional(); registrar.Parameter("request_suppression_timeout", &TThis::RequestSuppressionTimeout) diff --git a/yt/yt/core/logging/config.h b/yt/yt/core/logging/config.h index 6e5f2b0f9f..f025e58f11 100644 --- a/yt/yt/core/logging/config.h +++ b/yt/yt/core/logging/config.h @@ -160,9 +160,13 @@ public: std::vector<TRuleConfigPtr> Rules; THashMap<TString, NYTree::IMapNodePtr> Writers; - std::vector<TString> SuppressedMessages; THashMap<TString, i64> CategoryRateLimits; + //! Messages with these prefixes will not be logged regardless of the configured levels. + std::vector<TString> SuppressedMessages; + //! Overrides levels of messages with a matching prefix . + THashMap<TString, ELogLevel> MessageLevelOverrides; + TDuration RequestSuppressionTimeout; bool EnableAnchorProfiling; @@ -215,9 +219,11 @@ public: std::optional<int> LowBacklogWatermark; std::optional<std::vector<TRuleConfigPtr>> Rules; - std::optional<std::vector<TString>> SuppressedMessages; std::optional<THashMap<TString, i64>> CategoryRateLimits; + std::optional<std::vector<TString>> SuppressedMessages; + THashMap<TString, ELogLevel> MessageLevelOverrides; + std::optional<TDuration> RequestSuppressionTimeout; std::optional<bool> EnableAnchorProfiling; diff --git a/yt/yt/core/logging/log_manager.cpp b/yt/yt/core/logging/log_manager.cpp index 1a6d51cb02..d7e15992be 100644 --- a/yt/yt/core/logging/log_manager.cpp +++ b/yt/yt/core/logging/log_manager.cpp @@ -511,29 +511,24 @@ public: { auto guard = Guard(SpinLock_); auto config = Config_.Acquire(); - - bool enabled = true; - for (const auto& prefix : config->SuppressedMessages) { - if (anchor->AnchorMessage.StartsWith(prefix)) { - enabled = false; - break; - } - } - - anchor->Enabled.store(enabled, std::memory_order::relaxed); - anchor->CurrentVersion.store(GetVersion(), std::memory_order::relaxed); + DoUpdateAnchor(config, anchor); } - void RegisterStaticAnchor(TLoggingAnchor* anchor, ::TSourceLocation sourceLocation, TStringBuf message) + void RegisterStaticAnchor( + TLoggingAnchor* anchor, + ::TSourceLocation sourceLocation, + TStringBuf message) { if (anchor->Registered.exchange(true)) { return; } auto guard = Guard(SpinLock_); + auto config = Config_.Acquire(); anchor->SourceLocation = sourceLocation; anchor->AnchorMessage = BuildAnchorMessage(sourceLocation, message); DoRegisterAnchor(anchor); + DoUpdateAnchor(config, anchor); } TLoggingAnchor* RegisterDynamicAnchor(TString anchorMessage) @@ -1356,9 +1351,7 @@ private: return eventsWritten; } - void DoUpdateCategory( - const TLogManagerConfigPtr& config, - TLoggingCategory* category) + void DoUpdateCategory(const TLogManagerConfigPtr& config, TLoggingCategory* category) { VERIFY_THREAD_AFFINITY_ANY(); @@ -1384,6 +1377,33 @@ private: FirstAnchor_.store(anchor); } + void DoUpdateAnchor(const TLogManagerConfigPtr& config, TLoggingAnchor* anchor) + { + VERIFY_SPINLOCK_AFFINITY(SpinLock_); + + auto isPrefixOf = [] (const TString& message, const std::vector<TString>& prefixes) { + for (const auto& prefix : prefixes) { + if (message.StartsWith(prefix)) { + return true; + } + } + return false; + }; + + auto findByPrefix = [] (const TString& message, const THashMap<TString, ELogLevel>& levelOverrides) -> std::optional<ELogLevel> { + for (const auto& [prefix, level] : levelOverrides) { + if (message.StartsWith(prefix)) { + return level; + } + } + return std::nullopt; + }; + + anchor->Suppressed.store(isPrefixOf(anchor->AnchorMessage, config->SuppressedMessages)); + anchor->LevelOverride.store(findByPrefix(anchor->AnchorMessage, config->MessageLevelOverrides)); + anchor->CurrentVersion.store(GetVersion()); + } + static TString BuildAnchorMessage(::TSourceLocation sourceLocation, TStringBuf message) { if (message) { diff --git a/yt/yt/core/logging/unittests/logging_ut.cpp b/yt/yt/core/logging/unittests/logging_ut.cpp index c967675ae1..1abc7fe271 100644 --- a/yt/yt/core/logging/unittests/logging_ut.cpp +++ b/yt/yt/core/logging/unittests/logging_ut.cpp @@ -224,14 +224,14 @@ TEST_F(TLoggingTest, ReloadOnSighup) Configure(Format(R"({ rules = [ { - "min_level" = "info"; - "writers" = [ "info" ]; + min_level = info; + writers = [ info ]; }; ]; - "writers" = { - "info" = { - "file_name" = "%v"; - "type" = "file"; + writers = { + info = { + file_name = "%v"; + type = "file"; }; }; })", logFile.Name())); @@ -272,14 +272,14 @@ TEST_F(TLoggingTest, ReloadOnRename) watch_period = 1000; rules = [ { - "min_level" = "info"; - "writers" = [ "info" ]; + min_level = info; + writers = [ info ]; }; ]; - "writers" = { - "info" = { - "file_name" = "%v"; - "type" = "file"; + writers = { + info = { + file_name = "%v"; + type = "file"; }; }; })", logFile.Name())); @@ -442,22 +442,22 @@ TEST_F(TLoggingTest, LogManager) Configure(Format(R"({ rules = [ { - "min_level" = "info"; - "writers" = [ "info" ]; + min_level = info; + writers = [ info ]; }; { - "min_level" = "error"; - "writers" = [ "error" ]; + min_level = "error"; + writers = [ "error" ]; }; ]; - "writers" = { + writers = { "error" = { - "file_name" = "%v"; - "type" = "file"; + file_name = "%v"; + type = "file"; }; - "info" = { - "file_name" = "%v"; - "type" = "file"; + info = { + file_name = "%v"; + type = "file"; }; }; })", errorFile.Name(), infoFile.Name())); @@ -486,14 +486,14 @@ TEST_F(TLoggingTest, ThreadMinLogLevel) Configure(Format(R"({ rules = [ { - "min_level" = "debug"; - "writers" = [ "debug" ]; + min_level = "debug"; + writers = [ "debug" ]; }; ]; - "writers" = { + writers = { "debug" = { - "file_name" = "%v"; - "type" = "file"; + file_name = "%v"; + type = "file"; }; }; })", debugFile.Name())); @@ -702,15 +702,15 @@ TEST_F(TLoggingTest, StructuredLoggingWithValidator) rules = [ { "family" = "structured"; - "min_level" = "info"; - "writers" = [ "test" ]; + min_level = info; + writers = [ "test" ]; }; ]; - "writers" = { + writers = { "test" = { "format" = "structured"; - "file_name" = "%v"; - "type" = "file"; + file_name = "%v"; + type = "file"; }; }; "structured_validation_sampling_rate" = 1.0; @@ -752,15 +752,15 @@ TEST_F(TLoggingTest, StructuredValidationWithSamplingRate) rules = [ { "family" = "structured"; - "min_level" = "info"; - "writers" = [ "test" ]; + min_level = info; + writers = [ "test" ]; }; ]; - "writers" = { + writers = { "test" = { - "file_name" = "%v"; + file_name = "%v"; "format" = "structured"; - "type" = "file"; + type = "file"; } }; "structured_validation_sampling_rate" = 0.5; @@ -842,15 +842,15 @@ TEST_P(TBuiltinRotationTest, All) flush_period = 100; rules = [ { - "min_level" = "info"; - "writers" = [ "info" ]; + min_level = info; + writers = [ info ]; }; ]; - "writers" = { - "info" = { - "file_name" = "%v"; + writers = { + info = { + file_name = "%v"; "use_timestamp_suffix" = %v; - "type" = "file"; + type = "file"; "rotation_policy" = { "max_segment_count_to_keep" = %v; "max_segment_size" = 10; @@ -1062,14 +1062,14 @@ TEST_F(TLoggingTest, DISABLED_LogFatal) Configure(Format(R"({ rules = [ { - "min_level" = "info"; - "writers" = [ "info" ]; + min_level = info; + writers = [ info ]; }; ]; - "writers" = { - "info" = { - "file_name" = "%v"; - "type" = "file"; + writers = { + info = { + file_name = "%v"; + type = "file"; }; }; })", logFile.Name())); @@ -1084,21 +1084,21 @@ TEST_F(TLoggingTest, DISABLED_LogFatal) // Windows does not support request tracing for now. #ifndef _win_ -TEST_F(TLoggingTest, RequestSuppression) +TEST_F(TLoggingTest, SupressedRequests) { TTempFile logFile(GenerateLogFileName()); Configure(Format(R"({ rules = [ { - "min_level" = "info"; - "writers" = [ "info" ]; + min_level = info; + writers = [ info ]; }; ]; - "writers" = { - "info" = { - "file_name" = "%v"; - "type" = "file"; + writers = { + info = { + file_name = "%v"; + type = "file"; }; }; "request_suppression_timeout" = 100; @@ -1125,6 +1125,73 @@ TEST_F(TLoggingTest, RequestSuppression) } #endif +TEST_F(TLoggingTest, SuppressedMessages) +{ + TTempFile logFile(GenerateLogFileName()); + + Configure(Format(R"({ + rules = [ + { + min_level = info; + writers = [ info ]; + }; + ]; + writers = { + info = { + file_name = "%v"; + type = "file"; + }; + }; + suppressed_messages = ["Suppressed message"]; + })", logFile.Name())); + + YT_LOG_INFO("Suppressed message 1"); + YT_LOG_INFO("Suppressed message 2"); + YT_LOG_INFO("Good message"); + + TLogManager::Get()->Synchronize(); + + auto lines = ReadPlainTextEvents(logFile.Name()); + EXPECT_EQ(1, std::ssize(lines)); + EXPECT_TRUE(lines[0].find("Good message") != TString::npos); +} + +TEST_F(TLoggingTest, MessageLevelOverride) +{ + TTempFile logFile(GenerateLogFileName()); + + Configure(Format(R"({ + rules = [ + { + min_level = info; + writers = [ info ]; + }; + ]; + writers = { + info = { + file_name = "%v"; + type = "file"; + }; + }; + message_level_overrides = { + "Overridden message" = "info"; + }; + })", logFile.Name())); + + YT_LOG_INFO("Overridden message 1"); + YT_LOG_TRACE("Overridden message 2"); + YT_LOG_INFO("Good message"); + + TLogManager::Get()->Synchronize(); + + auto lines = ReadPlainTextEvents(logFile.Name()); + for (auto l : lines) Cerr << l << Endl; + EXPECT_EQ(3, std::ssize(lines)); + EXPECT_TRUE(lines[0].find("Overridden message 1") != TString::npos); + EXPECT_TRUE(lines[1].find("Overridden message 2") != TString::npos); + EXPECT_TRUE(lines[2].find("Good message") != TString::npos); +} + //////////////////////////////////////////////////////////////////////////////// class TLoggingTagsTest @@ -1198,15 +1265,15 @@ protected: Configure(Format(R"({ rules = [ { - "min_level" = "info"; - "max_level" = "info"; - "writers" = [ "info" ]; + min_level = info; + "max_level" = info; + writers = [ info ]; }; ]; - "writers" = { - "info" = { - "file_name" = "%v"; - "type" = "file"; + writers = { + info = { + file_name = "%v"; + type = "file"; }; }; })", fileName)); @@ -1388,9 +1455,9 @@ TEST_F(TCustomWriterTest, UnknownWriterType) { Configure(R"({ "rules" = []; - "writers" = { + writers = { "custom" = { - "type" = "unknown"; + type = "unknown"; }; }; })"); @@ -1404,9 +1471,9 @@ TEST_F(TCustomWriterTest, WriterConfigValidation) { Configure(Format(R"({ "rules" = []; - "writers" = { + writers = { "custom" = { - "type" = "%v"; + type = "%v"; "padding" = -10; }; }; @@ -1420,13 +1487,13 @@ TEST_F(TCustomWriterTest, Write) Configure(Format(R"({ "rules" = [ { - "min_level" = "info"; - "writers" = [ "custom" ]; + min_level = info; + writers = [ "custom" ]; } ]; - "writers" = { + writers = { "custom" = { - "type" = "%v"; + type = "%v"; "padding" = 2; }; }; diff --git a/yt/yt/core/rpc/unittests/lib/common.h b/yt/yt/core/rpc/unittests/lib/common.h index 4f24a3b964..f6b83454f7 100644 --- a/yt/yt/core/rpc/unittests/lib/common.h +++ b/yt/yt/core/rpc/unittests/lib/common.h @@ -143,6 +143,11 @@ public: return false; } + static int GetMaxSimultaneousRequestCount() + { + return TImpl::MaxSimultaneousRequestCount; + } + private: NConcurrency::IThreadPoolPtr WorkerPool_; TTestNodeMemoryTrackerPtr MemoryUsageTracker_; @@ -158,6 +163,7 @@ class TRpcOverBus public: static constexpr bool AllowTransportErrors = false; static constexpr bool Secure = false; + static constexpr int MaxSimultaneousRequestCount = 1000; static TTestServerHostPtr CreateTestServerHost( NTesting::TPortHolder port, @@ -361,6 +367,7 @@ class TRpcOverGrpcImpl public: static constexpr bool AllowTransportErrors = true; static constexpr bool Secure = EnableSsl; + static constexpr int MaxSimultaneousRequestCount = 1000; static IChannelPtr CreateChannel( const std::string& address, @@ -467,6 +474,10 @@ public: // TODO(melkov): Fill ssl_credentials_ext in server code and enable the Secure flag. static constexpr bool Secure = false; + // HTTP will use at least two file descriptors per test connection. + // Allow tests to run when the limit for the file descriptors is low. + static constexpr int MaxSimultaneousRequestCount = 400; + static IChannelPtr CreateChannel( const std::string& address, const std::string& /*serverAddress*/, @@ -475,9 +486,9 @@ public: static auto poller = NConcurrency::CreateThreadPoolPoller(4, "HttpChannelTest"); auto credentials = New<NHttps::TClientCredentialsConfig>(); credentials->PrivateKey = New<NCrypto::TPemBlobConfig>(); - credentials->PrivateKey->Value = ServerKey; + credentials->PrivateKey->Value = ClientKey; credentials->CertChain = New<NCrypto::TPemBlobConfig>(); - credentials->CertChain->Value = ServerCert; + credentials->CertChain->Value = ClientCert; return NHttp::CreateHttpChannel(address, poller, EnableSsl, credentials); } diff --git a/yt/yt/core/rpc/unittests/lib/test_service.cpp b/yt/yt/core/rpc/unittests/lib/test_service.cpp index 8ac8d4720d..e71ffffc1a 100644 --- a/yt/yt/core/rpc/unittests/lib/test_service.cpp +++ b/yt/yt/core/rpc/unittests/lib/test_service.cpp @@ -109,6 +109,9 @@ public: DECLARE_RPC_SERVICE_METHOD(NTestRpc, AllocationCall) { context->SetRequestInfo(); + if (request->wait_on_latch()) { + Latch_()->Wait(); + } response->set_allocated_string(TString("r", request->size())); context->Reply(); } diff --git a/yt/yt/core/rpc/unittests/lib/test_service.proto b/yt/yt/core/rpc/unittests/lib/test_service.proto index d126bea68f..c5d3acf520 100644 --- a/yt/yt/core/rpc/unittests/lib/test_service.proto +++ b/yt/yt/core/rpc/unittests/lib/test_service.proto @@ -36,6 +36,7 @@ message TRspPassCall message TReqAllocationCall { required int64 size = 1; + optional bool wait_on_latch = 2 [default = true]; } message TRspAllocationCall diff --git a/yt/yt/core/rpc/unittests/rpc_allocation_tags_ut.cpp b/yt/yt/core/rpc/unittests/rpc_allocation_tags_ut.cpp index 919981feb0..ec5c49d7cc 100644 --- a/yt/yt/core/rpc/unittests/rpc_allocation_tags_ut.cpp +++ b/yt/yt/core/rpc/unittests/rpc_allocation_tags_ut.cpp @@ -47,6 +47,8 @@ TYPED_TEST(TRpcTest, ResponseWithAllocationTags) TTestProxy proxy(this->CreateChannel()); + MaybeInitLatch(); + constexpr auto size = 4_MB - 1_KB; constexpr auto numberOfLoops = 10; for (int i = 0; i < numberOfLoops; ++i) { @@ -80,12 +82,17 @@ TYPED_TEST(TRpcTest, ResponseWithAllocationTags) } auto memoryUsageBefore = CollectMemoryUsageSnapshot()->GetUsage(MemoryAllocationTag, ToString(testMemoryTag)); - EXPECT_LE(memoryUsageBefore, numberOfLoops * 2048_KB); + EXPECT_LE(memoryUsageBefore, numberOfLoops * 2048_KB) + << "InitialUsage: " << initialMemoryUsage << std::endl; + + ReleaseLatchedCalls(); for (const auto& rsp : responses) { WaitFor(rsp).ValueOrThrow(); } + ResetLatch(); + auto memoryUsageAfter = CollectMemoryUsageSnapshot()->GetUsage(MemoryAllocationTag, ToString(testMemoryTag)); auto deltaMemoryUsage = memoryUsageAfter - initialMemoryUsage - memoryUsageBefore; EXPECT_GE(deltaMemoryUsage, numberOfLoops * size * 6 / 5) diff --git a/yt/yt/core/rpc/unittests/rpc_ut.cpp b/yt/yt/core/rpc/unittests/rpc_ut.cpp index 157ee8faaa..48c89093c1 100644 --- a/yt/yt/core/rpc/unittests/rpc_ut.cpp +++ b/yt/yt/core/rpc/unittests/rpc_ut.cpp @@ -473,7 +473,7 @@ TYPED_TEST(TNotGrpcTest, DisableAcceptsBaggage) TYPED_TEST(TRpcTest, ManyAsyncRequests) { - const int RequestCount = 1000; + const int RequestCount = this->GetMaxSimultaneousRequestCount(); std::vector<TFuture<void>> asyncResults; @@ -622,8 +622,6 @@ TYPED_TEST(TNotGrpcTest, Compression) TYPED_TEST(TRpcTest, ResponseMemoryTag) { - // FIXME: YT-23048 - return; static TMemoryTag testMemoryTag = 12345; testMemoryTag++; auto initialMemoryUsage = GetMemoryUsageForTag(testMemoryTag); |