Hi Edwin
> On 1. Mar 2024, at 23:43, Edwin Ancaer <eancaer@gmail.com> wrote:
>
> Eliot,
>
> thanks for the help.
>
> There was another warning turned into error since clang 15, that was also solved by turning the error in a warning. :
>
>
> /home/edwin/Squeak/opensmalltalk-vm/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:194:62: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'char *' [-Wint-conversion]
> char *getDefaultSoundPlayer(void) { return -1; }
> ^~
> /home/edwin/Squeak/opensmalltalk-vm/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:195:62: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'char *' [-Wint-conversion]
> char *getDefaultSoundRecorder(void) { return -1; }
> ^~
> /home/edwin/Squeak/opensmalltalk-vm/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:196:62: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'char *' [-Wint-conversion]
> char *getSoundPlayerDeviceName(sqInt i) { return -1; }
> ^~
> /home/edwin/Squeak/opensmalltalk-vm/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:197:62: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'char *' [-Wint-conversion]
> char *getSoundRecorderDeviceName(sqInt i) { return -1; }
> ^~
> 4 errors generated.
Yeah, -1 isn't a char* anyway, and the plugin actually checks for NULL:
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/src/plugins/SoundPlugin/SoundPlugin.c#L198
I changed it here https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/0084f9f3e4b34dc39af23febfbb8c70cd0ef7bfa
>
> But now I have the following, which I see no way to solve:
>
> /home/edwin/Squeak/opensmalltalk-vm/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c:951:13: error: redefinition of 'devname' as different kind of symbol
> static char devname[MAX_NAME_LEN];
> ^
> /usr/include/stdlib.h:289:7: note: previous definition is here
> char *devname(__dev_t, __mode_t);
>
> Any help is welcome....
Ok this is very strange.
Yes, devname is declared in stdlib, but sqUnixSoundALSA.c does not include stdlib.h (nor does anything I know of)
can you generate the .i file? (that is, replacing `-c` in the compilation process of sqUnixSoundALSA.c with `-E`)
Best regards
-Tobias
>
> Edwin Ancaer
> Op vr 1 mrt 2024 om 07:17 schreef Eliot Miranda <eliot.miranda@gmail.com>:
> Hi Edwin,
>
> On Thu, Feb 29, 2024 at 3:10 PM Edwin Ancaer <eancaer@gmail.com> wrote:
>
> Hello,
>
> I recently upgraded to FreeBSD 14, with clang version 'FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)'
>
> If I understand correctly, Clang promoted some warnings to errors and in special the warning Wincompatible-function-pointer-types. It looks as if this prevents me to compile the linux-cog-spur virtual machine:
>
> clang -Wall -g -O2 -DNDEBUG -DDEBUGVM=0 -msse2 -DCOGMTVM=0 -pthread -DLSB_FIRST=1 -m64 -Wno-missing-braces -Wno-unknown-pragmas -Wno-unused-value -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -DHAVE_CONFIG_H -DSQUEAK_BUILTIN_PLUGIN -I/home/edwin/Squeak/opensmalltalk-vm/building/linux64x64/squeak.cog.spur/build -I/home/edwin/Squeak/opensmalltalk-vm/building/linux64x64/squeak.cog.spur/build -I/home/edwin/Squeak/opensmalltalk-vm/platforms/unix/vm -I/home/edwin/Squeak/opensmalltalk-vm/platforms/Cross/vm -I/home/edwin/Squeak/opensmalltalk-vm/src/spur64.cog -I/home/edwin/Squeak/opensmalltalk-vm/platforms/Cross/vm -I/home/edwin/Squeak/opensmalltalk-vm/platforms/unix/vm -I/home/edwin/Squeak/opensmalltalk-vm/src/spur64.cog -I/home/edwin/Squeak/opensmalltalk-vm/platforms/Cross/plugins/FilePlugin -I/home/edwin/Squeak/opensmalltalk-vm/platforms/unix/plugins/B3DAcceleratorPlugin -m64 -Wno-missing-braces -Wno-unknown-pragmas -Wno-unused-value -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -c -o sqUnixMain.o /home/edwin/Squeak/opensmalltalk-vm/platforms/unix/vm/sqUnixMain.c
> /home/edwin/Squeak/opensmalltalk-vm/platforms/unix/vm/sqUnixMain.c:1832:10: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> printf(optionStrings[count]);
> ^~~~~~~~~~~~~~~~~~~~
> /home/edwin/Squeak/opensmalltalk-vm/platforms/unix/vm/sqUnixMain.c:1832:10: note: treat the string as an argument to avoid this
> printf(optionStrings[count]);
> ^
> "%s",
> /home/edwin/Squeak/opensmalltalk-vm/platforms/unix/vm/sqUnixMain.c:2324:38: error: incompatible function pointer types assigning to 'void (*)(int, struct __siginfo *, void *)' from 'void (int, siginfo_t *, ucontext_t *)' (aka 'void (int, struct __siginfo *, struct __ucontext *)') [-Wincompatible-function-pointer-types]
> sigsegv_handler_action.sa_sigaction = sigsegv;
> ^ ~~~~~~~
> /home/edwin/Squeak/opensmalltalk-vm/platforms/unix/vm/sqUnixMain.c:2331:38: error: incompatible function pointer types assigning to 'void (*)(int, struct __siginfo *, void *)' from 'void (int, siginfo_t *, ucontext_t *)' (aka 'void (int, struct __siginfo *, struct __ucontext *)') [-Wincompatible-function-pointer-types]
> sigusr1_handler_action.sa_sigaction = sigusr1;
> ^ ~~~~~~~
> 1 warning and 2 errors generated.
> *** Error code 1
>
> Stop.
> make[1]: stopped in /home/edwin/Squeak/opensmalltalk-vm/building/linux64x64/squeak.cog.spur/build/vm
> *** Error code 1
>
> Stop.
> make: stopped in /home/edwin/Squeak/opensmalltalk-vm/building/linux64x64/squeak.cog.spur/build
> [edwin@ottopedi ~/Squeak/opensmalltalk-vm/building/linux64x64/squeak.cog.spur/build]$
>
> If my assumption is correct, the 'solution seems to downgrade the error to a warning with a compiler option: -Wno-error=, but I have no idea how to do this in the whole configuration and compilation process.
> Can someone tell how this should be done, or is it better to signal this as an error and wait until it gets corrected.
>
> Ugh, this is such an annoying warning, and now error. Why isn't there a define for the type of sa_sigaction so that one can cast a function to it? I've been looking for an acceptable cross-platform way to eliminate the warning for years. I'm open to any suggestion. As far as adding -Wno-error=incompatible-function-pointer-types, can't you do it by making a build directory that contains an mvm file that adds it to the compiler command line? You could add, say, building/freebsd64x64/squeak.cog.spur/{build,buildast,builddbg} can't mvms that contain
>
> CFLAGS="$CFLAGS -I/usr/local/include -Wno-error=incompatible-function-pointer-types"
>
> or you could extend the existing linux64x64 mvms with a test for clang, etc. But basically the mvm is the most convenient place to add hacks like this, and the building directory is a convenient place to put configuration files that hack around annoying issues like this.
>
>
> Kind regards
>
> Edwin Ancaer
>
> Good luck man!
>
> _,,,^..^,,,_
> best, Eliot
>
>