Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ tools/_infotojson/infotojson
tools/ccanlint/test/run-file_analysis
tools/configurator/configurator
scores/
*.dSYM
7 changes: 7 additions & 0 deletions ccan/coroutine/coroutine.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ struct coroutine_stack *coroutine_stack_init(void *buf, size_t bufsize,
size_t size = bufsize - sizeof(*stack) - metasize;

#ifdef MINSIGSTKSZ
# if defined(__APPLE__)
/* MINSIGSTKSZ is a runtime value on macOS 14+, not a compile-time
* constant, so it can't be used in BUILD_ASSERT; check at runtime. */
if (COROUTINE_MIN_STKSZ < (size_t)MINSIGSTKSZ)
return NULL;
# else
BUILD_ASSERT(COROUTINE_MIN_STKSZ >= MINSIGSTKSZ);
# endif
#endif

if (bufsize < (COROUTINE_MIN_STKSZ + sizeof(*stack) + metasize))
Expand Down
18 changes: 17 additions & 1 deletion tools/create-ccan-tree
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,23 @@ EOF
# parse options, setting the following flags
build_type=

opts=$(getopt -o ab: --long copy-all,build-type: -n $progname -- "$@")
# macOS ships BSD getopt which lacks --long; prefer GNU getopt if available
if [ -x /opt/homebrew/opt/gnu-getopt/bin/getopt ]; then
GETOPT=/opt/homebrew/opt/gnu-getopt/bin/getopt
elif [ -x /usr/local/opt/gnu-getopt/bin/getopt ]; then
GETOPT=/usr/local/opt/gnu-getopt/bin/getopt
else
# GNU getopt returns 4 from --test; BSD getopt does not
getopt --test > /dev/null 2>&1
if [ $? -eq 4 ]; then
GETOPT=getopt
else
echo "$progname: GNU getopt required (on macOS: brew install gnu-getopt)" >&2
exit 1
fi
fi

opts=$("$GETOPT" -o ab: --long copy-all,build-type: -n $progname -- "$@")

if [ $? != 0 ]
then
Expand Down
Loading