diff -Nru mk-configure-0.36.0/debian/changelog mk-configure-0.37.0/debian/changelog --- mk-configure-0.36.0/debian/changelog 2021-01-31 17:25:20.000000000 +0000 +++ mk-configure-0.37.0/debian/changelog 2023-01-01 15:13:04.000000000 +0000 @@ -1,3 +1,15 @@ +mk-configure (0.37.0-2) unstable; urgency=medium + + * Manually install by calling bmake directly. + + -- Andrej Shadura Sun, 01 Jan 2023 16:13:04 +0100 + +mk-configure (0.37.0-1) unstable; urgency=medium + + * New upstream release. + + -- Andrej Shadura Wed, 28 Dec 2022 16:43:55 +0100 + mk-configure (0.36.0-1) unstable; urgency=medium * New upstream release. diff -Nru mk-configure-0.36.0/debian/rules mk-configure-0.37.0/debian/rules --- mk-configure-0.36.0/debian/rules 2021-01-31 17:25:20.000000000 +0000 +++ mk-configure-0.37.0/debian/rules 2023-01-01 15:13:04.000000000 +0000 @@ -16,6 +16,9 @@ dh_auto_build bmake pdf +override_dh_auto_install: + bmake install DESTDIR=$(CURDIR)/debian/mk-configure + override_dh_auto_test: -bmake test diff -Nru mk-configure-0.36.0/doc/NEWS mk-configure-0.37.0/doc/NEWS --- mk-configure-0.36.0/doc/NEWS 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/doc/NEWS 2021-04-08 12:46:42.000000000 +0000 @@ -1,4 +1,44 @@ ====================================================================== +Version 0.37.0, by Aleksey Cheusov, Thu, 8 Apr 2021 09:07:48 +0300 + + Features: + * new feature "strtoi" for NetBSD function with the same name + * new feature "strtou" for NetBSD function with the same name + * new feature "reallocarr" for NetBSD function with the same name + * new feature "macro". It provides NetBSD-style macro __dead, __pure, + __UNCONST, __printflike, __constfunc, __always_inline, __aligned, + __arraycount, MAX and MIN + * "efun": add support for ereallocarr(3), estrtoi(3) and estrtou(3) + + Fixes: + * imp.foreign_autotools.mk: add MAKE=${AT_MAKE} to environment + This fixes ./configure when "make" executable is not available + * CXXSTD: appropriate option is passed to the linker. This fixes + failures with Sun C++ compiler. + * examples/shquote/prog.c: fix segfault seen on Solaris-10 + (incorrect use of getline(3)) + + mk-configure.7: + * add missing documentation for features "reallocarray", "fparseln" + and "vis" + * minor fixes + * CXXSTD: fix incorrect description + + Exit with error if generated config under ~/.mkcmake is older than + system mk files. This situation potentially means that generated + configs do not contain all required information about compiler. + + System-wide mk file for compiler settings has higher priority + than files under ~/.mkcmake + + EXPORT_SYMBOLS: empty lines and comments started with '#' are ignored + + mkc_install: do not remove "$dst" before renaming "$dsttmp" to + "$dst", it is just useless. + + Simplify the target "installdirs". + +====================================================================== Version 0.36.0, by Aleksey Cheusov, Tue, 5 Jan 2021 19:29:08 +0300 Introduce new variables: diff -Nru mk-configure-0.36.0/doc/TODO mk-configure-0.37.0/doc/TODO --- mk-configure-0.36.0/doc/TODO 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/doc/TODO 2021-04-08 12:46:42.000000000 +0000 @@ -1,33 +1,68 @@ +############################################################ +PLAN 0.38.0: + ============================================================ -SRC_PATHADD, CC_PREFIX and CXX_PREFIX? +Generate .d files at the same time as compilation and load +in the very beginning by default if appropriate variable +is set. ============================================================ -SHRTOUT -- set -x and redirect everything to temporary -log file and print it only if the target fails? +MKC_REQUIRE_PKGCONFIG - make sure _mkc_ files are deleted +when this check fails. ============================================================ -Tests for MCOMPRESS? +New rules for .by (bison without -y option) ============================================================ -MKC_PATH environment variable for mkcmake(1) -and mkc_compiler_settings(1) +Add new feature for glibc-style defines +__wur and __deprecated ============================================================ -OBJDIR_* and SRCDIR_* variable should be available -after mkc.init.mk and initialized again in mkc.mk +MKC_CACHEDIR ?= ${OBJTOP:U${SRCTOP}} ============================================================ -Generate .d files at the same time as compilation and load -in the very beginning by default if appropriate variable -is set. +Add new feature for define restrict (C99 etc.) + + + + + +############################################################ +PLAN 0.39.0: + + - Implement mkc_imp.libtool.mk to build + the shared libraries using GNU libtool(1). + + - add support for pkg-config aware projects, i.e., projects + that provide .pc files + + + + + +############################################################ +PLAN REST: ============================================================ More efun features: e{read,write,setenv} from FreeBSD ============================================================ -MKC_CACHEDIR ?= ${OBJTOP:U${SRCTOP}} +Add recursive lint and ctags (by David Young) targets -New rules for .by (bison without -y option) +============================================================ +SHRTOUT -- set -x and redirect everything to temporary +log file and print it only if the target fails? + +============================================================ +Tests for MCOMPRESS? + +============================================================ +MKC_PATH environment variable for mkcmake(1) +and mkc_compiler_settings(1) + +============================================================ +OBJDIR_* and SRCDIR_* variable should be available +after mkc.init.mk and initialized again in mkc.mk ============================================================ LDFLAGS.check @@ -36,14 +71,11 @@ markdown to html rules ============================================================ -Add new feature for NetBSD-style defines like __dead, -__pure, __printflike, __UNCONST, __constfunc, __noinline, -__always_inline, __returns_twice, __noclone, __unused, -__used, __packed, __aligned, __section, __restrict, -__printflike, __sysloglike, __scanflike, __format_arg, -__arraycount, __MIN, __MAX +Add new feature for NetBSD-style defines +__packed, __section, __restrict, +__sysloglike, __scanflike, __format_arg -and glibc-style defines like __wur, __deprecated, __nonnull +and glibc-style define __nonnull ============================================================ Add feature "alloca" @@ -57,15 +89,6 @@ or from define (if exists). This is issue #7 ============================================================ - -[06/27 15:13] MKDEP.c = ${MAKEDEPEND} -f- ${ddash} ${MKDEPFLAGS} \ -[06/27 15:13] ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > -[06/27 15:13] ë¸øà, çà÷åì ýòà çàìåíà? -[06/27 17:51] mkc_imp.dep.mk: -[06/27 17:51] .if !defined(_MKC_IMP_DEP_MK) && !empty(_SRCS_ALL) -[06/27 17:51] ... -[06/27 17:51] .if defined(_SRCS_ALL) - INCS generated by INTEXTS ============================================================ @@ -75,21 +98,13 @@ - test for CCLD option - bzero, bcopy -- check awk capabilities at build time - Hide regression tests details - "bmake -k regrtest/check" (mkc.minitest.mk?) -- PRId64 -- leveldb, strtoll, strtoull -- wmemcpy, strnlen -- wcsdup - - Special marker for checks that cannot be possible in cross-compiling - regression tests without garbage, make it look like paexec -- MKC_FEATURES: inttypes - Some thoughts inspired by talks with Michael Crogan - MKASNEEDED=yes => ld --as-needed @@ -112,28 +127,27 @@ - Steal cool features from Simon Gerraty's mk files and analyse "meta mode" he invented. -Some "targets" from TARGETS should set MKCHECKS to "no" +- Some "targets" from TARGETS should set MKCHECKS to "no" -ronn(1) : markdown to man pages +- ronn(1) : markdown to man pages custom test failed -> exit status of mkcmake should not be zero MKC_CUSTOM_ERR.qqqq -> error message before exiting just like - mkcmake configure doesn't work - New variable MKC_CUSTOM_ENV.xxx +- New variable MKC_CUSTOM_ENV.xxx + +- BINSUBDIR, LIBSUBDIR, LIBEXECSUBDIR etc... - - BINSUBDIR, LIBSUBDIR, LIBEXECSUBDIR etc... - - USE_RPATH - - Regression tests: - * optional(!) glib2 tests +- USE_RPATH + +- Regression tests: + * optional(!) glib2 tests ============================================================ Plan 1) - Support for MKDEBUG like in NetBSD mk files - .lua.luac: - - Implement mkc_imp.libtool.mk to build - the shared libraries using GNU libtool(1). ============================================================ Plan 2) @@ -172,6 +186,7 @@ = Online tutorial = shared libraries support for AIX, UnixWare, Hurd, Haiku. + = shared libraries support for nwcc and other compilers. = Comparison with quagmire, kBuild, CMake, scons, waf, framewerk, pmk, @@ -196,6 +211,8 @@ = Implement mkc.doxygen.mk? + = Implement mkc.cunit.mk? + ============================================================ Plan 5) @@ -234,8 +251,8 @@ snprintf, sprintf, sscanf, strerror_r, strnlen, sysconf, unlink, unsetenv, va_copy, va_list, signed_shr, int_div, chown_minus_1,... - (autoconf.info/Particular Function Checks) AC_FUNC_ALLOCA - = autoconf (Portability of headers) - = autoconf (Particular Header Checks) + = autoconf info documentation: Particular Functions + = autoconf info documentation: Portability Of Headers + = autoconf info documentation: Particular Headers diff -Nru mk-configure-0.36.0/examples/compatlib/test.mk mk-configure-0.37.0/examples/compatlib/test.mk --- mk-configure-0.36.0/examples/compatlib/test.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/examples/compatlib/test.mk 2021-04-08 12:46:42.000000000 +0000 @@ -1,4 +1,4 @@ -FUNCS_RE=(fgetln|progname|strlcat|strlcpy|getline|err|getdelim|strndup|_mkcfake)[.][do] +FUNCS_RE=(fgetln|progname|strlcat|strlcpy|getline|err|getdelim|strndup|_mkcfake)[.][do]|custom_attribute .PHONY : test_output test_output : @@ -16,11 +16,11 @@ echo =========== depend ============; \ ${MAKE} ${MAKEFLAGS} depend > /dev/null; \ find ${.OBJDIR} -type f | LC_ALL=C sort | \ - grep '[.]d$$' | grep -Ev '${FUNCS_RE}' | \ + grep '[.]d$$' | grep -Ev ${FUNCS_RE:Q} | \ env NOSORT=1 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ echo =========== clean ============; \ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \ - find ${.OBJDIR} -type f | grep -v _mkc | grep -Ev '${FUNCS_RE}' | \ + find ${.OBJDIR} -type f | grep -v _mkc | grep -Ev ${FUNCS_RE:Q} | \ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ echo =========== cleandir ============; \ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \ @@ -29,7 +29,7 @@ echo ======= depend to OBJDIR ==========; \ mkdir obj; MAKEOBJDIR=${.OBJDIR}/obj; export MAKEOBJDIR; \ ${MAKE} ${MAKEFLAGS} depend > /dev/null; \ - find ${.OBJDIR}/obj -type f | grep -vE '${FUNCS_RE}' | \ + find ${.OBJDIR}/obj -type f | grep -vE ${FUNCS_RE:Q} | \ grep -v _mkc | \ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ rm -rf obj; unset MAKEOBJDIR; \ diff -Nru mk-configure-0.36.0/examples/dictd/libmaa/export.sym mk-configure-0.37.0/examples/dictd/libmaa/export.sym --- mk-configure-0.36.0/examples/dictd/libmaa/export.sym 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/examples/dictd/libmaa/export.sym 2021-04-08 12:46:42.000000000 +0000 @@ -1,3 +1,6 @@ +# functions of category A fake4 -fake5 +fake5 # one-line comment is allowed + +# functions of category B fake6 diff -Nru mk-configure-0.36.0/examples/efun/expect.out mk-configure-0.37.0/examples/efun/expect.out --- mk-configure-0.36.0/examples/efun/expect.out 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/examples/efun/expect.out 2021-04-08 12:46:42.000000000 +0000 @@ -5,3 +5,6 @@ Hello World! Hello Hello World! +Hello World! +111 +-111 diff -Nru mk-configure-0.36.0/examples/efun/prog.c mk-configure-0.37.0/examples/efun/prog.c --- mk-configure-0.36.0/examples/efun/prog.c 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/examples/efun/prog.c 2021-04-08 12:46:42.000000000 +0000 @@ -1,3 +1,4 @@ +#include #include #include #include @@ -9,6 +10,8 @@ char *buffer = ecalloc(BUF_SIZE, 1); char *copy; FILE *fd; + uintmax_t uval; + intmax_t sval; estrlcpy(buffer, "Hello", BUF_SIZE); estrlcat(buffer, " World!", BUF_SIZE); @@ -32,9 +35,22 @@ estrlcpy(copy, buffer, 200); puts(copy); free(copy); + copy = NULL; + + ereallocarr(©, 200, 1); + estrlcpy(copy, buffer, 200); + puts(copy); + free(copy); + copy = NULL; fd = efopen("/dev/null", "r"); fclose(fd); + uval = estrtou("111", 10, 0, 999); + printf("%" PRIuMAX "\n", uval); + + sval = estrtoi("-111", 10, -999, 999); + printf("%" PRIdMAX "\n", sval); + return 0; } diff -Nru mk-configure-0.36.0/examples/fgetln/test.mk mk-configure-0.37.0/examples/fgetln/test.mk --- mk-configure-0.36.0/examples/fgetln/test.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/examples/fgetln/test.mk 2021-04-08 12:46:42.000000000 +0000 @@ -1,4 +1,4 @@ -FUNCS_RE=(fgetln|getline|err|progname|strndup)[.]o +FUNCS_RE=(fgetln|getline|err|progname|strndup)[.]o|custom_attribute .PHONY : test_output test_output: @@ -7,7 +7,7 @@ rm -rf ${.OBJDIR}${PREFIX}; \ \ echo =========== all ============; \ - find ${.OBJDIR} -type f | grep -Ev '${FUNCS_RE}' | \ + find ${.OBJDIR} -type f | grep -Ev ${FUNCS_RE:Q} | \ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ \ echo ======= CLEANFILES ==========; \ diff -Nru mk-configure-0.36.0/examples/progs/test.mk mk-configure-0.37.0/examples/progs/test.mk --- mk-configure-0.36.0/examples/progs/test.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/examples/progs/test.mk 2021-04-08 12:46:42.000000000 +0000 @@ -1,4 +1,4 @@ -FEATURES_RE=_mkc_|efun|progname|strlc|dprintf|strndup|err +FEATURES_RE=_mkc_|efun|progname|strlc|dprintf|strndup|err|reallocarr|strto[iu] .PHONY : test_output test_output: diff -Nru mk-configure-0.36.0/examples/reallocarr/expect.out mk-configure-0.37.0/examples/reallocarr/expect.out --- mk-configure-0.36.0/examples/reallocarr/expect.out 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/examples/reallocarr/expect.out 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,2 @@ +Allocated pointer: NNNNNNNN +Allocated pointer: NNNNNNNN diff -Nru mk-configure-0.36.0/examples/reallocarr/Makefile mk-configure-0.37.0/examples/reallocarr/Makefile --- mk-configure-0.36.0/examples/reallocarr/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/examples/reallocarr/Makefile 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,11 @@ +PROG = prog +SRCS = prog.c + +WARNS = 4 + +MKC_FEATURES += errc reallocarr + +MKC_REQD = 0.36.90 + +.include "test.mk" +.include diff -Nru mk-configure-0.36.0/examples/reallocarr/prog.c mk-configure-0.37.0/examples/reallocarr/prog.c --- mk-configure-0.36.0/examples/reallocarr/prog.c 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/examples/reallocarr/prog.c 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,27 @@ +#include +#include + +#include +#include + +int main(int argc, char *argv[]) +{ + int *data = NULL; + int ret = 0; + + ret = reallocarr(&data, 16, sizeof(*data)); + if (ret) + errc(1, ret, "reallocarr failed"); + + printf("Allocated pointer: %p\n", data); + + ret = reallocarr(&data, 256, sizeof(*data)); + if (ret) + errc(1, ret, "reallocarr failed on resize"); + + printf("Allocated pointer: %p\n", data); + + free(data); + + return 0; +} diff -Nru mk-configure-0.36.0/examples/reallocarr/test.mk mk-configure-0.37.0/examples/reallocarr/test.mk --- mk-configure-0.36.0/examples/reallocarr/test.mk 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/examples/reallocarr/test.mk 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,6 @@ +.PHONY : test_output +test_output: + @${.OBJDIR}/prog | sed 's/: [^ ][^ ]*/: NNNNNNNN/'; \ + ${MAKE} ${MAKEFLAGS} cleandir > /dev/null + +.include diff -Nru mk-configure-0.36.0/examples/shquote/prog.c mk-configure-0.37.0/examples/shquote/prog.c --- mk-configure-0.36.0/examples/shquote/prog.c 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/examples/shquote/prog.c 2021-04-08 12:46:42.000000000 +0000 @@ -11,7 +11,7 @@ { char *buf = NULL; char *old_buf = NULL; - size_t size; + size_t size = 0; size_t len; char *shquoted_buf = NULL; diff -Nru mk-configure-0.36.0/examples/strtoi/expect.out mk-configure-0.37.0/examples/strtoi/expect.out --- mk-configure-0.36.0/examples/strtoi/expect.out 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/examples/strtoi/expect.out 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,16 @@ +strtoi: ECANCELED +strtou: ECANCELED +strtoi: 12 +strtou: 12 +strtoi: 0 +strtou: 0 +strtoi: 99 +strtou: 99 +strtoi: ERANGE +strtou: ERANGE +strtoi: ECANCELED +strtou: ECANCELED +strtoi: ERANGE +strtou: ERANGE +strtoi: -17 +strtou: ERANGE diff -Nru mk-configure-0.36.0/examples/strtoi/input.in mk-configure-0.37.0/examples/strtoi/input.in --- mk-configure-0.36.0/examples/strtoi/input.in 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/examples/strtoi/input.in 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,8 @@ +aaa +12 +0 ++99 +111 + +-989 +-17 diff -Nru mk-configure-0.36.0/examples/strtoi/Makefile mk-configure-0.37.0/examples/strtoi/Makefile --- mk-configure-0.36.0/examples/strtoi/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/examples/strtoi/Makefile 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,11 @@ +PROG = prog +SRCS = prog.c + +WARNS = 4 + +MKC_FEATURES = getline strtoi strtou + +MKC_REQD = 0.36.90 + +.include "test.mk" +.include diff -Nru mk-configure-0.36.0/examples/strtoi/prog.c mk-configure-0.37.0/examples/strtoi/prog.c --- mk-configure-0.36.0/examples/strtoi/prog.c 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/examples/strtoi/prog.c 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,71 @@ +#include +#include +#include +#include + +#include +#include +#include + +int main (int argc, char ** argv) +{ + char *buf = NULL; + size_t size = 0; + ssize_t len = 0; + intmax_t sval; + uintmax_t uval; + int rstatus; + + while (len = getline(&buf, &size, stdin), len != -1){ + if (len > 0 && buf[len-1] == '\n') + buf[len - 1] = 0; + + /* strtoi */ + printf("strtoi: "); + sval = strtoi(buf, NULL, 10, -99, 99, &rstatus); + switch (rstatus){ + case ECANCELED: + puts("ECANCELED"); + break; + case EINVAL: + puts("EINVAL"); + break; + case ENOTSUP: + puts("ENOTSUP"); + break; + case ERANGE: + puts("ERANGE"); + break; + case 0: + printf("%" PRIdMAX "\n", sval); + break; + default: + abort(); + } + + /* strtoi */ + printf("strtou: "); + uval = strtou(buf, NULL, 10, 0, 99, &rstatus); + switch (rstatus){ + case ECANCELED: + puts("ECANCELED"); + break; + case EINVAL: + puts("EINVAL"); + break; + case ENOTSUP: + puts("ENOTSUP"); + break; + case ERANGE: + puts("ERANGE"); + break; + case 0: + printf("%" PRIuMAX "\n", uval); + break; + default: + abort(); + } + } + + return 0; +} diff -Nru mk-configure-0.36.0/examples/strtoi/test.mk mk-configure-0.37.0/examples/strtoi/test.mk --- mk-configure-0.36.0/examples/strtoi/test.mk 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/examples/strtoi/test.mk 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,6 @@ +.PHONY : test_output +test_output: + @set -e; \ + ${.OBJDIR}/prog < ${.CURDIR}/input.in + +.include diff -Nru mk-configure-0.36.0/examples.mk mk-configure-0.37.0/examples.mk --- mk-configure-0.36.0/examples.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/examples.mk 2021-04-08 12:46:42.000000000 +0000 @@ -9,4 +9,5 @@ require_tools check_compiler_opts help_target \ arc4random bswap dprintf efun strsep errc posix_getopt \ raise_default_signal reallocarray fparseln vis \ - fts humanize_number shquote tiny_id c99 + fts humanize_number shquote tiny_id c99 reallocarr \ + strtoi diff -Nru mk-configure-0.36.0/features/efun/mkc_efun.c mk-configure-0.37.0/features/efun/mkc_efun.c --- mk-configure-0.36.0/features/efun/mkc_efun.c 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/efun/mkc_efun.c 2021-04-08 12:46:42.000000000 +0000 @@ -33,6 +33,9 @@ #include "mkc_strlcat.h" #include "mkc_strlcpy.h" #include "mkc_strndup.h" +#include "mkc_reallocarr.h" +#include "mkc_strtoi.h" +#include "mkc_strtou.h" #if HAVE_NBTOOL_CONFIG_H #include "nbtool_config.h" @@ -129,7 +132,6 @@ return q; } -/* void ereallocarr(void *p, size_t n, size_t s) { @@ -139,7 +141,6 @@ (*efunc)(1, "Cannot re-allocate %zu * %zu bytes", n, s); } } -*/ FILE * efopen(const char *p, const char *m) @@ -171,7 +172,6 @@ return rv; } -/* intmax_t estrtoi(const char * nptr, int base, intmax_t lo, intmax_t hi) { @@ -199,4 +199,3 @@ } return rv; } -*/ diff -Nru mk-configure-0.36.0/features/errc/mkc_errc.c mk-configure-0.37.0/features/errc/mkc_errc.c --- mk-configure-0.36.0/features/errc/mkc_errc.c 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/errc/mkc_errc.c 2021-04-08 12:46:42.000000000 +0000 @@ -39,12 +39,12 @@ #include "mkc_errc.h" -/*__dead*/ void +void errc(int eval, int code, const char *fmt, ...) { va_list ap; va_start(ap, fmt); verrc(eval, code, fmt, ap); - va_end(ap); + /* va_end(ap); NOT REACHED */ } diff -Nru mk-configure-0.36.0/features/errc/mkc_verrc.c mk-configure-0.37.0/features/errc/mkc_verrc.c --- mk-configure-0.36.0/features/errc/mkc_verrc.c 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/errc/mkc_verrc.c 2021-04-08 12:46:42.000000000 +0000 @@ -43,11 +43,12 @@ #include "mkc_errc.h" #include "mkc_progname.h" + #include #include #include -/*__dead*/ void +void verrc(int eval, int code, const char *fmt, va_list ap) { (void)fprintf(stderr, "%s: ", getprogname()); diff -Nru mk-configure-0.36.0/features/macro/mkc_attribute_aligned.c mk-configure-0.37.0/features/macro/mkc_attribute_aligned.c --- mk-configure-0.36.0/features/macro/mkc_attribute_aligned.c 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/macro/mkc_attribute_aligned.c 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1 @@ +char array[256] __attribute__((aligned(256))); diff -Nru mk-configure-0.36.0/features/macro/mkc_attribute_always_inline.c mk-configure-0.37.0/features/macro/mkc_attribute_always_inline.c --- mk-configure-0.36.0/features/macro/mkc_attribute_always_inline.c 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/macro/mkc_attribute_always_inline.c 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,11 @@ +static int square(int v) __attribute__ ((always_inline)); + +static int square(int v) +{ + return v * v; +} + +int main(int argc, char **argv) +{ + return square(2); +} diff -Nru mk-configure-0.36.0/features/macro/mkc_attribute_const.c mk-configure-0.37.0/features/macro/mkc_attribute_const.c --- mk-configure-0.36.0/features/macro/mkc_attribute_const.c 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/macro/mkc_attribute_const.c 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,6 @@ +int square(int v) __attribute__ ((const)); + +int square(int v) +{ + return v * v; +} diff -Nru mk-configure-0.36.0/features/macro/mkc_attribute_noreturn.c mk-configure-0.37.0/features/macro/mkc_attribute_noreturn.c --- mk-configure-0.36.0/features/macro/mkc_attribute_noreturn.c 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/macro/mkc_attribute_noreturn.c 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,8 @@ +#include + +void err_exit() __attribute__ ((noreturn)); + +void err_exit(int status) +{ + exit(status); +} diff -Nru mk-configure-0.36.0/features/macro/mkc_attribute_printflike.c mk-configure-0.37.0/features/macro/mkc_attribute_printflike.c --- mk-configure-0.36.0/features/macro/mkc_attribute_printflike.c 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/macro/mkc_attribute_printflike.c 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,5 @@ +extern int +my_printf (void *my_object, const char *my_format, ...) + __attribute__ ((format (printf, 2, 3))); + +int zzz; diff -Nru mk-configure-0.36.0/features/macro/mkc_attribute_pure.c mk-configure-0.37.0/features/macro/mkc_attribute_pure.c --- mk-configure-0.36.0/features/macro/mkc_attribute_pure.c 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/macro/mkc_attribute_pure.c 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,6 @@ +int square(int v) __attribute__ ((pure)); + +int square(int v) +{ + return v * v; +} diff -Nru mk-configure-0.36.0/features/Makefile mk-configure-0.37.0/features/Makefile --- mk-configure-0.36.0/features/Makefile 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/Makefile 2021-04-08 12:46:42.000000000 +0000 @@ -1,23 +1,32 @@ -FILES += mkc_imp.f_libl.mk -FILESDIR_mkc_imp.f_libl.mk = ${MKFILESDIR} +.for f in libl strtoi strtou macro +FILES += mkc_imp.f_${f}.mk +FILESDIR_mkc_imp.f_${f}.mk = ${MKFILESDIR} +.endfor -FILES += mkc_externc.h -FILESDIR_mkc_externc.h = ${FEATURESDIR} +.for f in mkc_externc.h mkc_macro.h mkc_strtoi.h mkc_strtou.h +FILES += ${f} +FILESDIR_${f} = ${FEATURESDIR} +.endfor .for f in dprintf efun err errc fgetln fparseln getdelim getline \ humanize_number posix_getopt progname pwdgrp raise_default_signal \ - reallocarray strlcat strlcpy strndup strsep vis warn shquote + reallocarr reallocarray strlcat strlcpy strndup strsep vis warn shquote FILES += mkc_${f}.h mkc_imp.f_${f}.mk ${f}/mkc_${f}.c FILESDIR_mkc_imp.f_${f}.mk = ${MKFILESDIR} FILESDIR_mkc_${f}.h = ${FEATURESDIR} FILESDIR_${f}/mkc_${f}.c = ${FEATURESDIR}/${f} .endfor -FILES += errc/mkc_verrc.c -FILESDIR_errc/mkc_verrc.c = ${FEATURESDIR}/errc +.for f in aligned always_inline const noreturn printflike pure +FILES += macro/mkc_attribute_${f}.c +FILESDIR_macro/mkc_attribute_${f}.c = ${FEATURESDIR}/macro +.endfor -FILES += vis/mkc_unvis.c -FILESDIR_vis/mkc_unvis.c = ${FEATURESDIR}/vis +.for f in strto/mkc_strtoi.c strto/mkc_strtou.c strto/mkc__strtoi.h vis/mkc_unvis.c \ + errc/mkc_verrc.c +FILES += ${f} +FILESDIR_${f} = ${FEATURESDIR}/${f:H} +.endfor .for f in libm libdl SLIST RB bswap fts arc4random FILES += mkc_${f}.h mkc_imp.f_${f}.mk diff -Nru mk-configure-0.36.0/features/mkc_efun.h mk-configure-0.37.0/features/mkc_efun.h --- mk-configure-0.36.0/features/mkc_efun.h 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_efun.h 2021-04-08 12:46:42.000000000 +0000 @@ -63,7 +63,7 @@ void * erealloc(void *p, size_t n); -//void ereallocarr(void *, size_t, size_t); +void ereallocarr(void *, size_t, size_t); char * estrdup(const char *s); @@ -75,6 +75,10 @@ int evasprintf(char ** /*__restrict*/ str, const char * /*__restrict*/ fmt, va_list ap); +intmax_t estrtoi(const char * nptr, int base, intmax_t lo, intmax_t hi); + +uintmax_t estrtou(const char * nptr, int base, uintmax_t lo, uintmax_t hi); + __MKC_END_DECLS # endif diff -Nru mk-configure-0.36.0/features/mkc_errc.h mk-configure-0.37.0/features/mkc_errc.h --- mk-configure-0.36.0/features/mkc_errc.h 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_errc.h 2021-04-08 12:46:42.000000000 +0000 @@ -21,12 +21,14 @@ __MKC_BEGIN_DECLS +#include "mkc_macro.h" + #if !HAVE_FUNC4_ERRC_ERR_H -void errc(int status, int code, const char *fmt, ...); +void errc(int status, int code, const char *fmt, ...) __printflike(3, 4) __dead; #endif #if !HAVE_PROTOTYPE_VERRC -void verrc(int status, int code, const char *fmt, va_list args); +void verrc(int status, int code, const char *fmt, va_list args) __printflike(3, 0) __dead; #endif __MKC_END_DECLS diff -Nru mk-configure-0.36.0/features/mkc_err.h mk-configure-0.37.0/features/mkc_err.h --- mk-configure-0.36.0/features/mkc_err.h 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_err.h 2021-04-08 12:46:42.000000000 +0000 @@ -27,17 +27,19 @@ __MKC_BEGIN_DECLS +#include "mkc_macro.h" + #if !HAVE_FUNC3_ERR_ERR_H -void err (int, const char *, ...); +void err (int, const char *, ...) __printflike(2, 3) __dead; #endif #if !HAVE_FUNC3_ERRX_ERR_H -void errx (int, const char *, ...); +void errx (int, const char *, ...) __printflike(2, 3) __dead; #endif #if !HAVE_FUNC3_VERR_ERR_H -void verr (int, const char *, va_list); +void verr (int, const char *, va_list) __printflike(2, 0) __dead; #endif #if !HAVE_FUNC3_VERRX_ERR_H -void verrx (int, const char *, va_list); +void verrx (int, const char *, va_list) __printflike(2, 0) __dead; #endif __MKC_END_DECLS diff -Nru mk-configure-0.36.0/features/mkc_imp.f_efun.mk mk-configure-0.37.0/features/mkc_imp.f_efun.mk --- mk-configure-0.36.0/features/mkc_imp.f_efun.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_imp.f_efun.mk 2021-04-08 12:46:42.000000000 +0000 @@ -9,8 +9,9 @@ .include "mkc_imp.f_strlcpy.mk" .include "mkc_imp.f_strlcat.mk" .include "mkc_imp.f_strndup.mk" - -MKC_FEATURES += strlcpy strlcat fgetln err +.include "mkc_imp.f_reallocarr.mk" +.include "mkc_imp.f_strtoi.mk" +.include "mkc_imp.f_strtou.mk" MKC_CHECK_FUNCS2 += ecalloc:util.h MKC_CHECK_FUNCLIBS += ecalloc:util diff -Nru mk-configure-0.36.0/features/mkc_imp.f_errc.mk mk-configure-0.37.0/features/mkc_imp.f_errc.mk --- mk-configure-0.36.0/features/mkc_imp.f_errc.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_imp.f_errc.mk 2021-04-08 12:46:42.000000000 +0000 @@ -5,7 +5,8 @@ .ifndef _MKC_IMP_F_ERRC_MK _MKC_IMP_F_ERRC_MK := 1 -.include +.include "mkc_imp.f_progname.mk" +.include "mkc_imp.f_macro.mk" .include diff -Nru mk-configure-0.36.0/features/mkc_imp.f_err.mk mk-configure-0.37.0/features/mkc_imp.f_err.mk --- mk-configure-0.36.0/features/mkc_imp.f_err.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_imp.f_err.mk 2021-04-08 12:46:42.000000000 +0000 @@ -5,7 +5,8 @@ .ifndef _MKC_IMP_F_ERR_MK _MKC_IMP_F_ERR_MK := 1 -.include +.include "mkc_imp.f_progname.mk" +.include "mkc_imp.f_macro.mk" .include diff -Nru mk-configure-0.36.0/features/mkc_imp.f_humanize_number.mk mk-configure-0.37.0/features/mkc_imp.f_humanize_number.mk --- mk-configure-0.36.0/features/mkc_imp.f_humanize_number.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_imp.f_humanize_number.mk 2021-04-08 12:46:42.000000000 +0000 @@ -12,6 +12,7 @@ .include . if ${HAVE_FUNCLIB.humanize_number:U} != 1 #|| ${HAVE_FUNCLIB.dehumanize_number:U} != 1 +. include "mkc_imp.f_macro.mk" MKC_SRCS += ${FEATURESDIR}/humanize_number/mkc_humanize_number.c . endif diff -Nru mk-configure-0.36.0/features/mkc_imp.f_macro.mk mk-configure-0.37.0/features/mkc_imp.f_macro.mk --- mk-configure-0.36.0/features/mkc_imp.f_macro.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_imp.f_macro.mk 2021-04-08 12:46:42.000000000 +0000 @@ -5,9 +5,19 @@ .ifndef _MKC_IMP_F_MACRO_MK _MKC_IMP_F_MACRO_MK := 1 -#MKC_CHECK_TYPES += u_quad_t:sys/types.h -#MKC_CHECK_HEADER_FILES += sys/sysmacros.h sys/cdefs.h paths.h +.for f in noreturn pure printflike const always_inline aligned +MKC_CHECK_CUSTOM += attribute_${f} +MKC_CUSTOM_FN.attribute_${f} = ${FEATURESDIR}/macro/mkc_attribute_${f}.c +.endfor -#CPPFLAGS += -D_MKC_CHECK_MACRO +.include -.endif #_MKC_IMP_F_MACRO_MK +CPPFLAGS += -D_MKC_CHECK_MACRO + +.for f in noreturn pure printflike const always_inline aligned +. if ${CUSTOM.attribute_${f}:U} != 1 +MKC_CPPFLAGS += -DHAVE_NO_ATTR_${f:tu} +. endif +.endfor + +.endif # _MKC_IMP_F_MACRO_MK diff -Nru mk-configure-0.36.0/features/mkc_imp.f_reallocarr.mk mk-configure-0.37.0/features/mkc_imp.f_reallocarr.mk --- mk-configure-0.36.0/features/mkc_imp.f_reallocarr.mk 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_imp.f_reallocarr.mk 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,19 @@ +# Copyright (c) 2021 by Aleksey Cheusov +# +# See LICENSE file in the distribution. + +.ifndef _MKC_IMP_F_REALLOCARR_MK +_MKC_IMP_F_REALLOCARR_MK := 1 + +MKC_CHECK_FUNCS3 += reallocarr:stdlib.h +MKC_CHECK_FUNCLIBS += reallocarr + +.include + +.if ${HAVE_FUNCLIB.reallocarr:U} != 1 +MKC_SRCS += ${FEATURESDIR}/reallocarr/mkc_reallocarr.c +.endif + +CPPFLAGS += -D_MKC_CHECK_REALLOCARR + +.endif #_MKC_IMP_F_REALLOCARR_MK diff -Nru mk-configure-0.36.0/features/mkc_imp.f_shquote.mk mk-configure-0.37.0/features/mkc_imp.f_shquote.mk --- mk-configure-0.36.0/features/mkc_imp.f_shquote.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_imp.f_shquote.mk 2021-04-08 12:46:42.000000000 +0000 @@ -5,6 +5,8 @@ .ifndef _MKC_IMP_F_SHQUOTE_MK _MKC_IMP_F_SHQUOTE_MK := 1 +.include "mkc_imp.f_macro.mk" + MKC_CHECK_FUNCLIBS += shquote MKC_CHECK_FUNCS3 += shquote:stdlib.h diff -Nru mk-configure-0.36.0/features/mkc_imp.f_strtoi.mk mk-configure-0.37.0/features/mkc_imp.f_strtoi.mk --- mk-configure-0.36.0/features/mkc_imp.f_strtoi.mk 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_imp.f_strtoi.mk 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,19 @@ +# Copyright (c) 2021 by Aleksey Cheusov +# +# See LICENSE file in the distribution. + +.ifndef _MKC_IMP_F_STRTOI_MK +_MKC_IMP_F_STRTOI_MK := 1 + +MKC_CHECK_FUNCS6 += strtoi:inttypes.h +MKC_CHECK_FUNCLIBS += strtoi + +.include + +.if ${HAVE_FUNCLIB.strtoi:U} != 1 +MKC_SRCS += ${FEATURESDIR}/strto/mkc_strtoi.c +.endif + +CPPFLAGS += -D_MKC_CHECK_STRTOI + +.endif #_MKC_IMP_F_STRTOI_MK diff -Nru mk-configure-0.36.0/features/mkc_imp.f_strtou.mk mk-configure-0.37.0/features/mkc_imp.f_strtou.mk --- mk-configure-0.36.0/features/mkc_imp.f_strtou.mk 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_imp.f_strtou.mk 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,19 @@ +# Copyright (c) 2021 by Aleksey Cheusov +# +# See LICENSE file in the distribution. + +.ifndef _MKC_IMP_F_STRTOU_MK +_MKC_IMP_F_STRTOU_MK := 1 + +MKC_CHECK_FUNCS6 += strtou:inttypes.h +MKC_CHECK_FUNCLIBS += strtou + +.include + +.if ${HAVE_FUNCLIB.strtou:U} != 1 +MKC_SRCS += ${FEATURESDIR}/strto/mkc_strtou.c +.endif + +CPPFLAGS += -D_MKC_CHECK_STRTOU + +.endif #_MKC_IMP_F_STRTOU_MK diff -Nru mk-configure-0.36.0/features/mkc_imp.f_warn.mk mk-configure-0.37.0/features/mkc_imp.f_warn.mk --- mk-configure-0.36.0/features/mkc_imp.f_warn.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_imp.f_warn.mk 2021-04-08 12:46:42.000000000 +0000 @@ -5,7 +5,8 @@ .ifndef _MKC_IMP_F_WARN_MK _MKC_IMP_F_WARN_MK := 1 -.include +.include "mkc_imp.f_progname.mk" +.include "mkc_imp.f_macro.mk" .include diff -Nru mk-configure-0.36.0/features/mkc_macro.h mk-configure-0.37.0/features/mkc_macro.h --- mk-configure-0.36.0/features/mkc_macro.h 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_macro.h 2021-04-08 12:46:42.000000000 +0000 @@ -1,8 +1,86 @@ +/********************************************************************\ + Copyright (c) 2021 by Aleksey Cheusov + + See LICENSE file in the distribution. +\********************************************************************/ + #ifndef _MKC_MACRO_H_ #define _MKC_MACRO_H_ +#ifndef _MKC_CHECK_MACRO +# error "Missing MKC_FEATURES += macro" +#endif + +#include +#include + +#ifndef __aligned +# ifdef HAVE_NO_ATTR_ALIGNED +# define __aligned(x) +# else +# define __aligned(x) __attribute__((aligned(x))) +# endif +#endif + +#ifndef __always_inline +# ifdef HAVE_NO_ATTR_ALWAYS_INLINE +# define __always_inline +# else +# define __always_inline __attribute__((always_inline)) +# endif +#endif + +#ifndef __constfunc +# ifdef HAVE_NO_ATTR_CONST +# define __constfunc +# else +# define __constfunc __attribute__((const)) +# endif +#endif + +#ifndef __dead +# ifdef HAVE_NO_ATTR_NORETURN +# define __dead +# else +# define __dead __attribute__((noreturn)) +# endif +#endif + +#ifndef __pure +# ifdef HAVE_NO_ATTR_PURE +# define __pure +# else +# define __pure __attribute__((pure)) +# endif +#endif + +#ifndef __printflike +# ifdef HAVE_NO_ATTR_PRINTFLIKE +# define __printflike(fmtarg, firstvararg) +# else +# define __printflike(fmtarg, firstvararg) \ + __attribute__((format (printf, fmtarg, firstvararg))) +# endif +#endif + +#ifndef MIN +# define MIN(a,b) (((a)<(b))?(a):(b)) +#endif + +#ifndef MAX +# define MAX(b,a) (((a)<(b))?(a):(b)) +#endif + #ifndef _DIAGASSERT -#define _DIAGASSERT(c) assert(c) +# define _DIAGASSERT(c) assert(c) #endif +#ifndef __UNCONST +# define __UNCONST(p) ((void *) ((char *)0 + ((const char *)(p) - (const char *)0))) #endif + +#ifndef __arraycount +# define __arraycount(__a) (sizeof(__a)/sizeof(__a[0])) +#endif + +#endif /* _MKC_MACRO_H_ */ diff -Nru mk-configure-0.36.0/features/mkc_reallocarr.h mk-configure-0.37.0/features/mkc_reallocarr.h --- mk-configure-0.36.0/features/mkc_reallocarr.h 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_reallocarr.h 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2021 Aleksey Cheusov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MKC_REALLOCARR_H_ +#define _MKC_REALLOCARR_H_ + +#ifndef _MKC_CHECK_REALLOCARR +# error "Missing MKC_FEATURES += reallocarr" +#endif + +#include + +#ifndef HAVE_FUNC3_REALLOCARR_STDLIB_H + +#include "mkc_externc.h" + +__MKC_BEGIN_DECLS + +int reallocarr(void *ptr, size_t number, size_t size); + +__MKC_END_DECLS + +#endif + +#endif // _MKC_REALLOCARR_H_ diff -Nru mk-configure-0.36.0/features/mkc_shquote.h mk-configure-0.37.0/features/mkc_shquote.h --- mk-configure-0.36.0/features/mkc_shquote.h 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_shquote.h 2021-04-08 12:46:42.000000000 +0000 @@ -17,7 +17,11 @@ #ifndef HAVE_FUNC3_SHQUOTE_STDLIB_H __MKC_BEGIN_DECLS -size_t shquote (const char *arg, char *buf, size_t bufsize); + +#include "mkc_macro.h" + +size_t shquote (const char *arg, char *buf, size_t bufsize) __constfunc; + __MKC_END_DECLS #endif diff -Nru mk-configure-0.36.0/features/mkc_strtoi.h mk-configure-0.37.0/features/mkc_strtoi.h --- mk-configure-0.36.0/features/mkc_strtoi.h 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_strtoi.h 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright © 2021 Aleksey Cheusov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MKC_STRTOI_H_ +#define _MKC_STRTOI_H_ 1 + +#ifndef _MKC_CHECK_STRTOI +# error "Missing MKC_FEATURES += strtoi" +#endif + +#include + +#ifndef HAVE_FUNC6_STRTOI_INTTYPES_H +#include "mkc_externc.h" +__MKC_BEGIN_DECLS +intmax_t +strtoi(const char * /*restrict*/ nptr, char ** /*restrict*/ endptr, int base, + intmax_t lo, intmax_t hi, int *rstatus); +__MKC_END_DECLS +#endif + +#endif diff -Nru mk-configure-0.36.0/features/mkc_strtou.h mk-configure-0.37.0/features/mkc_strtou.h --- mk-configure-0.36.0/features/mkc_strtou.h 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_strtou.h 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright © 2021 Aleksey Cheusov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MKC_STRTOU_H_ +#define _MKC_STRTOU_H_ 1 + +#ifndef _MKC_CHECK_STRTOU +# error "Missing MKC_FEATURES += strtou" +#endif + +#include + +#ifndef HAVE_FUNC6_STRTOU_INTTYPES_H +#include "mkc_externc.h" +__MKC_BEGIN_DECLS +uintmax_t +strtou(const char * /*restrict*/ nptr, char ** /*restrict*/ endptr, int base, + uintmax_t lo, uintmax_t hi, int *rstatus); +__MKC_END_DECLS +#endif + +#endif diff -Nru mk-configure-0.36.0/features/mkc_warn.h mk-configure-0.37.0/features/mkc_warn.h --- mk-configure-0.36.0/features/mkc_warn.h 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/features/mkc_warn.h 2021-04-08 12:46:42.000000000 +0000 @@ -27,17 +27,19 @@ __MKC_BEGIN_DECLS +#include "mkc_macro.h" + #if !HAVE_FUNC2_WARN_ERR_H -void warn (const char *, ...); +void warn (const char *, ...) __printflike(1, 2); #endif #if !HAVE_FUNC2_WARNX_ERR_H -void warnx (const char *, ...); +void warnx (const char *, ...) __printflike(1, 2); #endif #if !HAVE_FUNC2_VWARN_ERR_H -void vwarn (const char *, va_list); +void vwarn (const char *, va_list) __printflike(1, 0); #endif #if !HAVE_FUNC2_VWARNX_ERR_H -void vwarnx (const char *, va_list); +void vwarnx (const char *, va_list) __printflike(1, 0); #endif __MKC_END_DECLS diff -Nru mk-configure-0.36.0/features/reallocarr/mkc_reallocarr.c mk-configure-0.37.0/features/reallocarr/mkc_reallocarr.c --- mk-configure-0.36.0/features/reallocarr/mkc_reallocarr.c 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/reallocarr/mkc_reallocarr.c 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,102 @@ +/* $NetBSD: reallocarr.c,v 1.5 2015/08/20 22:27:49 kamil Exp $ */ + +/*- + * Copyright (c) 2015 Joerg Sonnenberger . + * Copyright (c) 2021 Aleksey Cheusov . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +/* __RCSID("$NetBSD: reallocarr.c,v 1.5 2015/08/20 22:27:49 kamil Exp $"); */ + +#include +/* Old POSIX has SIZE_MAX in limits.h */ +#include +#include +#include +#include + +#include "mkc_reallocarr.h" +#include "mkc_macro.h" + +#ifdef _LIBC +#ifdef __weak_alias +__weak_alias(reallocarr, _reallocarr) +#endif +#endif + +#define SQRT_SIZE_MAX (((size_t)1) << (sizeof(size_t) * CHAR_BIT / 2)) + +#if !HAVE_REALLOCARR + +#ifndef __predict_false +#define __predict_false(exp) (exp) +#endif + +int +reallocarr(void *ptr, size_t number, size_t size) +{ + int saved_errno, result; + void *optr; + void *nptr; + + saved_errno = errno; + memcpy(&optr, ptr, sizeof(ptr)); + if (number == 0 || size == 0) { + free(optr); + nptr = NULL; + memcpy(ptr, &nptr, sizeof(ptr)); + errno = saved_errno; + return 0; + } + + /* + * Try to avoid division here. + * + * It isn't possible to overflow during multiplication if neither + * operand uses any of the most significant half of the bits. + */ + if (__predict_false((number|size) >= SQRT_SIZE_MAX && + number > SIZE_MAX / size)) { + errno = saved_errno; + return EOVERFLOW; + } + + nptr = realloc(optr, number * size); + if (__predict_false(nptr == NULL)) { + result = errno; + } else { + result = 0; + memcpy(ptr, &nptr, sizeof(ptr)); + } + errno = saved_errno; + return result; +} +#endif diff -Nru mk-configure-0.36.0/features/strto/mkc_strtoi.c mk-configure-0.37.0/features/strto/mkc_strtoi.c --- mk-configure-0.36.0/features/strto/mkc_strtoi.c 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/strto/mkc_strtoi.c 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,75 @@ +/* $NetBSD: strtoi.c,v 1.2 2015/05/01 14:17:56 christos Exp $ */ + +/*- + * Copyright (c) 2021 Aleksey Cheusov . All rights reserved. + * Copyright (c) 2005 The DragonFly Project. All rights reserved. + * Copyright (c) 2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Created by Kamil Rytarowski, based on ID: + * NetBSD: src/common/lib/libc/stdlib/strtoul.c,v 1.3 2008/08/20 19:58:34 oster Exp + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +/* +#include +__RCSID("$NetBSD: strtoi.c,v 1.2 2015/05/01 14:17:56 christos Exp $"); +*/ + +#ifdef _LIBC +#include "namespace.h" +#endif + +#if defined(_KERNEL) +#include +#include +#include +#elif defined(_STANDALONE) +#include +#include +#include +#include +#else +#include +#include +#include +#include +#endif + +#define _FUNCNAME strtoi +#define __TYPE intmax_t +#define __WRAPPED strtoimax + +//#include "mkc_macro.h" +#define _STANDALONE +#include "mkc_strtoi.h" +#include "mkc__strtoi.h" + +#ifdef _LIBC +__weak_alias(strtoi, _strtoi) +__weak_alias(strtoi_l, _strtoi_l) +#endif diff -Nru mk-configure-0.36.0/features/strto/mkc__strtoi.h mk-configure-0.37.0/features/strto/mkc__strtoi.h --- mk-configure-0.36.0/features/strto/mkc__strtoi.h 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/strto/mkc__strtoi.h 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,146 @@ +/* $NetBSD: _strtoi.h,v 1.2 2015/01/18 17:55:22 christos Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Original version ID: + * NetBSD: src/lib/libc/locale/_wcstoul.h,v 1.2 2003/08/07 16:43:03 agc Exp + * + * Created by Kamil Rytarowski, based on ID: + * NetBSD: src/common/lib/libc/stdlib/_strtoul.h,v 1.7 2013/05/17 12:55:56 joerg Exp + */ + +/* + * function template for strtoi and strtou + * + * parameters: + * _FUNCNAME : function name + * __TYPE : return and range limits type + * __WRAPPED : wrapped function, strtoimax or strtoumax + */ + +#define __WRAPPED_L_(x) x ## _l +#define __WRAPPED_L__(x) __WRAPPED_L_(x) +#define __WRAPPED_L __WRAPPED_L__(__WRAPPED) + +#if defined(_KERNEL) || defined(_STANDALONE) || \ + defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) +__TYPE +_FUNCNAME(const char * /*restrict*/ nptr, char ** /*restrict*/ endptr, int base, + __TYPE lo, __TYPE hi, int * rstatus) +#else +#include +#include "setlocale_local.h" +#define INT_FUNCNAME_(pre, name, post) pre ## name ## post +#define INT_FUNCNAME(pre, name, post) INT_FUNCNAME_(pre, name, post) + +static __TYPE +INT_FUNCNAME(_int_, _FUNCNAME, _l)(const char * /*restrict*/ nptr, + char ** /*restrict*/ endptr, int base, + __TYPE lo, __TYPE hi, int * rstatus, locale_t loc) +#endif +{ +#if !defined(_KERNEL) && !defined(_STANDALONE) + int serrno; +#endif + __TYPE im; + char *ep; + int rep; + + assert(hi >= lo); + + assert(nptr != NULL); + /* endptr may be NULL */ + + if (endptr == NULL) + endptr = &ep; + + if (rstatus == NULL) + rstatus = &rep; + + *rstatus = 0; + +#if !defined(_KERNEL) && !defined(_STANDALONE) + serrno = errno; + errno = 0; +#endif + +#if defined(_KERNEL) || defined(_STANDALONE) || \ + defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) + im = __WRAPPED(nptr, endptr, base); +#else + im = __WRAPPED_L(nptr, endptr, base, loc); +#endif + +#if !defined(_KERNEL) && !defined(_STANDALONE) + *rstatus = errno; + errno = serrno; +#endif + + if (*rstatus == 0) { + /* No digits were found */ + if (nptr == *endptr) + *rstatus = ECANCELED; + /* There are further characters after number */ + else if (**endptr != '\0') + *rstatus = ENOTSUP; + } + + if (im < lo) { + if (*rstatus == 0) + *rstatus = ERANGE; + return lo; + } + if (im > hi) { + if (*rstatus == 0) + *rstatus = ERANGE; + return hi; + } + + return im; +} + +#if !defined(_KERNEL) && !defined(_STANDALONE) && \ + !defined(HAVE_NBTOOL_CONFIG_H) && !defined(BCS_ONLY) +__TYPE +_FUNCNAME(const char * /*restrict*/ nptr, char ** /*restrict*/ endptr, int base, + __TYPE lo, __TYPE hi, int * rstatus) +{ + return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, lo, hi, + rstatus, _current_locale()); +} + +__TYPE +INT_FUNCNAME(, _FUNCNAME, _l)(const char * /*restrict*/ nptr, + char ** /*restrict*/ endptr, int base, + __TYPE lo, __TYPE hi, int * rstatus, locale_t loc) +{ + return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, lo, hi, + rstatus, loc); +} +#endif diff -Nru mk-configure-0.36.0/features/strto/mkc_strtou.c mk-configure-0.37.0/features/strto/mkc_strtou.c --- mk-configure-0.36.0/features/strto/mkc_strtou.c 1970-01-01 00:00:00.000000000 +0000 +++ mk-configure-0.37.0/features/strto/mkc_strtou.c 2021-04-08 12:46:42.000000000 +0000 @@ -0,0 +1,75 @@ +/* $NetBSD: strtou.c,v 1.2 2015/05/01 14:17:56 christos Exp $ */ + +/*- + * Copyright (c) 2021 Aleksey Cheusov . All rights reserved. + * Copyright (c) 2005 The DragonFly Project. All rights reserved. + * Copyright (c) 2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Created by Kamil Rytarowski, based on ID: + * NetBSD: src/common/lib/libc/stdlib/strtoul.c,v 1.3 2008/08/20 19:58:34 oster Exp + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +/* +#include +__RCSID("$NetBSD: strtou.c,v 1.2 2015/05/01 14:17:56 christos Exp $"); +*/ + +#ifdef _LIBC +#include "namespace.h" +#endif + +#if defined(_KERNEL) +#include +#include +#include +#elif defined(_STANDALONE) +#include +#include +#include +#include +#else +#include +#include +#include +#include +#endif + +#define _FUNCNAME strtou +#define __TYPE uintmax_t +#define __WRAPPED strtoumax + +//#include "mkc_macro.h" +#define _STANDALONE +#include "mkc_strtou.h" +#include "mkc__strtoi.h" + +#ifdef _LIBC +__weak_alias(strtou, _strtou) +__weak_alias(strtou_l, _strtou_l) +#endif diff -Nru mk-configure-0.36.0/Makefile.inc mk-configure-0.37.0/Makefile.inc --- mk-configure-0.36.0/Makefile.inc 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/Makefile.inc 2021-04-08 12:46:42.000000000 +0000 @@ -1,4 +1,4 @@ -VERSION = 0.36.0 +VERSION = 0.37.0 BIRTHDATE = 2009-02-21 diff -Nru mk-configure-0.36.0/mk/mkc_imp.compiler_settings.mk mk-configure-0.37.0/mk/mkc_imp.compiler_settings.mk --- mk-configure-0.36.0/mk/mkc_imp.compiler_settings.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/mk/mkc_imp.compiler_settings.mk 2021-04-08 12:46:42.000000000 +0000 @@ -2,7 +2,7 @@ ### C variables CFLAGS.dflt.clang = -Qunused-arguments -Werror=implicit-function-declaration CFLAGS.dflt.icc = -we147 -we10006 # 147 is required for MKC_CHECK_PROTOTYPES -CFLAGS.dflt.sunpro = -errtags +CFLAGS.dflt.sunpro = -errtags -errwarn=E_ATTRIBUTE_UNKNOWN CFLAGS.warnerr.gcc = -Werror CFLAGS.warnerr.clang = -Werror diff -Nru mk-configure-0.36.0/mk/mkc_imp.compiler_type.mk mk-configure-0.37.0/mk/mkc_imp.compiler_type.mk --- mk-configure-0.36.0/mk/mkc_imp.compiler_type.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/mk/mkc_imp.compiler_type.mk 2021-04-08 12:46:42.000000000 +0000 @@ -6,6 +6,7 @@ !empty(MKC_CHECK_CXX_OPTS:U) || !empty(MKC_CHECK_CXXLD_OPTS:U) src_type += cxx LDREAL ?= ${CXX} +LDFLAGS += ${CXXFLAGS.std.${CXXSTD}.${CXX_TYPE}} .endif .endif diff -Nru mk-configure-0.36.0/mk/mkc_imp.final.mk mk-configure-0.37.0/mk/mkc_imp.final.mk --- mk-configure-0.36.0/mk/mkc_imp.final.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/mk/mkc_imp.final.mk 2021-04-08 12:46:42.000000000 +0000 @@ -34,10 +34,10 @@ realdo_clean: mkc_clean mkc_clean: .PHONY -.if ${CLEANFILES:U} != "" +.if !empty(CLEANFILES) -${CLEANFILES_CMD} ${CLEANFILES} .endif -.if ${CLEANDIRS:U} != "" +.if !empty(CLEANDIRS) -${CLEANDIRS_CMD} ${CLEANDIRS} .endif @@ -49,13 +49,19 @@ realdo_cleandir: mkc_cleandir mkc_cleandir: -.if ${CLEANFILES:U} != "" || ${CLEANDIRFILES:U} != "" +.if !empty(CLEANFILES) || !empty(CLEANDIRFILES) -${CLEANFILES_CMD} ${CLEANDIRFILES} ${CLEANFILES} .endif -.if ${CLEANDIRS:U} != "" || ${CLEANDIRDIRS:U} != "" +.if !empty(CLEANDIRS) || !empty(CLEANDIRDIRS) -${CLEANDIRS_CMD} ${CLEANDIRDIRS} ${CLEANDIRS} .endif +##### +realdo_installdirs: +.if !empty(INSTALLDIRS) + ${INSTALL} ${INSTALL_FLAGS} -d -m ${DIRMODE} ${INSTALLDIRS:O:u} +.endif + ########## # pre_, do_, post_ targets .for t in ${ALLTARGETS} diff -Nru mk-configure-0.36.0/mk/mkc_imp.foreign_autotools.mk mk-configure-0.37.0/mk/mkc_imp.foreign_autotools.mk --- mk-configure-0.36.0/mk/mkc_imp.foreign_autotools.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/mk/mkc_imp.foreign_autotools.mk 2021-04-08 12:46:42.000000000 +0000 @@ -40,7 +40,7 @@ _CONFIGURE_ENV = CC=${CC:Q} CFLAGS=${_CFLAGS:Q} \ CXX=${CXX:Q} CXXFLAGS=${_CXXFLAGS:Q} \ - CPPFLAGS=${_CPPFLAGS:Q} \ + CPPFLAGS=${_CPPFLAGS:Q} MAKE=${AT_MAKE} \ LDFLAGS=${LDFLAGS:Q} LIBS=${LDADD:Q} CPP=${CPP:Q} ${AT_CONFIGURE_ENV} _AT_MAKE_ENV = ${DESTDIR:DDESTDIR=${DESTDIR:Q}} ${AT_MAKE_ENV} diff -Nru mk-configure-0.36.0/mk/mkc_imp.mk mk-configure-0.37.0/mk/mkc_imp.mk --- mk-configure-0.36.0/mk/mkc_imp.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/mk/mkc_imp.mk 2021-04-08 12:46:42.000000000 +0000 @@ -72,7 +72,6 @@ -${UNINSTALL} ${UNINSTALLFILES} realdo_installdirs: - if test -n "${INSTALLDIRS:O:u}"; then ${INSTALL} ${INSTALL_FLAGS} -d -m ${DIRMODE} ${INSTALLDIRS:O:u}; fi filelist: @for d in ${UNINSTALLFILES:O:u}; do \ diff -Nru mk-configure-0.36.0/mk/mkc_imp.pkg-config.mk mk-configure-0.37.0/mk/mkc_imp.pkg-config.mk --- mk-configure-0.36.0/mk/mkc_imp.pkg-config.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/mk/mkc_imp.pkg-config.mk 2021-04-08 12:46:42.000000000 +0000 @@ -3,13 +3,10 @@ # See LICENSE file in the distribution. ############################################################ -.if !empty(MKC_REQUIRE_PKGCONFIG) -MKC_CHECK_PKGCONFIG += ${MKC_REQUIRE_PKGCONFIG} -.endif +MKC_CHECK_PKGCONFIG += ${MKC_REQUIRE_PKGCONFIG:U} .if ${MKCHECKS} == "yes" && !empty(MKC_CHECK_PKGCONFIG) -MKC_CHECK_PKGCONFIG += ${MKC_REQUIRE_PKGCONFIG:U} MKC_REQUIRE_PROGS += pkg-config .include "mkc.conf.mk" diff -Nru mk-configure-0.36.0/mk/mkc_imp.platform.sys.mk mk-configure-0.37.0/mk/mkc_imp.platform.sys.mk --- mk-configure-0.36.0/mk/mkc_imp.platform.sys.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/mk/mkc_imp.platform.sys.mk 2021-04-08 12:46:42.000000000 +0000 @@ -103,14 +103,24 @@ ${c:tu}_TYPE := ${_full_type:[1]} ${c:tu}_VERSION := ${_full_type:[2]} . undef _full_type -_mkfile=mkc_imp.${c}_${${c:tu}_TYPE}-${${c:tu}_VERSION}.mk -. if exists(${HOME}/.mk-c/${_mkfile}) -.warning "Directory ~/.mk-c is deprecated since 2020-12-11, please rename it to ~/.mkcmake" -. include "${HOME}/.mk-c/${_mkfile}" +_mkfile:=mkc_imp.${c}_${${c:tu}_TYPE}-${${c:tu}_VERSION}.mk +. if exists(${_MKFILESDIR}/${_mkfile}) + _full_mkfile:=${_MKFILESDIR}/${_mkfile} +. elif exists(${HOME}/.mk-c/${_mkfile}) +. warning "Directory ~/.mk-c is deprecated since 2020-12-11, please rename it to ~/.mkcmake" + _full_mkfile:=${HOME}/.mk-c/${_mkfile} . elif exists(${HOME}/.mkcmake/${_mkfile}) -. include "${HOME}/.mkcmake/${_mkfile}" -. elif exists(${_MKFILESDIR}/${_mkfile}) -. include "${_MKFILESDIR}/${_mkfile}" + _full_mkfile:=${HOME}/.mkcmake/${_mkfile} +. endif +. if defined(_full_mkfile) + _ != test ${_full_mkfile} -ot ${.PARSEDIR}/${.PARSEFILE}; echo $$? +. if ${_} == 0 && !defined(MK_C_PROJECT) && !defined(compiler_settings) +. error '${_full_mkfile} is older than ${.PARSEDIR}/${.PARSEFILE}, please update it using "mkc_compiler_settings" utility' +. endif +. undef _ +. if !defined(compiler_settings) +. include "${_full_mkfile}" +. endif . elif !defined(MK_C_PROJECT) && empty(compiler_settings) . if ${MKCOMPILERSETTINGS:Uno:tl} == "yes" _ != env CC= CXX= ${c:tu}=${${c:tu}} mkc_compiler_settings @@ -119,6 +129,8 @@ . error 'Settings for ${${c:tu}_TYPE}-${${c:tu}_VERSION} is not available, run "mkc_compiler_settings" utility' . endif . endif # exists(...) + +. undef _full_mkfile . undef _mkfile . endfor # .for c in ${src_type} .endif # cleandir|distclean|... @@ -311,13 +323,13 @@ lib${LIB}${SHLIB_EXTFULL}: ${EXPORT_SYMBOLS}.tmp ${EXPORT_SYMBOLS}.tmp: ${EXPORT_SYMBOLS} awk 'BEGIN {print "{ global:"} \ - {print $$0 ";"} \ + {sub(/#.*/, ""); if (NF>0) { $$1=$$1; print $$0 ";"} } \ END {print "local: *; };"}' ${.ALLSRC} > ${.TARGET} .elif ${LD_TYPE} == "darwinld" CLEANFILES += ${EXPORT_SYMBOLS}.tmp lib${LIB}${SHLIB_EXTFULL}: ${EXPORT_SYMBOLS}.tmp ${EXPORT_SYMBOLS}.tmp: ${EXPORT_SYMBOLS} - awk '{print "_" $$0}' ${.ALLSRC} > ${.TARGET} + awk '{sub(/#.*/, ""); if (NF>0) { $$1=$$1; print "_" $$0}}' ${.ALLSRC} > ${.TARGET} .endif # sunld or darwinld LDFLAGS.expsym.gnuld = --version-script ${EXPORT_SYMBOLS}.tmp diff -Nru mk-configure-0.36.0/scripts/mkc_check_custom.in mk-configure-0.37.0/scripts/mkc_check_custom.in --- mk-configure-0.36.0/scripts/mkc_check_custom.in 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/scripts/mkc_check_custom.in 2021-04-08 12:46:42.000000000 +0000 @@ -1,4 +1,5 @@ #!@SH@ +# -*- mode: sh; -*- ############################################################ # Copyright (c) 2009-2020 by Aleksey Cheusov diff -Nru mk-configure-0.36.0/scripts/mkc_check_version.in mk-configure-0.37.0/scripts/mkc_check_version.in --- mk-configure-0.36.0/scripts/mkc_check_version.in 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/scripts/mkc_check_version.in 2021-04-08 12:46:42.000000000 +0000 @@ -1,4 +1,5 @@ #!@AWK@ -f +# -*- mode: awk; -*- ############################################################ # Copyright (c) 2009-2010 by Aleksey Cheusov diff -Nru mk-configure-0.36.0/scripts/mkc_compiler_settings.in mk-configure-0.37.0/scripts/mkc_compiler_settings.in --- mk-configure-0.36.0/scripts/mkc_compiler_settings.in 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/scripts/mkc_compiler_settings.in 2021-04-08 12:46:42.000000000 +0000 @@ -1,4 +1,5 @@ #!@SH@ +# -*- mode: sh; -*- set -e diff -Nru mk-configure-0.36.0/scripts/mkc_get_deps.in mk-configure-0.37.0/scripts/mkc_get_deps.in --- mk-configure-0.36.0/scripts/mkc_get_deps.in 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/scripts/mkc_get_deps.in 2021-04-08 12:46:42.000000000 +0000 @@ -1,4 +1,5 @@ #!@AWK@ -f +# -*- mode: awk; -*- # Usage: mkc_get_deps # $1 -- project name diff -Nru mk-configure-0.36.0/scripts/mkc_install.in mk-configure-0.37.0/scripts/mkc_install.in --- mk-configure-0.36.0/scripts/mkc_install.in 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/scripts/mkc_install.in 2021-04-08 12:46:42.000000000 +0000 @@ -1,4 +1,5 @@ #!@SH@ +# -*- mode: sh; -*- # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh) @@ -119,7 +120,6 @@ $doit $stripcmd "$dsttmp" $doit $chmodcmd "$dsttmp" - $doit $rmcmd -f "$dst" $doit $mvcmd "$dsttmp" "$dst" } diff -Nru mk-configure-0.36.0/scripts/mk-configure.7.in mk-configure-0.37.0/scripts/mk-configure.7.in --- mk-configure-0.36.0/scripts/mk-configure.7.in 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/scripts/mk-configure.7.in 2021-04-08 12:46:42.000000000 +0000 @@ -18,7 +18,7 @@ .sp .. .\" ------------------------------------------------------------------ -.TH MK-CONFIGURE 7 "Jan 05, 2021" "" "" +.TH MK-CONFIGURE 7 "Jan 21, 2021" "" "" .SH NAME mk-configure \- lightweight replacement for GNU autotools .SH DESCRIPTION @@ -222,11 +222,12 @@ C compiler version. .RI < "I" > .IP CCSTD -C language standard required by program. Supported options: +Add C language standard command line option to the compiler. +Supported options: .IR c89 ", " gnu89 " (C89 with GNU extensions), " c99 ", " gnu99 \ " (C99 with GNU extensions), " c11 ", " gnu11 " (C89 with GNU extensions), " \ c17 ", " gnu17 " (C17 with GNU extensions)." -If compiler is not known for mk-configure developer or does not +If compiler is not known for mk-configure or does not support appropriate option, no additional options are applied. .RI < M > .RI [ "" ] @@ -353,11 +354,13 @@ Similar to CXXOPTS but for project ${PROJECTNAME}. .RI < "U" > .IP CXXSTD -C++ language standard required by program. Supported options: -.IR c89 ", " gnu89 " (C89 with GNU extensions), " c99 ", " gnu99 \ -" (C99 with GNU extensions), " c11 ", " gnu11 " (C89 with GNU extensions), " \ -c17 ", " gnu17 " (C17 with GNU extensions)." -If compiler is not known for mk-configure developer or does not +Add C++ language standard command line option to the compiler and linker. +Supported options: +.IR c++98 ", " gnu++98 " (C++98 with GNU extensions), " +.IR c++11 ", " gnu++11 " (C++11 with GNU extensions), " +.IR c++14 ", " gnu++14 " (C++14 with GNU extensions), " +.IR c++17 ", " gnu++17 " (C++17 with GNU extensions)" +If compiler is not known for mk-configure or does not support appropriate option, no additional options are applied. .RI < M > .RI [ "" ] @@ -876,7 +879,8 @@ .BR mk.subprj.mk . .IP EXPORT_SYMBOLS Only symbols listed in a specified file (one symbol per line) are -exported. This variable has no effect on some platforms. By default +exported. Empty lines and comments started with # symbol +are ignored. This variable has no effect on some platforms. By default all symbols are exported. .RI < "M" > [] @@ -1388,7 +1392,7 @@ MKC_CHECK_FUNCS1 += htobe32:sys/endian.h MKC_FUNC_OR_DEFINE.htobe32 += yes Res: HAVE_FUNC2.fgetln.stdio_h = 1 - HAVE_FUNC6.pselect.sys.select_h = 1 + HAVE_FUNC6.pselect.sys_select_h = 1 HAVE_FUNC1.htobe32.sys_endian_h=1 CFLAGS += -DHAVE_FUNC2_FGETLN_STDIO_H=1 \\ += -DHAVE_FUNC6_PSELECT_SYS_SELECT_H=1 \\ @@ -1620,10 +1624,11 @@ .B dprintf This feature provides dprintf(3). .TP -.B efunc -This feature provides esetfunc(3), efopen(3), ecalloc(3), -emalloc(3), erealloc(3), estrdup(3), estrndup(3), estrlcpy(3), -estrlcat(3), easprintf(3), and evasprintf(3) functions from NetBSD. +.B efun +This feature provides esetfunc(3), efopen(3), ecalloc(3), emalloc(3), +erealloc(3), ereallocarr(3), estrdup(3), estrndup(3), estrlcpy(3), +estrlcat(3), easprintf(3), estrtoi(3), estrtou(3) +and evasprintf(3) functions from NetBSD. .TP .B err This feature provides err(3), errx(3), verr(3) and verrx(3) BSD-isms. @@ -1634,6 +1639,9 @@ .B fgetln This feature provides fgetln(3) BSD-ism. .TP +.B fparseln +This feature provides fparseln(3) BSD-ism. +.TP .B fts This feature provides fts_open(3), fts_read(3) etc. functions available on BSDs and Linux. If it is absent on your system, @@ -1670,6 +1678,37 @@ not. mkc_imp.f_libm.mk checks whether libm library is available and if yes, -lm is added to LDADD. .TP +.B macro +This feature provides the following macro stolen from NetBSD. +.I __aligned(x) +defined as +.I "__attribute__((aligned(x)))" +if supported by compiler, +.I __always_inline +defined as +.I "__attribute__((always_inline))" +if supported by compiler, +.I __arraycount(a) +defined as +.I "(sizeof(__a)/sizeof(__a[0]))", +.I __constfunc +defined as +.I "__attribute__((const))" +if supported by compiler, +.I __dead +defined as +.I "__attribute__((noreturn))" +if supported by compiler, +.IR "MIN(a,b)" " and " "MAX(a,b)," +.I __pure +defined as +.I "__attribute__((pure))" +if supported by compiler, +.I "__printflike(n,m)" +defined as +.I "__attribute__((format (printf, n, m)))" +if supported by compiler. +.TP .B posix_getopt It is well-known that glibc getopt(3) does not conform to POSIX by default. This feature provides POSIX-ly correct getopt. @@ -1692,6 +1731,12 @@ and mkc_SPLAY.h include system-wide sys/tree.h, otherwise NetBSD version of sys/tree.h provided by mk-configure is included. .TP +.B reallocarr +This feature provides reallocarr(3) function from NetBSD. +.TP +.B reallocarray +This feature provides reallocarray(3) function from OpenBSD. +.TP .B shquote This feature provides shquote(3) function from NetBSD. .TP @@ -1719,6 +1764,21 @@ .B strsep This features provides strsep(3) and stresep(3) functions. .TP +.B strtoi +This feature provides strtoi(3) function +introduced in NetBSD. +.TP +.B strtou +This feature provides strtoi(3) function +introduced in NetBSD. +.TP +.B vis +This feature provides vis(3), nvis(3), svis(3), snvis(3), strvis(3), +strnvis(3), strsvis(3), strsnvis(3), strvisx(3), strnvisx(3), +strenvisx(3), strsvisx(3), strsnvisx(3), strsenvisx(3), +strunvis(3), strnunvis(3), strunvisx(3), strnunvisx(3) and +unvis(3) from NetBSD. +.TP .B warn This feature provides warn(3), warnx(3), vwarn(3) and vwarnx(3) BSD-isms. .RE diff -Nru mk-configure-0.36.0/tests/mkc_features/features.mk mk-configure-0.37.0/tests/mkc_features/features.mk --- mk-configure-0.36.0/tests/mkc_features/features.mk 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/tests/mkc_features/features.mk 2021-04-08 12:46:42.000000000 +0000 @@ -1,4 +1,5 @@ MKC_FEATURES += strlcat strlcpy getline progname fgetln err warn libm \ getdelim strndup libdl RB SLIST SIMPLEQ STAILQ LIST TAILQ CIRCLEQ SPLAY \ bswap dprintf efun strsep errc posix_getopt shquote pwdgrp \ - raise_default_signal reallocarray fparseln vis fts humanize_number + raise_default_signal reallocarr reallocarray fparseln vis fts \ + humanize_number strtoi strtou diff -Nru mk-configure-0.36.0/tests/mkc_features/tool/test_features1.cxx mk-configure-0.37.0/tests/mkc_features/tool/test_features1.cxx --- mk-configure-0.36.0/tests/mkc_features/tool/test_features1.cxx 2021-01-06 12:38:04.000000000 +0000 +++ mk-configure-0.37.0/tests/mkc_features/tool/test_features1.cxx 2021-04-08 12:46:42.000000000 +0000 @@ -24,6 +24,7 @@ #include "mkc_strsep.h" #include "mkc_posix_getopt.h" #include "mkc_raise_default_signal.h" +#include "mkc_reallocarr.h" #include "mkc_reallocarray.h" #include "mkc_fparseln.h" #include "mkc_vis.h" @@ -31,6 +32,18 @@ #include "mkc_humanize_number.h" #include "mkc_shquote.h" #include "mkc_pwdgrp.h" +#include "mkc_macro.h" +#include "mkc_strtoi.h" +#include "mkc_strtou.h" + +extern int myprintf(void *my_object, const char *my_format, ...) __printflike(2, 3); +extern int square(int v) __constfunc; +__always_inline static int cube(int v) +{ + return v * v * v; +} + +int aligned_array[16] __aligned(64); int main(int argc, char** argv) { @@ -62,9 +75,13 @@ easprintf(&ptr, "%s", "papa"); strsep(NULL, "\0"); stresep(NULL, " \t", '\0');; + printf("%p\n", __UNCONST(ptr)); free(ptr); + ptr = NULL; + ereallocarr(&ptr, 10, 32); getopt(0, NULL, NULL); raise_default_signal(15); + reallocarr(NULL, 0, 0); reallocarray(NULL, 0, 0); fparseln(NULL, NULL, NULL, "\\\\#", 0); vis(NULL, 0, 0, 0); @@ -93,6 +110,14 @@ group_from_gid(0, 0); uid_from_user(NULL, NULL); gid_from_group(NULL, NULL); + printf("cube(2)=%d\n", cube(2)); + printf("aligned_array: %p\n", &aligned_array); + printf("MIN(1,2), MIN(1,2): %d, %d\n", MIN(1,2), MAX(1,2)); + printf("arraycount(aligned_array)=%d\n", __arraycount(aligned_array)); + strtoi("5", NULL, 10, 0, 9, NULL); + strtou("5", NULL, 10, 0, 9, NULL); + estrtoi("5", 10, 0, 9); + estrtou("5", 10, 0, 9); return 0; }