[squeak-dev] Building with a strict(er) C99 compiler

Eliot Miranda eliot.miranda at gmail.com
Wed Nov 30 23:57:30 UTC 2022


> On Nov 30, 2022, at 11:41 AM, Florian Weimer <fweimer at redhat.com> wrote:
> 
> * tim Rowledge:
> 
>>>> On 2022-11-30, at 12:56 AM, Florian Weimer <fweimer at redhat.com> wrote:
>>> 
>>> Is Fedora using outdated sources?
>> 
>> Yes, very much so. Just like Debian etc. PhilB was working on solving
>> the problem but ran out of time and so far nobody has been able to
>> take up the challenge.
> 
> Should I propose to retire the Fedora package (i.e., remove it from
> future Fedora releases)?  It's really ancient, and I'm worried we do the
> community a disservice here by misrepresenting the current state of the
> project.

+1

> 
> Anyway, I built the real sources with the instrumented compiler and
> submitted
> 
>  configure.ac: Fix tzet typo for tzset
>  <https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/660>
> 
> and it already got merged.  Thanks!

Wow, thanks Florian!

> 
> I found a couple of other places where implicit function declarations
> were involved, but don't really know what to do with these.
> 
> diff --git a/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/video/slice.h b/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/video/slice.h
> index d21984e0c..2726be3cb 100755
> --- a/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/video/slice.h
> +++ b/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/video/slice.h
> @@ -44,6 +44,8 @@ typedef struct
> #endif
> } mpeg3_slice_t;
> 
> +void mpeg3_slice_loop(mpeg3_slice_t *slice);
> +
> #define mpeg3slice_fillbits(buffer, nbits) \
>    while(((mpeg3_slice_buffer_t*)(buffer))->bits_size < (nbits)) \
>    { \
> 
> 
> That is probably an okay as a fix?
> 
> diff --git a/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c b/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c
> index 5a68ec982..ddd733dc8 100644
> --- a/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c
> +++ b/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c
> @@ -42,6 +42,8 @@
> #include "FilePlugin.h"
> #include "DropPlugin.h"
> 
> +extern usqIntptr_t fileRecordSize(void);
> +
> extern struct VirtualMachine  *interpreterProxy;
> extern int                        uxDropFileCount;
> extern char                      **uxDropFileNames;
> 
> This is way more questionable.  I couldn't find the right header for
> this declaration.
> 
> 
> diff --git a/platforms/unix/vm-display-X11/sqUnixX11.c b/platforms/unix/vm-display-X11/sqUnixX11.c
> index 09b3f03f9..a07377ee9 100644
> --- a/platforms/unix/vm-display-X11/sqUnixX11.c
> +++ b/platforms/unix/vm-display-X11/sqUnixX11.c
> @@ -4144,7 +4144,9 @@ void initPixmap(void)
>    for (b= 0; b < 6; b++)
>      {
>        int i= 40 + ((36 * r) + (6 * b) + g);
> -        if (i > 255) error("index out of range in color table compuation");
> +        if (i > 255)
> +          fprintf(stderr,
> +              "index out of range in color table compuation\n");
>        initColourmap(i, (r * 65535) / 5, (g * 65535) / 5, (b * 65535) / 5);
>      }
>   }
> 
> 
> I think the call goes to the error function in
> platforms/unix/vm/sqUnixMain.c, but its name is unfortunate because it
> interposes the function of the same name in glibc (which as a different
> prototype).
> 
> diff --git a/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c b/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c
> index 64c384ba6..48372180f 100644
> --- a/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c
> +++ b/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c
> @@ -33,6 +33,10 @@ static char __buildInfo[] = "XDisplayControlPlugin VMConstruction-Plugins-XDispl
> # define INT_EXT "(e)"
> #endif
> 
> +void openXDisplay(void);
> +void forgetXDisplay(void);
> +void synchronizeXDisplay(void);
> +void disconnectXDisplay(void);
> 
> /*** Function Prototypes ***/
> EXPORT(const char*) getModuleName(void);
> 
> This is obviously the wrong fix because it's in generated code, but it
> gets the build to pass.
> 
> The logged errors are:
> 
> …/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/video/getpicture.c:695: implicit function declaration: mpeg3_slice_loop
> …/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c:120: implicit function declaration: fileRecordSize
> …/platforms/unix/vm-display-X11/sqUnixX11.c:4147: implicit function declaration: error
> …/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c:188: implicit function declaration: forgetXDisplay
> …/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c:200: implicit function declaration: synchronizeXDisplay
> …/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c:259: implicit function declaration: disconnectXDisplay
> …/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c:284: implicit function declaration: openXDisplay
> 
> You should be able to replicate this with unpatched GCC by building with
> -Werror=implicit-function-declaration.  The instrumentation is only
> really needed for cases where errors do not fail the build and tend to
> be hidden (such as configure scripts).
> 
> Thanks,
> Florian
> 
> 


More information about the Squeak-dev mailing list