Skip to content
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

unused-command-line-argument warning with Apple Clang #1805

Closed
StrikerRUS opened this issue Oct 30, 2018 · 8 comments
Closed

unused-command-line-argument warning with Apple Clang #1805

StrikerRUS opened this issue Oct 30, 2018 · 8 comments

Comments

@StrikerRUS
Copy link
Collaborator

There is a warning

clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]

in the current master branch.

I've done binsearching among available Xcode versions on Azure Pipelines and found that the lowest Xcode version which recognizes -pthread and doesn't produce the warning is 9.3.

ping @guolinke and @chivee

@guolinke
Copy link
Collaborator

@chivee
Copy link
Collaborator

chivee commented Oct 31, 2018

maybe just adding -Qunused-arguments option for those under 9.3

@StrikerRUS
Copy link
Collaborator Author

StrikerRUS commented Nov 21, 2018

@chivee Won't this hide from us future (possibly dangerous) warnings?

I've tried the following solution, but unfortunately warning hasn't gone.

if((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.1.0"))
    if("${CMAKE_SHARED_LINKER_FLAGS}" STREQUAL "")
        string(REPLACE "-pthread" "" OLD_APPLE_CLANG_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS}")
    else()
        string(REPLACE "-pthread" "" OLD_APPLE_CLANG_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
    endif()
    set(CMAKE_SHARED_LINKER_FLAGS "${OLD_APPLE_CLANG_SHARED_LINKER_FLAGS}" CACHE STRING "" FORCE)
    if("${CMAKE_EXE_LINKER_FLAGS}" STREQUAL "")
        string(REPLACE "-pthread" "" OLD_APPLE_CLANG_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS}")
    else()
        string(REPLACE "-pthread" "" OLD_APPLE_CLANG_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
    endif()
    set(CMAKE_EXE_LINKER_FLAGS "${OLD_APPLE_CLANG_EXE_LINKER_FLAGS}" CACHE STRING "" FORCE)
endif()

@guolinke
Copy link
Collaborator

@StrikerRUS
from https://stackoverflow.com/questions/2391194/what-is-gs-pthread-equiv-in-clang/19382746#19382746
I think the pthread is needed for compiling, but not for linking.
can we set this in cmake ?

@StrikerRUS
Copy link
Collaborator Author

@guolinke I've tried: #1805 (comment). Unfortunately, without any luck 😢 .

@StrikerRUS
Copy link
Collaborator Author

Closed in favor of being in #2302. We decided to keep all feature requests in one place.

Welcome to contribute this feature! Please re-open this issue (or post a comment if you are not a topic starter) if you are actively working on implementing this feature.

@StrikerRUS
Copy link
Collaborator Author

I've done binsearching among available Xcode versions on Azure Pipelines and found that the lowest Xcode version which recognizes -pthread and doesn't produce the warning is 9.3.

According to the

I'm closing this issue.

@github-actions

This comment was marked as off-topic.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2023
@microsoft microsoft unlocked this conversation Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants