On Sat, Oct 22, 2016 at 06:19:46PM +0100, Thomas Adam wrote: > On Sat, Oct 22, 2016 at 03:42:13PM +0100, Dominik Vogt wrote: > > Proof reading this patch would also be helpful. > > I've taken a look. It's fine. I can't say I like the void casts all over the > place -- what's wrong with giving a default value?
It results in "set but not used" messages (gcc-4.7.2). This is in some functions where a feature is disabled with a macro: void foo(void) { int x; if (!FEATURE_XYZ) { return; } x = 0; Fxyz_some_func(&x); return; } Where #if FEATURE_XYZ #define Fxyz_some_function(a) Xyz_some_sunction(a) #else #define Fxyz_some_function(a) do { } while (0) #fi If FEATURE_XYZ is disabled, the preprocessed code is just ... x = 0; do { } while (0); ... And the least invasive way to prevent this is faking a read with the coid-cast. > However, since I'm using FreeBSD and hence clang, here's a further diff I'd > like you to include (to shut up clang): > > diff --git a/fvwm/icons.c b/fvwm/icons.c > index a3cb0cd..a6cc234 100644 > --- a/fvwm/icons.c > +++ b/fvwm/icons.c > @@ -754,7 +754,7 @@ void CreateIconWindow(FvwmWindow *fw, int def_x, int > def_y) > /* when fvwm is using the non-default visual client > * supplied icon pixmaps are drawn in a window with no > * relief */ > - int off ; > + int off = 0; > > (void)off; > if (Pdefault || fw->iconDepth == 1 || Ouch. So, the void casts are really bad because they actualy hide real bugs. This is not just a warning fix, the patch really breaks code that was fine before, except for the warning. There must be another way then... > Incidentally, you can always check to see what the different compilers are > doing (gcc/clang) by looking at the output from the travis-ci builds. In the > Clang case, your build looks are here: > > https://travis-ci.org/fvwmorg/fvwm/jobs/169749072 Hm, I just see a summary on top and below the heading "Job log" a "loading" icon that never finishes. Ciao Dominik ^_^ ^_^ -- Dominik Vogt