diff options
| author | Paul Eggert | 2021-10-04 12:11:39 -0700 |
|---|---|---|
| committer | Paul Eggert | 2021-10-04 15:21:31 -0700 |
| commit | 68a256c89270ef9e97bca6097967a9ed2b050f4a (patch) | |
| tree | 7a3cca947c133bf7def967083f1054dfa4239322 /lib/string.in.h | |
| parent | 63cb65dccecb1146cdad7134e4b62ea3e1433880 (diff) | |
| download | emacs-68a256c89270ef9e97bca6097967a9ed2b050f4a.tar.gz emacs-68a256c89270ef9e97bca6097967a9ed2b050f4a.zip | |
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
Diffstat (limited to 'lib/string.in.h')
| -rw-r--r-- | lib/string.in.h | 98 |
1 files changed, 61 insertions, 37 deletions
diff --git a/lib/string.in.h b/lib/string.in.h index c76c1820b36..8d77ae38000 100644 --- a/lib/string.in.h +++ b/lib/string.in.h | |||
| @@ -2,18 +2,18 @@ | |||
| 2 | 2 | ||
| 3 | Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc. | 3 | Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This program is free software; you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU Lesser General Public License as |
| 7 | the Free Software Foundation; either version 3, or (at your option) | 7 | published by the Free Software Foundation; either version 2.1 of the |
| 8 | any later version. | 8 | License, or (at your option) any later version. |
| 9 | 9 | ||
| 10 | This program is distributed in the hope that it will be useful, | 10 | This file is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. | 13 | GNU Lesser General Public License for more details. |
| 14 | 14 | ||
| 15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Lesser General Public License |
| 16 | along with this program; if not, see <https://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 17 | 17 | ||
| 18 | #if __GNUC__ >= 3 | 18 | #if __GNUC__ >= 3 |
| 19 | @PRAGMA_SYSTEM_HEADER@ | 19 | @PRAGMA_SYSTEM_HEADER@ |
| @@ -52,16 +52,6 @@ | |||
| 52 | # include <wchar.h> | 52 | # include <wchar.h> |
| 53 | #endif | 53 | #endif |
| 54 | 54 | ||
| 55 | /* The __attribute__ feature is available in gcc versions 2.5 and later. | ||
| 56 | The attribute __pure__ was added in gcc 2.96. */ | ||
| 57 | #ifndef _GL_ATTRIBUTE_PURE | ||
| 58 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ | ||
| 59 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) | ||
| 60 | # else | ||
| 61 | # define _GL_ATTRIBUTE_PURE /* empty */ | ||
| 62 | # endif | ||
| 63 | #endif | ||
| 64 | |||
| 65 | /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */ | 55 | /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */ |
| 66 | /* But in any case avoid namespace pollution on glibc systems. */ | 56 | /* But in any case avoid namespace pollution on glibc systems. */ |
| 67 | #if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \ | 57 | #if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \ |
| @@ -77,12 +67,31 @@ | |||
| 77 | # include <strings.h> | 67 | # include <strings.h> |
| 78 | #endif | 68 | #endif |
| 79 | 69 | ||
| 70 | /* The __attribute__ feature is available in gcc versions 2.5 and later. | ||
| 71 | The attribute __pure__ was added in gcc 2.96. */ | ||
| 72 | #ifndef _GL_ATTRIBUTE_PURE | ||
| 73 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ | ||
| 74 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) | ||
| 75 | # else | ||
| 76 | # define _GL_ATTRIBUTE_PURE /* empty */ | ||
| 77 | # endif | ||
| 78 | #endif | ||
| 79 | |||
| 80 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | 80 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
| 81 | 81 | ||
| 82 | /* The definition of _GL_ARG_NONNULL is copied here. */ | 82 | /* The definition of _GL_ARG_NONNULL is copied here. */ |
| 83 | 83 | ||
| 84 | /* The definition of _GL_WARN_ON_USE is copied here. */ | 84 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
| 85 | 85 | ||
| 86 | /* Declare 'free' if needed for _GL_ATTRIBUTE_DEALLOC_FREE. */ | ||
| 87 | _GL_EXTERN_C void free (void *); | ||
| 88 | #if @GNULIB_FREE_POSIX@ | ||
| 89 | # if (@REPLACE_FREE@ && !defined free \ | ||
| 90 | && !(defined __cplusplus && defined GNULIB_NAMESPACE)) | ||
| 91 | # define free rpl_free | ||
| 92 | _GL_EXTERN_C void free (void *); | ||
| 93 | # endif | ||
| 94 | #endif | ||
| 86 | 95 | ||
| 87 | /* Clear a block of memory. The compiler will not delete a call to | 96 | /* Clear a block of memory. The compiler will not delete a call to |
| 88 | this function, even if the block is dead after the call. */ | 97 | this function, even if the block is dead after the call. */ |
| @@ -418,7 +427,10 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " | |||
| 418 | # undef strdup | 427 | # undef strdup |
| 419 | # define strdup rpl_strdup | 428 | # define strdup rpl_strdup |
| 420 | # endif | 429 | # endif |
| 421 | _GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); | 430 | _GL_FUNCDECL_RPL (strdup, char *, |
| 431 | (char const *__s) | ||
| 432 | _GL_ARG_NONNULL ((1)) | ||
| 433 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
| 422 | _GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); | 434 | _GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); |
| 423 | # elif defined _WIN32 && !defined __CYGWIN__ | 435 | # elif defined _WIN32 && !defined __CYGWIN__ |
| 424 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 436 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| @@ -431,35 +443,47 @@ _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); | |||
| 431 | /* strdup exists as a function and as a macro. Get rid of the macro. */ | 443 | /* strdup exists as a function and as a macro. Get rid of the macro. */ |
| 432 | # undef strdup | 444 | # undef strdup |
| 433 | # endif | 445 | # endif |
| 434 | # if !(@HAVE_DECL_STRDUP@ || defined strdup) | 446 | # if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup |
| 435 | _GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); | 447 | _GL_FUNCDECL_SYS (strdup, char *, |
| 448 | (char const *__s) | ||
| 449 | _GL_ARG_NONNULL ((1)) | ||
| 450 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
| 436 | # endif | 451 | # endif |
| 437 | _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); | 452 | _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); |
| 438 | # endif | 453 | # endif |
| 439 | _GL_CXXALIASWARN (strdup); | 454 | _GL_CXXALIASWARN (strdup); |
| 440 | #elif defined GNULIB_POSIXCHECK | 455 | #else |
| 441 | # undef strdup | 456 | # if __GNUC__ >= 11 && !defined strdup |
| 442 | # if HAVE_RAW_DECL_STRDUP | 457 | /* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */ |
| 458 | _GL_FUNCDECL_SYS (strdup, char *, | ||
| 459 | (char const *__s) | ||
| 460 | _GL_ARG_NONNULL ((1)) | ||
| 461 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
| 462 | # endif | ||
| 463 | # if defined GNULIB_POSIXCHECK | ||
| 464 | # undef strdup | ||
| 465 | # if HAVE_RAW_DECL_STRDUP | ||
| 443 | _GL_WARN_ON_USE (strdup, "strdup is unportable - " | 466 | _GL_WARN_ON_USE (strdup, "strdup is unportable - " |
| 444 | "use gnulib module strdup for portability"); | 467 | "use gnulib module strdup for portability"); |
| 445 | # endif | 468 | # endif |
| 446 | #elif @GNULIB_MDA_STRDUP@ | 469 | # elif @GNULIB_MDA_STRDUP@ |
| 447 | /* On native Windows, map 'creat' to '_creat', so that -loldnames is not | 470 | /* On native Windows, map 'creat' to '_creat', so that -loldnames is not |
| 448 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | 471 | required. In C++ with GNULIB_NAMESPACE, avoid differences between |
| 449 | platforms by defining GNULIB_NAMESPACE::creat always. */ | 472 | platforms by defining GNULIB_NAMESPACE::strdup always. */ |
| 450 | # if defined _WIN32 && !defined __CYGWIN__ | 473 | # if defined _WIN32 && !defined __CYGWIN__ |
| 451 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 474 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 452 | # undef strdup | 475 | # undef strdup |
| 453 | # define strdup _strdup | 476 | # define strdup _strdup |
| 454 | # endif | 477 | # endif |
| 455 | _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); | 478 | _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); |
| 456 | # else | 479 | # else |
| 457 | # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup | 480 | # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup |
| 458 | # undef strdup | 481 | # undef strdup |
| 459 | # endif | 482 | # endif |
| 460 | _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); | 483 | _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); |
| 461 | # endif | 484 | # endif |
| 462 | _GL_CXXALIASWARN (strdup); | 485 | _GL_CXXALIASWARN (strdup); |
| 486 | # endif | ||
| 463 | #endif | 487 | #endif |
| 464 | 488 | ||
| 465 | /* Append no more than N characters from SRC onto DEST. */ | 489 | /* Append no more than N characters from SRC onto DEST. */ |