diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-10-04 12:11:39 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-10-04 15:21:31 -0700 |
commit | 68a256c89270ef9e97bca6097967a9ed2b050f4a (patch) | |
tree | 7a3cca947c133bf7def967083f1054dfa4239322 /lib/malloc | |
parent | 63cb65dccecb1146cdad7134e4b62ea3e1433880 (diff) | |
download | emacs-68a256c89270ef9e97bca6097967a9ed2b050f4a.tar.gz |
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/malloc')
-rw-r--r-- | lib/malloc/dynarray-skeleton.c | 41 | ||||
-rw-r--r-- | lib/malloc/dynarray.h | 8 | ||||
-rw-r--r-- | lib/malloc/dynarray_at_failure.c | 15 | ||||
-rw-r--r-- | lib/malloc/dynarray_emplace_enlarge.c | 12 | ||||
-rw-r--r-- | lib/malloc/dynarray_finalize.c | 12 | ||||
-rw-r--r-- | lib/malloc/dynarray_resize.c | 12 | ||||
-rw-r--r-- | lib/malloc/dynarray_resize_clear.c | 12 | ||||
-rw-r--r-- | lib/malloc/scratch_buffer.h | 8 | ||||
-rw-r--r-- | lib/malloc/scratch_buffer_dupfree.c | 8 | ||||
-rw-r--r-- | lib/malloc/scratch_buffer_grow.c | 8 | ||||
-rw-r--r-- | lib/malloc/scratch_buffer_grow_preserve.c | 8 | ||||
-rw-r--r-- | lib/malloc/scratch_buffer_set_array_size.c | 8 |
12 files changed, 88 insertions, 64 deletions
diff --git a/lib/malloc/dynarray-skeleton.c b/lib/malloc/dynarray-skeleton.c index 4995fd1c049..48210e32527 100644 --- a/lib/malloc/dynarray-skeleton.c +++ b/lib/malloc/dynarray-skeleton.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ @@ -192,7 +192,7 @@ DYNARRAY_NAME (free__array__) (struct DYNARRAY_STRUCT *list) /* Initialize a dynamic array object. This must be called before any use of the object. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static void DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list) { @@ -202,7 +202,7 @@ DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list) } /* Deallocate the dynamic array and its elements. */ -__attribute_maybe_unused__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_nonnull__ ((1)) static void DYNARRAY_FREE (struct DYNARRAY_STRUCT *list) { @@ -213,7 +213,7 @@ DYNARRAY_FREE (struct DYNARRAY_STRUCT *list) } /* Return true if the dynamic array is in an error state. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline bool DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list) { @@ -222,7 +222,7 @@ DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list) /* Mark the dynamic array as failed. All elements are deallocated as a side effect. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static void DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list) { @@ -236,7 +236,7 @@ DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list) /* Return the number of elements which have been added to the dynamic array. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline size_t DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list) { @@ -245,7 +245,7 @@ DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list) /* Return a pointer to the array element at INDEX. Terminate the process if INDEX is out of bounds. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline DYNARRAY_ELEMENT * DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index) { @@ -257,7 +257,7 @@ DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index) /* Return a pointer to the first array element, if any. For a zero-length array, the pointer can be NULL even though the dynamic array has not entered the failure state. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline DYNARRAY_ELEMENT * DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list) { @@ -267,7 +267,7 @@ DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list) /* Return a pointer one element past the last array element. For a zero-length array, the pointer can be NULL even though the dynamic array has not entered the failure state. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline DYNARRAY_ELEMENT * DYNARRAY_NAME (end) (struct DYNARRAY_STRUCT *list) { @@ -294,7 +294,7 @@ DYNARRAY_NAME (add__) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item) /* Add ITEM at the end of the array, enlarging it by one element. Mark *LIST as failed if the dynamic array allocation size cannot be increased. */ -__nonnull ((1)) +__attribute_nonnull__ ((1)) static inline void DYNARRAY_NAME (add) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item) { @@ -348,7 +348,8 @@ DYNARRAY_NAME (emplace__) (struct DYNARRAY_STRUCT *list) /* Allocate a place for a new element in *LIST and return a pointer to it. The pointer can be NULL if the dynamic array cannot be enlarged due to a memory allocation failure. */ -__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_warn_unused_result__ +__attribute_nonnull__ ((1)) static /* Avoid inlining with the larger initialization code. */ #if !(defined (DYNARRAY_ELEMENT_INIT) || defined (DYNARRAY_ELEMENT_FREE)) @@ -372,7 +373,7 @@ DYNARRAY_NAME (emplace) (struct DYNARRAY_STRUCT *list) existing size, new elements are added (which can be initialized). Otherwise, the list is truncated, and elements are freed. Return false on memory allocation failure (and mark *LIST as failed). */ -__attribute_maybe_unused__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_nonnull__ ((1)) static bool DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size) { @@ -417,7 +418,7 @@ DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size) } /* Remove the last element of LIST if it is present. */ -__attribute_maybe_unused__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_nonnull__ ((1)) static void DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list) { @@ -434,7 +435,7 @@ DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list) /* Remove all elements from the list. The elements are freed, but the list itself is not. */ -__attribute_maybe_unused__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_nonnull__ ((1)) static void DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list) { @@ -452,7 +453,8 @@ DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list) stored in *RESULT if LIST refers to an empty list. On success, the pointer in *RESULT is heap-allocated and must be deallocated using free. */ -__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1, 2)) +__attribute_maybe_unused__ __attribute_warn_unused_result__ +__attribute_nonnull__ ((1, 2)) static bool DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, DYNARRAY_FINAL_TYPE *result) @@ -483,7 +485,8 @@ DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, have a sentinel at the end). If LENGTHP is not NULL, the array length is written to *LENGTHP. *LIST is re-initialized and can be reused. */ -__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1)) +__attribute_maybe_unused__ __attribute_warn_unused_result__ +__attribute_nonnull__ ((1)) static DYNARRAY_ELEMENT * DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, size_t *lengthp) { diff --git a/lib/malloc/dynarray.h b/lib/malloc/dynarray.h index 84e4394bf32..638c33f9867 100644 --- a/lib/malloc/dynarray.h +++ b/lib/malloc/dynarray.h @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ diff --git a/lib/malloc/dynarray_at_failure.c b/lib/malloc/dynarray_at_failure.c index a4424593748..8dd68507870 100644 --- a/lib/malloc/dynarray_at_failure.c +++ b/lib/malloc/dynarray_at_failure.c @@ -3,22 +3,26 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#ifndef _LIBC +# include <libc-config.h> +# include <stdlib.h> +#endif + #include <dynarray.h> #include <stdio.h> -#include <stdlib.h> void __libc_dynarray_at_failure (size_t size, size_t index) @@ -28,6 +32,7 @@ __libc_dynarray_at_failure (size_t size, size_t index) __snprintf (buf, sizeof (buf), "Fatal glibc error: " "array index %zu not less than array length %zu\n", index, size); + __libc_fatal (buf); #else abort (); #endif diff --git a/lib/malloc/dynarray_emplace_enlarge.c b/lib/malloc/dynarray_emplace_enlarge.c index 7ac4b6db403..0f8baf94ad1 100644 --- a/lib/malloc/dynarray_emplace_enlarge.c +++ b/lib/malloc/dynarray_emplace_enlarge.c @@ -3,19 +3,23 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#ifndef _LIBC +# include <libc-config.h> +#endif + #include <dynarray.h> #include <errno.h> #include <intprops.h> diff --git a/lib/malloc/dynarray_finalize.c b/lib/malloc/dynarray_finalize.c index be9441e313d..c33da41389e 100644 --- a/lib/malloc/dynarray_finalize.c +++ b/lib/malloc/dynarray_finalize.c @@ -3,19 +3,23 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#ifndef _LIBC +# include <libc-config.h> +#endif + #include <dynarray.h> #include <stdlib.h> #include <string.h> diff --git a/lib/malloc/dynarray_resize.c b/lib/malloc/dynarray_resize.c index 92bbddd4461..5a57166a849 100644 --- a/lib/malloc/dynarray_resize.c +++ b/lib/malloc/dynarray_resize.c @@ -3,19 +3,23 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#ifndef _LIBC +# include <libc-config.h> +#endif + #include <dynarray.h> #include <errno.h> #include <intprops.h> diff --git a/lib/malloc/dynarray_resize_clear.c b/lib/malloc/dynarray_resize_clear.c index 99c2cc87c31..9c43b00c3a7 100644 --- a/lib/malloc/dynarray_resize_clear.c +++ b/lib/malloc/dynarray_resize_clear.c @@ -3,19 +3,23 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#ifndef _LIBC +# include <libc-config.h> +#endif + #include <dynarray.h> #include <string.h> diff --git a/lib/malloc/scratch_buffer.h b/lib/malloc/scratch_buffer.h index 26e306212d1..36d0bef4bb1 100644 --- a/lib/malloc/scratch_buffer.h +++ b/lib/malloc/scratch_buffer.h @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ diff --git a/lib/malloc/scratch_buffer_dupfree.c b/lib/malloc/scratch_buffer_dupfree.c index 775bff5609f..07363b9bc86 100644 --- a/lib/malloc/scratch_buffer_dupfree.c +++ b/lib/malloc/scratch_buffer_dupfree.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ diff --git a/lib/malloc/scratch_buffer_grow.c b/lib/malloc/scratch_buffer_grow.c index e7606d81cd7..22c8c7781ee 100644 --- a/lib/malloc/scratch_buffer_grow.c +++ b/lib/malloc/scratch_buffer_grow.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ diff --git a/lib/malloc/scratch_buffer_grow_preserve.c b/lib/malloc/scratch_buffer_grow_preserve.c index 59f8c710001..2b2b819289e 100644 --- a/lib/malloc/scratch_buffer_grow_preserve.c +++ b/lib/malloc/scratch_buffer_grow_preserve.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ diff --git a/lib/malloc/scratch_buffer_set_array_size.c b/lib/malloc/scratch_buffer_set_array_size.c index e2b9f31211a..a47f9276a82 100644 --- a/lib/malloc/scratch_buffer_set_array_size.c +++ b/lib/malloc/scratch_buffer_set_array_size.c @@ -3,16 +3,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ |