Project

General

Profile

Bug #12099

fm: cast between incompatible function types

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

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

Build errors with gcc 8:

    ../common/fmd.c: In function 'fmd_trmode_set':
    ../common/fmd.c:172:20: error: cast between incompatible function types from 'fmd_tracerec_t * (*)(fmd_tracebuf_t *, uint_t,  const char *, char *)' {aka 'struct fmd_tracerec * (*)(struct fmd_tracebuf *, unsigned int,  const char *, char *)'} to 'void (*)()' [-Werror=cast-function-type]
      fmd.d_thr_trace = (void (*)())func;
                        ^
    ../common/fmd_api.c: In function 'fmd_doorthr_create':
    ../common/fmd_api.c:1875:42: error: cast between incompatible function types from 'void * (*)(void *)' to 'void (*)(void *)' [-Werror=cast-function-type]
      if ((new_tp = fmd_doorthread_create(mp, (fmd_thread_f *)crf,
                                              ^
    ../common/fmd_module.c: In function 'fmd_module_gc':
    ../common/fmd_module.c:645:7: error: cast between incompatible function types from 'void (*)(fmd_serd_eng_t *)' {aka 'void (*)(struct fmd_serd_eng *)'} to 'void (*)(fmd_serd_eng_t *, void *)' {aka 'void (*)(struct fmd_serd_eng *, void *)'} [-Werror=cast-function-type]
           (fmd_serd_eng_f *)fmd_serd_eng_gc, NULL);
           ^
    ../common/fmd_module.c: In function 'fmd_module_trygc':
    ../common/fmd_module.c:661:7: error: cast between incompatible function types from 'void (*)(fmd_serd_eng_t *)' {aka 'void (*)(struct fmd_serd_eng *)'} to 'void (*)(fmd_serd_eng_t *, void *)' {aka 'void (*)(struct fmd_serd_eng *, void *)'} [-Werror=cast-function-type]
           (fmd_serd_eng_f *)fmd_serd_eng_gc, NULL);
           ^
    ../common/fmd_module.c: In function 'fmd_module_clrdirty':
    ../common/fmd_module.c:718:7: error: cast between incompatible function types from 'void (*)(fmd_serd_eng_t *)' {aka 'void (*)(struct fmd_serd_eng *)'} to 'void (*)(fmd_serd_eng_t *, void *)' {aka 'void (*)(struct fmd_serd_eng *, void *)'} [-Werror=cast-function-type]
           (fmd_serd_eng_f *)fmd_serd_eng_clrdirty, NULL);
           ^
    ../common/fmd_module.c: In function 'fmd_module_commit':
    ../common/fmd_module.c:744:7: error: cast between incompatible function types from 'void (*)(fmd_serd_eng_t *)' {aka 'void (*)(struct fmd_serd_eng *)'} to 'void (*)(fmd_serd_eng_t *, void *)' {aka 'void (*)(struct fmd_serd_eng *, void *)'} [-Werror=cast-function-type]
           (fmd_serd_eng_f *)fmd_serd_eng_commit, NULL);
           ^
    ../common/fmd_scheme.c:171:2: error: cast between incompatible function types from 'int (*)(void)' to 'void (*)()' [-Werror=cast-function-type]
      (void (*)())fmd_scheme_nop,  /* sop_fini */
      ^
    ../common/fmd_scheme.c:184:2: error: cast between incompatible function types from 'int (*)(void)' to 'void (*)()' [-Werror=cast-function-type]
      (void (*)())fmd_scheme_nop,  /* sop_fini */
      ^
    ../common/fmd_time.c:377:2: error: cast between incompatible function types from 'void * (*)(void)' to 'void (*)()' [-Werror=cast-function-type]
      (void (*)())fmd_time_nop, /* fto_fini */
      ^
    ../common/fmd_time.c:380:2: error: cast between incompatible function types from 'void * (*)(void)' to 'void (*)()' [-Werror=cast-function-type]
      (void (*)())fmd_time_nop, /* fto_addhrtime */
      ^
    ../common/fmd_thread.c: In function 'fmd_thread_xcreate':
    ../common/fmd_thread.c:44:19: error: cast between incompatible function types from 'void (*)()' to 'fmd_tracerec_t * (*)(fmd_tracebuf_t *, uint_t,  const char *, char *)' {aka 'struct fmd_tracerec * (*)(struct fmd_tracebuf *, unsigned int,  const char *, char *)'} [-Werror=cast-function-type]
      tp->thr_trfunc = (fmd_tracebuf_f *)fmd.d_thr_trace;
                       ^
    ../common/fmd_thread.c: In function 'fmd_thread_create_cmn':
    ../common/fmd_thread.c:84:19: error: cast between incompatible function types from 'void (*)()' to 'fmd_tracerec_t * (*)(fmd_tracebuf_t *, uint_t,  const char *, char *)' {aka 'struct fmd_tracerec * (*)(struct fmd_tracebuf *, unsigned int,  const char *, char *)'} [-Werror=cast-function-type]
      tp->thr_trfunc = (fmd_tracebuf_f *)fmd.d_thr_trace;
                       ^
    ../common/fmd_ckpt.c: In function 'fmd_ckpt_restore_case':
    ../common/fmd_ckpt.c:1053:6: error: cast between incompatible function types from 'int (*)(fmd_case_t *, fmd_event_t *)' {aka 'int (*)(struct fmd_case *, struct fmd_event *)'} to 'void (*)(void *, fmd_event_t *)' {aka 'void (*)(void *, struct fmd_event *)'} [-Werror=cast-function-type]
          (void (*)(void *, fmd_event_t *))fmd_case_insert_principal, cp);
          ^
    ../common/fmd_ckpt.c:1056:6: error: cast between incompatible function types from 'int (*)(fmd_case_t *, fmd_event_t *)' {aka 'int (*)(struct fmd_case *, struct fmd_event *)'} to 'void (*)(void *, fmd_event_t *)' {aka 'void (*)(void *, struct fmd_event *)'} [-Werror=cast-function-type]
          (void (*)(void *, fmd_event_t *))fmd_case_insert_event, cp);
          ^
    ../common/fmd_ckpt.c: In function 'fmd_ckpt_restore_serd':
    ../common/fmd_ckpt.c:1108:7: error: cast between incompatible function types from 'int (*)(fmd_serd_eng_t *, fmd_event_t *)' {aka 'int (*)(struct fmd_serd_eng *, struct fmd_event *)'} to 'void (*)(void *, fmd_event_t *)' {aka 'void (*)(void *, struct fmd_event *)'} [-Werror=cast-function-type]
           (void (*)(void *, fmd_event_t *))fmd_serd_eng_record,
           ^
    ../common/fmd_mdb.c: In function 'fmd_trace':
    ../common/fmd_mdb.c:296:28: error: cast between incompatible function types from 'int (*)(uintptr_t,  const fmd_tracerec_t *, uintptr_t)' {aka 'int (*)(unsigned int,  const struct fmd_tracerec *, unsigned int)'} to 'int (*)(uintptr_t,  const void *, void *)' {aka 'int (*)(unsigned int,  const void *, void *)'} [-Werror=cast-function-type]
      if (mdb_walk("fmd_trace", (mdb_walk_cb_t)func, (void *)tid) == -1) {
                                ^
    ../common/scheme.c:94:2: error: cast between incompatible function types from 'int (*)(void)' to 'void (*)()' [-Werror=cast-function-type]
      (void (*)())fmd_scheme_nop,  /* sop_fini */
      ^
    ../common/problem.c: In function 'sunFmProblemTable_init':
    ../common/problem.c:351:40: error: cast between incompatible function types from 'void (*)(void *)' to 'void * (*)(void *)' [-Werror=cast-function-type]
      if ((err = pthread_create(NULL, NULL, (void *(*)(void *))update_thread,
                                            ^
    ../common/module.c: In function 'sunFmModuleTable_init':
    ../common/module.c:360:40: error: cast between incompatible function types from 'void (*)(void *)' to 'void * (*)(void *)' [-Werror=cast-function-type]
      if ((err = pthread_create(NULL, NULL, (void *(*)(void *))update_thread,
                                            ^
    ../common/resource.c: In function 'sunFmResourceTable_init':
    ../common/resource.c:357:40: error: cast between incompatible function types from 'void (*)(void *)' to 'void * (*)(void *)' [-Werror=cast-function-type]
      if ((err = pthread_create(NULL, NULL, (void *(*)(void *))update_thread,
                                            ^
    ../common/scheme.c:97:2: error: cast between incompatible function types from 'int (*)(void)' to 'void (*)()' [-Werror=cast-function-type]
      (void (*)())fmd_scheme_nop,  /* sop_fini */
      ^
    cc1: all warnings being treated as errors

Testing: build/install/boot

History

#1

Updated by Toomas Soome 2 months ago

  • Description updated (diff)
#2

Updated by Electric Monk about 7 hours ago

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

git commit 1743a90d9abccc6cd1e57ef89729c674b859fc6e

commit  1743a90d9abccc6cd1e57ef89729c674b859fc6e
Author: Toomas Soome <tsoome@me.com>
Date:   2020-02-27T06:41:48.000Z

    12099 fm: cast between incompatible function types
    Reviewed by: Matthias Scheler <mscheler@tintri.com>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Also available in: Atom PDF