diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2024-02-02 12:59:30 +0300 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-02-09 19:17:15 +0300 |
commit | b07d0f5a11bc9e99d00f4e09eeee6112e88c9ce4 (patch) | |
tree | f7ca8545e0de0fff895c8ce12e42653171063dd2 | |
parent | d299e8854d8ffcea39aa93e6c807bdb93a0821ae (diff) | |
download | ydb-b07d0f5a11bc9e99d00f4e09eeee6112e88c9ce4.tar.gz |
Update contrib/libs/libidn to 1.42
67 files changed, 1697 insertions, 1613 deletions
diff --git a/contrib/libs/libidn/AUTHORS b/contrib/libs/libidn/AUTHORS index 835c3b4ea6..67d95a89d2 100644 --- a/contrib/libs/libidn/AUTHORS +++ b/contrib/libs/libidn/AUTHORS @@ -1,5 +1,5 @@ Libidn AUTHORS -- Information about the authors. -Copyright (C) 2002-2022 Simon Josefsson +Copyright (C) 2002-2024 Simon Josefsson See the end for copying conditions. Simon Josefsson <simon@josefsson.org> diff --git a/contrib/libs/libidn/CONTRIBUTING.md b/contrib/libs/libidn/CONTRIBUTING.md new file mode 100644 index 0000000000..b68a5ebe5c --- /dev/null +++ b/contrib/libs/libidn/CONTRIBUTING.md @@ -0,0 +1,111 @@ +# Contributing to Libidn + +This file contains instructions for developers and advanced users that +wants to build from version controlled sources. + +We rely on several tools to build the software, including: + +- Make <https://www.gnu.org/software/make/> +- C compiler <https://www.gnu.org/software/gcc/> +- Automake <https://www.gnu.org/software/automake/> +- Autoconf <https://www.gnu.org/software/autoconf/> +- Libtool <https://www.gnu.org/software/libtool/> +- Gettext <https://www.gnu.org/software/gettext/> +- Texinfo <https://www.gnu.org/software/texinfo/> +- Gperf <https://www.gnu.org/software/gperf/> +- help2man <https://www.gnu.org/software/help2man/> +- Gengetopt <https://www.gnu.org/software/gengetopt/> +- Tar <https://www.gnu.org/software/tar/> +- Gzip <https://www.gnu.org/software/gzip/> +- Texlive & epsf <https://tug.org/texlive/> (for PDF manual) +- GTK-DOC <https://gitlab.gnome.org/GNOME/gtk-doc> (for API manual) +- Git <https://git-scm.com/> +- Perl <https://www.cpan.org/src/http://www.cpan.org/> +- Valgrind <https://valgrind.org/> (optional) +- OpenJDK (for java port) +- Mono mcs <https://www.mono-project.com/> (for C# port) +- fig2dev <https://sourceforge.net/projects/mcj/> + +The software is typically distributed with your operating system, and +the instructions for installing them differ. Here are some hints: + +APT/DPKG-based distributions: +``` +apt-get install make git autoconf automake libtool gettext autopoint cvs +apt-get install texinfo texlive texlive-plain-generic texlive-extra-utils +apt-get install help2man gtk-doc-tools dblatex valgrind gengetopt +apt-get install transfig mono-mcs gperf default-jdk-headless +``` + +DNF/RPM-based distributions: +``` +dnf install -y make git autoconf automake libtool gettext-devel cvs +dnf install -y texinfo texinfo-tex texlive +dnf install -y help2man gtk-doc gengetopt dblatex valgrind +dnf install -y gperf java-latest-openjdk-devel +``` + +On macOS with Xcode and Homebrew: +``` +brew install autoconf automake libtool gengetopt help2man texinfo fig2dev +``` + +To download the version controlled sources: + +``` +git clone https://git.savannah.gnu.org/git/libidn.git +cd libidn +``` + +The next step is to import gnulib files, run autoreconf etc: + +``` +./bootstrap +``` + +If you have a local checkout of gnulib and wants to avoid download +another copy, you may want to use: + +``` +./bootstrap --gnulib-refdir=../gnulib +``` + +Then configure the project as you would normally, for example: + +``` +./configure --enable-java --enable-gtk-doc-pdf +``` + +Then build the project: + +``` +make +make check +``` + +To prepare releases you need some additional tools: + +- Mingw (to produce Windows binaries) +- Wine (to self-check Windows binaries) +- Lcov (to produce coverage HTML pages) +- Zip (to pack Windows binaries) +- Clang (to produce clang analysis) +- Doxygen (to produce doxygen manual) +- pmccabe (to produce cyclomatic code complexity report) +- ncftpput (to upload source tarballs) + +APT/DPKG-based distributions: +``` +apt-get install mingw-w64 wine binfmt-support lcov zip +apt-get install clang doxygen pmccabe ncftp +``` + +See README-release on how to make a release. + +Happy hacking! + +---------------------------------------------------------------------- +Copyright (C) 2009-2024 Simon Josefsson +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. diff --git a/contrib/libs/libidn/ChangeLog b/contrib/libs/libidn/ChangeLog index c4c5271de5..70feacee73 100644 --- a/contrib/libs/libidn/ChangeLog +++ b/contrib/libs/libidn/ChangeLog @@ -1,5 +1,180 @@ +2024-01-13 Simon Josefsson <simon@josefsson.org> + + version 1.42 + * NEWS: Record release date. + + doc: Fix NEWS codespell typo. + + tests: Add standalone.sh and improve tst_versions.c. Run system tests in CI/CD. + + cicd: Silence warnings. + + cicd: Enable UCRT/MINGW jobs. + + doc: Add NEWS entry about Windows fix. + + Silence compiler warnings. + +2024-01-13 Francesco Pretto <ceztko@gmail.com> + + Fix type confusion for Windows. + +2024-01-13 Simon Josefsson <simon@josefsson.org> + + cicd: Fix coverity job. + + maint: Improve compiler warning handling. + + cicd: Avoid duplicate pipeline. + + Bump required gettext version to 0.19.8 for musl-libc. + + cicd: More make -j. + + maint: Fix codespell. + + doc: Rename HACKING to CONTRIBUTING.md and fix markup. + + cicd: Add Windows/arm64/ppc64 jobs. Fix macOS jobs. + +2024-01-01 Simon Josefsson <simon@josefsson.org> + + cicd: Use standard stage naming. Some macOS/gcc/clang fixes. + + main: Bump NEWS hash after copyright year change. + + maint: Run 'make my-update-copyright'. + + maint: Don't disable copyright_check. + + Sync bootstrap scripts. + + maint: Update gnulib submodule. + + cicd: Improve macOS testing. + +2023-11-12 Simon Josefsson <simon@josefsson.org> + + cicd: Fix macOS dependencies. + + cicd: Add macOS/gcc + use Trisquel. Update images and stages. Use defaults. + + Drop autogen/autopull scripts (use bootstrap --gen/--pull). + + Update gnulib submodule. + +2023-11-11 Simon Josefsson <simon@josefsson.org> + + cicd: Update build-image names. + +2023-11-06 Simon Josefsson <simon@josefsson.org> + + Add NEWS entries. + + Indent code. + + Sync bootstrap scripts. + + Update gnulib. + + cicd: Use stable debian releases. Fix armcross build failure. + +2023-05-07 Tim Rühsen <tim.ruehsen@gmx.de> + + Merge branch 'rockdaboot/include-config.h-from-tlds.c' into 'master' + lib/gen-tld-tables.pl: include config.h + + See merge request libidn/libidn!1 + +2023-05-07 Tim Rühsen <tim.ruehsen@gmx.de> + + lib/gen-tld-tables.pl: include config.h + +2023-01-01 Simon Josefsson <simon@josefsson.org> + + maint: Fix syntax-check. + + maint: Run 'make my-update-copyright'. + + Sync bootstrap script. + + Update gnulib git submodule. + +2022-11-27 Simon Josefsson <simon@josefsson.org> + + cicd: Use extends:.test more. Check with VERBOSE=t. + +2022-11-05 Simon Josefsson <simon@josefsson.org> + + cicd: Test clang-15. + + Update gnulib submodule. + +2022-09-06 Simon Josefsson <simon@josefsson.org> + + maint: Update review-diff rule. + + cicd: Test coverity variables before use. + + Allow coverity scan build to fail (when variables are not set up). + + Update gnulib files. + +2022-09-05 Simon Josefsson <simon@josefsson.org> + + cicd: Add coverity and sast. + +2022-08-16 Simon Josefsson <simon@josefsson.org> + + Use AM_DISTCHECK_CONFIGURE_FLAGS. + + Update gnulib. + +2022-08-14 Simon Josefsson <simon@josefsson.org> + + Sync bootstrap. + + Update gdoc usage. + + Update gnulib files. + + Drop obsolete gdoc bootstrap. Refresh and move gtk-doc fix into hook. + +2022-07-11 Simon Josefsson <simon@josefsson.org> + + doc: Drop obsolete HTML hacks (we now use gendocs). + + Doc fix of bootstrap M4 hack. + + Reorder diagnostic outputs. + + Drop old bootstrap tarcache stuff. + + configure.ac: Use new iconv summary variable. + + maint: Update gnulib. + +2022-07-09 Simon Josefsson <simon@josefsson.org> + + Use proper variable for iconv diagnostics. Drop obsolete warning. + +2022-06-26 Simon Josefsson <simon@josefsson.org> + + Update gnulib files. + 2022-06-25 Simon Josefsson <simon@josefsson.org> + doc: Improve release steps. + + Bump LT_REVISION. + + Bump STRINGPREP_VERSION. + + maint: post-release administrivia + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * cfg.mk (old_NEWS_hash): Auto-update. + version 1.41 * NEWS: Record release date. diff --git a/contrib/libs/libidn/INSTALL b/contrib/libs/libidn/INSTALL index a093a3644b..94b917d3cf 100644 --- a/contrib/libs/libidn/INSTALL +++ b/contrib/libs/libidn/INSTALL @@ -1,177 +1,177 @@ Installation Instructions ************************* - Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2022 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 + The following shell commands: + + test -f configure || ./bootstrap + ./configure + make + make install + +should configure, build, and install this package. The first line, +which bootstraps, is intended for developers; when building from +distribution tarballs it does nothing and can be skipped. + + 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 the GNU Coding Standards. + + Many packages have scripts meant for developers instead of ordinary +builders, as they may use developer tools that are less commonly +installed, or they may access the network, which has privacy +implications. If the ‘bootstrap’ shell script exists, it attempts to +build the ‘configure’ shell script and related files, possibly using +developer tools or the network. Because the output of ‘bootstrap’ is +system-independent, it is normally run by a package developer so that +its output can be put into the distribution tarball and ordinary +builders and users need not run ‘bootstrap’. Some packages have +commands like ‘./autopull.sh’ and ‘./autogen.sh’ that you can run +instead of ‘./bootstrap’, for more fine-grained control over +bootstrapping. + + 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 +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'). +file ‘config.log’ containing output useful 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 + 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 +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 +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 ‘autoconf’ program generates ‘configure’ from the file +‘configure.ac’. Normally you should edit ‘configure.ac’ instead of +editing ‘configure’ directly. 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. + 1. ‘cd’ to the directory containing the package’s source code. + + 2. If this is a developer checkout and file ‘configure’ does not yet + exist, type ‘./bootstrap’ to create it. You may need special + developer tools and network access to bootstrap, and the network + access may have privacy implications. - Running 'configure' might take a while. While running, it prints - some messages telling which features it is checking for. + 3. Type ‘./configure’ to configure the package for your system. This + might take a while. While running, ‘configure’ prints messages + telling which features it is checking for. - 2. Type 'make' to compile the package. + 4. Type ‘make’ to compile the package. - 3. Optionally, type 'make check' to run any self-tests that come with + 5. 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 + 6. 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 + user, and only the ‘make install’ phase executed with root privileges. - 5. Optionally, type 'make installcheck' to repeat any self-tests, but + 7. 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 + 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. + 8. 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 + bootstrap again. + + 9. If the package follows the GNU Coding Standards, you can type ‘make + uninstall’ to remove the installed files. Compilers and Options ===================== Some systems require unusual options for compilation or linking that -the 'configure' script does not know about. Run './configure --help' +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 + 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 + ./configure CC=gcc CFLAGS=-g LIBS=-lposix - *Note Defining Variables::, for more details. + See “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. +same time, by placing the object files for each system 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 +system at a time in the source code directory. After you have installed +the package for one system, use ‘make distclean’ before reconfiguring +for another system. + + Some platforms, notably macOS, support “fat” or “universal” binaries, +where a single binary can execute on different architectures. On these +platforms you can configure and compile just once, with options specific +to that platform. 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 + 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 +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 +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 +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 +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 +‘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 +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 +‘${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 @@ -179,190 +179,187 @@ 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 + 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. +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'. +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 pay attention to ‘--enable-FEATURE’ and +‘--disable-FEATURE’ options to ‘configure’, where FEATURE indicates an +optional part of the package. They may also pay attention to +‘--with-PACKAGE’ and ‘--without-PACKAGE’ options, where PACKAGE is +something like ‘gnu-ld’. ‘./configure --help’ should mention the +‘--enable-...’ and ‘--with-...’ options that the package recognizes. 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 timestamps 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'. +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’. + +Specifying a System Type +======================== + + By default ‘configure’ builds for the current system. To create +binaries that can run on a different system type, specify a +‘--host=TYPE’ option along with compiler variables that specify how to +generate object code for TYPE. For example, to create binaries intended +to run on a 64-bit ARM processor: + + ./configure --host=aarch64-linux-gnu \ + CC=aarch64-linux-gnu-gcc \ + CXX=aarch64-linux-gnu-g++ + +If done on a machine that can execute these binaries (e.g., via +‘qemu-aarch64’, ‘$QEMU_LD_PREFIX’, and Linux’s ‘binfmt_misc’ +capability), the build behaves like a native build. Otherwise it is a +cross-build: ‘configure’ will make cross-compilation guesses instead of +running test programs, and ‘make check’ will not work. + + A system type can either be a short name like ‘mingw64’, or a +canonical name like ‘x86_64-pc-linux-gnu’. Canonical names have the +form CPU-COMPANY-SYSTEM where SYSTEM is either OS or KERNEL-OS. To +canonicalize and validate a system type, you can run the command +‘config.sub’, which is often squirreled away in a subdirectory like +‘build-aux’. For example: + + $ build-aux/config.sub arm64-linux + aarch64-unknown-linux-gnu + $ build-aux/config.sub riscv-lnx + Invalid configuration 'riscv-lnx': OS 'lnx' not recognized + +You can look at the ‘config.sub’ file to see which types are recognized. +If the file is absent, this package does not need the system type. + + If ‘configure’ fails with the diagnostic “cannot guess build type”. +‘config.sub’ did not recognize your system’s type. In this case, first +fetch the newest versions of these files from the GNU config package +(https://savannah.gnu.org/projects/config). If that fixes things, +please report it to the maintainers of the package containing +‘configure’. Otherwise, you can try the configure option ‘--build=TYPE’ +where TYPE comes close to your system type; also, please report the +problem to <config-patches@gnu.org>. + + For more details about configuring system types, see the Autoconf +documentation. 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. + 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 +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: +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 +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 +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’ Invocation ====================== - 'configure' recognizes the following options to control how it + ‘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’ +‘-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 +‘--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' +‘--version’ +‘-V’ + Print the version of Autoconf used to generate the ‘configure’ script, and exit. -'--cache-file=FILE' +‘--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 + 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). +‘--config-cache’ +‘-C’ + Alias for ‘--cache-file=config.cache’. -'--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - 'configure' can determine that directory automatically. +‘--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 +‘--prefix=DIR’ + Use DIR as the installation prefix. See “Installation Names” for more details, including other options available for fine-tuning the installation locations. -'--no-create' -'-n' +‘--host=TYPE’ + Build binaries for system TYPE. See “Specifying a System Type”. + +‘--enable-FEATURE’ +‘--disable-FEATURE’ + Enable or disable the optional FEATURE. See “Optional Features”. + +‘--with-PACKAGE’ +‘--without-PACKAGE’ + Use or omit PACKAGE when building. See “Optional Features”. + +‘--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). + +‘--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. +‘configure’ also recognizes several environment variables, and accepts +some other, less widely useful, options. Run ‘configure --help’ for +more details. + +Copyright notice +================ + + Copyright © 1994–1996, 1999–2002, 2004–2017, 2020–2023 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. diff --git a/contrib/libs/libidn/NEWS b/contrib/libs/libidn/NEWS index 58fa449ce6..7af6bcdce0 100644 --- a/contrib/libs/libidn/NEWS +++ b/contrib/libs/libidn/NEWS @@ -1,5 +1,47 @@ Libidn NEWS -- History of user-visible changes. -*- outline -*- +* Noteworthy changes in release 1.42 (2024-01-13) [stable] + +** Bump required gettext version to 0.19.8 for musl-libc. + +** Compiler warning improvements. +As before, compiler warnings are enabled by default. You may disable +them using ./configure --disable-gcc-warnings or turn them into fatal +errors using ./configure --enable-gcc-warnings=error to add -Werror +and sensible -Wno-error='s. Based on gnulib's manywarnings, see +<https://www.gnu.org/software/gnulib//manual/html_node/manywarnings.html>. + +** Fix type confusion on LLP64/Windows platforms. +While libidn has worked using cygwin libc, it has never worked on +ucrt/msvcrt libc. Report and tiny patch by Francesco Pretto in +<https://lists.gnu.org/archive/html/help-libidn/2022-02/msg00000.html>. + +** tests: Added script tests/standalone.sh suitable for integrators. +The main purpose is to test a system-installed libidn, suitable for +distributor checking (a'la Debian's autopkgtest/debci). It may also +be used to test a newly built libidn outside the usual 'make check' +infrastructure. To check that your system libidn is working, invoke +the script with `srcdir` as an environment variable indicating where +it can be find the source code for libidn's tests/ directory (it will +use the directory name where the script is by default): + +tests/standalone.sh + +To check that a newly built static libidn behaves, invoke: + +env STANDALONE_CFLAGS="-Ilib lib/.libs/libidn.a" tests/standalone.sh + +To check that a newly built shared libidn behaves, invoke: + +env srcdir=tests STANDALONE_CFLAGS="-Ilib -Wl,-rpath lib/.libs lib/.libs/libidn.so" tests/standalone.sh + +If the libidn under testing is too old and has known bugs, that should +cause tests to fail, which is intentional. + +** Updated translations. + +** Update gnulib files and build fixes. + * Noteworthy changes in release 1.41 (2022-06-25) [stable] ** Bump LT_REVISION for new release. @@ -1687,7 +1729,7 @@ used is included. ** Initial release ---------------------------------------------------------------------- -Copyright (C) 2002-2022 Simon Josefsson +Copyright (C) 2002-2024 Simon Josefsson 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. diff --git a/contrib/libs/libidn/README b/contrib/libs/libidn/README index e209fbbb6e..f05bc136bf 100644 --- a/contrib/libs/libidn/README +++ b/contrib/libs/libidn/README @@ -1,5 +1,5 @@ Libidn README -- Important introductory notes. -Copyright (C) 2002-2022 Simon Josefsson +Copyright (C) 2002-2024 Simon Josefsson See the end for copying conditions. Libidn is a package for internationalized string handling based on the @@ -13,8 +13,9 @@ the historic IDNA2003 behaviour or to use Stringprep profiles. Please try to migrate to libidn2 wherever possible. If you obtained this file as part of a "git clone", then see the -HACKING file. If this file came to you as part of a tar archive, then -see the file INSTALL for compilation and installation instructions. +CONTRIBUTING.md file. If this file came to you as part of a tar +archive, then see the file INSTALL for compilation and installation +instructions. If you need help to use Libidn, or wish to help others, you are invited to join our mailing list help-libidn@gnu.org, see diff --git a/contrib/libs/libidn/config-linux.h b/contrib/libs/libidn/config-linux.h index 78173951d6..3bc2edae03 100644 --- a/contrib/libs/libidn/config-linux.h +++ b/contrib/libs/libidn/config-linux.h @@ -1,6 +1,10 @@ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Witness that <config.h> has been included. */ +#define _GL_CONFIG_H_INCLUDED 1 + + /* Define to the number of bits in type 'ptrdiff_t'. */ /* #undef BITSIZEOF_PTRDIFF_T */ @@ -115,6 +119,9 @@ /* Define to 1 when the gnulib module getopt-posix should be tested. */ #define GNULIB_TEST_GETOPT_POSIX 1 +/* Define to 1 when the gnulib module getprogname should be tested. */ +#define GNULIB_TEST_GETPROGNAME 1 + /* Define to 1 when the gnulib module open should be tested. */ #define GNULIB_TEST_OPEN 1 @@ -174,6 +181,12 @@ /* Define to 1 if you have the <crtdefs.h> header file. */ /* #undef HAVE_CRTDEFS_H */ +/* Define to 1 if bool, true and false work as per C2023. */ +/* #undef HAVE_C_BOOL */ + +/* Define to 1 if the static_assert keyword works. */ +/* #undef HAVE_C_STATIC_ASSERT */ + /* Define to 1 if C supports variable-length arrays. */ #define HAVE_C_VARARRAYS 1 @@ -217,6 +230,10 @@ don't. */ #define HAVE_DECL_GETLINE 1 +/* Define to 1 if you have the declaration of `getw', and to 0 if you don't. + */ +#define HAVE_DECL_GETW 1 + /* 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 @@ -225,6 +242,10 @@ and to 0 if you don't. */ #define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1 +/* Define to 1 if you have the declaration of `putw', and to 0 if you don't. + */ +#define HAVE_DECL_PUTW 1 + /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #define HAVE_DECL_STRERROR_R 1 @@ -240,6 +261,12 @@ /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 +/* Define to 1 if you have the `error' function. */ +#define HAVE_ERROR 1 + +/* Define to 1 if you have the <error.h> header file. */ +#define HAVE_ERROR_H 1 + /* Define to 1 if you have the `fcntl' function. */ #define HAVE_FCNTL 1 @@ -264,6 +291,9 @@ /* Define to 1 if you have the `getexecname' function. */ /* #undef HAVE_GETEXECNAME */ +/* Define to 1 if you have the `getline' function. */ +#define HAVE_GETLINE 1 + /* Define to 1 if you have the <getopt.h> header file. */ #define HAVE_GETOPT_H 1 @@ -327,6 +357,12 @@ /* Define to 1 if 'wint_t' is a signed integer type. */ /* #undef HAVE_SIGNED_WINT_T */ +/* Define to 1 if you have the <stdbool.h> header file. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the <stdckdint.h> header file. */ +/* #undef HAVE_STDCKDINT_H */ + /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 @@ -399,6 +435,9 @@ /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 +/* Define to 1 if you have the <unistring/woe32dll.h> header file. */ +/* #undef HAVE_UNISTRING_WOE32DLL_H */ + /* Define to 1 if the system has the type 'unsigned long long int'. */ #define HAVE_UNSIGNED_LONG_LONG_INT 1 @@ -427,9 +466,6 @@ /* Define to 1 if O_NOFOLLOW works. */ #define HAVE_WORKING_O_NOFOLLOW 1 -/* Define to 1 if the system has the type `_Bool'. */ -#define HAVE__BOOL 1 - /* Define to 1 if you have the `_set_invalid_parameter_handler' function. */ /* #undef HAVE__SET_INVALID_PARAMETER_HANDLER */ @@ -492,7 +528,8 @@ # define _GL_EXTERN_INLINE_STDHEADER_BUG #endif #if ((__GNUC__ \ - ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ + ? (defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ + && !defined __PCC__) \ : (199901L <= __STDC_VERSION__ \ && !defined __HP_cc \ && !defined __PGI \ @@ -502,6 +539,7 @@ # define _GL_EXTERN_INLINE extern inline # define _GL_EXTERN_INLINE_IN_USE #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ + && !defined __PCC__ \ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ @@ -563,6 +601,9 @@ #endif +/* Define to 1 on musl libc. */ +/* #undef MUSL_LIBC */ + /* Define to 1 if open() fails to recognize a trailing slash. */ /* #undef OPEN_TRAILING_SLASH_BUG */ @@ -585,7 +626,7 @@ /* #undef PACKAGE_PACKAGER_VERSION */ /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "GNU Libidn 1.41" +#define PACKAGE_STRING "GNU Libidn 1.42" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "libidn" @@ -594,7 +635,7 @@ #define PACKAGE_URL "https://www.gnu.org/software/libidn/" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.41" +#define PACKAGE_VERSION "1.42" /* Define to the type that is the result of default argument promotions of type mode_t. */ @@ -703,11 +744,15 @@ #ifndef __STDC_WANT_IEC_60559_DFP_EXT__ # define __STDC_WANT_IEC_60559_DFP_EXT__ 1 #endif +/* Enable extensions specified by C23 Annex F. */ +#ifndef __STDC_WANT_IEC_60559_EXT__ +# define __STDC_WANT_IEC_60559_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. */ +/* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */ #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ # define __STDC_WANT_IEC_60559_TYPES_EXT__ 1 #endif @@ -731,7 +776,7 @@ /* Version number of package */ -#define VERSION "1.41" +#define VERSION "1.42" /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'wchar_t'. */ @@ -759,7 +804,7 @@ /* Define to enable the declarations of ISO C 11 types and functions. */ /* #undef _ISOC11_SOURCE */ -/* Define for large files, on AIX-style hosts. */ +/* Define to 1 on platforms where this makes off_t a 64-bit type. */ /* #undef _LARGE_FILES */ /* The _Noreturn keyword of C11. */ @@ -775,6 +820,11 @@ AIX system header files and several gnulib header files use precisely this syntax with 'extern'. */ # define _Noreturn [[noreturn]] +# elif (defined __clang__ && __clang_major__ < 16 \ + && defined _GL_WORK_AROUND_LLVM_BUG_59792) + /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around + that rare LLVM bug, though you may get many false-alarm warnings. */ +# define _Noreturn # elif ((!defined __cplusplus || defined __clang__) \ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ || (!defined __STRICT_ANSI__ \ @@ -793,7 +843,7 @@ #endif -/* Number of bits in a timestamp, on hosts where this is settable. */ +/* Number of bits in time_t, on hosts where this is settable. */ /* #undef _TIME_BITS */ /* For standard stat data types on VMS. */ @@ -803,7 +853,7 @@ used. */ /* #undef __GETOPT_PREFIX */ -/* For 64-bit time_t on 32-bit mingw. */ +/* Define to 1 on platforms where this makes time_t a 64-bit type. */ /* #undef __MINGW_USE_VC2005_COMPAT */ /* Define to 1 if the system <stdint.h> predates C++11. */ @@ -848,7 +898,7 @@ && (!defined __clang_minor__ \ || (defined __apple_build_version__ \ ? 6000000 <= __apple_build_version__ \ - : 3 < __clang_major__ + (5 <= __clang_minor__)))) + : 5 <= __clang_major__))) # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) #else # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr @@ -882,16 +932,30 @@ # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) #endif -#ifdef __has_c_attribute -# if ((defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710 \ - && _GL_GNUC_PREREQ (4, 6)) -# pragma GCC diagnostic ignored "-Wpedantic" -# endif -# define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__) +/* Use __has_c_attribute if available. However, do not use with + pre-C23 GCC, which can issue false positives if -Wpedantic. */ +#if (defined __has_c_attribute \ + && ! (_GL_GNUC_PREREQ (4, 6) \ + && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710)) +# define _GL_HAVE___HAS_C_ATTRIBUTE 1 #else -# define _GL_HAS_C_ATTRIBUTE(attr) 0 +# define _GL_HAVE___HAS_C_ATTRIBUTE 0 #endif +/* Define if, in a function declaration, the attributes in bracket syntax + [[...]] must come before the attributes in __attribute__((...)) syntax. + If this is defined, it is best to avoid the bracket syntax, so that the + various _GL_ATTRIBUTE_* can be cumulated on the same declaration in any + order. */ +#ifdef __cplusplus +# if defined __clang__ +# define _GL_BRACKET_BEFORE_ATTRIBUTE 1 +# endif +#else +# if defined __GNUC__ && !defined __clang__ +# define _GL_BRACKET_BEFORE_ATTRIBUTE 1 +# endif +#endif /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function is the size of the returned memory block. @@ -899,29 +963,35 @@ by the Nth argument of the function is the size of the returned memory block. */ /* Applies to: function, pointer to function, function types. */ -#if _GL_HAS_ATTRIBUTE (alloc_size) -# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) -#else -# define _GL_ATTRIBUTE_ALLOC_SIZE(args) +#ifndef _GL_ATTRIBUTE_ALLOC_SIZE +# if _GL_HAS_ATTRIBUTE (alloc_size) +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) +# else +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) +# endif #endif /* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the function and report an error if it cannot do so. */ /* Applies to: function. */ -#if _GL_HAS_ATTRIBUTE (always_inline) -# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) -#else -# define _GL_ATTRIBUTE_ALWAYS_INLINE +#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE +# if _GL_HAS_ATTRIBUTE (always_inline) +# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# else +# define _GL_ATTRIBUTE_ALWAYS_INLINE +# endif #endif /* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show in stack traces when debugging. The compiler should omit the function from stack traces. */ /* Applies to: function. */ -#if _GL_HAS_ATTRIBUTE (artificial) -# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) -#else -# define _GL_ATTRIBUTE_ARTIFICIAL +#ifndef _GL_ATTRIBUTE_ARTIFICIAL +# if _GL_HAS_ATTRIBUTE (artificial) +# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) +# else +# define _GL_ATTRIBUTE_ARTIFICIAL +# endif #endif /* _GL_ATTRIBUTE_COLD declares that the function is rarely executed. */ @@ -929,14 +999,16 @@ /* Avoid __attribute__ ((cold)) on MinGW; see thread starting at <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>. Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */ -#if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ -# ifndef __SUNPRO_C -# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) +#ifndef _GL_ATTRIBUTE_COLD +# if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ +# ifndef __SUNPRO_C +# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) +# else +# define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) +# endif # else -# define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) +# define _GL_ATTRIBUTE_COLD # endif -#else -# define _GL_ATTRIBUTE_COLD #endif /* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate @@ -946,10 +1018,12 @@ forever, and does not call longjmp. (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ /* Applies to: functions. */ -#if _GL_HAS_ATTRIBUTE (const) -# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) -#else -# define _GL_ATTRIBUTE_CONST +#ifndef _GL_ATTRIBUTE_CONST +# if _GL_HAS_ATTRIBUTE (const) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +# else +# define _GL_ATTRIBUTE_CONST +# endif #endif /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers @@ -958,16 +1032,25 @@ _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that can be freed via 'free'; it can be used only after declaring 'free'. */ /* Applies to: functions. Cannot be used on inline functions. */ -#if _GL_GNUC_PREREQ (11, 0) -# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) -#else -# define _GL_ATTRIBUTE_DEALLOC(f, i) +#ifndef _GL_ATTRIBUTE_DEALLOC +# if _GL_GNUC_PREREQ (11, 0) +# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) +# else +# define _GL_ATTRIBUTE_DEALLOC(f, i) +# endif #endif /* If gnulib's <string.h> or <wchar.h> has already defined this macro, continue to use this earlier definition, since <stdlib.h> may not have been included yet. */ #ifndef _GL_ATTRIBUTE_DEALLOC_FREE -# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1) +# if defined __cplusplus && defined __GNUC__ && !defined __clang__ +/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */ +# define _GL_ATTRIBUTE_DEALLOC_FREE \ + _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) +# else +# define _GL_ATTRIBUTE_DEALLOC_FREE \ + _GL_ATTRIBUTE_DEALLOC (free, 1) +# endif #endif /* _GL_ATTRIBUTE_DEPRECATED: Declares that an entity is deprecated. @@ -978,12 +1061,20 @@ - enumeration, enumeration item, - typedef, in C++ also: namespace, class, template specialization. */ -#if _GL_HAS_C_ATTRIBUTE (deprecated) -# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] -#elif _GL_HAS_ATTRIBUTE (deprecated) -# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) -#else -# define _GL_ATTRIBUTE_DEPRECATED +#ifndef _GL_ATTRIBUTE_DEPRECATED +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if _GL_HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute (__deprecated__) +# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] +# endif +# endif +# endif +# if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated) +# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) +# endif +# ifndef _GL_ATTRIBUTE_DEPRECATED +# define _GL_ATTRIBUTE_DEPRECATED +# endif #endif /* _GL_ATTRIBUTE_ERROR(msg) requests an error if a function is called and @@ -991,24 +1082,28 @@ _GL_ATTRIBUTE_WARNING(msg) requests a warning if a function is called and the function call is not optimized away. */ /* Applies to: functions. */ -#if _GL_HAS_ATTRIBUTE (error) -# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) -# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) -#elif _GL_HAS_ATTRIBUTE (diagnose_if) -# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error"))) -# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning"))) -#else -# define _GL_ATTRIBUTE_ERROR(msg) -# define _GL_ATTRIBUTE_WARNING(msg) +#if !(defined _GL_ATTRIBUTE_ERROR && defined _GL_ATTRIBUTE_WARNING) +# if _GL_HAS_ATTRIBUTE (error) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) +# elif _GL_HAS_ATTRIBUTE (diagnose_if) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error"))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning"))) +# else +# define _GL_ATTRIBUTE_ERROR(msg) +# define _GL_ATTRIBUTE_WARNING(msg) +# endif #endif /* _GL_ATTRIBUTE_EXTERNALLY_VISIBLE declares that the entity should remain visible to debuggers etc., even with '-fwhole-program'. */ /* Applies to: functions, variables. */ -#if _GL_HAS_ATTRIBUTE (externally_visible) -# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) -#else -# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE +#ifndef _GL_ATTRIBUTE_EXTERNALLY_VISIBLE +# if _GL_HAS_ATTRIBUTE (externally_visible) +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) +# else +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE +# endif #endif /* _GL_ATTRIBUTE_FALLTHROUGH declares that it is not a programming mistake if @@ -1016,12 +1111,18 @@ 'default' label. The compiler should not warn in this case. */ /* Applies to: Empty statement (;), inside a 'switch' statement. */ /* Always expands to something. */ -#if _GL_HAS_C_ATTRIBUTE (fallthrough) -# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] -#elif _GL_HAS_ATTRIBUTE (fallthrough) -# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) -#else -# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) +#ifndef _GL_ATTRIBUTE_FALLTHROUGH +# if _GL_HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute (__fallthrough__) +# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] +# endif +# endif +# if !defined _GL_ATTRIBUTE_FALLTHROUGH && _GL_HAS_ATTRIBUTE (fallthrough) +# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +# ifndef _GL_ATTRIBUTE_FALLTHROUGH +# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) +# endif #endif /* _GL_ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)) @@ -1035,10 +1136,12 @@ If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK are suitable for the format string. */ /* Applies to: functions. */ -#if _GL_HAS_ATTRIBUTE (format) -# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) -#else -# define _GL_ATTRIBUTE_FORMAT(spec) +#ifndef _GL_ATTRIBUTE_FORMAT +# if _GL_HAS_ATTRIBUTE (format) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +# else +# define _GL_ATTRIBUTE_FORMAT(spec) +# endif #endif /* _GL_ATTRIBUTE_LEAF declares that if the function is called from some other @@ -1046,19 +1149,23 @@ exception handling. This declaration lets the compiler optimize that unit more aggressively. */ /* Applies to: functions. */ -#if _GL_HAS_ATTRIBUTE (leaf) -# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) -#else -# define _GL_ATTRIBUTE_LEAF +#ifndef _GL_ATTRIBUTE_LEAF +# if _GL_HAS_ATTRIBUTE (leaf) +# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) +# else +# define _GL_ATTRIBUTE_LEAF +# endif #endif /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly allocated memory. */ /* Applies to: functions. */ -#if _GL_HAS_ATTRIBUTE (malloc) -# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) -#else -# define _GL_ATTRIBUTE_MALLOC +#ifndef _GL_ATTRIBUTE_MALLOC +# if _GL_HAS_ATTRIBUTE (malloc) +# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# else +# define _GL_ATTRIBUTE_MALLOC +# endif #endif /* _GL_ATTRIBUTE_MAY_ALIAS declares that pointers to the type may point to the @@ -1066,10 +1173,12 @@ strict aliasing optimization. */ /* Applies to: types. */ /* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */ -#if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C -# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) -#else -# define _GL_ATTRIBUTE_MAY_ALIAS +#ifndef _GL_ATTRIBUTE_MAY_ALIAS +# if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C +# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) +# else +# define _GL_ATTRIBUTE_MAY_ALIAS +# endif #endif /* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if @@ -1081,15 +1190,29 @@ - enumeration, enumeration item, - typedef, in C++ also: class. */ -/* In C++ and C2x, this is spelled [[__maybe_unused__]]. +/* In C++ and C23, this is spelled [[__maybe_unused__]]. GCC's syntax is __attribute__ ((__unused__)). - clang supports both syntaxes. */ -#if _GL_HAS_C_ATTRIBUTE (maybe_unused) -# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] -#else -# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED + clang supports both syntaxes. Except that with clang ≥ 6, < 10, in C++ mode, + __has_c_attribute (__maybe_unused__) yields true but the use of + [[__maybe_unused__]] nevertheless produces a warning. */ +#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if defined __clang__ && defined __cplusplus +# if !defined __apple_build_version__ && __clang_major__ >= 10 +# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] +# endif +# elif _GL_HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute (__maybe_unused__) +# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] +# endif +# endif +# endif +# ifndef _GL_ATTRIBUTE_MAYBE_UNUSED +# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED +# endif #endif -/* Alternative spelling of this macro, for convenience. */ +/* Alternative spelling of this macro, for convenience and for + compatibility with glibc/include/libc-symbols.h. */ #define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED /* Earlier spellings of this macro. */ #define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED @@ -1098,21 +1221,40 @@ discard the return value. The compiler may warn if the caller does not use the return value, unless the caller uses something like ignore_value. */ /* Applies to: function, enumeration, class. */ -#if _GL_HAS_C_ATTRIBUTE (nodiscard) -# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] -#elif _GL_HAS_ATTRIBUTE (warn_unused_result) -# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) -#else -# define _GL_ATTRIBUTE_NODISCARD +#ifndef _GL_ATTRIBUTE_NODISCARD +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if defined __clang__ && defined __cplusplus + /* With clang up to 15.0.6 (at least), in C++ mode, [[__nodiscard__]] produces + a warning. + The 1000 below means a yet unknown threshold. When clang++ version X + starts supporting [[__nodiscard__]] without warning about it, you can + replace the 1000 with X. */ +# if __clang_major__ >= 1000 +# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] +# endif +# elif _GL_HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute (__nodiscard__) +# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] +# endif +# endif +# endif +# if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result) +# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) +# endif +# ifndef _GL_ATTRIBUTE_NODISCARD +# define _GL_ATTRIBUTE_NODISCARD +# endif #endif /* _GL_ATTRIBUTE_NOINLINE tells that the compiler should not inline the function. */ /* Applies to: functions. */ -#if _GL_HAS_ATTRIBUTE (noinline) -# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) -#else -# define _GL_ATTRIBUTE_NOINLINE +#ifndef _GL_ATTRIBUTE_NOINLINE +# if _GL_HAS_ATTRIBUTE (noinline) +# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) +# else +# define _GL_ATTRIBUTE_NOINLINE +# endif #endif /* _GL_ATTRIBUTE_NONNULL ((N1, N2,...)) declares that the arguments N1, N2,... @@ -1120,20 +1262,24 @@ _GL_ATTRIBUTE_NONNULL () declares that all pointer arguments must not be null. */ /* Applies to: functions. */ -#if _GL_HAS_ATTRIBUTE (nonnull) -# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) -#else -# define _GL_ATTRIBUTE_NONNULL(args) +#ifndef _GL_ATTRIBUTE_NONNULL +# if _GL_HAS_ATTRIBUTE (nonnull) +# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) +# else +# define _GL_ATTRIBUTE_NONNULL(args) +# endif #endif /* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is not meant to be NUL-terminated. */ /* Applies to: struct/union members and variables that are arrays of element type '[[un]signed] char'. */ -#if _GL_HAS_ATTRIBUTE (nonstring) -# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) -#else -# define _GL_ATTRIBUTE_NONSTRING +#ifndef _GL_ATTRIBUTE_NONSTRING +# if _GL_HAS_ATTRIBUTE (nonstring) +# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) +# else +# define _GL_ATTRIBUTE_NONSTRING +# endif #endif /* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */ @@ -1141,10 +1287,26 @@ /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. */ /* Applies to: functions. */ -#if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus -# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) -#else -# define _GL_ATTRIBUTE_NOTHROW +/* After a function's parameter list, this attribute must come first, before + other attributes. */ +#ifndef _GL_ATTRIBUTE_NOTHROW +# if defined __cplusplus +# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 +# if __cplusplus >= 201103L +# define _GL_ATTRIBUTE_NOTHROW noexcept (true) +# else +# define _GL_ATTRIBUTE_NOTHROW throw () +# endif +# else +# define _GL_ATTRIBUTE_NOTHROW +# endif +# else +# if _GL_HAS_ATTRIBUTE (nothrow) +# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) +# else +# define _GL_ATTRIBUTE_NOTHROW +# endif +# endif #endif /* _GL_ATTRIBUTE_PACKED declares: @@ -1153,10 +1315,12 @@ minimizing the memory required. */ /* Applies to: struct members, struct, union, in C++ also: class. */ -#if _GL_HAS_ATTRIBUTE (packed) -# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) -#else -# define _GL_ATTRIBUTE_PACKED +#ifndef _GL_ATTRIBUTE_PACKED +# if _GL_HAS_ATTRIBUTE (packed) +# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) +# else +# define _GL_ATTRIBUTE_PACKED +# endif #endif /* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate @@ -1166,19 +1330,23 @@ observable state, and always returns exactly once. (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ /* Applies to: functions. */ -#if _GL_HAS_ATTRIBUTE (pure) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE +#ifndef _GL_ATTRIBUTE_PURE +# if _GL_HAS_ATTRIBUTE (pure) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE +# endif #endif /* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is a non-NULL pointer. */ /* Applies to: functions. */ -#if _GL_HAS_ATTRIBUTE (returns_nonnull) -# define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) -#else -# define _GL_ATTRIBUTE_RETURNS_NONNULL +#ifndef _GL_ATTRIBUTE_RETURNS_NONNULL +# if _GL_HAS_ATTRIBUTE (returns_nonnull) +# define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) +# else +# define _GL_ATTRIBUTE_RETURNS_NONNULL +# endif #endif /* _GL_ATTRIBUTE_SENTINEL(pos) declares that the variadic function expects a @@ -1186,17 +1354,21 @@ _GL_ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99). _GL_ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */ /* Applies to: functions. */ -#if _GL_HAS_ATTRIBUTE (sentinel) -# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) -#else -# define _GL_ATTRIBUTE_SENTINEL(pos) +#ifndef _GL_ATTRIBUTE_SENTINEL +# if _GL_HAS_ATTRIBUTE (sentinel) +# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) +# else +# define _GL_ATTRIBUTE_SENTINEL(pos) +# endif #endif /* A helper macro. Don't use it directly. */ -#if _GL_HAS_ATTRIBUTE (unused) -# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -#else -# define _GL_ATTRIBUTE_UNUSED +#ifndef _GL_ATTRIBUTE_UNUSED +# if _GL_HAS_ATTRIBUTE (unused) +# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define _GL_ATTRIBUTE_UNUSED +# endif #endif @@ -1206,10 +1378,24 @@ /* Applies to: label (both in C and C++). */ /* Note that g++ < 4.5 does not support the '__attribute__ ((__unused__)) ;' syntax. But clang does. */ -#if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__ -# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED +#ifndef _GL_UNUSED_LABEL +# if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__ +# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED +# else +# define _GL_UNUSED_LABEL +# endif +#endif + + +/* In C++, there is the concept of "language linkage", that encompasses + name mangling and function calling conventions. + The following macros start and end a block of "C" linkage. */ +#ifdef __cplusplus +# define _GL_BEGIN_C_LINKAGE extern "C" { +# define _GL_END_C_LINKAGE } #else -# define _GL_UNUSED_LABEL +# define _GL_BEGIN_C_LINKAGE +# define _GL_END_C_LINKAGE #endif @@ -1292,3 +1478,37 @@ /* Define as a macro for copying va_list variables. */ /* #undef va_copy */ + +#ifndef HAVE_C_BOOL +# if !defined __cplusplus && !defined __bool_true_false_are_defined +# if HAVE_STDBOOL_H +# include <stdbool.h> +# else +# if defined __SUNPRO_C +# error "<stdbool.h> is not usable with this configuration. To make it usable, add -D_STDC_C99= to $CC." +# else +# error "<stdbool.h> does not exist on this platform. Use gnulib module 'stdbool-c99' instead of gnulib module 'stdbool'." +# endif +# endif +# endif +# if !true +# define true (!false) +# endif +#endif + +#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ + && (!defined __cplusplus \ + || (__cpp_static_assert < 201411 \ + && __GNUG__ < 6 && __clang_major__ < 6))) + #include <assert.h> + #undef/**/assert + #ifdef __sgi + #undef/**/__ASSERT_H__ + #endif + /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. + We need it also to be invocable with a single argument. */ + #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus + #undef/**/static_assert + #define static_assert _Static_assert + #endif +#endif diff --git a/contrib/libs/libidn/gl/alloca.h b/contrib/libs/libidn/gl/alloca.h index d21d810c66..dbf5fc130c 100644 --- a/contrib/libs/libidn/gl/alloca.h +++ b/contrib/libs/libidn/gl/alloca.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001-2004, 2006-2022 Free Software Foundation, + Copyright (C) 1995, 1999, 2001-2004, 2006-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify diff --git a/contrib/libs/libidn/gl/basename-lgpl.c b/contrib/libs/libidn/gl/basename-lgpl.c index eb07e25413..256f84609c 100644 --- a/contrib/libs/libidn/gl/basename-lgpl.c +++ b/contrib/libs/libidn/gl/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-2022 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify @@ -21,7 +21,6 @@ /* Specification. */ #include "basename-lgpl.h" -#include <stdbool.h> #include <string.h> #include "filename.h" diff --git a/contrib/libs/libidn/gl/basename-lgpl.h b/contrib/libs/libidn/gl/basename-lgpl.h index 5569f21933..2a56be98e2 100644 --- a/contrib/libs/libidn/gl/basename-lgpl.h +++ b/contrib/libs/libidn/gl/basename-lgpl.h @@ -1,6 +1,6 @@ /* Extract the last component (base name) of a file name. - Copyright (C) 1998, 2001, 2003-2006, 2009-2022 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify @@ -19,6 +19,11 @@ #ifndef _BASENAME_LGPL_H #define _BASENAME_LGPL_H +/* This file uses _GL_ATTRIBUTE_PURE. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include <stddef.h> #ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT diff --git a/contrib/libs/libidn/gl/fd-hook.c b/contrib/libs/libidn/gl/fd-hook.c index 64a7a80c06..75bbe49c92 100644 --- a/contrib/libs/libidn/gl/fd-hook.c +++ b/contrib/libs/libidn/gl/fd-hook.c @@ -1,5 +1,5 @@ /* Hook for making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2009-2024 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This file is free software: you can redistribute it and/or modify diff --git a/contrib/libs/libidn/gl/fd-hook.h b/contrib/libs/libidn/gl/fd-hook.h index d6c4964d1c..2150460bc1 100644 --- a/contrib/libs/libidn/gl/fd-hook.h +++ b/contrib/libs/libidn/gl/fd-hook.h @@ -1,5 +1,5 @@ /* Hook for making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2009-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/contrib/libs/libidn/gl/filename.h b/contrib/libs/libidn/gl/filename.h index ab77ca2df9..a2400a9dfe 100644 --- a/contrib/libs/libidn/gl/filename.h +++ b/contrib/libs/libidn/gl/filename.h @@ -1,5 +1,5 @@ /* Basic filename support macros. - Copyright (C) 2001-2022 Free Software Foundation, Inc. + Copyright (C) 2001-2023 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 diff --git a/contrib/libs/libidn/gl/getprogname.c b/contrib/libs/libidn/gl/getprogname.c index 547a684feb..38d033c189 100644 --- a/contrib/libs/libidn/gl/getprogname.c +++ b/contrib/libs/libidn/gl/getprogname.c @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2016-2022 Free Software Foundation, Inc. + Copyright (C) 2016-2024 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -16,11 +16,10 @@ #include <config.h> -/* Specification. */ -#include "getprogname.h" +/* Specification. Also get __argv declaration. */ +#include <stdlib.h> #include <errno.h> /* get program_invocation_name declaration */ -#include <stdlib.h> /* get __argv declaration */ #ifdef _AIX # include <unistd.h> @@ -53,13 +52,12 @@ #if defined __SCO_VERSION__ || defined __sysv5__ # include <fcntl.h> -# include <stdlib.h> # include <string.h> #endif #include "basename-lgpl.h" -#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */ +#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Solaris >= 11, Cygwin, Android API level >= 21 */ char const * getprogname (void) { @@ -214,7 +212,19 @@ getprogname (void) { char *s = strdup (last_component (buf.ps_pathptr)); if (s) - p = s; + { +# if defined __XPLINK__ && __CHARSET_LIB == 1 + /* The compiler option -qascii is in use. + https://makingdeveloperslivesbetter.wordpress.com/2022/01/07/is-z-os-ascii-or-ebcdic-yes/ + https://www.ibm.com/docs/en/zos/2.5.0?topic=features-macros-related-compiler-option-settings + So, convert the result from EBCDIC to ASCII. + https://www.ibm.com/docs/en/zos/2.5.0?topic=functions-e2a-s-convert-string-from-ebcdic-ascii */ + if (__e2a_s (s) == (size_t)-1) + free (s); + else +# endif + p = s; + } break; } } diff --git a/contrib/libs/libidn/gl/getprogname.h b/contrib/libs/libidn/gl/getprogname.h deleted file mode 100644 index 9a35e584ee..0000000000 --- a/contrib/libs/libidn/gl/getprogname.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Program name management. - Copyright (C) 2016-2022 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <https://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/libs/libidn/gl/gettext.h b/contrib/libs/libidn/gl/gettext.h index b3577a043f..39d5ae4daa 100644 --- a/contrib/libs/libidn/gl/gettext.h +++ b/contrib/libs/libidn/gl/gettext.h @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2022 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify diff --git a/contrib/libs/libidn/gl/idx.h b/contrib/libs/libidn/gl/idx.h index c3669ddaca..f9ce0acd57 100644 --- a/contrib/libs/libidn/gl/idx.h +++ b/contrib/libs/libidn/gl/idx.h @@ -1,5 +1,5 @@ /* A type for indices and sizes. - Copyright (C) 2020-2022 Free Software Foundation, Inc. + Copyright (C) 2020-2024 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 diff --git a/contrib/libs/libidn/gl/intprops-internal.h b/contrib/libs/libidn/gl/intprops-internal.h new file mode 100644 index 0000000000..c8a87d2bb2 --- /dev/null +++ b/contrib/libs/libidn/gl/intprops-internal.h @@ -0,0 +1,397 @@ +/* intprops-internal.h -- properties of integer types not visible to users + + Copyright (C) 2001-2024 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#ifndef _GL_INTPROPS_INTERNAL_H +#define _GL_INTPROPS_INTERNAL_H + +#include <limits.h> + +/* Pacify GCC 13.2 in some calls to _GL_EXPR_SIGNED. */ +#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__) +# pragma GCC diagnostic ignored "-Wtype-limits" +#endif + +/* Return a value with the common real type of E and V and the value of V. + Do not evaluate E. */ +#define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) + +/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see + <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00406.html>. */ +#define _GL_INT_NEGATE_CONVERT(e, v) ((1 ? 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 real type T is signed. */ +#define _GL_TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) + +/* Return 1 if the real expression E, after promotion, has a + signed or floating type. Do not evaluate E. */ +#define _GL_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. + Do not evaluate T. T must not be a bit-field expression. + Padding bits are not supported; this is checked at compile-time below. */ +#define _GL_TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) + +/* The maximum and minimum values for the type of the expression E, + after integer promotion. E is not evaluated. */ +#define _GL_INT_MINIMUM(e) \ + (_GL_EXPR_SIGNED (e) \ + ? ~ _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_CONVERT (e, 0)) +#define _GL_INT_MAXIMUM(e) \ + (_GL_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) << (_GL_TYPE_WIDTH (+ (e)) - 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. + This assumption is tested by the intprops-tests module. */ + +/* 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__ \ + || (4 <= __clang_major__) \ + || (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. T must not be a bit-field expression. + 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) _GL_TYPE_SIGNED (__typeof__ (t)) +#else +# define _GL_SIGNED_TYPE_OR_EXPR(t) 1 +#endif + +/* Return 1 if - A would overflow in [MIN,MAX] arithmetic. + A should not have side effects, and A's type should be an + integer with minimum value MIN and maximum MAX. */ +#define _GL_INT_NEGATE_RANGE_OVERFLOW(a, min, max) \ + ((min) < 0 ? (a) < - (max) : 0 < (a)) + +/* True if __builtin_add_overflow (A, B, P) and __builtin_sub_overflow + (A, B, P) work when P is non-null. */ +#ifdef __EDG__ +/* EDG-based compilers like nvc 22.1 cannot add 64-bit signed to unsigned + <https://bugs.gnu.org/53256>. */ +# define _GL_HAS_BUILTIN_ADD_OVERFLOW 0 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow) +/* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x, + see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269>. */ +#elif 7 <= __GNUC__ +# define _GL_HAS_BUILTIN_ADD_OVERFLOW 1 +#else +# define _GL_HAS_BUILTIN_ADD_OVERFLOW 0 +#endif + +/* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */ +#if defined __clang_major__ && __clang_major__ < 14 +/* Work around Clang bug <https://bugs.llvm.org/show_bug.cgi?id=16404>. */ +# define _GL_HAS_BUILTIN_MUL_OVERFLOW 0 +#else +# define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW +#endif + +/* True if __builtin_add_overflow_p (A, B, C) works, and similarly for + __builtin_sub_overflow_p and __builtin_mul_overflow_p. */ +#ifdef __EDG__ +/* In EDG-based compilers like ICC 2021.3 and earlier, + __builtin_add_overflow_p etc. are not treated as integral constant + expressions even when all arguments are. */ +# define _GL_HAS_BUILTIN_OVERFLOW_P 0 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_OVERFLOW_P __has_builtin (__builtin_mul_overflow_p) +#else +# define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__) +#endif + +#if (!defined _GL_STDCKDINT_H && 202311 <= __STDC_VERSION__ \ + && ! (_GL_HAS_BUILTIN_ADD_OVERFLOW && _GL_HAS_BUILTIN_MUL_OVERFLOW)) +# include <stdckdint.h> +#endif + +/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R. + Return 1 if the result overflows. Arguments should not have side + effects and A, B and *R can be of any integer type other than char, + bool, a bit-precise integer type, or an enumeration type. */ +#if _GL_HAS_BUILTIN_ADD_OVERFLOW +# define _GL_INT_ADD_WRAPV(a, b, r) __builtin_add_overflow (a, b, r) +# define _GL_INT_SUBTRACT_WRAPV(a, b, r) __builtin_sub_overflow (a, b, r) +#elif defined ckd_add && defined ckd_sub && !defined _GL_STDCKDINT_H +# define _GL_INT_ADD_WRAPV(a, b, r) ckd_add (r, + (a), + (b)) +# define _GL_INT_SUBTRACT_WRAPV(a, b, r) ckd_sub (r, + (a), + (b)) +#else +# define _GL_INT_ADD_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW) +# define _GL_INT_SUBTRACT_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW) +#endif +#if _GL_HAS_BUILTIN_MUL_OVERFLOW +# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \ + || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \ + && !defined __EDG__) +# define _GL_INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r) +# else + /* Work around GCC bug 91450. */ +# define _GL_INT_MULTIPLY_WRAPV(a, b, r) \ + ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && _GL_EXPR_SIGNED (a) && _GL_EXPR_SIGNED (b) \ + && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \ + ? ((void) __builtin_mul_overflow (a, b, r), 1) \ + : __builtin_mul_overflow (a, b, r)) +# endif +#elif defined ckd_mul && !defined _GL_STDCKDINT_H +# define _GL_INT_MULTIPLY_WRAPV(a, b, r) ckd_mul (r, + (a), + (b)) +#else +# define _GL_INT_MULTIPLY_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) +#endif + +/* 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 compilers that + lack relevant builtins. */ +#if __GNUC__ || defined __clang__ +# 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 and OVERFLOW the overflow predicate. Return 1 if the + result overflows. Arguments should not have side effects, + and A, B and *R can be of any integer type other than char, bool, a + bit-precise integer type, or an enumeration type. */ +#if 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS +# define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ + (_Generic \ + (*(r), \ + signed char: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + signed char, SCHAR_MIN, SCHAR_MAX), \ + unsigned char: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned char, 0, UCHAR_MAX), \ + short int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + short int, SHRT_MIN, SHRT_MAX), \ + unsigned short int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned short int, 0, USHRT_MAX), \ + int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX), \ + unsigned int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned int, 0, UINT_MAX), \ + long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX), \ + unsigned long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + unsigned long int, 0, ULONG_MAX), \ + long long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX), \ + unsigned long long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + unsigned long long int, 0, ULLONG_MAX))) +#else +/* Store the low-order bits of A <op> B into *R, where OP specifies + the operation and OVERFLOW the overflow predicate. If *R is + signed, its type is ST with bounds SMIN..SMAX; otherwise its type + is UT with bounds U..UMAX. ST and UT are narrower than int. + Return 1 if the result overflows. Arguments should not have side + effects, and A, B and *R can be of any integer type other than + char, bool, a bit-precise integer type, or an enumeration type. */ +# if _GL_HAVE___TYPEOF__ +# define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ + (_GL_TYPE_SIGNED (__typeof__ (*(r))) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, st, smin, smax) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, ut, 0, umax)) +# else +# define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ + (overflow (a, b, smin, smax) \ + ? (overflow (a, b, 0, umax) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 1) \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) < 0) \ + : (overflow (a, b, 0, umax) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) >= 0 \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 0))) +# endif + +# define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ + (sizeof *(r) == sizeof (signed char) \ + ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \ + signed char, SCHAR_MIN, SCHAR_MAX, \ + unsigned char, UCHAR_MAX) \ + : sizeof *(r) == sizeof (short int) \ + ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \ + short int, SHRT_MIN, SHRT_MAX, \ + unsigned short int, USHRT_MAX) \ + : sizeof *(r) == sizeof (int) \ + ? (_GL_EXPR_SIGNED (*(r)) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned int, 0, UINT_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_EXPR_SIGNED (*(r)) \ + ? _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 int, \ + unsigned long int, 0, ULONG_MAX)) \ + : (_GL_EXPR_SIGNED (*(r)) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + unsigned long long int, 0, ULLONG_MAX))) +# else +# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ + (_GL_EXPR_SIGNED (*(r)) \ + ? _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 int, \ + unsigned long int, 0, ULONG_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 extrema TMIN and TMAX. + T can be any signed integer type other than char, bool, a + bit-precise integer type, or an enumeration type. + Return 1 if the result overflows. */ +#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \ + (overflow (a, b, tmin, tmax) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0)) + +/* Return 1 if the integer expressions A - B and -A would overflow, + respectively. Arguments should not have side effects, + and can be any signed integer type other than char, bool, a + bit-precise integer type, or an enumeration type. + These macros are tuned for their last input argument being a constant. */ + +#if _GL_HAS_BUILTIN_OVERFLOW_P +# define _GL_INT_NEGATE_OVERFLOW(a) \ + __builtin_sub_overflow_p (0, a, (__typeof__ (- (a))) 0) +#else +# define _GL_INT_NEGATE_OVERFLOW(a) \ + _GL_INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) +#endif + +/* Return the low-order bits of A <op> B, where the operation is given + by OP. Use the unsigned type UT for calculation to avoid undefined + behavior on signed integer overflow, and convert the result to type T. + UT is at least as wide as T and is no narrower than unsigned int, + T is two's complement, and there is no padding or trap representations. + Assume that converting UT to T yields the low-order bits, as is + done in all known two's-complement C compilers. E.g., see: + https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html + + According to the C standard, converting UT to T yields an + implementation-defined result or signal for values outside T's + range. However, code that works around this theoretical problem + runs afoul of a compiler bug in Oracle Studio 12.3 x86. See: + https://lists.gnu.org/r/bug-gnulib/2017-04/msg00049.html + As the compiler bug is real, don't try to work around the + theoretical problem. */ + +#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \ + ((t) ((ut) (a) op (ut) (b))) + +/* Return true if the numeric values A + B, A - B, A * B fall outside + the range TMIN..TMAX. Arguments should not have side effects + and can be any integer type other than char, bool, + a bit-precise integer type, or an enumeration type. + TMIN should be signed and nonpositive. + TMAX should be positive, and should be signed unless TMIN is zero. */ +#define _GL_INT_ADD_RANGE_OVERFLOW(a, b, tmin, tmax) \ + ((b) < 0 \ + ? (((tmin) \ + ? ((_GL_EXPR_SIGNED (_GL_INT_CONVERT (a, (tmin) - (b))) || (b) < (tmin)) \ + && (a) < (tmin) - (b)) \ + : (a) <= -1 - (b)) \ + || ((_GL_EXPR_SIGNED (a) ? 0 <= (a) : (tmax) < (a)) && (tmax) < (a) + (b))) \ + : (a) < 0 \ + ? (((tmin) \ + ? ((_GL_EXPR_SIGNED (_GL_INT_CONVERT (b, (tmin) - (a))) || (a) < (tmin)) \ + && (b) < (tmin) - (a)) \ + : (b) <= -1 - (a)) \ + || ((_GL_EXPR_SIGNED (_GL_INT_CONVERT (a, b)) || (tmax) < (b)) \ + && (tmax) < (a) + (b))) \ + : (tmax) < (b) || (tmax) - (b) < (a)) +#define _GL_INT_SUBTRACT_RANGE_OVERFLOW(a, b, tmin, tmax) \ + (((a) < 0) == ((b) < 0) \ + ? ((a) < (b) \ + ? !(tmin) || -1 - (tmin) < (b) - (a) - 1 \ + : (tmax) < (a) - (b)) \ + : (a) < 0 \ + ? ((!_GL_EXPR_SIGNED (_GL_INT_CONVERT ((a) - (tmin), b)) && (a) - (tmin) < 0) \ + || (a) - (tmin) < (b)) \ + : ((! (_GL_EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \ + && _GL_EXPR_SIGNED (_GL_INT_CONVERT ((tmax) + (b), a))) \ + && (tmax) <= -1 - (b)) \ + || (tmax) + (b) < (a))) +#define _GL_INT_MULTIPLY_RANGE_OVERFLOW(a, b, tmin, tmax) \ + ((b) < 0 \ + ? ((a) < 0 \ + ? (_GL_EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \ + ? (a) < (tmax) / (b) \ + : ((_GL_INT_NEGATE_OVERFLOW (b) \ + ? _GL_INT_CONVERT (b, tmax) >> (_GL_TYPE_WIDTH (+ (b)) - 1) \ + : (tmax) / -(b)) \ + <= -1 - (a))) \ + : _GL_INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (b, tmin)) && (b) == -1 \ + ? (_GL_EXPR_SIGNED (a) \ + ? 0 < (a) + (tmin) \ + : 0 < (a) && -1 - (tmin) < (a) - 1) \ + : (tmin) / (b) < (a)) \ + : (b) == 0 \ + ? 0 \ + : ((a) < 0 \ + ? (_GL_INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (a, tmin)) && (a) == -1 \ + ? (_GL_EXPR_SIGNED (b) ? 0 < (b) + (tmin) : -1 - (tmin) < (b) - 1) \ + : (tmin) / (a) < (b)) \ + : (tmax) / (b) < (a))) + +#endif /* _GL_INTPROPS_INTERNAL_H */ diff --git a/contrib/libs/libidn/gl/intprops.h b/contrib/libs/libidn/gl/intprops.h deleted file mode 100644 index d4a917f72a..0000000000 --- a/contrib/libs/libidn/gl/intprops.h +++ /dev/null @@ -1,642 +0,0 @@ -/* intprops.h -- properties of integer types - - Copyright (C) 2001-2022 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published - by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. */ - - -#ifndef _GL_INTPROPS_H -#define _GL_INTPROPS_H - -#include <limits.h> - -/* Return a value with the common real type of E and V and the value of V. - Do not evaluate E. */ -#define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) - -/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see - <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00406.html>. */ -#define _GL_INT_NEGATE_CONVERT(e, v) ((1 ? 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. Do not evaluate E. */ -#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. - Do not evaluate T. T must not be a bit-field expression. - 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 is not evaluated. */ -#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)) - 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. - This assumption is tested by the intprops-tests module. */ - -/* 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__ \ - || (4 <= __clang_major__) \ - || (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. T must not be a bit-field expression. - 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. - T must not be a bit-field expression. - - 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 1 when its argument is - unsigned, 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. T must not be a bit-field expression. */ -#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 harder to use and may be less - efficient than the INT_<op>_WRAPV, INT_<op>_OK, and - 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. - - Because all arguments are subject to integer promotions, these - macros typically do not work on types narrower than 'int'. - - 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 - <https://lists.gnu.org/r/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) and __builtin_sub_overflow - (A, B, P) work when P is non-null. */ -#ifdef __EDG__ -/* EDG-based compilers like nvc 22.1 cannot add 64-bit signed to unsigned - <https://bugs.gnu.org/53256>. */ -# define _GL_HAS_BUILTIN_ADD_OVERFLOW 0 -#elif defined __has_builtin -# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow) -/* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x, - see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269>. */ -#elif 7 <= __GNUC__ -# define _GL_HAS_BUILTIN_ADD_OVERFLOW 1 -#else -# define _GL_HAS_BUILTIN_ADD_OVERFLOW 0 -#endif - -/* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */ -#if defined __clang_major__ && __clang_major__ < 14 -/* Work around Clang bug <https://bugs.llvm.org/show_bug.cgi?id=16404>. */ -# define _GL_HAS_BUILTIN_MUL_OVERFLOW 0 -#else -# define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW -#endif - -/* True if __builtin_add_overflow_p (A, B, C) works, and similarly for - __builtin_sub_overflow_p and __builtin_mul_overflow_p. */ -#ifdef __EDG__ -/* In EDG-based compilers like ICC 2021.3 and earlier, - __builtin_add_overflow_p etc. are not treated as integral constant - expressions even when all arguments are. */ -# define _GL_HAS_BUILTIN_OVERFLOW_P 0 -#elif defined __has_builtin -# define _GL_HAS_BUILTIN_OVERFLOW_P __has_builtin (__builtin_mul_overflow_p) -#else -# define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__) -#endif - -/* 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 compute the low-order bits of the sum, - difference, and product of two C integers, and return 1 if these - low-order bits are not numerically correct. - 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 *. - - Because the WRAPV macros convert the result, they report overflow - in different circumstances than the OVERFLOW macros do. For - example, in the typical case with 16-bit 'short' and 32-bit 'int', - if A, B and R are all of type 'short' then INT_ADD_OVERFLOW (A, B) - returns false because the addition cannot overflow after A and B - are converted to 'int', whereas INT_ADD_WRAPV (A, B, &R) returns - true or false depending on whether the sum fits into 'short'. - - These macros are tuned for their last input 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 (_GL_INT_CONVERT (a, b)), \ - _GL_INT_MAXIMUM (_GL_INT_CONVERT (a, b))) - -/* 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. */ -#if _GL_HAS_BUILTIN_ADD_OVERFLOW -# define INT_ADD_WRAPV(a, b, r) __builtin_add_overflow (a, b, r) -# define INT_SUBTRACT_WRAPV(a, b, r) __builtin_sub_overflow (a, b, r) -#else -# define INT_ADD_WRAPV(a, b, r) \ - _GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW) -# define INT_SUBTRACT_WRAPV(a, b, r) \ - _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW) -#endif -#if _GL_HAS_BUILTIN_MUL_OVERFLOW -# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \ - || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \ - && !defined __EDG__) -# define INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r) -# else - /* Work around GCC bug 91450. */ -# define INT_MULTIPLY_WRAPV(a, b, r) \ - ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \ - && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \ - ? ((void) __builtin_mul_overflow (a, b, r), 1) \ - : __builtin_mul_overflow (a, b, r)) -# endif -#else -# define INT_MULTIPLY_WRAPV(a, b, r) \ - _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) -#endif - -/* 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 compilers that - lack relevant builtins. */ -#if __GNUC__ || defined __clang__ -# 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 and OVERFLOW the overflow predicate. Return 1 if the - result overflows. See above for restrictions. */ -#if 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS -# define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ - (_Generic \ - (*(r), \ - signed char: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ - signed char, SCHAR_MIN, SCHAR_MAX), \ - unsigned char: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ - unsigned char, 0, UCHAR_MAX), \ - short int: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ - short int, SHRT_MIN, SHRT_MAX), \ - unsigned short int: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ - unsigned short int, 0, USHRT_MAX), \ - int: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ - int, INT_MIN, INT_MAX), \ - unsigned int: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ - unsigned int, 0, UINT_MAX), \ - long int: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ - long int, LONG_MIN, LONG_MAX), \ - unsigned long int: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ - unsigned long int, 0, ULONG_MAX), \ - long long int: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ - long long int, LLONG_MIN, LLONG_MAX), \ - unsigned long long int: \ - _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ - unsigned long long int, 0, ULLONG_MAX))) -#else -/* Store the low-order bits of A <op> B into *R, where OP specifies - the operation and OVERFLOW the overflow predicate. If *R is - signed, its type is ST with bounds SMIN..SMAX; otherwise its type - is UT with bounds U..UMAX. ST and UT are narrower than int. - Return 1 if the result overflows. See above for restrictions. */ -# if _GL_HAVE___TYPEOF__ -# define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ - (TYPE_SIGNED (__typeof__ (*(r))) \ - ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, st, smin, smax) \ - : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, ut, 0, umax)) -# else -# define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ - (overflow (a, b, smin, smax) \ - ? (overflow (a, b, 0, umax) \ - ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 1) \ - : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) < 0) \ - : (overflow (a, b, 0, umax) \ - ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) >= 0 \ - : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 0))) -# endif - -# define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ - (sizeof *(r) == sizeof (signed char) \ - ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \ - signed char, SCHAR_MIN, SCHAR_MAX, \ - unsigned char, UCHAR_MAX) \ - : sizeof *(r) == sizeof (short int) \ - ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \ - short int, SHRT_MIN, SHRT_MAX, \ - unsigned short int, USHRT_MAX) \ - : sizeof *(r) == sizeof (int) \ - ? (EXPR_SIGNED (*(r)) \ - ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ - int, INT_MIN, INT_MAX) \ - : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ - unsigned int, 0, UINT_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) \ - ? (EXPR_SIGNED (*(r)) \ - ? _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 int, \ - unsigned long int, 0, ULONG_MAX)) \ - : (EXPR_SIGNED (*(r)) \ - ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ - long long int, LLONG_MIN, LLONG_MAX) \ - : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ - unsigned long long int, 0, ULLONG_MAX))) -# else -# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ - (EXPR_SIGNED (*(r)) \ - ? _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 int, \ - unsigned long int, 0, ULONG_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 extrema 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) \ - (overflow (a, b, tmin, tmax) \ - ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \ - : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0)) - -/* Return the low-order bits of A <op> B, where the operation is given - by OP. Use the unsigned type UT for calculation to avoid undefined - behavior on signed integer overflow, and convert the result to type T. - UT is at least as wide as T and is no narrower than unsigned int, - T is two's complement, and there is no padding or trap representations. - Assume that converting UT to T yields the low-order bits, as is - done in all known two's-complement C compilers. E.g., see: - https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html - - According to the C standard, converting UT to T yields an - implementation-defined result or signal for values outside T's - range. However, code that works around this theoretical problem - runs afoul of a compiler bug in Oracle Studio 12.3 x86. See: - https://lists.gnu.org/r/bug-gnulib/2017-04/msg00049.html - As the compiler bug is real, don't try to work around the - theoretical problem. */ - -#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \ - ((t) ((ut) (a) op (ut) (b))) - -/* Return true if the numeric values A + B, A - B, A * B fall outside - the range TMIN..TMAX. Arguments should be integer expressions - without side effects. TMIN should be signed and nonpositive. - TMAX should be positive, and should be signed unless TMIN is zero. */ -#define _GL_INT_ADD_RANGE_OVERFLOW(a, b, tmin, tmax) \ - ((b) < 0 \ - ? (((tmin) \ - ? ((EXPR_SIGNED (_GL_INT_CONVERT (a, (tmin) - (b))) || (b) < (tmin)) \ - && (a) < (tmin) - (b)) \ - : (a) <= -1 - (b)) \ - || ((EXPR_SIGNED (a) ? 0 <= (a) : (tmax) < (a)) && (tmax) < (a) + (b))) \ - : (a) < 0 \ - ? (((tmin) \ - ? ((EXPR_SIGNED (_GL_INT_CONVERT (b, (tmin) - (a))) || (a) < (tmin)) \ - && (b) < (tmin) - (a)) \ - : (b) <= -1 - (a)) \ - || ((EXPR_SIGNED (_GL_INT_CONVERT (a, b)) || (tmax) < (b)) \ - && (tmax) < (a) + (b))) \ - : (tmax) < (b) || (tmax) - (b) < (a)) -#define _GL_INT_SUBTRACT_RANGE_OVERFLOW(a, b, tmin, tmax) \ - (((a) < 0) == ((b) < 0) \ - ? ((a) < (b) \ - ? !(tmin) || -1 - (tmin) < (b) - (a) - 1 \ - : (tmax) < (a) - (b)) \ - : (a) < 0 \ - ? ((!EXPR_SIGNED (_GL_INT_CONVERT ((a) - (tmin), b)) && (a) - (tmin) < 0) \ - || (a) - (tmin) < (b)) \ - : ((! (EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \ - && EXPR_SIGNED (_GL_INT_CONVERT ((tmax) + (b), a))) \ - && (tmax) <= -1 - (b)) \ - || (tmax) + (b) < (a))) -#define _GL_INT_MULTIPLY_RANGE_OVERFLOW(a, b, tmin, tmax) \ - ((b) < 0 \ - ? ((a) < 0 \ - ? (EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \ - ? (a) < (tmax) / (b) \ - : ((INT_NEGATE_OVERFLOW (b) \ - ? _GL_INT_CONVERT (b, tmax) >> (TYPE_WIDTH (+ (b)) - 1) \ - : (tmax) / -(b)) \ - <= -1 - (a))) \ - : INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (b, tmin)) && (b) == -1 \ - ? (EXPR_SIGNED (a) \ - ? 0 < (a) + (tmin) \ - : 0 < (a) && -1 - (tmin) < (a) - 1) \ - : (tmin) / (b) < (a)) \ - : (b) == 0 \ - ? 0 \ - : ((a) < 0 \ - ? (INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (a, tmin)) && (a) == -1 \ - ? (EXPR_SIGNED (b) ? 0 < (b) + (tmin) : -1 - (tmin) < (b) - 1) \ - : (tmin) / (a) < (b)) \ - : (tmax) / (b) < (a))) - -/* The following macros compute A + B, A - B, and A * B, respectively. - If no overflow occurs, they set *R to the result and return 1; - otherwise, they return 0 and may modify *R. - - Example usage: - - long int result; - if (INT_ADD_OK (a, b, &result)) - printf ("result is %ld\n", result); - else - printf ("overflow\n"); - - A, B, and *R should be integers; they need not be the same type, - and they need not be all signed or all unsigned. - - These macros work correctly on all known practical hosts, and do not rely - on undefined behavior due to signed arithmetic overflow. - - These macros are not constant expressions. - - These macros may evaluate their arguments zero or multiple times, so the - arguments should not have side effects. - - These macros are tuned for B being a constant. */ - -#define INT_ADD_OK(a, b, r) ! INT_ADD_WRAPV (a, b, r) -#define INT_SUBTRACT_OK(a, b, r) ! INT_SUBTRACT_WRAPV (a, b, r) -#define INT_MULTIPLY_OK(a, b, r) ! INT_MULTIPLY_WRAPV (a, b, r) - -#endif /* _GL_INTPROPS_H */ diff --git a/contrib/libs/libidn/gl/malloca.c b/contrib/libs/libidn/gl/malloca.c index e7beaaf066..b3a01e719c 100644 --- a/contrib/libs/libidn/gl/malloca.c +++ b/contrib/libs/libidn/gl/malloca.c @@ -1,5 +1,5 @@ /* Safe automatic memory allocation. - Copyright (C) 2003, 2006-2007, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2024 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003, 2018. This file is free software: you can redistribute it and/or modify @@ -21,9 +21,12 @@ /* Specification. */ #include "malloca.h" +#include <stdckdint.h> +#if defined __CHERI_PURE_CAPABILITY__ +# error #include <cheri.h> +#endif + #include "idx.h" -#include "intprops.h" -#include "verify.h" /* The speed critical point in this file is freea() applied to an alloca() result: it must be fast, to match the speed of alloca(). The speed of @@ -36,10 +39,15 @@ allocation. - NULL comes from a failed heap allocation. */ +#if defined __CHERI_PURE_CAPABILITY__ +/* Type for holding the original malloc() result. */ +typedef uintptr_t small_t; +#else /* Type for holding very small pointer differences. */ typedef unsigned char small_t; /* Verify that it is wide enough. */ -verify (2 * sa_alignment_max - 1 <= (small_t) -1); +static_assert (2 * sa_alignment_max - 1 <= (small_t) -1); +#endif void * mmalloca (size_t n) @@ -50,27 +58,34 @@ mmalloca (size_t n) uintptr_t alignment2_mask = 2 * sa_alignment_max - 1; int plus = sizeof (small_t) + alignment2_mask; idx_t nplus; - if (!INT_ADD_WRAPV (n, plus, &nplus) && !xalloc_oversized (nplus, 1)) + if (!ckd_add (&nplus, n, plus) && !xalloc_oversized (nplus, 1)) { char *mem = (char *) malloc (nplus); if (mem != NULL) { - uintptr_t umem = (uintptr_t)mem, umemplus; - /* The INT_ADD_WRAPV avoids signed integer overflow on + uintptr_t umem = (uintptr_t) mem; + /* The ckd_add avoids signed integer overflow on theoretical platforms where UINTPTR_MAX <= INT_MAX. */ - INT_ADD_WRAPV (umem, sizeof (small_t) + sa_alignment_max - 1, - &umemplus); - idx_t offset = ((umemplus & ~alignment2_mask) + uintptr_t umemplus; + ckd_add (&umemplus, umem, sizeof (small_t) + sa_alignment_max - 1); + idx_t offset = (umemplus - umemplus % (2 * sa_alignment_max) + sa_alignment_max - umem); - void *vp = mem + offset; - small_t *p = vp; + void *p = mem + offset; /* Here p >= mem + sizeof (small_t), and p <= mem + sizeof (small_t) + 2 * sa_alignment_max - 1 hence p + n <= mem + nplus. So, the memory range [p, p+n) lies in the allocated memory range [mem, mem + nplus). */ - p[-1] = offset; + small_t *sp = p; +# if defined __CHERI_PURE_CAPABILITY__ + sp[-1] = umem; + p = (char *) cheri_bounds_set ((char *) p - sizeof (small_t), + sizeof (small_t) + n) + + sizeof (small_t); +# else + sp[-1] = offset; +# endif /* p ≡ sa_alignment_max mod 2*sa_alignment_max. */ return p; } @@ -91,15 +106,22 @@ void freea (void *p) { /* Check argument. */ - if ((uintptr_t) p & (sa_alignment_max - 1)) + uintptr_t u = (uintptr_t) p; + if (u & (sa_alignment_max - 1)) { /* p was not the result of a malloca() call. Invalid argument. */ abort (); } /* Determine whether p was a non-NULL pointer returned by mmalloca(). */ - if ((uintptr_t) p & sa_alignment_max) + if (u & sa_alignment_max) { - void *mem = (char *) p - ((small_t *) p)[-1]; + char *cp = p; + small_t *sp = p; +# if defined __CHERI_PURE_CAPABILITY__ + void *mem = sp[-1]; +# else + void *mem = cp - sp[-1]; +# endif free (mem); } } diff --git a/contrib/libs/libidn/gl/malloca.h b/contrib/libs/libidn/gl/malloca.h index 7ec235f370..cb8b6cbd4d 100644 --- a/contrib/libs/libidn/gl/malloca.h +++ b/contrib/libs/libidn/gl/malloca.h @@ -1,5 +1,5 @@ /* Safe automatic memory allocation. - Copyright (C) 2003-2007, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2024 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This file is free software: you can redistribute it and/or modify @@ -18,10 +18,19 @@ #ifndef _MALLOCA_H #define _MALLOCA_H +/* This file uses _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_DEALLOC, + _GL_ATTRIBUTE_MALLOC, HAVE_ALLOCA. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include <alloca.h> #include <stddef.h> #include <stdlib.h> #include <stdint.h> +#if defined __CHERI_PURE_CAPABILITY__ +# error #include <cheri.h> +#endif #include "xalloc-oversized.h" @@ -62,12 +71,24 @@ extern void freea (void *p); memory allocated on the stack, that must be freed using freea() before the function returns. Upon failure, it returns NULL. */ #if HAVE_ALLOCA -# define malloca(N) \ - ((N) < 4032 - (2 * sa_alignment_max - 1) \ - ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \ - + (2 * sa_alignment_max - 1)) \ - & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ - : mmalloca (N)) +# if defined __CHERI_PURE_CAPABILITY__ +# define malloca(N) \ + ((N) < 4032 - (2 * sa_alignment_max - 1) \ + ? cheri_bounds_set ((void *) (((uintptr_t) \ + (char *) \ + alloca ((N) + 2 * sa_alignment_max - 1) \ + + (2 * sa_alignment_max - 1)) \ + & ~(uintptr_t)(2 * sa_alignment_max - 1)), \ + (N)) \ + : mmalloca (N)) +# else +# define malloca(N) \ + ((N) < 4032 - (2 * sa_alignment_max - 1) \ + ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \ + + (2 * sa_alignment_max - 1)) \ + & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ + : mmalloca (N)) +# endif #else # define malloca(N) \ mmalloca (N) diff --git a/contrib/libs/libidn/gl/stat-time.c b/contrib/libs/libidn/gl/stat-time.c index 3d48a2b5b0..1ab01f532c 100644 --- a/contrib/libs/libidn/gl/stat-time.c +++ b/contrib/libs/libidn/gl/stat-time.c @@ -1,6 +1,6 @@ /* stat-related time functions. - Copyright (C) 2012-2022 Free Software Foundation, Inc. + Copyright (C) 2012-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/contrib/libs/libidn/gl/stat-time.h b/contrib/libs/libidn/gl/stat-time.h index 6b0088e328..3cd8478f31 100644 --- a/contrib/libs/libidn/gl/stat-time.h +++ b/contrib/libs/libidn/gl/stat-time.h @@ -1,6 +1,6 @@ /* stat-related time functions. - Copyright (C) 2005, 2007, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -20,16 +20,18 @@ #ifndef STAT_TIME_H #define STAT_TIME_H 1 -#include "intprops.h" +/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_UNUSED, + _GL_ATTRIBUTE_PURE, HAVE_STRUCT_STAT_*. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif #include <errno.h> +#include <stdckdint.h> #include <stddef.h> #include <sys/stat.h> #include <time.h> -#ifndef _GL_INLINE_HEADER_BEGIN - #error "Please include config.h first." -#endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_STAT_TIME_INLINE # define _GL_STAT_TIME_INLINE _GL_INLINE @@ -50,11 +52,13 @@ extern "C" { #if _GL_WINDOWS_STAT_TIMESPEC || defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC # if _GL_WINDOWS_STAT_TIMESPEC || defined TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) +# define STAT_TIMESPEC_OFFSETOF(st_xtim) offsetof (struct stat, st_xtim) # else # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec) # endif #elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim##espec) +# define STAT_TIMESPEC_OFFSETOF(st_xtim) offsetof (struct stat, st_xtim##espec) #elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC # define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim##ensec) #elif defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC @@ -120,10 +124,8 @@ get_stat_atime (struct stat const *st) #ifdef STAT_TIMESPEC return STAT_TIMESPEC (st, st_atim); #else - struct timespec t; - t.tv_sec = st->st_atime; - t.tv_nsec = get_stat_atime_ns (st); - return t; + return (struct timespec) { .tv_sec = st->st_atime, + .tv_nsec = get_stat_atime_ns (st) }; #endif } @@ -134,10 +136,8 @@ get_stat_ctime (struct stat const *st) #ifdef STAT_TIMESPEC return STAT_TIMESPEC (st, st_ctim); #else - struct timespec t; - t.tv_sec = st->st_ctime; - t.tv_nsec = get_stat_ctime_ns (st); - return t; + return (struct timespec) { .tv_sec = st->st_ctime, + .tv_nsec = get_stat_ctime_ns (st) }; #endif } @@ -148,10 +148,8 @@ get_stat_mtime (struct stat const *st) #ifdef STAT_TIMESPEC return STAT_TIMESPEC (st, st_mtim); #else - struct timespec t; - t.tv_sec = st->st_mtime; - t.tv_nsec = get_stat_mtime_ns (st); - return t; + return (struct timespec) { .tv_sec = st->st_mtime, + .tv_nsec = get_stat_mtime_ns (st) }; #endif } @@ -166,8 +164,8 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st) || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC) t = STAT_TIMESPEC (st, st_birthtim); #elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC - t.tv_sec = st->st_birthtime; - t.tv_nsec = st->st_birthtimensec; + t = (struct timespec) { .tv_sec = st->st_birthtime, + .tv_nsec = st->st_birthtimensec }; #elif defined _WIN32 && ! defined __CYGWIN__ /* Native Windows platforms (but not Cygwin) put the "file creation time" in st_ctime (!). See @@ -175,13 +173,11 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st) # if _GL_WINDOWS_STAT_TIMESPEC t = st->st_ctim; # else - t.tv_sec = st->st_ctime; - t.tv_nsec = 0; + t = (struct timespec) { .tv_sec = st->st_ctime }; # endif #else /* Birth time is not supported. */ - t.tv_sec = -1; - t.tv_nsec = -1; + t = (struct timespec) { .tv_sec = -1, .tv_nsec = -1 }; #endif #if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ @@ -193,30 +189,28 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st) sometimes returns junk in the birth time fields; work around this bug if it is detected. */ if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000)) - { - t.tv_sec = -1; - t.tv_nsec = -1; - } + t = (struct timespec) { .tv_sec = -1, .tv_nsec = -1 }; #endif return t; } /* If a stat-like function returned RESULT, normalize the timestamps - in *ST, in case this platform suffers from the Solaris 11 bug where + in *ST, if this platform suffers from a macOS and Solaris bug where tv_nsec might be negative. Return the adjusted RESULT, setting errno to EOVERFLOW if normalization overflowed. This function is intended to be private to this .h file. */ _GL_STAT_TIME_INLINE int stat_time_normalize (int result, _GL_UNUSED struct stat *st) { -#if defined __sun && defined STAT_TIMESPEC +#if (((defined __APPLE__ && defined __MACH__) || defined __sun) \ + && defined STAT_TIMESPEC_OFFSETOF) if (result == 0) { long int timespec_hz = 1000000000; - short int const ts_off[] = { offsetof (struct stat, st_atim), - offsetof (struct stat, st_mtim), - offsetof (struct stat, st_ctim) }; + short int const ts_off[] = { STAT_TIMESPEC_OFFSETOF (st_atim), + STAT_TIMESPEC_OFFSETOF (st_mtim), + STAT_TIMESPEC_OFFSETOF (st_ctim) }; int i; for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++) { @@ -230,9 +224,8 @@ stat_time_normalize (int result, _GL_UNUSED struct stat *st) } ts->tv_nsec = r; /* Overflow is possible, as Solaris 11 stat can yield - tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000. - INT_ADD_WRAPV is OK, since time_t is signed on Solaris. */ - if (INT_ADD_WRAPV (q, ts->tv_sec, &ts->tv_sec)) + tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000. */ + if (ckd_add (&ts->tv_sec, q, ts->tv_sec)) { errno = EOVERFLOW; return -1; diff --git a/contrib/libs/libidn/gl/stdckdint.h b/contrib/libs/libidn/gl/stdckdint.h new file mode 100644 index 0000000000..95987395a8 --- /dev/null +++ b/contrib/libs/libidn/gl/stdckdint.h @@ -0,0 +1,36 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* stdckdint.h -- checked integer arithmetic + + Copyright 2022-2024 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#ifndef _GL_STDCKDINT_H +#define _GL_STDCKDINT_H + +#include "intprops-internal.h" + +/* Store into *R the low-order bits of A + B, A - B, A * B, respectively. + Return 1 if the result overflows, 0 otherwise. + A, B, and *R can have any integer type other than char, bool, a + bit-precise integer type, or an enumeration type. + + These are like the standard macros introduced in C23, except that + arguments should not have side effects. */ + +#define ckd_add(r, a, b) ((bool) _GL_INT_ADD_WRAPV (a, b, r)) +#define ckd_sub(r, a, b) ((bool) _GL_INT_SUBTRACT_WRAPV (a, b, r)) +#define ckd_mul(r, a, b) ((bool) _GL_INT_MULTIPLY_WRAPV (a, b, r)) + +#endif /* _GL_STDCKDINT_H */ diff --git a/contrib/libs/libidn/gl/verify.h b/contrib/libs/libidn/gl/verify.h deleted file mode 100644 index c5c63ae97c..0000000000 --- a/contrib/libs/libidn/gl/verify.h +++ /dev/null @@ -1,318 +0,0 @@ -/* Compile-time assert-like macros. - - Copyright (C) 2005-2006, 2009-2022 Free Software Foundation, Inc. - - This file is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. */ - -/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ - -#ifndef _GL_VERIFY_H -#define _GL_VERIFY_H - - -/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert (R, DIAGNOSTIC) - works as per C11. This is supported by GCC 4.6.0+ and by clang 4+. - - Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as - per C2x. This is supported by GCC 9.1+. - - Support compilers claiming conformance to the relevant standard, - and also support GCC when not pedantic. If we were willing to slow - 'configure' down we could also use it with other compilers, but - since this affects only the quality of diagnostics, why bother? */ -#ifndef __cplusplus -# if (201112L <= __STDC_VERSION__ \ - || (!defined __STRICT_ANSI__ \ - && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__))) -# define _GL_HAVE__STATIC_ASSERT 1 -# endif -# if (202000L <= __STDC_VERSION__ \ - || (!defined __STRICT_ANSI__ && 9 <= __GNUC__)) -# define _GL_HAVE__STATIC_ASSERT1 1 -# endif -#endif - -/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other - system headers, defines a conflicting _Static_assert that is no - better than ours; override it. */ -#ifndef _GL_HAVE__STATIC_ASSERT -# include <stddef.h> -# undef _Static_assert -#endif - -/* Each of these macros verifies that its argument R is nonzero. To - be portable, R should be an integer constant expression. Unlike - assert (R), there is no run-time overhead. - - If _Static_assert works, verify (R) uses it directly. Similarly, - _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct - that is an operand of sizeof. - - The code below uses several ideas for C++ compilers, and for C - compilers that do not support _Static_assert: - - * The first step is ((R) ? 1 : -1). Given an expression R, of - integral or boolean or floating-point type, this yields an - expression of integral type, whose value is later verified to be - constant and nonnegative. - - * Next this expression W is wrapped in a type - struct _gl_verify_type { - unsigned int _gl_verify_error_if_negative: W; - }. - If W is negative, this yields a compile-time error. No compiler can - deal with a bit-field of negative size. - - One might think that an array size check would have the same - effect, that is, that the type struct { unsigned int dummy[W]; } - would work as well. However, inside a function, some compilers - (such as C++ compilers and GNU C) allow local parameters and - variables inside array size expressions. With these compilers, - an array size check would not properly diagnose this misuse of - the verify macro: - - void function (int n) { verify (n < 0); } - - * For the verify macro, the struct _gl_verify_type will need to - somehow be embedded into a declaration. To be portable, this - declaration must declare an object, a constant, a function, or a - typedef name. If the declared entity uses the type directly, - such as in - - struct dummy {...}; - typedef struct {...} dummy; - extern struct {...} *dummy; - extern void dummy (struct {...} *); - extern struct {...} *dummy (void); - - two uses of the verify macro would yield colliding declarations - if the entity names are not disambiguated. A workaround is to - attach the current line number to the entity name: - - #define _GL_CONCAT0(x, y) x##y - #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) - extern struct {...} * _GL_CONCAT (dummy, __LINE__); - - But this has the problem that two invocations of verify from - within the same macro would collide, since the __LINE__ value - would be the same for both invocations. (The GCC __COUNTER__ - macro solves this problem, but is not portable.) - - A solution is to use the sizeof operator. It yields a number, - getting rid of the identity of the type. Declarations like - - extern int dummy [sizeof (struct {...})]; - extern void dummy (int [sizeof (struct {...})]); - extern int (*dummy (void)) [sizeof (struct {...})]; - - can be repeated. - - * Should the implementation use a named struct or an unnamed struct? - Which of the following alternatives can be used? - - extern int dummy [sizeof (struct {...})]; - extern int dummy [sizeof (struct _gl_verify_type {...})]; - extern void dummy (int [sizeof (struct {...})]); - extern void dummy (int [sizeof (struct _gl_verify_type {...})]); - extern int (*dummy (void)) [sizeof (struct {...})]; - extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})]; - - In the second and sixth case, the struct type is exported to the - outer scope; two such declarations therefore collide. GCC warns - about the first, third, and fourth cases. So the only remaining - possibility is the fifth case: - - extern int (*dummy (void)) [sizeof (struct {...})]; - - * GCC warns about duplicate declarations of the dummy function if - -Wredundant-decls is used. GCC 4.3 and later have a builtin - __COUNTER__ macro that can let us generate unique identifiers for - each dummy function, to suppress this warning. - - * This implementation exploits the fact that older versions of GCC, - which do not support _Static_assert, also do not warn about the - last declaration mentioned above. - - * GCC warns if -Wnested-externs is enabled and 'verify' is used - within a function body; but inside a function, you can always - arrange to use verify_expr instead. - - * In C++, any struct definition inside sizeof is invalid. - Use a template type to work around the problem. */ - -/* Concatenate two preprocessor tokens. */ -#define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) -#define _GL_CONCAT0(x, y) x##y - -/* _GL_COUNTER is an integer, preferably one that changes each time we - use it. Use __COUNTER__ if it works, falling back on __LINE__ - otherwise. __LINE__ isn't perfect, but it's better than a - constant. */ -#if defined __COUNTER__ && __COUNTER__ != __COUNTER__ -# define _GL_COUNTER __COUNTER__ -#else -# define _GL_COUNTER __LINE__ -#endif - -/* Generate a symbol with the given prefix, making it unique if - possible. */ -#define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) - -/* Verify requirement R at compile-time, as an integer constant expression - that returns 1. If R is false, fail at compile-time, preferably - with a diagnostic that includes the string-literal DIAGNOSTIC. */ - -#define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ - (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC))) - -#ifdef __cplusplus -# if !GNULIB_defined_struct__gl_verify_type -template <int w> - struct _gl_verify_type { - unsigned int _gl_verify_error_if_negative: w; - }; -# define GNULIB_defined_struct__gl_verify_type 1 -# endif -# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ - _gl_verify_type<(R) ? 1 : -1> -#elif defined _GL_HAVE__STATIC_ASSERT -# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ - struct { \ - _Static_assert (R, DIAGNOSTIC); \ - int _gl_dummy; \ - } -#else -# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ - struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; } -#endif - -/* Verify requirement R at compile-time, as a declaration without a - trailing ';'. If R is false, fail at compile-time. - - This macro requires three or more arguments but uses at most the first - two, so that the _Static_assert macro optionally defined below supports - both the C11 two-argument syntax and the C2x one-argument syntax. - - Unfortunately, unlike C11, this implementation must appear as an - ordinary declaration, and cannot appear inside struct { ... }. */ - -#if 200410 <= __cpp_static_assert -# define _GL_VERIFY(R, DIAGNOSTIC, ...) static_assert (R, DIAGNOSTIC) -#elif defined _GL_HAVE__STATIC_ASSERT -# define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) -#else -# define _GL_VERIFY(R, DIAGNOSTIC, ...) \ - extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ - [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] -# if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) -# pragma GCC diagnostic ignored "-Wnested-externs" -# endif -#endif - -/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ -#ifdef _GL_STATIC_ASSERT_H -# if !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert -# define _Static_assert(...) \ - _GL_VERIFY (__VA_ARGS__, "static assertion failed", -) -# endif -# if __cpp_static_assert < 201411 && !defined static_assert -# define static_assert _Static_assert /* C11 requires this #define. */ -# endif -#endif - -/* @assert.h omit start@ */ - -#if 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)) -# define _GL_HAS_BUILTIN_TRAP 1 -#elif defined __has_builtin -# define _GL_HAS_BUILTIN_TRAP __has_builtin (__builtin_trap) -#else -# define _GL_HAS_BUILTIN_TRAP 0 -#endif - -#if 4 < __GNUC__ + (5 <= __GNUC_MINOR__) -# define _GL_HAS_BUILTIN_UNREACHABLE 1 -#elif defined __has_builtin -# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) -#else -# define _GL_HAS_BUILTIN_UNREACHABLE 0 -#endif - -/* Each of these macros verifies that its argument R is nonzero. To - be portable, R should be an integer constant expression. Unlike - assert (R), there is no run-time overhead. - - There are two macros, since no single macro can be used in all - contexts in C. verify_expr (R, E) is for scalar contexts, including - integer constant expression contexts. verify (R) is for declaration - contexts, e.g., the top level. */ - -/* Verify requirement R at compile-time. Return the value of the - expression E. */ - -#define verify_expr(R, E) \ - (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E)) - -/* Verify requirement R at compile-time, as a declaration without a - trailing ';'. verify (R) acts like static_assert (R) except that - it is portable to C11/C++14 and earlier, it can issue better - diagnostics, and its name is shorter and may be more convenient. */ - -#ifdef __PGI -/* PGI barfs if R is long. */ -# define verify(R) _GL_VERIFY (R, "verify (...)", -) -#else -# define verify(R) _GL_VERIFY (R, "verify (" #R ")", -) -#endif - -/* Assume that R always holds. Behavior is undefined if R is false, - fails to evaluate, or has side effects. - - 'assume (R)' is a directive from the programmer telling the - compiler that R is true so the compiler needn't generate code to - test R. This is why 'assume' is in verify.h: it's related to - static checking (in this case, static checking done by the - programmer), not dynamic checking. - - 'assume (R)' can affect compilation of all the code, not just code - that happens to be executed after the assume (R) is "executed". - For example, if the code mistakenly does 'assert (R); assume (R);' - the compiler is entitled to optimize away the 'assert (R)'. - - Although assuming R can help a compiler generate better code or - diagnostics, performance can suffer if R uses hard-to-optimize - features such as function calls not inlined by the compiler. - - Avoid Clang's __builtin_assume, as it breaks GNU Emacs master - as of 2020-08-23T21:09:49Z!eggert@cs.ucla.edu; see - <https://bugs.gnu.org/43152#71>. It's not known whether this breakage - is a Clang bug or an Emacs bug; play it safe for now. */ - -#if _GL_HAS_BUILTIN_UNREACHABLE -# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) -#elif 1200 <= _MSC_VER -# define assume(R) __assume (R) -#elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP - /* 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 - /* Some tools grok NOTREACHED, e.g., Oracle Studio 12.6. */ -# define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0) -#endif - -/* @assert.h omit end@ */ - -#endif diff --git a/contrib/libs/libidn/gl/xalloc-oversized.h b/contrib/libs/libidn/gl/xalloc-oversized.h index aefa6fd804..0b7bb2cee8 100644 --- a/contrib/libs/libidn/gl/xalloc-oversized.h +++ b/contrib/libs/libidn/gl/xalloc-oversized.h @@ -1,6 +1,6 @@ /* xalloc-oversized.h -- memory allocation size checking - Copyright (C) 1990-2000, 2003-2004, 2006-2022 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -48,13 +48,13 @@ #if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX # define xalloc_oversized(n, s) \ __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1) -#elif (5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ \ - && PTRDIFF_MAX < SIZE_MAX) +#elif 5 <= __GNUC__ && !defined __ICC && PTRDIFF_MAX < SIZE_MAX # define xalloc_oversized(n, s) \ (__builtin_constant_p (n) && __builtin_constant_p (s) \ ? __xalloc_oversized (n, s) \ - : ({ ptrdiff_t __xalloc_count; \ - __builtin_mul_overflow (n, s, &__xalloc_count); })) + : __extension__ \ + ({ ptrdiff_t __xalloc_count; \ + __builtin_mul_overflow (n, s, &__xalloc_count); })) /* Other compilers use integer division; this may be slower but is more portable. */ diff --git a/contrib/libs/libidn/lib/gl/attribute.h b/contrib/libs/libidn/lib/gl/attribute.h index 378d4f0a80..710341ba41 100644 --- a/contrib/libs/libidn/lib/gl/attribute.h +++ b/contrib/libs/libidn/lib/gl/attribute.h @@ -1,6 +1,6 @@ /* ATTRIBUTE_* macros for using attributes in GCC and similar compilers - Copyright 2020-2022 Free Software Foundation, Inc. + Copyright 2020-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -32,7 +32,7 @@ /* This file defines two types of attributes: - * C2x standard attributes. These have macro names that do not begin with + * C23 standard attributes. These have macro names that do not begin with 'ATTRIBUTE_'. * Selected GCC attributes; see: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html @@ -41,6 +41,21 @@ These names begin with 'ATTRIBUTE_' to avoid name clashes. */ +/* This file uses _GL_ATTRIBUTE_ALLOC_SIZE, _GL_ATTRIBUTE_ALWAYS_INLINE, + _GL_ATTRIBUTE_ARTIFICIAL, _GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_CONST, + _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR, + _GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE, + _GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF, + _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED, + _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL, + _GL_ATTRIBUTE_NONSTRING, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, + _GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_RETURNS_NONNULL, + _GL_ATTRIBUTE_SENTINEL. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + + /* =============== Attributes for specific kinds of functions =============== */ /* Attributes for functions that should not be used. */ @@ -167,6 +182,8 @@ /* The function does not throw exceptions. */ /* Applies to: functions. */ +/* After a function's parameter list, this attribute must come first, before + other attributes. */ #define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW /* Do not inline the function. */ diff --git a/contrib/libs/libidn/lib/gl/c-ctype.c b/contrib/libs/libidn/lib/gl/c-ctype.c index a247514cd6..d3f1b12d5a 100644 --- a/contrib/libs/libidn/lib/gl/c-ctype.c +++ b/contrib/libs/libidn/lib/gl/c-ctype.c @@ -1,6 +1,6 @@ /* Character handling in C locale. - Copyright (C) 2003-2022 Free Software Foundation, Inc. + Copyright (C) 2003-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/contrib/libs/libidn/lib/gl/c-ctype.h b/contrib/libs/libidn/lib/gl/c-ctype.h index 1a4f603898..b582de4a7f 100644 --- a/contrib/libs/libidn/lib/gl/c-ctype.h +++ b/contrib/libs/libidn/lib/gl/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-2022 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -23,11 +23,11 @@ #ifndef C_CTYPE_H #define C_CTYPE_H -#include <stdbool.h> - -#ifndef _GL_INLINE_HEADER_BEGIN +/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE. */ +#if !_GL_CONFIG_H_INCLUDED #error "Please include config.h first." #endif + _GL_INLINE_HEADER_BEGIN #ifndef C_CTYPE_INLINE # define C_CTYPE_INLINE _GL_INLINE diff --git a/contrib/libs/libidn/lib/gl/c-strcase.h b/contrib/libs/libidn/lib/gl/c-strcase.h index 3e874b5ea3..b75e8dd1cb 100644 --- a/contrib/libs/libidn/lib/gl/c-strcase.h +++ b/contrib/libs/libidn/lib/gl/c-strcase.h @@ -1,5 +1,5 @@ /* Case-insensitive string comparison functions in C locale. - Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2022 Free Software + Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify @@ -18,6 +18,11 @@ #ifndef C_STRCASE_H #define C_STRCASE_H +/* This file uses _GL_ATTRIBUTE_PURE. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include <stddef.h> diff --git a/contrib/libs/libidn/lib/gl/c-strcasecmp.c b/contrib/libs/libidn/lib/gl/c-strcasecmp.c index 87b993cb2f..1fa575a856 100644 --- a/contrib/libs/libidn/lib/gl/c-strcasecmp.c +++ b/contrib/libs/libidn/lib/gl/c-strcasecmp.c @@ -1,5 +1,5 @@ /* c-strcasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/contrib/libs/libidn/lib/gl/c-strncasecmp.c b/contrib/libs/libidn/lib/gl/c-strncasecmp.c index 5a5d30b6e5..4c8b0b6b84 100644 --- a/contrib/libs/libidn/lib/gl/c-strncasecmp.c +++ b/contrib/libs/libidn/lib/gl/c-strncasecmp.c @@ -1,5 +1,5 @@ /* c-strncasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/contrib/libs/libidn/lib/gl/cdefs.h b/contrib/libs/libidn/lib/gl/cdefs.h index 78b68bff80..48f3134fde 100644 --- a/contrib/libs/libidn/lib/gl/cdefs.h +++ b/contrib/libs/libidn/lib/gl/cdefs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2022 Free Software Foundation, Inc. +/* Copyright (C) 1992-2024 Free Software Foundation, Inc. Copyright The GNU Toolchain Authors. This file is part of the GNU C Library. @@ -140,32 +140,37 @@ #endif +/* Gnulib avoids these definitions, as they don't work on non-glibc platforms. + In particular, __bos and __bos0 are defined differently in the Android libc. + */ +#ifndef __GNULIB_CDEFS + /* Fortify support. */ -#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) -#define __bos0(ptr) __builtin_object_size (ptr, 0) +# define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) +# define __bos0(ptr) __builtin_object_size (ptr, 0) /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ -#if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \ - || __GNUC_PREREQ (12, 0)) -# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) -# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) -#else -# define __glibc_objsize0(__o) __bos0 (__o) -# define __glibc_objsize(__o) __bos (__o) -#endif +# if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \ + || __GNUC_PREREQ (12, 0)) +# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) +# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) +# else +# define __glibc_objsize0(__o) __bos0 (__o) +# define __glibc_objsize(__o) __bos (__o) +# endif /* Compile time conditions to choose between the regular, _chk and _chk_warn variants. These conditions should get evaluated to constant and optimized away. */ -#define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s)) -#define __glibc_unsigned_or_positive(__l) \ +# define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s)) +# define __glibc_unsigned_or_positive(__l) \ ((__typeof (__l)) 0 < (__typeof (__l)) -1 \ || (__builtin_constant_p (__l) && (__l) > 0)) /* Length is known to be safe at compile time if the __L * __S <= __OBJSZ condition can be folded to a constant and if it is true, or unknown (-1) */ -#define __glibc_safe_or_unknown_len(__l, __s, __osz) \ +# define __glibc_safe_or_unknown_len(__l, __s, __osz) \ ((__osz) == (__SIZE_TYPE__) -1 \ || (__glibc_unsigned_or_positive (__l) \ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ @@ -175,7 +180,7 @@ /* Conversely, we know at compile time that the length is unsafe if the __L * __S <= __OBJSZ condition can be folded to a constant and if it is false. */ -#define __glibc_unsafe_len(__l, __s, __osz) \ +# define __glibc_unsafe_len(__l, __s, __osz) \ (__glibc_unsigned_or_positive (__l) \ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ __s, __osz)) \ @@ -184,7 +189,7 @@ /* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be declared. */ -#define __glibc_fortify(f, __l, __s, __osz, ...) \ +# define __glibc_fortify(f, __l, __s, __osz, ...) \ (__glibc_safe_or_unknown_len (__l, __s, __osz) \ ? __ ## f ## _alias (__VA_ARGS__) \ : (__glibc_unsafe_len (__l, __s, __osz) \ @@ -194,13 +199,16 @@ /* Fortify function f, where object size argument passed to f is the number of elements and not total size. */ -#define __glibc_fortify_n(f, __l, __s, __osz, ...) \ +# define __glibc_fortify_n(f, __l, __s, __osz, ...) \ (__glibc_safe_or_unknown_len (__l, __s, __osz) \ ? __ ## f ## _alias (__VA_ARGS__) \ : (__glibc_unsafe_len (__l, __s, __osz) \ ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \ : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) \ +#endif + + #if __GNUC_PREREQ (4,3) # define __warnattr(msg) __attribute__((__warning__ (msg))) # define __errordecl(name, msg) \ diff --git a/contrib/libs/libidn/lib/gl/iconv.h b/contrib/libs/libidn/lib/gl/iconv.h index ffebfabe9e..9eb7da9ad9 100644 --- a/contrib/libs/libidn/lib/gl/iconv.h +++ b/contrib/libs/libidn/lib/gl/iconv.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* A GNU-like <iconv.h>. - Copyright (C) 2007-2022 Free Software Foundation, Inc. + Copyright (C) 2007-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -29,9 +29,14 @@ #ifndef _GL_LGL_ICONV_H #define _GL_LGL_ICONV_H +/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* C++ compatible function declaration macros. - Copyright (C) 2010-2022 Free Software Foundation, Inc. + Copyright (C) 2010-2024 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -131,6 +136,12 @@ Example: _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); + + Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front + of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's + because + [[...]] extern "C" <declaration>; + is invalid syntax in C++.) */ #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) @@ -364,7 +375,7 @@ /* The definition of _GL_ARG_NONNULL is copied here. */ /* A C macro for declaring that specific arguments must not be NULL. - Copyright (C) 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2009-2024 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -392,7 +403,7 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ /* A C macro for emitting warnings if a function is used. - Copyright (C) 2010-2022 Free Software Foundation, Inc. + Copyright (C) 2010-2024 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/contrib/libs/libidn/lib/gl/libc-config.h b/contrib/libs/libidn/lib/gl/libc-config.h index a56665b1ce..70114608fb 100644 --- a/contrib/libs/libidn/lib/gl/libc-config.h +++ b/contrib/libs/libidn/lib/gl/libc-config.h @@ -1,6 +1,6 @@ /* System definitions for code taken from the GNU C Library - Copyright 2017-2022 Free Software Foundation, Inc. + Copyright 2017-2024 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -137,8 +137,6 @@ # undef __attribute_returns_twice__ # undef __attribute_used__ # undef __attribute_warn_unused_result__ -# undef __bos -# undef __bos0 # undef __errordecl # undef __extension__ # undef __extern_always_inline @@ -147,21 +145,13 @@ # undef __fortified_attr_access # undef __fortify_function # undef __glibc_c99_flexarr_available -# undef __glibc_fortify -# undef __glibc_fortify_n # undef __glibc_has_attribute # undef __glibc_has_builtin # undef __glibc_has_extension # undef __glibc_likely # undef __glibc_macro_warning # undef __glibc_macro_warning1 -# undef __glibc_objsize -# undef __glibc_objsize0 -# undef __glibc_safe_len_cond -# undef __glibc_safe_or_unknown_len # undef __glibc_unlikely -# undef __glibc_unsafe_len -# undef __glibc_unsigned_or_positive # undef __inline # undef __ptr_t # undef __restrict @@ -170,6 +160,18 @@ # undef __va_arg_pack_len # undef __warnattr # undef __wur +# ifndef __GNULIB_CDEFS +# undef __bos +# undef __bos0 +# undef __glibc_fortify +# undef __glibc_fortify_n +# undef __glibc_objsize +# undef __glibc_objsize0 +# undef __glibc_safe_len_cond +# undef __glibc_safe_or_unknown_len +# undef __glibc_unsafe_len +# undef __glibc_unsigned_or_positive +# endif /* Include our copy of glibc <sys/cdefs.h>. */ # include <cdefs.h> diff --git a/contrib/libs/libidn/lib/gl/striconv.c b/contrib/libs/libidn/lib/gl/striconv.c index d3da10a470..9688a9fbb1 100644 --- a/contrib/libs/libidn/lib/gl/striconv.c +++ b/contrib/libs/libidn/lib/gl/striconv.c @@ -1,5 +1,5 @@ /* Charset conversion. - Copyright (C) 2001-2007, 2010-2022 Free Software Foundation, Inc. + Copyright (C) 2001-2007, 2010-2024 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. This file is free software: you can redistribute it and/or modify diff --git a/contrib/libs/libidn/lib/gl/striconv.h b/contrib/libs/libidn/lib/gl/striconv.h index 5a184ac11b..cb42c7b19f 100644 --- a/contrib/libs/libidn/lib/gl/striconv.h +++ b/contrib/libs/libidn/lib/gl/striconv.h @@ -1,5 +1,5 @@ /* Charset conversion. - Copyright (C) 2001-2004, 2006-2007, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009-2024 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. This file is free software: you can redistribute it and/or modify @@ -18,6 +18,11 @@ #ifndef _STRICONV_H #define _STRICONV_H +/* This file uses _GL_ATTRIBUTE_MALLOC, HAVE_ICONV. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include <stdlib.h> #if HAVE_ICONV #include <iconv.h> diff --git a/contrib/libs/libidn/lib/gl/strverscmp.c b/contrib/libs/libidn/lib/gl/strverscmp.c index 374f564a4e..b0c11fc295 100644 --- a/contrib/libs/libidn/lib/gl/strverscmp.c +++ b/contrib/libs/libidn/lib/gl/strverscmp.c @@ -1,5 +1,5 @@ /* Compare strings while treating digits characters numerically. - Copyright (C) 1997-2022 Free Software Foundation, Inc. + Copyright (C) 1997-2024 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997. diff --git a/contrib/libs/libidn/lib/gl/unistr.h b/contrib/libs/libidn/lib/gl/unistr.h index 9336c10434..242a39caa4 100644 --- a/contrib/libs/libidn/lib/gl/unistr.h +++ b/contrib/libs/libidn/lib/gl/unistr.h @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Elementary Unicode string functions. - Copyright (C) 2001-2002, 2005-2022 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2005-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -381,6 +381,15 @@ extern uint16_t * extern uint32_t * u32_cpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n); +/* Copy N units from SRC to DEST, returning pointer after last written unit. */ +/* Similar to mempcpy(). */ +extern uint8_t * + u8_pcpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n); +extern uint16_t * + u16_pcpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n); +extern uint32_t * + u32_pcpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n); + /* Copy N units from SRC to DEST, guaranteeing correct behavior for overlapping memory areas. */ /* Similar to memmove(). */ diff --git a/contrib/libs/libidn/lib/gl/unistr/u8-check.c b/contrib/libs/libidn/lib/gl/unistr/u8-check.c index b6228c1f5a..556f992763 100644 --- a/contrib/libs/libidn/lib/gl/unistr/u8-check.c +++ b/contrib/libs/libidn/lib/gl/unistr/u8-check.c @@ -1,5 +1,5 @@ /* Check UTF-8 string. - Copyright (C) 2002, 2006-2007, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This file is free software: you can redistribute it and/or modify @@ -57,13 +57,13 @@ u8_check (const uint8_t *s, size_t n) continue; } } - else if (c < 0xf8) + else if (c <= 0xf4) { if (s + 4 <= s_end && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (s[3] ^ 0x80) < 0x40 && (c >= 0xf1 || s[1] >= 0x90) - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))) + && (c < 0xf4 || (/* c == 0xf4 && */ s[1] < 0x90))) { s += 4; continue; diff --git a/contrib/libs/libidn/lib/gl/unistr/u8-mbtoucr.c b/contrib/libs/libidn/lib/gl/unistr/u8-mbtoucr.c index 6672298ab2..564e47e91d 100644 --- a/contrib/libs/libidn/lib/gl/unistr/u8-mbtoucr.c +++ b/contrib/libs/libidn/lib/gl/unistr/u8-mbtoucr.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-8 string, returning an error code. - Copyright (C) 1999-2002, 2006-2007, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software: you can redistribute it and/or modify @@ -86,13 +86,13 @@ u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n) return -2; } } - else if (c < 0xf8) + else if (c <= 0xf4) { if (n >= 2) { if ((s[1] ^ 0x80) < 0x40 && (c >= 0xf1 || s[1] >= 0x90) - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))) + && (c < 0xf4 || (/* c == 0xf4 && */ s[1] < 0x90))) { if (n >= 3) { diff --git a/contrib/libs/libidn/lib/gl/unistr/u8-uctomb-aux.c b/contrib/libs/libidn/lib/gl/unistr/u8-uctomb-aux.c index 5ca219152c..ffe567d92f 100644 --- a/contrib/libs/libidn/lib/gl/unistr/u8-uctomb-aux.c +++ b/contrib/libs/libidn/lib/gl/unistr/u8-uctomb-aux.c @@ -1,5 +1,5 @@ /* Conversion UCS-4 to UTF-8. - Copyright (C) 2002, 2006-2007, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This file is free software: you can redistribute it and/or modify diff --git a/contrib/libs/libidn/lib/gl/unistr/u8-uctomb.c b/contrib/libs/libidn/lib/gl/unistr/u8-uctomb.c index 2a97dfc838..a78654dee0 100644 --- a/contrib/libs/libidn/lib/gl/unistr/u8-uctomb.c +++ b/contrib/libs/libidn/lib/gl/unistr/u8-uctomb.c @@ -1,5 +1,5 @@ /* Store a character in UTF-8 string. - Copyright (C) 2002, 2005-2006, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2006, 2009-2024 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This file is free software: you can redistribute it and/or modify diff --git a/contrib/libs/libidn/lib/gl/unitypes.h b/contrib/libs/libidn/lib/gl/unitypes.h index 6eaab1c9b6..949dead2bc 100644 --- a/contrib/libs/libidn/lib/gl/unitypes.h +++ b/contrib/libs/libidn/lib/gl/unitypes.h @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Elementary types and macros for the GNU UniString library. - Copyright (C) 2002, 2005-2006, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2006, 2009-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/contrib/libs/libidn/lib/idn-free.c b/contrib/libs/libidn/lib/idn-free.c index 0df9e810a9..cd62538359 100644 --- a/contrib/libs/libidn/lib/idn-free.c +++ b/contrib/libs/libidn/lib/idn-free.c @@ -1,5 +1,5 @@ /* idn-free.h --- Invoke the free function to release memory - Copyright (C) 2004-2022 Simon Josefsson + Copyright (C) 2004-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/idn-free.h b/contrib/libs/libidn/lib/idn-free.h index c6881e94ba..103e8285e5 100644 --- a/contrib/libs/libidn/lib/idn-free.h +++ b/contrib/libs/libidn/lib/idn-free.h @@ -1,5 +1,5 @@ /* idn-free.h --- Invoke the free function to release memory - Copyright (C) 2004-2022 Simon Josefsson + Copyright (C) 2004-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/idna.c b/contrib/libs/libidn/lib/idna.c index 8901f0c504..043e05b811 100644 --- a/contrib/libs/libidn/lib/idna.c +++ b/contrib/libs/libidn/lib/idna.c @@ -1,5 +1,5 @@ /* idna.c --- Prototypes for Internationalized Domain Name library. - Copyright (C) 2002-2022 Simon Josefsson + Copyright (C) 2002-2024 Simon Josefsson This file is part of GNU Libidn. @@ -115,7 +115,7 @@ static char* STRCAT(char* destination, const char* source) { * Return value: Returns 0 on success, or an #Idna_rc error code. */ int -idna_to_ascii_4i (const uint32_t * in, size_t inlen, char *out, int flags) +idna_to_ascii_4i (const uint32_t *in, size_t inlen, char *out, int flags) { size_t len, outlen; uint32_t *src; /* XXX don't need to copy data? */ @@ -318,7 +318,7 @@ step8: /* ToUnicode(). May realloc() utf8in. Will free utf8in unconditionally. */ static int idna_to_unicode_internal (char *utf8in, - uint32_t * out, size_t *outlen, int flags) + uint32_t *out, size_t *outlen, int flags) { int rc; char tmpout[IDNA_LABEL_MAX_LENGTH + 1]; @@ -478,8 +478,8 @@ step3: * checking it means breaking the standard. */ int -idna_to_unicode_44i (const uint32_t * in, size_t inlen, - uint32_t * out, size_t *outlen, int flags) +idna_to_unicode_44i (const uint32_t *in, size_t inlen, + uint32_t *out, size_t *outlen, int flags) { int rc; size_t outlensave = *outlen; @@ -518,7 +518,7 @@ idna_to_unicode_44i (const uint32_t * in, size_t inlen, * Return value: Returns %IDNA_SUCCESS on success, or error code. **/ int -idna_to_ascii_4z (const uint32_t * input, char **output, int flags) +idna_to_ascii_4z (const uint32_t *input, char **output, int flags) { const uint32_t *start = input; const uint32_t *end; @@ -681,7 +681,7 @@ idna_to_ascii_lz (const char *input, char **output, int flags) * Return value: Returns %IDNA_SUCCESS on success, or error code. **/ int -idna_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags) +idna_to_unicode_4z4z (const uint32_t *input, uint32_t **output, int flags) { const uint32_t *start = input; const uint32_t *end; @@ -760,7 +760,7 @@ idna_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags) * Return value: Returns %IDNA_SUCCESS on success, or error code. **/ int -idna_to_unicode_8z4z (const char *input, uint32_t ** output, int flags) +idna_to_unicode_8z4z (const char *input, uint32_t **output, int flags) { uint32_t *ucs4; size_t ucs4len; diff --git a/contrib/libs/libidn/lib/idna.h b/contrib/libs/libidn/lib/idna.h index ce143ce26e..e1f7535373 100644 --- a/contrib/libs/libidn/lib/idna.h +++ b/contrib/libs/libidn/lib/idna.h @@ -1,5 +1,5 @@ /* idna.h --- Prototypes for Internationalized Domain Name library. - Copyright (C) 2002-2022 Simon Josefsson + Copyright (C) 2002-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/nfkc.c b/contrib/libs/libidn/lib/nfkc.c index 9b9e9c406b..940b73d17c 100644 --- a/contrib/libs/libidn/lib/nfkc.c +++ b/contrib/libs/libidn/lib/nfkc.c @@ -1,5 +1,5 @@ /* nfkc.c --- Unicode normalization utilities. - Copyright (C) 2002-2022 Simon Josefsson + Copyright (C) 2002-2024 Simon Josefsson This file is part of GNU Libidn. @@ -40,7 +40,6 @@ #define gboolean int #define gchar char #define guchar unsigned char -#define glong long #define gint int #define guint unsigned int #define gushort unsigned short @@ -238,10 +237,10 @@ static const gchar *const g_utf8_skip = utf8_skip_data; * * Return value: the length of the string in characters **/ -static glong -g_utf8_strlen (const gchar * p) +static gsize +g_utf8_strlen (const gchar *p) { - glong len = 0; + gsize len = 0; g_return_val_if_fail (p != NULL, 0); @@ -267,7 +266,7 @@ g_utf8_strlen (const gchar * p) * Return value: the resulting character **/ static gunichar -g_utf8_get_char (const gchar * p) +g_utf8_get_char (const gchar *p) { int i, mask = 0, len; gunichar result; @@ -293,7 +292,7 @@ g_utf8_get_char (const gchar * p) * Return value: number of bytes written **/ static int -g_unichar_to_utf8 (gunichar c, gchar * outbuf) +g_unichar_to_utf8 (gunichar c, gchar *outbuf) { /* If this gets modified, also update the copy in g_string_insert_unichar() */ guint len = 0; @@ -362,7 +361,7 @@ g_unichar_to_utf8 (gunichar c, gchar * outbuf) * This value must be freed with g_free(). **/ static gunichar * -g_utf8_to_ucs4_fast (const gchar * str, glong len, glong * items_written) +g_utf8_to_ucs4_fast (const gchar *str, gssize len, gsize *items_written) { gunichar *result; gsize n_chars, i; @@ -461,16 +460,16 @@ g_utf8_to_ucs4_fast (const gchar * str, glong len, glong * items_written) * character. **/ static gchar * -g_ucs4_to_utf8 (const gunichar * str, - glong len, glong * items_read, glong * items_written) +g_ucs4_to_utf8 (const gunichar *str, + gsize len, gsize *items_read, gsize *items_written) { gint result_length; gchar *result = NULL; gchar *p; - gint i; + gsize i; result_length = 0; - for (i = 0; len < 0 || i < len; i++) + for (i = 0; i < len; i++) { if (!str[i]) break; @@ -567,7 +566,7 @@ err_out: * manual for more information. **/ static void -g_unicode_canonical_ordering (gunichar * string, gsize len) +g_unicode_canonical_ordering (gunichar *string, gsize len) { gsize i; int swap = 1; @@ -608,7 +607,7 @@ g_unicode_canonical_ordering (gunichar * string, gsize len) * only calculate the result_len; however, a buffer with space for three * characters will always be big enough. */ static void -decompose_hangul (gunichar s, gunichar * r, gsize * result_len) +decompose_hangul (gunichar s, gunichar *r, gsize *result_len) { gint SIndex = s - SBase; gint TIndex = SIndex % TCount; @@ -674,7 +673,7 @@ find_decomposition (gunichar ch, gboolean compat) /* L,V => LV and LV,T => LVT */ static gboolean -combine_hangul (gunichar a, gunichar b, gunichar * result) +combine_hangul (gunichar a, gunichar b, gunichar *result) { if (a >= LBase && a < LCount + LBase && b >= VBase && b < VCount + VBase) { @@ -710,7 +709,7 @@ combine_hangul (gunichar a, gunichar b, gunichar * result) (((Char >> 8) > (COMPOSE_TABLE_LAST)) ? 0 : CI((Char) >> 8, (Char) & 0xff)) static gboolean -combine (gunichar a, gunichar b, gunichar * result) +combine (gunichar a, gunichar b, gunichar *result) { gushort index_a, index_b; @@ -765,7 +764,7 @@ combine (gunichar a, gunichar b, gunichar * result) } static gunichar * -_g_utf8_normalize_wc (const gchar * str, gssize max_len, GNormalizeMode mode) +_g_utf8_normalize_wc (const gchar *str, gssize max_len, GNormalizeMode mode) { gsize n_wc; gunichar *wc_buffer; @@ -937,7 +936,7 @@ _g_utf8_normalize_wc (const gchar * str, gssize max_len, GNormalizeMode mode) * valid UTF-8. **/ static gchar * -g_utf8_normalize (const gchar * str, gssize len, GNormalizeMode mode) +g_utf8_normalize (const gchar *str, gssize len, GNormalizeMode mode) { gunichar *result_wc = _g_utf8_normalize_wc (str, len, mode); gchar *result = NULL; @@ -1016,7 +1015,7 @@ stringprep_utf8_to_ucs4 (const char *str, ssize_t len, size_t *items_written) if (u8_check ((const uint8_t *) str, n)) return NULL; - return g_utf8_to_ucs4_fast (str, (glong) len, (glong *) items_written); + return g_utf8_to_ucs4_fast (str, len, items_written); } /** @@ -1037,11 +1036,10 @@ stringprep_utf8_to_ucs4 (const char *str, ssize_t len, size_t *items_written) * If an error occurs, %NULL will be returned. **/ char * -stringprep_ucs4_to_utf8 (const uint32_t * str, ssize_t len, +stringprep_ucs4_to_utf8 (const uint32_t *str, ssize_t len, size_t *items_read, size_t *items_written) { - return g_ucs4_to_utf8 (str, len, (glong *) items_read, - (glong *) items_written); + return g_ucs4_to_utf8 (str, len, items_read, items_written); } /** @@ -1095,7 +1093,7 @@ stringprep_utf8_nfkc_normalize (const char *str, ssize_t len) * normalized form of @str. **/ uint32_t * -stringprep_ucs4_nfkc_normalize (const uint32_t * str, ssize_t len) +stringprep_ucs4_nfkc_normalize (const uint32_t *str, ssize_t len) { char *p; uint32_t *result_wc; diff --git a/contrib/libs/libidn/lib/pr29.c b/contrib/libs/libidn/lib/pr29.c index 6a8e260c86..2a2d116055 100644 --- a/contrib/libs/libidn/lib/pr29.c +++ b/contrib/libs/libidn/lib/pr29.c @@ -1,5 +1,5 @@ /* pr29.h --- Detect strings that are non-idempotent under NFKC in Unicode 3.2. - Copyright (C) 2004-2022 Simon Josefsson + Copyright (C) 2004-2024 Simon Josefsson This file is part of GNU Libidn. @@ -1244,7 +1244,7 @@ combinationclass (uint32_t c) * implementations). **/ int -pr29_4 (const uint32_t * in, size_t len) +pr29_4 (const uint32_t *in, size_t len) { size_t i, j, k, row; @@ -1285,7 +1285,7 @@ pr29_4 (const uint32_t * in, size_t len) * implementations). **/ int -pr29_4z (const uint32_t * in) +pr29_4z (const uint32_t *in) { size_t len; diff --git a/contrib/libs/libidn/lib/pr29.h b/contrib/libs/libidn/lib/pr29.h index cad3b69d2d..f26fc3b698 100644 --- a/contrib/libs/libidn/lib/pr29.h +++ b/contrib/libs/libidn/lib/pr29.h @@ -1,5 +1,5 @@ /* pr29.h --- Detect strings which are non-idempotent under NFKC. - Copyright (C) 2004-2022 Simon Josefsson + Copyright (C) 2004-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/profiles.c b/contrib/libs/libidn/lib/profiles.c index d9c4c03e1a..c0832b9185 100644 --- a/contrib/libs/libidn/lib/profiles.c +++ b/contrib/libs/libidn/lib/profiles.c @@ -1,5 +1,5 @@ /* profiles.c --- Definitions of stringprep profiles. - Copyright (C) 2002-2022 Simon Josefsson + Copyright (C) 2002-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/punycode.c b/contrib/libs/libidn/lib/punycode.c index f20be6a3be..0a99d1d302 100644 --- a/contrib/libs/libidn/lib/punycode.c +++ b/contrib/libs/libidn/lib/punycode.c @@ -1,5 +1,5 @@ /* punycode.c --- Implementation of punycode used to ASCII encode IDN's. - Copyright (C) 2002-2022 Simon Josefsson + Copyright (C) 2002-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/punycode.h b/contrib/libs/libidn/lib/punycode.h index 2489984e22..287a104dab 100644 --- a/contrib/libs/libidn/lib/punycode.h +++ b/contrib/libs/libidn/lib/punycode.h @@ -1,5 +1,5 @@ /* punycode.h --- Declarations for punycode functions. - Copyright (C) 2002-2022 Simon Josefsson + Copyright (C) 2002-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/strerror-idna.c b/contrib/libs/libidn/lib/strerror-idna.c index 27a54cc97c..ae61adeb8c 100644 --- a/contrib/libs/libidn/lib/strerror-idna.c +++ b/contrib/libs/libidn/lib/strerror-idna.c @@ -1,5 +1,5 @@ /* strerror-idna.c --- Convert IDNA errors into text. - Copyright (C) 2004-2022 Simon Josefsson + Copyright (C) 2004-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/strerror-pr29.c b/contrib/libs/libidn/lib/strerror-pr29.c index d6e100b0cf..2192d4c41e 100644 --- a/contrib/libs/libidn/lib/strerror-pr29.c +++ b/contrib/libs/libidn/lib/strerror-pr29.c @@ -1,5 +1,5 @@ /* strerror-pr29.c --- Convert PR29 errors into text. - Copyright (C) 2004-2022 Simon Josefsson + Copyright (C) 2004-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/strerror-punycode.c b/contrib/libs/libidn/lib/strerror-punycode.c index e6a6294452..4d7a562f78 100644 --- a/contrib/libs/libidn/lib/strerror-punycode.c +++ b/contrib/libs/libidn/lib/strerror-punycode.c @@ -1,5 +1,5 @@ /* strerror-punycode.c --- Convert punycode errors into text. - Copyright (C) 2004-2022 Simon Josefsson + Copyright (C) 2004-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/strerror-stringprep.c b/contrib/libs/libidn/lib/strerror-stringprep.c index 42075eb75a..f95aca88c3 100644 --- a/contrib/libs/libidn/lib/strerror-stringprep.c +++ b/contrib/libs/libidn/lib/strerror-stringprep.c @@ -1,5 +1,5 @@ /* strerror-stringprep.c --- Convert stringprep errors into text. - Copyright (C) 2004-2022 Simon Josefsson + Copyright (C) 2004-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/strerror-tld.c b/contrib/libs/libidn/lib/strerror-tld.c index 824ebfe286..fff01164e3 100644 --- a/contrib/libs/libidn/lib/strerror-tld.c +++ b/contrib/libs/libidn/lib/strerror-tld.c @@ -1,5 +1,5 @@ /* strerror-tld.c --- Convert TLD errors into text. - Copyright (C) 2004-2022 Simon Josefsson + Copyright (C) 2004-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/lib/stringprep.c b/contrib/libs/libidn/lib/stringprep.c index 846c691963..fe846f7585 100644 --- a/contrib/libs/libidn/lib/stringprep.c +++ b/contrib/libs/libidn/lib/stringprep.c @@ -1,5 +1,5 @@ /* stringprep.c --- Core stringprep implementation. - Copyright (C) 2002-2022 Simon Josefsson + Copyright (C) 2002-2024 Simon Josefsson This file is part of GNU Libidn. @@ -37,8 +37,7 @@ #include "stringprep.h" static int -_compare_table_element (const uint32_t * c, - const Stringprep_table_element * e) +_compare_table_element (const uint32_t *c, const Stringprep_table_element *e) { if (*c < e->start) return -1; @@ -49,7 +48,7 @@ _compare_table_element (const uint32_t * c, static ssize_t stringprep_find_character_in_table (uint32_t ucs4, - const Stringprep_table_element * table, + const Stringprep_table_element *table, size_t table_size) { /* This is where typical uses of Libidn spends very close to all CPU @@ -108,10 +107,10 @@ stringprep_find_character_in_table_fast (uint32_t ucs4, } static ssize_t -stringprep_find_string_in_table (uint32_t * ucs4, +stringprep_find_string_in_table (uint32_t *ucs4, size_t ucs4len, size_t *tablepos, - const Stringprep_table_element * table, + const Stringprep_table_element *table, const size_t table_size) { size_t j; @@ -131,10 +130,10 @@ stringprep_find_string_in_table (uint32_t * ucs4, } static int -stringprep_apply_table_to_string (uint32_t * ucs4, +stringprep_apply_table_to_string (uint32_t *ucs4, size_t *ucs4len, size_t maxucs4len, - const Stringprep_table_element * table, + const Stringprep_table_element *table, const size_t table_size) { ssize_t pos; @@ -201,9 +200,9 @@ stringprep_apply_table_to_string (uint32_t * ucs4, * #Stringprep_rc error code. **/ int -stringprep_4i (uint32_t * ucs4, size_t *len, size_t maxucs4len, +stringprep_4i (uint32_t *ucs4, size_t *len, size_t maxucs4len, Stringprep_profile_flags flags, - const Stringprep_profile * profile) + const Stringprep_profile *profile) { size_t i, j; ssize_t k; @@ -347,9 +346,9 @@ stringprep_4i (uint32_t * ucs4, size_t *len, size_t maxucs4len, } static int -stringprep_4zi_1 (uint32_t * ucs4, size_t ucs4len, size_t maxucs4len, +stringprep_4zi_1 (uint32_t *ucs4, size_t ucs4len, size_t maxucs4len, Stringprep_profile_flags flags, - const Stringprep_profile * profile) + const Stringprep_profile *profile) { int rc; @@ -390,9 +389,9 @@ stringprep_4zi_1 (uint32_t * ucs4, size_t ucs4len, size_t maxucs4len, * #Stringprep_rc error code. **/ int -stringprep_4zi (uint32_t * ucs4, size_t maxucs4len, +stringprep_4zi (uint32_t *ucs4, size_t maxucs4len, Stringprep_profile_flags flags, - const Stringprep_profile * profile) + const Stringprep_profile *profile) { size_t ucs4len; @@ -404,7 +403,7 @@ stringprep_4zi (uint32_t * ucs4, size_t maxucs4len, /** * stringprep: - * @in: input/ouput array with string to prepare. + * @in: input/output array with string to prepare. * @maxlen: maximum length of input/output array. * @flags: a #Stringprep_profile_flags value, or 0. * @profile: pointer to #Stringprep_profile to use. @@ -432,8 +431,7 @@ stringprep_4zi (uint32_t * ucs4, size_t maxucs4len, int stringprep (char *in, size_t maxlen, - Stringprep_profile_flags flags, - const Stringprep_profile * profile) + Stringprep_profile_flags flags, const Stringprep_profile *profile) { int rc; char *utf8 = NULL; @@ -703,7 +701,7 @@ stringprep_profile (const char *in, /** * stringprep_nameprep: - * @in: input/ouput array with string to prepare. + * @in: input/output array with string to prepare. * @maxlen: maximum length of input/output array. * * Prepare the input UTF-8 string according to the nameprep profile. @@ -714,7 +712,7 @@ stringprep_profile (const char *in, /** * stringprep_nameprep_no_unassigned: - * @in: input/ouput array with string to prepare. + * @in: input/output array with string to prepare. * @maxlen: maximum length of input/output array. * * Prepare the input UTF-8 string according to the nameprep profile. @@ -724,7 +722,7 @@ stringprep_profile (const char *in, /** * stringprep_iscsi: - * @in: input/ouput array with string to prepare. + * @in: input/output array with string to prepare. * @maxlen: maximum length of input/output array. * * Prepare the input UTF-8 string according to the draft iSCSI @@ -733,7 +731,7 @@ stringprep_profile (const char *in, /** * stringprep_plain: - * @in: input/ouput array with string to prepare. + * @in: input/output array with string to prepare. * @maxlen: maximum length of input/output array. * * Prepare the input UTF-8 string according to the draft SASL @@ -742,7 +740,7 @@ stringprep_profile (const char *in, /** * stringprep_kerberos5: - * @in: input/ouput array with string to prepare. + * @in: input/output array with string to prepare. * @maxlen: maximum length of input/output array. * * Prepare the input UTF-8 string according to the draft Kerberos 5 @@ -752,7 +750,7 @@ stringprep_profile (const char *in, /** * stringprep_xmpp_nodeprep: - * @in: input/ouput array with string to prepare. + * @in: input/output array with string to prepare. * @maxlen: maximum length of input/output array. * * Prepare the input UTF-8 string according to the draft XMPP node diff --git a/contrib/libs/libidn/lib/stringprep.h b/contrib/libs/libidn/lib/stringprep.h index 1694871dd9..3cfe48e148 100644 --- a/contrib/libs/libidn/lib/stringprep.h +++ b/contrib/libs/libidn/lib/stringprep.h @@ -1,5 +1,5 @@ /* stringprep.h --- Header file for stringprep functions. - Copyright (C) 2002-2022 Simon Josefsson + Copyright (C) 2002-2024 Simon Josefsson This file is part of GNU Libidn. @@ -51,7 +51,7 @@ extern "C" { # endif -# define STRINGPREP_VERSION "1.41" +# define STRINGPREP_VERSION "1.42" /* Error codes. */ typedef enum diff --git a/contrib/libs/libidn/lib/tld.c b/contrib/libs/libidn/lib/tld.c index f64ddc18bf..767f4c167b 100644 --- a/contrib/libs/libidn/lib/tld.c +++ b/contrib/libs/libidn/lib/tld.c @@ -1,6 +1,6 @@ /* tld.c --- Declarations for TLD restriction checking. - Copyright (C) 2004-2022 Simon Josefsson. - Copyright (C) 2003-2022 Free Software Foundation, Inc. + Copyright (C) 2004-2024 Simon Josefsson. + Copyright (C) 2003-2024 Free Software Foundation, Inc. Author: Thomas Jacob, Internet24.de @@ -57,7 +57,7 @@ extern const Tld_table *_tld_tables[]; * thru @tables, or return %NULL if no such structure is found. */ const Tld_table * -tld_get_table (const char *tld, const Tld_table ** tables) +tld_get_table (const char *tld, const Tld_table **tables) { const Tld_table **tldtable = NULL; @@ -86,7 +86,7 @@ tld_get_table (const char *tld, const Tld_table ** tables) * no such structure found. */ const Tld_table * -tld_default_table (const char *tld, const Tld_table ** overrides) +tld_default_table (const char *tld, const Tld_table **overrides) { const Tld_table *tldtable = NULL; @@ -119,7 +119,7 @@ tld_default_table (const char *tld, const Tld_table ** overrides) * #Tld_rc error code otherwise. */ int -tld_get_4 (const uint32_t * in, size_t inlen, char **out) +tld_get_4 (const uint32_t *in, size_t inlen, char **out) { const uint32_t *ipos; size_t olen; @@ -168,7 +168,7 @@ tld_get_4 (const uint32_t * in, size_t inlen, char **out) * #Tld_rc error code otherwise. */ int -tld_get_4z (const uint32_t * in, char **out) +tld_get_4z (const uint32_t *in, char **out) { const uint32_t *ipos = in; @@ -229,7 +229,7 @@ tld_get_z (const char *in, char **out) * %TLD_INVALID if @ch is invalid as defined by @tld. */ static int -_tld_checkchar (uint32_t ch, const Tld_table * tld) +_tld_checkchar (uint32_t ch, const Tld_table *tld) { const Tld_table_element *s, *e, *m; @@ -277,8 +277,8 @@ _tld_checkchar (uint32_t ch, const Tld_table * tld) * failure conditions. */ int -tld_check_4t (const uint32_t * in, size_t inlen, size_t *errpos, - const Tld_table * tld) +tld_check_4t (const uint32_t *in, size_t inlen, size_t *errpos, + const Tld_table *tld) { const uint32_t *ipos; int rc; @@ -319,7 +319,7 @@ tld_check_4t (const uint32_t * in, size_t inlen, size_t *errpos, * failure conditions. */ int -tld_check_4tz (const uint32_t * in, size_t *errpos, const Tld_table * tld) +tld_check_4tz (const uint32_t *in, size_t *errpos, const Tld_table *tld) { const uint32_t *ipos = in; @@ -356,8 +356,8 @@ tld_check_4tz (const uint32_t * in, size_t *errpos, const Tld_table * tld) * failure conditions. */ int -tld_check_4 (const uint32_t * in, size_t inlen, size_t *errpos, - const Tld_table ** overrides) +tld_check_4 (const uint32_t *in, size_t inlen, size_t *errpos, + const Tld_table **overrides) { const Tld_table *tld; char *domain; @@ -406,8 +406,7 @@ tld_check_4 (const uint32_t * in, size_t inlen, size_t *errpos, * failure conditions. */ int -tld_check_4z (const uint32_t * in, size_t *errpos, - const Tld_table ** overrides) +tld_check_4z (const uint32_t *in, size_t *errpos, const Tld_table **overrides) { const uint32_t *ipos = in; @@ -444,7 +443,7 @@ tld_check_4z (const uint32_t * in, size_t *errpos, * failure conditions. */ int -tld_check_8z (const char *in, size_t *errpos, const Tld_table ** overrides) +tld_check_8z (const char *in, size_t *errpos, const Tld_table **overrides) { uint32_t *iucs; size_t ilen; @@ -489,7 +488,7 @@ tld_check_8z (const char *in, size_t *errpos, const Tld_table ** overrides) * failure conditions. */ int -tld_check_lz (const char *in, size_t *errpos, const Tld_table ** overrides) +tld_check_lz (const char *in, size_t *errpos, const Tld_table **overrides) { char *utf8; int rc; diff --git a/contrib/libs/libidn/lib/tld.h b/contrib/libs/libidn/lib/tld.h index 81eac7d969..a3ebe1e19d 100644 --- a/contrib/libs/libidn/lib/tld.h +++ b/contrib/libs/libidn/lib/tld.h @@ -1,6 +1,6 @@ /* tld.h --- Declarations for TLD restriction checking. - Copyright (C) 2004-2022 Simon Josefsson. - Copyright (C) 2003-2022 Free Software Foundation, Inc. + Copyright (C) 2004-2024 Simon Josefsson. + Copyright (C) 2003-2024 Free Software Foundation, Inc. Author: Thomas Jacob, Internet24.de diff --git a/contrib/libs/libidn/lib/tlds.c b/contrib/libs/libidn/lib/tlds.c index 6ac0ce637e..7be88c811a 100644 --- a/contrib/libs/libidn/lib/tlds.c +++ b/contrib/libs/libidn/lib/tlds.c @@ -1,6 +1,7 @@ /* This file is automatically generated. DO NOT EDIT! Instead, edit gen-tld-tables.pl and re-run. */ +#include <config.h> #include "tld.h" /* TLD fr */ diff --git a/contrib/libs/libidn/lib/toutf8.c b/contrib/libs/libidn/lib/toutf8.c index 57c8945f35..02dbb6d22c 100644 --- a/contrib/libs/libidn/lib/toutf8.c +++ b/contrib/libs/libidn/lib/toutf8.c @@ -1,5 +1,5 @@ /* toutf8.c --- Convert strings from system locale into UTF-8. - Copyright (C) 2002-2022 Simon Josefsson + Copyright (C) 2002-2024 Simon Josefsson This file is part of GNU Libidn. @@ -120,6 +120,8 @@ stringprep_convert (const char *str, return str_iconv (str, from_codeset, to_codeset); #else char *p; + (void) to_codeset; + (void) from_codeset; fprintf (stderr, "libidn: warning: libiconv not installed, cannot " "convert data to UTF-8\n"); p = malloc (strlen (str) + 1); diff --git a/contrib/libs/libidn/lib/version.c b/contrib/libs/libidn/lib/version.c index 349c704709..993a9d14d5 100644 --- a/contrib/libs/libidn/lib/version.c +++ b/contrib/libs/libidn/lib/version.c @@ -1,5 +1,5 @@ /* version.c --- Version handling. - Copyright (C) 2002-2022 Simon Josefsson + Copyright (C) 2002-2024 Simon Josefsson This file is part of GNU Libidn. diff --git a/contrib/libs/libidn/ya.make b/contrib/libs/libidn/ya.make index 9eaf83a4ba..fc1d35bcc5 100644 --- a/contrib/libs/libidn/ya.make +++ b/contrib/libs/libidn/ya.make @@ -1,4 +1,4 @@ -# Generated by devtools/yamaker from nixpkgs 22.05. +# Generated by devtools/yamaker from nixpkgs 22.11. DEFAULT(USE_IDN ${_USE_IDN}) @@ -6,9 +6,9 @@ LIBRARY() WITHOUT_LICENSE_TEXTS() -VERSION(1.41) +VERSION(1.42) -ORIGINAL_SOURCE(mirror://gnu/libidn/libidn-1.41.tar.gz) +ORIGINAL_SOURCE(mirror://gnu/libidn/libidn-1.42.tar.gz) LICENSE(Service-Dll-Harness) |