Open
Description
Previous ID | SR-10559 |
Radar | None |
Original Reporter | mroi (JIRA User) |
Type | Bug |
Attachment: Download
Environment
Error is reproducible when building on Linux by adding -D_FORTIFY_SOURCE=2
to the CFLAGS
.
Additional Detail from JIRA
Votes | 0 |
Component/s | libdispatch |
Labels | Bug |
Assignee | mroi (JIRA) |
Priority | Medium |
md5: 7b08875efa899b1d63183c32fe0bd5d5
Issue Description:
The Nix Packages collection on Linux routinely builds with the fortify option (-D_FORTIFY_SOURCE=2
). Currently, libdispatch fails to build with the following error:
/home/michael/swift/src/swift-corelibs-libdispatch/src/queue.c:47:2: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result]
_dispatch_client_assert_fail(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/michael/swift/src/swift-corelibs-libdispatch/src/internal.h:1056:3: note: expanded from macro '_dispatch_client_assert_fail'
asprintf(&_msg, "%s" fmt, DISPATCH_ASSERTION_FAILED_MESSAGE, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/sr4253np2gz2bpha4gn8gqlmiw604155-glibc-2.27-dev/include/bits/stdio2.h:199:3: note: expanded from macro 'asprintf'
__asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
^~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/michael/swift/src/swift-corelibs-libdispatch/src/queue.c:56:2: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result]
_dispatch_client_assert_fail(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/michael/swift/src/swift-corelibs-libdispatch/src/internal.h:1056:3: note: expanded from macro '_dispatch_client_assert_fail'
asprintf(&_msg, "%s" fmt, DISPATCH_ASSERTION_FAILED_MESSAGE, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/sr4253np2gz2bpha4gn8gqlmiw604155-glibc-2.27-dev/include/bits/stdio2.h:199:3: note: expanded from macro 'asprintf'
__asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
^~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
Since the fix is very easy, I was hoping it could be considered, even though _FORTIFY_SOURCE
may not be the recommended way of building swift.