Project

General

Profile

Bug #10188

libast: cast between incompatible function types

Added by Toomas Soome 6 months ago. Updated 6 months ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

Issue found by gcc 8 build:

    ../common/misc/mime.c: In function 'mimehead':
    ../common/misc/mime.c:744:37: error: cast between incompatible function types from 'int (*)(const char *, const char *, char **)' to 'int (*)(const char *, const char *)' [-Werror=cast-function-type]
       if ((p = strsearch(tab, num, siz, (Strcmp_f)mimecmp, s, &e)) && *e == ':')
                                         ^
    ../common/misc/mime.c:753:40: error: cast between incompatible function types from 'int (*)(const char *, const char *, char **)' to 'int (*)(const char *, const char *)' [-Werror=cast-function-type]
              (p = strsearch(tab, num, siz, (Strcmp_f)mimecmp, pp.name.data, &e)) &&
                                            ^
    ../common/misc/glob.c: In function '_ast_glob':
    ../common/misc/glob.c:630:22: error: cast between incompatible function types from 'int (*)(DIR *)' {aka 'int (*)(struct <anonymous> *)'} to 'void (*)(void *)' [-Werror=cast-function-type]
        gp->gl_closedir = (GL_closedir_f)closedir;
                          ^
    ../common/string/strsearch.c: In function '_ast_strsearch':
    ../common/string/strsearch.c:50:25: error: cast between incompatible function types from 'Strcmp_f' {aka 'int (*)(const char *, const char *)'} to 'int (*)(const char *, const char *, void *)' [-Werror=cast-function-type]
       if (!(v = context ? (*(Strcmp_context_f)comparf)(name, *((char**)mid), context) : (*comparf)(name, *((char**)mid))))
                             ^
    cc1: all warnings being treated as errors

Add proper wrapper function and cast over uintptr_t.

History

#1

Updated by Electric Monk 6 months ago

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

git commit f3618278e9f3d420057d55d344e871e4d0c45517

commit  f3618278e9f3d420057d55d344e871e4d0c45517
Author: Toomas Soome <tsoome@me.com>
Date:   2019-01-18T02:15:25.000Z

    10188 libast: cast between incompatible function types
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF