Bug #10072

ip: timeout takes void (*)(void *) as callback

Added by Toomas Soome 2 months ago. Updated about 2 months ago.

Status:ClosedStart date:2018-12-18
Priority:NormalDue date:
Assignee:Toomas Soome% Done:

100%

Category:driver - device drivers
Target version:-
Difficulty:Medium Tags:

Description

The issue found by gcc 8 build:

    ../../common/inet/mi.c: In function 'mi_timer':
    ../../common/inet/mi.c:1127:26: error: cast between incompatible function types from 'int (*)(struct mtb_s *)' to 'void (*)()' [-Werror=cast-function-type]
       mtb->mtb_tid = timeout((pfv_t)mi_timer_fire, mtb, tim);
                              ^
    ../../common/inet/mi.c: In function 'mi_timer_move':
    ../../common/inet/mi.c:1256:26: error: cast between incompatible function types from 'int (*)(struct mtb_s *)' to 'void (*)()' [-Werror=cast-function-type]
       mtb->mtb_tid = timeout((pfv_t)mi_timer_fire, mtb, tim);
                              ^
    ../../common/inet/mi.c: In function 'mi_timer_valid':
    ../../common/inet/mi.c:1343:27: error: cast between incompatible function types from 'int (*)(struct mtb_s *)' to 'void (*)()' [-Werror=cast-function-type]
        mtb->mtb_tid = timeout((pfv_t)mi_timer_fire,
                               ^
    cc1: all warnings being treated as errors

The callback for timeout() is not function returning int, but void ()(void), we have no reason to pass something else there.

History

#1 Updated by Dan McDonald about 2 months ago

Tested by checking disassemblies of affected mi_* functions. Only noted differences were in line numbers passed to assfail().

#2 Updated by Electric Monk about 2 months ago

  • % Done changed from 90 to 100
  • Status changed from In Progress to Closed

git commit e88f57b4cab0ed8f8a773d404d6781e20a4c26d7

commit  e88f57b4cab0ed8f8a773d404d6781e20a4c26d7
Author: Toomas Soome <tsoome@me.com>
Date:   2018-12-21T18:59:42.000Z

    10072 ip: timeout takes void (*)(void *) as callback
    Reviewed by: C Fraire <cfraire@me.com>
    Reviewed by: Norm Jacobs <naj@snapcon.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom