[all-commits] [llvm/llvm-project] 250c39: [libcxx] Add cast to avoid pointer casting warning...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Mon May 20 13:31:12 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 250c39cd7aae8d4a6a76e2f04cfe5ce657f8260c
      https://github.com/llvm/llvm-project/commit/250c39cd7aae8d4a6a76e2f04cfe5ce657f8260c
  Author: Martin Storsjö <martin at martin.st>
  Date:   2024-05-20 (Mon, 20 May 2024)

  Changed paths:
    M libcxx/src/chrono.cpp

  Log Message:
  -----------
  [libcxx] Add cast to avoid pointer casting warning on Windows (#92738)

This avoids the following build time warning, when building with the
latest nightly Clang:

warning: cast from 'FARPROC' (aka 'int (*)() __attribute__((stdcall))')
to
'GetSystemTimeAsFileTimePtr' (aka 'void (*)(_FILETIME *)
__attribute__((stdcall))')
converts to incompatible function type [-Wcast-function-type-mismatch]

This warning seems to have appeared since Clang commit
999d4f840777bf8de26d45947192aa0728edc0fb, which restructured.

The GetProcAddress function returns a `FARPROC` type, which is `int
(WINAPI *)()`. Directly casting this to another function pointer type
triggers this warning, but casting to a `void*` inbetween avoids this
issue. (On Unix-like platforms, dlsym returns a `void*`, which doesn't
exhibit this casting problem.)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list