summaryrefslogtreecommitdiff
path: root/src/make-prime-list.c
AgeCommit message (Collapse)Author
2014-01-02maint: update all copyright year number rangesBernhard Voelker
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2013-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2012-11-12factor: improve primes.h changePaul Eggert
This follows suggestions by Jim Meyering in <http://bugs.gnu.org/12841#34>. * src/make-prime-list.c (print_wide_uint): Change "nested" argument to "nesting", and use it to avoid outputting lines that are too long. * src/primes.h: Remove from git. This can be generated by a maintainer. It's nicer to do so on a host with at least 128-bit arithmetic.
2012-11-12factor: maintainer builds primes.h, not builderPaul Eggert
With this change, the maintainer builds primes.h and it is part of the tarball. primes.h's contents are not architecture-specific. * .gitignore: Remove /src/primes.h. * src/factor.c: Include verify.h. (W): New constant. Verify that uintmax_t lacks holes and that W is no wider than the integers used to generate primes.h. * src/local.mk (EXTRA_DIST): Add src/primes.h. (BUILT_SOURCES, CLEANFILES): Remove src/primes.h. ($(top_srcdir)/src/primes.h): Rename from src/primes.h. Do not depend on src/make-prime-list. Instead, use sub-make to build, so that we build primes.h only if it does not exist. * src/make-prime-list.c: Include <limits.h>, for ULONG_MAX. (wide_uint): Define to uintmax_t or unsigned __int128 if not #defined. (struct prime, binvert, process_prime): Use it instead of uintmax_t. (print_wide_uint): New function. This generates the proper pinv value regardless of the width of uintmax_t on the target, so long as the width doesn't exceed that of the width of wide_uint on the maintainer host that generated src/primes.h. (output_primes): Use it. Output WIDE_UINT_BITS, too. Let the target compute its own lim, since its uintmax_t may be narrower than ours. (SZ): Remove. * src/primes.h: New file, generated with 128-bit integers and usable on any host where uintmax_t's width is no greater than 128 bits.
2012-11-12factor: port to systems with rpl_mallocPaul Eggert
* src/make-prime-list.c (malloc): Undef. This fixes a problem on AIX 8.20 reported by Michael Felt in <http://bugs.gnu.org/12841>.
2012-11-04build: don't assume uintmax_t is 64 bitsPádraig Brady
This was not seen to be an issue in practise, but to make the code more robust, don't assume uintmax_t is 64 bits. * src/factor.c (W_TYPE_SIZE): Define based on integer limits. * src/make-prime-list.c (output_primes): Define format width based on integer limits.
2012-11-04build: don't rely on support for '%*j' printf formatPádraig Brady
* src/make-prime-list.c: Hardcode the uintmax_t width to 16 hex digits (64 bit), to avoid this compile issue on HPUS systems at least.
2012-10-05build: avoid link failure when strerror is replacedJim Meyering
When building the new make-prime-list program on a system for which strerror is defined to rpl_strerror, we'd get a link failure. The problem is that we're including <config.h> for some definitions, but do not want the rpl_ ones, since this particular program must not be linked against gnulib (aka libcoreutils.a). This did not arise on Fedora 17 or 18, but did on Debian wheezy/sid. * src/make-prime-list.c (strerror): #undef. Build failure introduced by commit v8.19-152-gcf67e4c.
2012-10-04maint: make-prime-list: syntax conventions; be robust for large NJim Meyering
* src/make-prime-list.c: Insert spaces before parens. (main): Abort if the 8-delta value ever exceeds 255.
2012-10-04maint: make-prime-list: do not ignore write failureJim Meyering
Even though this is just a helper program that is run solely to create primes.h, it should not ignore a write failure. Normally we would simply call atexit (close_stdout), but we cannot do that from this helper program, since it must be built before the generated header, primes.h. If we were to make the linking of make-prime-list depend on libcoreutils.a, that would add all lib/*.o files to the list of dependents of $(BUILT_HEADERS). Then, since there is currently no provision to ensure that a file like lib/stdio.h (another built header) is built before the first lib/*.o file that also includes <stdio.h>, some lib/*.o files would be built before lib/stdio.h and some after. The former would provoke link failures due to undefined rpl_* functions. * src/make-prime-list.c: Include <errno.h>. (fclose): Undef, so that a definition to rpl_fclose does not cause a link failure. (main): Per the above, in this exceptional case, we check for fclose and ferror failure manually, and don't worry about the ferror-only failure case in which errno may not be relevant.
2012-10-04maint: make-prime-list: avoid -Wsuggest-attribute=const warningJim Meyering
* src/make-prime-list.c: Include <config.h>. (binvert): Add _GL_ATTRIBUTE_CONST.
2012-10-04factor: prepare for the new factor programTorbjörn Granlund
* src/make-prime-list.c: New file, from nt-factor. Co-authored-by: Niels Möller <nisse@lysator.liu.se>