Skip to content

[SR-10559] libdispatch fails to build with _FORTIFY_SOURCE=2 #474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2019
Merged

Conversation

mroi
Copy link
Contributor

@mroi mroi commented Apr 29, 2019

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.

Filed as Swift bug SR-10559.

fixes compilation with _FORTIFY_SOURCE=2,
which would otherwise fail with -Werror and -Wunused
@ktopley-apple
Copy link
Contributor

@swift-ci please test

3 similar comments
@ktopley-apple
Copy link
Contributor

@swift-ci please test

@compnerd
Copy link
Member

@swift-ci please test

@ktopley-apple
Copy link
Contributor

@swift-ci please test

@mroi mroi mentioned this pull request May 2, 2019
10 tasks
@compnerd
Copy link
Member

compnerd commented May 5, 2019

@swift-ci please test

@ktopley-apple ktopley-apple merged commit 1482ec9 into swiftlang:master May 10, 2019
rokhinip pushed a commit that referenced this pull request Nov 5, 2021
[SR-10559] libdispatch fails to build with _FORTIFY_SOURCE=2

Signed-off-by: Kim Topley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants