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

gcc 9.2 warning (-Wcast-function-type) on MSYS2 #38

Closed
phlptp opened this issue Nov 17, 2019 · 4 comments
Closed

gcc 9.2 warning (-Wcast-function-type) on MSYS2 #38

phlptp opened this issue Nov 17, 2019 · 4 comments
Assignees
Labels
available on master Fix is done on master branch, issue closed on next release
Milestone

Comments

@phlptp
Copy link

phlptp commented Nov 17, 2019

Describe the bug
warning in gcc 9.2 on MSYS2 environment

C:/msys64/home/phlpt/HELICS/build_gcc/include/helics_cxx/helics/external/filesystem.hpp: In function 'void ghc::filesystem::detail::create_symlink(const ghc::filesystem::path&, const ghc::filesystem::path&, bool, std::error_code&)':
C:/msys64/home/phlpt/HELICS/build_gcc/include/helics_cxx/helics/external/filesystem.hpp:1605:159: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'ghc::filesystem::detail::CreateSymbolicLinkW_fp' {aka 'unsigned char (*)(const wchar_t*, const wchar_t*, long unsigned int)'} [-Wcast-function-type]
 1605 |     static CreateSymbolicLinkW_fp api_call = reinterpret_cast<CreateSymbolicLinkW_fp>(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "CreateSymbolicLinkW"));
      |                                                                                                                                                               ^

To Reproduce
Detailed steps to reproduce the behavior.

Expected behavior
It would be nice if the code were warning free

Additional context
MSYS2, gcc 9.2 compiler --std=c++14, most warnings turned on.
Tried with the latest release, but that didn't clear up the warning.

@gulrak
Copy link
Owner

gulrak commented Nov 17, 2019

Yes it is my goal too, to be warning free, when possible, GCC 9 on MSYS2 is not yet under the CI tested compilers. I'll look into it.

@phlptp
Copy link
Author

phlptp commented Nov 17, 2019

as best as I can tell the most recent commit 73da6e1 does clear up the warning on MSYS2. I am not really familiar with those functions or think we are using them in any way so I can't speak to the correctness. But it does clear up the warning, so that is 👍

@gulrak gulrak added this to the v1.2.10 milestone Nov 22, 2019
@gulrak gulrak added the available on master Fix is done on master branch, issue closed on next release label Nov 22, 2019
@gulrak
Copy link
Owner

gulrak commented Nov 23, 2019

Re-updated the fix, as I didn't like that "evil cast" myself. Following the example of other projects to disable the check for these lines as it is a known issue with GetProcAddress and the warning is not helpful in that exceptional context.

@gulrak gulrak changed the title gcc 9.2 warning on MSYS2 gcc 9.2 warning (-Wcast-function-type) on MSYS2 Nov 23, 2019
gulrak added a commit that referenced this issue Nov 23, 2019
@gulrak
Copy link
Owner

gulrak commented Nov 24, 2019

Fix released with v1.2.10

@gulrak gulrak closed this as completed Nov 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
available on master Fix is done on master branch, issue closed on next release
Projects
None yet
Development

No branches or pull requests

2 participants