lib/obstack.h


Log

Author Commit Date CI Message
Paul Eggert 281b825e 2018-01-01T00:57:25 maint: Run 'make update-copyright'
Paul Eggert ca35d468 2017-09-13T00:48:18 all: prefer https: URLs
Paul Eggert a3fd683d 2017-01-01T02:59:23 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Paul Eggert 9f623dc5 2016-11-14T19:48:28 obstack: port to gcc -fcheck-pointer-bounds Problem found by 'make check' failure on bleeding-edge coreutils on an MPX-enabled CPU (Intel Core i3-7100U) running GCC (Ubuntu 6.2.0-5ubuntu12), configured via "./configure --enable-gcc-warnings CFLAGS='-mmpx -fcheck-pointer-bounds -g3 -O2' LDFLAGS='-static-libmpx -static-libmpxwrappers'". * lib/obstack.h (__FLEXIBLE_ARRAY_MEMBER): New macro, copied from fts_.h. (struct _obstack_chunk.contents): Use it.
Paul Eggert 77d36b55 2016-07-15T10:35:22 obstack: pacify GCC 6 with -Wnull-dereference Problem reported by Assaf Gordon in: http://lists.gnu.org/archive/html/bug-gnulib/2016-07/msg00028.html * lib/obstack.c, lib/obstack.h (obstack_alloc_failed_handler): Declare with __attribute_noreturn__. * lib/obstack.h (__attribute_noreturn__): New macro.
Paul Eggert 71090a2a 2016-01-01T00:56:19 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Paul Eggert b9bfe784 2015-01-01T01:38:23 version-etc: new year * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
Paul Eggert ed253cd8 2014-11-05T11:41:57 obstack: do not reject malloc-style obstack_chunkfun, obstack_freefun Problem reported by Alan Modra in: http://lists.gnu.org/archive/html/bug-gnulib/2014-11/msg00007.html * lib/obstack.h (obstack_chunkfun, obstack_freefun): Always cast the function arg, reverting this part of the previous change.
Paul Eggert 127ed6a3 2014-11-04T00:31:31 obstack: avoid potentially-nonportable function casts * lib/obstack.c (CALL_CHUNKFUN, CALL_FREEFUN): Remove, replacing with ... (call_chunkfun, call_freefun): New static functions. All uses changed. Avoid potentially-nonportable casts. (chunkfun_type, freefun_type): Remove typedefs; no longer used. (_obstack_begin_worker): Omit last two args, since they rely on potentially-nonportable casts. All callers changed. * lib/obstack.h (_OBSTACK_CAST): New macro. Use it everywhere the old API used a potentially-nonportable cast. The new API doesn't cast. (struct obstack): Use unions rather than requiring potentially-nonportable casts. (obstack_chunkfun, obstack_freefun): Return void.
Alan Modra d15b2da0 2014-11-03T17:32:27 obstack: fix macro return values * lib/obstack.h (obstack_next_free): Return void *. (obstack_1grow_fast, obstack_blank_fast): Return void. For __GNUC__ macros: (obstack_1grow, obstack_blank): Remove now unnecessary (void) 0. For !__GNUC__ macros: (obstack_make_room, obstack_grow, obstack_grow0) (obstack_ptr_grow_fast, obstack_int_grow_fast): Return void.
Paul Eggert 6c34297a 2014-10-28T23:58:42 obstack: use size_t alignments and check for overflow * lib/obstack.c, lib/obstack.h (_obstack_begin, _obstack_begin_1): * lib/obstack.c (_obstack_begin_worker, _obstack_newchunk): * lib/obstack.h (struct obstack.alignment_mask): Use _OBSTACK_SIZE_T, not int, for alignments. * lib/obstack.c (_obstack_newchunk): Fail if the size calculation overflows, e.g., when adding the alignment.
Alan Modra 82a38a0d 2014-10-29T14:03:00 obstack: 64-bit obstack support, part 3 This finally enables full 64-bit obstack support. The glibc shared library specific code is removed from obstack.c too, and the error handling code conditionally compiled under control of another macro, _OBSTACK_NO_ERROR_HANDLER. * lib/obstack.h: Include string.h earlier. (_OBSTACK_INTERFACE_VERSION): Define. (_OBSTACK_SIZE_T, _CHUNK_SIZE_T): Define as size_t for version 2. * lib/obstack.c: Don't include shlib-compat.h. (OBSTACK_INTERFACE_VERSION): Delete. (_OBSTACK_ELIDE_CODE): Rename from ELIDE_CODE. Define when version 1 glibc code is compatible with version 2. Don't include stdio.h for __GNU_LIBRARY. (obstack_exit_failure, print_and_abort, obstack_alloc_failed_handler): Omit when _OBSTACK_NO_ERROR_HANDLER defined. Include stdio.h here. (_obstack_compat, _obstack, _obstack_newchunk, obstack_free): Delete glibc shared library specific source.
Alan Modra bb2ab7ec 2014-10-29T14:02:40 obstack: 64-bit obstack support, part 2 This gets us 4G obstack support, without changing ABI compatibility, apart from possibly introducing some signed/unsigned comparison warnings in code that uses obstack.h. a) Replace "int" size parameters, return values, and macro local vars with _OBSTACK_SIZE_T, an "unsigned int" for now. b) Make obstack.chunk_size a _CHUNK_SIZE_T, an "unsigned long" for now. c) Make all obstack macros checking available room use obstack_room. "next_free + desired > chunk_limit" may wrap the lhs for chunks allocated near the top of memory. d) Use unsigned comparisons, and macro locals to support >2G on 32-bit. * lib/obstack.h (_OBSTACK_SIZE_T): Define. Use throughout in place of "int" size parameters, return values and local vars. (_CHUNK_SIZE_T): Define. (struct obstack): Make chunk_size a _CHUNK_SIZE_T. Make temp union use an _OBSTACK_SIZE_T integer type. For __GNUC__ versions of the following macros... (obstack_room): Rename local var. (obstack_make_room): Use obstack_room. (obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow, obstack_int_grow, obstack_blank): Likewise. (obstack_finish): Use unsigned comparison when comparing aligned next_free against chunk_limit. (obstack_free): Cast OBJ to remove possible const qualifier. For !__GNUC__ versions of the following macros... (obstack_make_room): Use obstack_room. (obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow, obstack_int_grow, obstack_blank): Likewise. (obstack_finish): Use unsigned comparision when comparing aligned next_free against chunk_limit. (obstack_free): Use temp.p and same comparisons as __GNUC__ version. * lib/obstack.c (_obstack_begin_worker): Make "size" parameter _OBSTACK_SIZE_T. (_obstack_begin, _obstack_begin_1): Likewise. (_obstack_newchunk): Likewise for length parameter. Use size_t locals. (_obstack_memory_used): Return and use _OBSTACK_SIZE_T local.
Alan Modra 266ac1b9 2014-10-29T14:02:31 obstack: 64-bit obstack support, part 1 a) Correct calls to alloc function, to use a size_t arg. "long" is just wrong on targets like x86_64-mingw64 where "long" is 32 bits and "size_t" 64 bits. b) Consolidate _obstack_begin and _obstack_begin1 code. * lib/obstack.h (struct obstack <chunkfun>): Correct prototype to use "size_t" rather than "long". (_obstack_begin, _obstack_begin1): Likewise. (obstack_init, obstack_begin, obstack_specify_allocation_with_arg, obstack_chunkfun): Update alloc function casts. * lib/obstack.c (CALL_CHUNKFUN): Update chunkfun cast. (chunkfun_type, freefun_type): New typdefs. (_obstack_begin_worker): Split out from .. (_obstack_begin, _obstack_begin_1): ..here.
Alan Modra 8216dffc 2014-10-29T14:02:22 obstack: tidy part 2 a) Don't be concerned about "not polluting the namespace with stddef.h symbols" in obstack.h, since gnulib string.h includes stddef.h anyway, and it seems unlikely that anyone would care. b) Don't roll our own slow memcpy in _obstack_newchunk. c) Rename obstack_free to _obstack_free. This makes the naming consistent with other obstack functions and obviates the need for __obstack_free. Ancient obstack.c defined both obstack_free and _obstack_free. We continue to do that for _LIBC via an alias. d) Miscellaneous macro fixes. The expression used to test for gcc-2.8 is clever, but nowadays gcc warns on undefined macros. You'll get an undefined macro warning if simulating an old gcc with -U__GNUC__ -U__GNUC_MINOR__ -D__GNUC__=1. * lib/obstack.h: Include stddef.h unconditionally. Formatting fixes. (PTR_INT_TYPE): Delete, replace with ptrdiff_t. (__obstack_free): Delete, update refs. (_obstack_free): Rename from obstack_free. (__extension__): Avoid undefined macro warning for __GNUC_MINOR__. (obstack_object_size, obstack_room): Parenthesise !__GNUC__ versions. * lib/obstack.c: Don't include stddef.h. (COPYING_UNIT): Delete. (_obstack_begin): Formatting fix. (_obstack_newchunk): Use memcpy to move existing object to new chunk. (_obstack_free): Rename from __obstack_free, update alias. Move undef of obstack_free to where it is needed.
Alan Modra ec1a9f7b 2014-10-29T14:02:13 obstack: tidy part 1 a) Rename temp fields. temp.tempint and temp.tempptr just looks ugly to me, and result in overlong lines after later patches. b) Move error handling code, to avoid a forward declaration and to simplify later patches in this series. * lib/obstack.h (struct obstack <temp>): Rename fields of union and update all uses. * lib/obstack.c: Include stdlib.h earlier. (obstack_exit_failure, obstack_alloc_failed_handler): Move later in file. (print_and_abort): Remove now redundant forward declaration.
Paul Eggert 6421fd46 2014-03-27T13:38:41 obstack: Remove ancient NeXTSTEP gcc support conditional This change will ease merging with glibc. The "#if ... __NEXT__" causes a warning with -Wundef which glibc now enables by default. Problem reported by Will Newton in <http://lists.gnu.org/archive/html/bug-gnulib/2014-03/msg00032.html>. glibc <sys/cdefs.h> now uses __extension__ for GCC 2.8 or later, so go with that. * lib/obstack.h (__extension__):
Paul Eggert df9b7142 2014-03-27T12:55:07 obstack: merge with glibc changes * lib/obstack.c, lib/obstack.h: Merge from glibc. This is mostly indenting and commentary changes. Instances of 'register' have been removed.
Eric Blake 1276a2c5 2014-01-01T00:04:40 maint: update copyright I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
Paul Eggert 9c5dea9a 2013-10-31T09:44:44 obstack: pacify HP C * lib/obstack.h (obstack_free) [!__GNUC__]: Rewrite to avoid warning "conversion from pointer to smaller integer" from HP C-ANSI-C - cc version B9007AA/B3910B A.06.26. It's safe to assume C89 or later nowadays, so cast to void instead of int. Privately reported by H.Merijn Brand. Also, change header to match glibc's, to make checking against glibc easier.
Jim Meyering c2b08ae2 2013-09-30T10:19:38 fpending, obstack, strerror-override: use pure+const function attrs * lib/fpending.h (__fpending): Declare with the "pure" attribute. * lib/obstack.c (_obstack_allocated_p): Likewise. * lib/obstack.h (_obstack_memory_used): Likewise. (_obstack_memory_used): Likewise. * lib/strerror-override.h (strerror_override): Declare with the "const" attribute.
Paul Eggert 45a46d96 2013-05-15T00:27:15 obstack: port --enable-gcc-warnings to clang * lib/obstack.h (obstack_ptr_grow_fast, obstack_int_grow_fast): Avoid casts from looser to stricter-aligned pointers.
Eric Blake 9fc81090 2013-01-01T00:50:58 maint: update all copyright year number ranges Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
Paul Eggert a4d796fb 2012-02-05T13:42:03 maint: spelling fixes
Paul Eggert c5230ae4 2012-01-25T11:08:01 obstack: remove __STDC__ conditionals * lib/obstack.h: Remove __STDC__ conditionals, as suggested by Joseph S. Myers in <http://cygwin.com/ml/libc-alpha/2012-01/msg00104.html>. This leaves lib/localcharset.c, m4/iconv.m4, and a confusing comment in m4/include_next.m4 as the only gnulib-maintained places that still refer to __STDC__.
Paul Eggert 51e801f2 2012-01-05T23:53:49 In commentary, do not use ` to quote.
Jim Meyering 1602f0af 2012-01-01T10:04:58 maint: update all copyright year number ranges Run "make update-copyright".
Jim Meyering d60f3b0c 2011-01-01T20:17:23 maint: update almost all copyright ranges to include 2011 Run the new "make update-copyright" rule.
Bruno Haible 89519c00 2010-03-21T01:14:37 Ensure no #include statements inside extern "C" { ... }.
Jim Meyering b2e2010c 2010-01-01T10:31:12 update nearly all FSF copyright year lists to include 2010 Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
Jim Meyering 3030c5b5 2009-12-28T10:50:36 update nearly all FSF copyright year lists to include 2009 The files named by the following are exempted: grep -v '^#' config/srclist.txt|grep -v '^$' \ | while read src dst; do test -f "$dst" && { echo "$dst"; continue; } test -d "$dst" || continue echo "$dst"/$(basename "$src") done > exempt git ls-files tests/unictype >> exempt In the remaining files, convert to all-interval notation if - there is already at least one year interval like 2000-2003 - the file is maintained by me - the file is in lib/uni*/, where that style already prevails Otherwise, use update-copyright's default.
Bruno Haible 441aa304 2009-12-10T20:28:30 Use spaces for indentation, not tabs.
Bruno Haible 57fdfd3f 2007-10-07T19:14:58 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible 9d55a02b 2006-10-23T19:40:24 Make it possible to rename obstack_free.
Paul Eggert 0e56d268 2005-10-14T23:23:50 * config/srclist.txt: Add glibc bug 321 for obstack.c, obstack.h. * lib/obstack.c [defined _LIBC && defined USE_IN_LIBIO]: Don't include <wchar.h>; no longer needed. * lib/obstack.c (print_and_abort) [defined _LIBC]: Use __fxprintf instead of inline stream orientation test and two separate function calls. Pay no attention to USE_IN_LIBIO. * lib/obstack.h [!__STDC__] (obstack_int_grow_fast): Fix misnamed macro argument. Reported by Matej Vela <vela@debian.org>.
Paul Eggert 267a39ba 2005-05-14T06:03:57 *** empty log message ***
Paul Eggert 3dec705e 2004-08-10T05:16:29 (obstack_empty_p): Don't assume that chunk->contents is suitably aligned.
Jim Meyering 1e5e485b 2004-06-24T06:04:10 (obstack_base): Cast to (void *), per documentation.
Paul Eggert 39e82e46 2004-05-19T20:04:16 Remove unused vars and decls in obstack.
Paul Eggert e8681568 2004-05-17T07:52:52 Port obstack to the AS/400.
Paul Eggert 62506e78 2004-05-07T04:22:56 Import obstack changes from libc.
Paul Eggert 19e15828 2003-10-22T05:10:04 Merge changes from glibc obstack; minor cleanups to make it easier to merge back in the future.
Paul Eggert ff0ca1ea 2003-10-22T01:02:47 Don't use lvalue casts, as GCC plans to remove support for them in GCC 3.5.
Paul Eggert e5c08814 2003-09-09T23:00:43 Remove K&R cruft.
Paul Eggert aef0001b 2003-08-15T03:12:34 White-space changes only; from coreutils.
Paul Eggert 57153f2e 2003-07-11T23:33:34 (__INT_TO_PTR): Revert change of 2003-03-13; it breaks C++ compilation. [!__GNUC__ || !__STDC__] (obstack_finish): Cast result to void*.
Paul Eggert 4589d52c 2003-07-09T22:48:52 Switch from LGPL to GPL.
Jim Meyering c36b7b51 2003-03-14T09:59:32 Merge changes from Coreutils. (obstack_object_size): Declare temporary, __o, to be const, in order to avoid warnings. (obstack_room): Likewise. (obstack_empty_p): Likewise.
Paul Eggert 70ec9ea6 2003-03-13T21:13:59 (__INT_TO_PTR) [__STDC__]: Cast result to (void *) to avoid diagnostic with native c89 on SGI IRIX 6.5 when compiling Bison 1.875's `bitset bset = obstack_alloc (bobstack, bytes);'. Problem reported by Nelson H. F. Beebe.
Jim Meyering 063e0ea8 2000-11-18T09:53:33 tweak a comment
Jim Meyering 291a8b36 2000-11-18T09:50:09 Formatting changes. (obstack_grow, obstack_grow0): Don't cast WHERE at all: that would prevent type checking. (obstack_ptr_grow, obstack_ptr_grow_fast): When assigning, don't cast the value to (void *): assigning a `foo *' to a `void *' variable is valid. (obstack_int_grow, obstack_int_grow_fast): Don't cast AINT to int.
Jim Meyering 8ccdfffb 2000-11-10T11:10:39 Update from GNU libc.
Jim Meyering 89f2b489 2000-08-07T15:48:18 back out Copyright date changes for files with no changes year
Jim Meyering d349992d 2000-07-09T07:22:43 update copyright date
Jim Meyering 1315b9b9 2000-05-04T07:19:24 update from glibc -- solely white space changes
Jim Meyering a9785518 1997-11-13T14:22:56 update from GNU libc
Jim Meyering 05fdbef0 1997-08-22T14:55:01 update from glibc
Jim Meyering e4ccac4d 1997-02-04T03:20:29 new obstack from libc
Jim Meyering 4d8692e4 1996-12-10T05:22:12 Include config.h. [!HAVE_BCOPY && HAVE_MEMCPY && !defined (bcopy)]: Define bcopy in terms of memcpy. Reported by Marcus Daniels.
Jim Meyering 2b7f7f6f 1996-11-04T18:15:56 from franc,ois
Jim Meyering 6d8337bf 1996-07-15T03:36:16 update FSF address in copyright
Jim Meyering c89f48f0 1995-08-09T05:15:31 Include config.h. Define bcopy to memcpy if possible.
Jim Meyering d6435a17 1994-11-06T17:51:31 merge with 1.12
Jim Meyering 9f657ec1 1994-11-05T13:37:49 merge with 3.10
Jim Meyering bc244b77 1994-11-04T16:50:15 merge with 3.9u1
Jim Meyering 94f5c09e 1994-10-20T16:10:00 Initial revision