mywave82 / opencubicplayer

Open Cubic Player (unix fork). Music visualizer for various tracked music formats (amiga modules, S3M, IT), chiptunes and other formats related to demoscene
https://stian.cubic.org/project-ocp.php
GNU General Public License v2.0
280 stars 19 forks source link

error: incompatible function pointer types #105

Closed ryandesign closed 1 year ago

ryandesign commented 1 year ago

ocp 0.2.106 is failing to build with clang 16 on macOS:

/opt/local/bin/clang-mp-16 -pipe -Os -arch x86_64 -fno-common -fPIC -D_DARWIN_C_SOURCE -DNCURSES_WIDECHAR -Wall -I.././ pfilesel.c -o pfilesel.o -c
In file included from pfilesel.c:104:
./pfilesel-charset.c:285:4: warning: need to find ideal top and left to match where we pop out from [-W#warnings]
                #warning need to find ideal top and left to match where we pop out from
                 ^
pfilesel.c:296:2: warning: What about RD_SUBNOSYMLINK ??..... [-W#warnings]
#warning What about RD_SUBNOSYMLINK ??.....
 ^
pfilesel.c:335:13: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        token.mask = mask;
                   ^ ~~~~
pfilesel.c:1066:2: error: incompatible function pointer types initializing 'const void (*)(uint16_t, const char *)' (aka 'const void (*)(unsigned short, const char *)') with an expression of type 'void (uint16_t, const char *)' (aka 'void (unsigned short, const char *)') [-Wincompatible-function-pointer-types]
        cpiKeyHelp,
        ^~~~~~~~~~
pfilesel.c:1067:2: error: incompatible function pointer types initializing 'const void (*)(void)' with an expression of type 'void (void)' [-Wincompatible-function-pointer-types]
        cpiKeyHelpClear,
        ^~~~~~~~~~~~~~~
pfilesel.c:1068:2: error: incompatible function pointer types initializing 'const int (*)(void)' with an expression of type 'int (void)' [-Wincompatible-function-pointer-types]
        cpiKeyHelpDisplay,
        ^~~~~~~~~~~~~~~~~
pfilesel.c:1069:2: error: incompatible function pointer types initializing 'const void (*)(void)' with an expression of type 'void (void)' [-Wincompatible-function-pointer-types]
        fsDraw
        ^~~~~~
pfilesel.c:3897:2: warning: we can add a dir->SaveFile API..... [-W#warnings]
#warning we can add a dir->SaveFile API.....
 ^
4 warnings and 4 errors generated.
make[1]: *** [pfilesel.o] Error 1
mywave82 commented 1 year ago

Yes, clang 16 broke the C standard specification and at the same time made missmatching function declarations hard-fault as default.

ryandesign commented 1 year ago

Thanks!

mywave82 commented 1 year ago

@ryandesign

If you cherry pick this patch, you should be able to compile on most variants of MacOS I believe.

Also you can add dependency to libgme (Game-Music-Emulator) for adding more possible file-types. This is new in 0.2.106

ryandesign commented 1 year ago

If you cherry pick this patch, you should be able to compile on most variants of MacOS I believe.

Yes, it does work, thank you: https://github.com/macports/macports-ports/commit/eac144dfee88a42f085bed7b1c552b08548692b3

Also you can add dependency to libgme (Game-Music-Emulator) for adding more possible file-types. This is new in 0.2.106

In MacPorts, nobody has contributed a port for libgme yet; after someone does that, then yes we can enable support for it in the ocp port.