#31374 closed defect (fixed)

Appveyor: cast between incompatible function types in compat_time

Reported by: teor Owned by: nickm
Priority: Medium Milestone: Tor: 0.2.9.x-final
Component: Core Tor/Tor Version: Tor:
Severity: Normal Keywords: tor-ci-fail Windows 029-backport 035-backport 040-backport 041-backport
Cc: Actual Points: 0.1
Parent ID: #31343 Points: 0.5
Reviewer: Sponsor: Sponsor2-must


The latest Appveyor compiler complains:

../src/lib/time/compat_time.c:522:25: error: cast between incompatible function types from 'FARPROC' to 'ULONGLONG (__attribute__((stdcall)) *)(void)' [-Werror=cast-function-type]
  522 |     GetTickCount64_fn = (GetTickCount64_fn_t)
      |                         ^

This issue is like #27465:

GetProcAddress() returns FARPROC, which is (long long int(*)()) on
64-bit Windows:

But GetTickCount64() is (long long unsigned int(*)()), on both 32-bit
and 64-bit Windows:

So gcc 8 issues a spurious "incompatible function pointer" warning
about the cast to GetTickCount64_fn_t.

Silence this warning by casting to a void function pointer, before
the cast to GetTickCount64_fn_t.

Fixes bug NNNNN; bugfix on

Child Tickets

Change History (8)

comment:1 Changed 12 months ago by teor

Keywords: tor-ci-fail added; tor-ci removed

comment:2 Changed 12 months ago by nickm

Owner: set to nickm
Status: newaccepted

comment:3 Changed 12 months ago by nickm

Status: acceptedneeds_review

I have branches:

ticket31374_029 with PR at https://github.com/torproject/tor/pull/1221
ticket31374_035 (fixes a merge conflict) with PR at https://github.com/torproject/tor/pull/1222
and ticket31374_042 (for CI only) with PR at https://github.com/torproject/tor/pull/1223

comment:4 Changed 12 months ago by nickm

Actual Points: 0.1

comment:5 Changed 12 months ago by nickm

Appveyor passed with this. I propose that we merge it to 0.4.1 and forward, and let teor backport.

comment:6 Changed 12 months ago by dgoulet

Status: needs_reviewmerge_ready


comment:7 Changed 12 months ago by nickm

Keywords: 041-must removed
Milestone: Tor: 0.4.1.x-finalTor: 0.4.0.x-final

MErged to 0.4.1 and forward. Marking for backport.

comment:8 Changed 12 months ago by teor

Milestone: Tor: 0.4.0.x-finalTor: 0.2.9.x-final
Resolution: fixed
Status: merge_readyclosed

This issue breaks Appveyor CI: backporting immediately.

It looks like #31343 and #31374 each fail due to the other's error: I'll do a combined test branch to check.

Merged #31343 and #31374 together.

Note: See TracTickets for help on using tickets.