Project

General

Profile

Actions

Bug #12106

closed

libshell: cast between incompatible function types

Added by Toomas Soome almost 2 years ago. Updated almost 2 years ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Build errors with gcc 8:

    ../common/sh/streval.c: In function 'arith_exec':
    ../common/sh/streval.c:394:13: error: cast between incompatible function types from 'Math_f' {aka 'long double (*)(long double,  ...)'} to 'int (*)(long double)' [-Werror=cast-function-type]
        num = (*((Math_1i_f)fun))(num);
                 ^
    ../common/sh/streval.c:406:13: error: cast between incompatible function types from 'Math_f' {aka 'long double (*)(long double,  ...)'} to 'int (*)(long double,  long double)' [-Werror=cast-function-type]
        num = (*((Math_2i_f)fun))(sp[1],num);
                 ^
    In file included from ../common/data/strdata.c:104:
    ../i386/src/cmd/ksh93/FEATURE/math:133:20: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011fpclassify", (Math_f)local_fpclassify,
                        ^
    ../i386/src/cmd/ksh93/FEATURE/math:135:15: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011ilogb", (Math_f)ilogbl,
                   ^
    ../i386/src/cmd/ksh93/FEATURE/math:136:18: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011isfinite", (Math_f)local_isfinite,
                      ^
    ../i386/src/cmd/ksh93/FEATURE/math:137:19: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012isgreater", (Math_f)local_isgreater,
                       ^
    ../i386/src/cmd/ksh93/FEATURE/math:138:24: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012isgreaterequal", (Math_f)local_isgreaterequal,
                            ^
    ../i386/src/cmd/ksh93/FEATURE/math:139:15: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011isinf", (Math_f)local_isinf,
                   ^
    ../i386/src/cmd/ksh93/FEATURE/math:140:16: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012isless", (Math_f)local_isless,
                    ^
    ../i386/src/cmd/ksh93/FEATURE/math:141:21: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012islessequal", (Math_f)local_islessequal,
                         ^
    ../i386/src/cmd/ksh93/FEATURE/math:142:23: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012islessgreater", (Math_f)local_islessgreater,
                           ^
    ../i386/src/cmd/ksh93/FEATURE/math:143:15: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011isnan", (Math_f)isnanl,
                   ^
    ../i386/src/cmd/ksh93/FEATURE/math:144:18: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011isnormal", (Math_f)local_isnormal,
                      ^
    ../i386/src/cmd/ksh93/FEATURE/math:146:21: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011issubnormal", (Math_f)local_issubnormal,
                         ^
    ../i386/src/cmd/ksh93/FEATURE/math:148:21: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012isunordered", (Math_f)local_isunordered,
                         ^
    ../i386/src/cmd/ksh93/FEATURE/math:150:16: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011iszero", (Math_f)local_iszero,
                    ^
    ../i386/src/cmd/ksh93/FEATURE/math:154:12: error: cast between incompatible function types from 'long double (*)(int,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\002jn", (Math_f)jnl,
                ^
    ../i386/src/cmd/ksh93/FEATURE/math:170:17: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011signbit", (Math_f)local_signbit,
                     ^
    ../i386/src/cmd/ksh93/FEATURE/math:180:12: error: cast between incompatible function types from 'long double (*)(int,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\002yn", (Math_f)ynl,
                ^
    In file included from ../common/data/strdata.c:104:
    ../amd64/src/cmd/ksh93/FEATURE/math:133:20: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011fpclassify", (Math_f)local_fpclassify,
                        ^
    ../amd64/src/cmd/ksh93/FEATURE/math:135:15: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011ilogb", (Math_f)ilogbl,
                   ^
    ../amd64/src/cmd/ksh93/FEATURE/math:136:18: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011isfinite", (Math_f)local_isfinite,
                      ^
    ../amd64/src/cmd/ksh93/FEATURE/math:137:19: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012isgreater", (Math_f)local_isgreater,
                       ^
    ../amd64/src/cmd/ksh93/FEATURE/math:138:24: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012isgreaterequal", (Math_f)local_isgreaterequal,
                            ^
    ../amd64/src/cmd/ksh93/FEATURE/math:139:15: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011isinf", (Math_f)local_isinf,
                   ^
    ../amd64/src/cmd/ksh93/FEATURE/math:140:16: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012isless", (Math_f)local_isless,
                    ^
    ../amd64/src/cmd/ksh93/FEATURE/math:141:21: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012islessequal", (Math_f)local_islessequal,
                         ^
    ../amd64/src/cmd/ksh93/FEATURE/math:142:23: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012islessgreater", (Math_f)local_islessgreater,
                           ^
    ../amd64/src/cmd/ksh93/FEATURE/math:143:15: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011isnan", (Math_f)isnanl,
                   ^
    ../amd64/src/cmd/ksh93/FEATURE/math:144:18: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011isnormal", (Math_f)local_isnormal,
                      ^
    ../amd64/src/cmd/ksh93/FEATURE/math:146:21: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011issubnormal", (Math_f)local_issubnormal,
                         ^
    ../amd64/src/cmd/ksh93/FEATURE/math:148:21: error: cast between incompatible function types from 'int (*)(long double,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\012isunordered", (Math_f)local_isunordered,
                         ^
    ../amd64/src/cmd/ksh93/FEATURE/math:150:16: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011iszero", (Math_f)local_iszero,
                    ^
    ../amd64/src/cmd/ksh93/FEATURE/math:154:12: error: cast between incompatible function types from 'long double (*)(int,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\002jn", (Math_f)jnl,
                ^
    ../amd64/src/cmd/ksh93/FEATURE/math:170:17: error: cast between incompatible function types from 'int (*)(long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\011signbit", (Math_f)local_signbit,
                     ^
    ../amd64/src/cmd/ksh93/FEATURE/math:180:12: error: cast between incompatible function types from 'long double (*)(int,  long double)' to 'long double (*)(long double,  ...)' [-Werror=cast-function-type]
      "\002yn", (Math_f)ynl,
                ^

    cc1: all warnings being treated as errors

Cast over uintptr_t for quick fix.

Testing done: build/install/boot.

wsdiff compared to master branch:

libshell/i386/pics/data/strdata.o
NOTE: ELF .debug_info difference detected.

libshell/i386/pics/sh/streval.o
NOTE: ELF .debug_info difference detected.

libshell/amd64/pics/sh/streval.o
NOTE: ELF .rela.debug_info difference detected.

libshell/amd64/pics/data/strdata.o
NOTE: ELF .rela.debug_info difference detected.

Actions #1

Updated by Toomas Soome almost 2 years ago

  • Description updated (diff)
Actions #2

Updated by Toomas Soome almost 2 years ago

  • Description updated (diff)
Actions #3

Updated by Electric Monk almost 2 years ago

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

git commit 2cac0f114247a29fba32510c4c0ea549c8c0a7c9

commit  2cac0f114247a29fba32510c4c0ea549c8c0a7c9
Author: Toomas Soome <tsoome@me.com>
Date:   2020-01-13T17:42:07.000Z

    12106 libshell: cast between incompatible function types
    Reviewed by: John Levon <john.levon@joyent.com>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions

Also available in: Atom PDF