diff options
| author | Jakob Kaivo <jkk@ung.org> | 2020-08-14 18:53:56 -0400 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2020-08-14 18:53:56 -0400 |
| commit | b1b60bd8cb71f7010c0dca555f027e84ec657947 (patch) | |
| tree | d00206e3fee9760f4c5e7b629c673357193bc71b | |
| parent | 4f4d04f00b768157cde2c4b457377d70c61b4692 (diff) | |
prevent comparisons againt the empty string and error out if the compiler is not correct for the environment
| -rwxr-xr-x | mkh.sh | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -41,6 +41,18 @@ for i in $(cat "${TOPDIR}/.deps/h/${HEADERNAME}.deps" | sort -u); do printf '%s <%s> (%s)\n' "$i" "$HEADER" "$version" >&2 done +### +### TODO: prevent _XOPEN_SOURCE expanding to empty string +### +if grep -Fq -e '_XOPEN_SOURCE <' -e '< _XOPEN_SOURCE' $(cat $(HEADER.*/*); then +cat <<-EOF + #if defined _XOPEN_SOURCE && _XOPEN_SOURCE - 1 < 0 + # undef _XOPEN_SOURCE + # define _XOPEN_SOURCE 400 + #endif +EOF +fi + if grep -Fq 'POSIX(' $(cat $HEADER.*/*); then cat <<-EOF #if defined _XOPEN_SOURCE && !defined _POSIX_C_SOURCE @@ -62,6 +74,18 @@ cat <<-EOF EOF fi +if grep -Fq -e 'POSIX(' -e 'XOPEN(' $(cat $HEADER.*/*); then +cat <<-EOF + #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 19901L + # if (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 200112L) + # error POSIX.1-2001 and later require a C99 compiler + # elif(defined _XOPEN_SOURCE && _XOPEN_SOURCE >= 600) + # error XOPEN Issue 6 and later require a C99 compiler + # endif + #endif +EOF +fi + for type in REFERENCE MACRO TYPE TYPE_LONG RECORD FNTYPE EXTERN; do if [ -d $HEADER.$type ]; then for v in $HEADER.$type/*; do |
