1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-04-28 14:43:36 +00:00

64 Commits

Author SHA1 Message Date
Paul Eggert
a3fd683de3 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'.
2017-01-01 02:59:23 +00:00
Paul Eggert
9f623dc537 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.
2016-11-14 19:50:43 -08:00
Paul Eggert
77d36b554f 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.
2016-07-15 12:15:37 +02:00
Paul Eggert
71090a2a31 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'.
2016-01-01 00:57:21 -08:00
Paul Eggert
b9bfe78424 version-etc: new year
* doc/gnulib.texi:
* lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date.
* all files: Run 'make update-copyright'.
2014-12-31 17:47:54 -08:00
Paul Eggert
ed253cd8e5 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.
2014-11-05 11:42:24 -08:00
Paul Eggert
127ed6a3ea 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.
2014-11-04 00:33:36 -08:00
Alan Modra
d15b2da0ac 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.
2014-11-04 00:33:36 -08:00
Paul Eggert
6c34297a91 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.
2014-10-29 00:23:39 -07:00
Alan Modra
82a38a0d77 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.
2014-10-29 00:23:39 -07:00
Alan Modra
bb2ab7ecb6 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.
2014-10-29 00:23:38 -07:00
Alan Modra
266ac1b98d 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.
2014-10-29 00:23:38 -07:00
Alan Modra
8216dffc27 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.
2014-10-29 00:23:38 -07:00
Alan Modra
ec1a9f7b6f 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.
2014-10-29 00:23:38 -07:00
Paul Eggert
6421fd4600 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__):
2014-03-27 13:41:16 -07:00
Paul Eggert
df9b714234 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.
2014-03-27 12:55:41 -07:00
Eric Blake
1276a2c5f2 maint: update copyright
I ran 'make update-copyright'.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-01-01 00:07:10 -07:00
Paul Eggert
9c5dea9a6b 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.
2013-10-31 09:46:27 -07:00
Jim Meyering
c2b08ae26c 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.
2013-10-19 09:19:37 -07:00
Paul Eggert
45a46d96e1 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.
2013-05-15 00:33:38 -07:00
Eric Blake
9fc81090f6 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>
2013-01-01 00:50:58 +00:00
Paul Eggert
a4d796fb14 maint: spelling fixes 2012-02-05 13:42:03 -08:00
Paul Eggert
c5230ae4c1 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__.
2012-01-25 11:08:36 -08:00
Paul Eggert
51e801f2f2 In commentary, do not use ` to quote. 2012-01-05 23:55:42 -08:00
Jim Meyering
1602f0afed maint: update all copyright year number ranges
Run "make update-copyright".
2012-01-01 10:04:58 +01:00
Jim Meyering
d60f3b0c6b maint: update almost all copyright ranges to include 2011
Run the new "make update-copyright" rule.
2011-01-01 22:12:59 +01:00
Bruno Haible
89519c0008 Ensure no #include statements inside extern "C" { ... }. 2010-03-21 01:14:37 +01:00
Jim Meyering
b2e2010c7c 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
2010-01-01 10:42:00 +01:00
Jim Meyering
3030c5b5e0 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.
2009-12-29 17:49:30 +01:00
Bruno Haible
441aa3044f Use spaces for indentation, not tabs. 2009-12-10 20:28:30 +01:00
Bruno Haible
57fdfd3f8e Change copyright notice from GPLv2+ to GPLv3+. 2007-10-07 19:14:58 +02:00
Bruno Haible
9d55a02b1b Make it possible to rename obstack_free. 2006-10-23 19:40:24 +00:00
Paul Eggert
0e56d268c0 * 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>.
2005-10-14 23:23:50 +00:00
Paul Eggert
267a39bafd *** empty log message *** 2005-05-14 06:03:57 +00:00
Paul Eggert
3dec705e02 (obstack_empty_p): Don't assume that chunk->contents is suitably
aligned.
2004-08-10 05:16:29 +00:00
Jim Meyering
1e5e485be4 (obstack_base): Cast to (void *), per documentation. 2004-06-24 06:04:10 +00:00
Paul Eggert
39e82e46dd Remove unused vars and decls in obstack. 2004-05-19 20:04:16 +00:00
Paul Eggert
e868156834 Port obstack to the AS/400. 2004-05-17 07:52:52 +00:00
Paul Eggert
62506e7817 Import obstack changes from libc. 2004-05-07 04:22:56 +00:00
Paul Eggert
19e15828f6 Merge changes from glibc obstack; minor cleanups to make it easier to
merge back in the future.
2003-10-22 05:10:04 +00:00
Paul Eggert
ff0ca1ea25 Don't use lvalue casts, as GCC plans to remove support for them in GCC 3.5. 2003-10-22 01:02:47 +00:00
Paul Eggert
e5c0881413 Remove K&R cruft. 2003-09-09 23:00:43 +00:00
Paul Eggert
aef0001b00 White-space changes only; from coreutils. 2003-08-15 03:12:34 +00:00
Paul Eggert
57153f2edb (__INT_TO_PTR): Revert change of 2003-03-13; it breaks C++ compilation.
[!__GNUC__ || !__STDC__] (obstack_finish): Cast result to void*.
2003-07-11 23:33:34 +00:00
Paul Eggert
4589d52c7c Switch from LGPL to GPL. 2003-07-09 22:48:52 +00:00
Jim Meyering
c36b7b511f 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.
2003-03-14 09:59:32 +00:00
Paul Eggert
70ec9ea693 (__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.
2003-03-13 21:13:59 +00:00
Jim Meyering
063e0ea873 tweak a comment 2000-11-18 09:53:33 +00:00
Jim Meyering
291a8b36a3 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.
2000-11-18 09:50:09 +00:00
Jim Meyering
8ccdfffb64 Update from GNU libc. 2000-11-10 11:10:39 +00:00