Opened 6 weeks ago

Closed 6 weeks ago

#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: 0.2.9.1-alpha
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

Description

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:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683212(v=vs.85).aspx

But GetTickCount64() is (long long unsigned int(*)()), on both 32-bit
and 64-bit Windows:
https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount64

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 0.2.9.1-alpha.

Child Tickets

Change History (8)

comment:1 Changed 6 weeks ago by teor

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

comment:2 Changed 6 weeks ago by nickm

Owner: set to nickm
Status: newaccepted

comment:3 Changed 6 weeks 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 6 weeks ago by nickm

Actual Points: 0.1

comment:5 Changed 6 weeks 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 6 weeks ago by dgoulet

Status: needs_reviewmerge_ready

lgtm;

comment:7 Changed 6 weeks 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 6 weeks 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.