diff --git a/src/cmd/INIT/cc.darwin b/src/cmd/INIT/cc.darwin deleted file mode 100755 index e9e188c6b..000000000 --- a/src/cmd/INIT/cc.darwin +++ /dev/null @@ -1,52 +0,0 @@ -: unix wrapper for macOS cc : 2020-07-17 : - -HOSTTYPE=darwin.generic - -case " $* " in -*" -dumpmachine "*) echo $HOSTTYPE; exit ;; -esac - -CC=/usr/bin/cc -op=init -for arg -do case $op in - init) op=ld - set '' - ;; - esac - case $arg in - -c) op=cc - ;; - -E) op=cpp - continue - ;; - -G) op=dll - continue - ;; - -lc) continue - ;; - -lm) continue - ;; - esac - set "$@" "$arg" -done -case $# in -0) ;; -*) shift ;; -esac -case $* in --v) $CC "$@"; exit ;; -esac -case $op in -init) echo "cc: arguments expected" >&2 - exit 1 - ;; -cpp) $CC -E "$@" - ;; -cc) $CC -D_ast_int8_t=int64_t -D_lib_memccpy "$@" - ;; -dll) $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@" - ;; -ld) $CC -Wl,-search_paths_first "$@" - ;; -esac diff --git a/src/cmd/INIT/cc.darwin07 b/src/cmd/INIT/cc.darwin07 deleted file mode 100755 index a29930caf..000000000 --- a/src/cmd/INIT/cc.darwin07 +++ /dev/null @@ -1,71 +0,0 @@ -: unix wrapper for Mac OS X 10.3-10.6 (Darwin 7-10) cc : 2020-07-17 : - -HOSTTYPE=darwin07.generic - -case " $* " in -*" -dumpmachine "*) echo $HOSTTYPE; exit ;; -esac - -CC=/usr/bin/cc -op=init -for arg -do case $op in - init) op=ld - set '' - ;; - esac - case $arg in - -c) op=cc - ;; - -E) op=cpp - continue - ;; - -G) op=dll - continue - ;; - -lc) continue - ;; - -lm) continue - ;; - esac - set "$@" "$arg" -done -case $# in -0) ;; -*) shift ;; -esac -case $* in --v) $CC "$@"; exit ;; -esac -case $op in -init) echo "cc: arguments expected" >&2 - exit 1 - ;; -cpp) $CC -E "$@" - ;; -cc) $CC -DCLK_TCK=100 "$@" - ;; -dll) # what a compatibility mess -- surely they can get the apis to play nice - tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err - trap "rm -f $tmp" EXIT - case `MACOSX_DEPLOYMENT_TARGET=10.3 ld -undefined dynamic_lookup 2>&1` in - *undefined*dynamic_lookup*) - ld -m -flat_namespace -undefined suppress -dylib -dynamic \ - -ldylib1.o "$@" -lcc_dynamic -framework System >$tmp 2>&1 - status=$? - ;; - *) MACOSX_DEPLOYMENT_TARGET=10.3 $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@" >$tmp 2>&1 - status=$? - ;; - esac - egrep -v ' (warning .*multiple definitions|definition) of ' $tmp >&2 - exit $status - ;; -ld) tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err - trap "rm -f $tmp" EXIT - $CC -Wl,-m -DCLK_TCK=100 "$@" >$tmp 2>&1 - status=$? - egrep -v ' (warning .*multiple definitions of|definition of|as lazy binding|not from earlier dynamic) ' $tmp >&2 - exit $status - ;; -esac diff --git a/src/cmd/INIT/cc.darwin11 b/src/cmd/INIT/cc.darwin11 deleted file mode 100755 index 23766681e..000000000 --- a/src/cmd/INIT/cc.darwin11 +++ /dev/null @@ -1,71 +0,0 @@ -: unix wrapper for Mac OS X 10.7 (Darwin 11) cc : 2020-07-17 : - -HOSTTYPE=darwin11.generic - -case " $* " in -*" -dumpmachine "*) echo $HOSTTYPE; exit ;; -esac - -CC=/usr/bin/cc -op=init -for arg -do case $op in - init) op=ld - set '' - ;; - esac - case $arg in - -c) op=cc - ;; - -E) op=cpp - continue - ;; - -G) op=dll - continue - ;; - -lc) continue - ;; - -lm) continue - ;; - esac - set "$@" "$arg" -done -case $# in -0) ;; -*) shift ;; -esac -case $* in --v) $CC "$@"; exit ;; -esac -case $op in -init) echo "cc: arguments expected" >&2 - exit 1 - ;; -cpp) $CC -E "$@" - ;; -cc) $CC -DCLK_TCK=100 "$@" - ;; -dll) # what a compatibility mess -- surely they can get the apis to play nice - tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err - trap "rm -f $tmp" EXIT - case `MACOSX_DEPLOYMENT_TARGET=10.7 ld -undefined dynamic_lookup 2>&1` in - *undefined*dynamic_lookup*) - ld -m -flat_namespace -undefined suppress -dylib -dynamic \ - -ldylib1.o "$@" -lcc_dynamic -framework System >$tmp 2>&1 - status=$? - ;; - *) MACOSX_DEPLOYMENT_TARGET=10.7 $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@" >$tmp 2>&1 - status=$? - ;; - esac - egrep -v ' (warning .*multiple definitions|definition) of ' $tmp >&2 - exit $status - ;; -ld) tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err - trap "rm -f $tmp" EXIT - $CC -Wl,-m -DCLK_TCK=100 "$@" >$tmp 2>&1 - status=$? - egrep -v ' (warning .*multiple definitions of|definition of|as lazy binding|not from earlier dynamic) ' $tmp >&2 - exit $status - ;; -esac diff --git a/src/lib/libast/features/lib b/src/lib/libast/features/lib index 39410ad93..70dfe5beb 100644 --- a/src/lib/libast/features/lib +++ b/src/lib/libast/features/lib @@ -446,6 +446,9 @@ tst lib_memcmp string.h note{ standard memcmp interface that works }end execute{ }end tst lib_memccpy string.h unistd.h stdlib.h fcntl.h signal.h sys/types.h sys/stat.h sys/mman.h fcntl.h note{ standard memccpy interface that works }end execute{ + #ifndef MAP_FAILED + #define MAP_FAILED ((void*)-1) /* introduced in POSIX-1.2017 */ + #endif #if _STD_ static void gotcha(int sig) #else @@ -490,7 +493,7 @@ tst lib_memccpy string.h unistd.h stdlib.h fcntl.h signal.h sys/types.h sys/stat return 1; } m = n * (sizeof(x)-1); - if (!(b = mmap((void*)0, m, PROT_READ|PROT_WRITE, MAP_PRIVATE, d, (off_t)0))) + if ((b = mmap((void*)0, m, PROT_READ|PROT_WRITE, MAP_PRIVATE, d, (off_t)0)) == MAP_FAILED) { close(d); return 1; @@ -544,9 +547,9 @@ tst lib_memccpy string.h unistd.h stdlib.h fcntl.h signal.h sys/types.h sys/stat return 0; if ((fd = open("/dev/zero", O_RDWR)) < 0) return 0; - if (!(srcbuf = (char*)mmap(NULL, siz, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0))) + if ((srcbuf = (char*)mmap(NULL, siz, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0)) == MAP_FAILED) return 0; - if (!mmap(srcbuf + siz, siz, PROT_NONE, MAP_PRIVATE, fd, 0)) + if (mmap(srcbuf + siz, siz, PROT_NONE, MAP_PRIVATE, fd, 0) == MAP_FAILED) return 0; for (i = 0; i < siz; i++) srcbuf[i] = 'x';