On Sat, Oct 22, 2016 at 10:04:39PM +0100, Thomas Adam wrote:
> On Sat, Oct 22, 2016 at 07:55:01PM +0100, Dominik Vogt wrote:
> > Yes, but that does not fix the warning.  "x" is unused because of
> > the dummy replacement of the function call.  The compiler does not
> > see that if "x = 0" is ever executed, Fxyz_some_func always has a
> > non-empty definition.
> > 
> > I've always used
> > 
> >   if (FEATURE)
> >   {
> >     ...
> >   }
> > 
> > Instead of 
> > 
> >   #if FEATURE
> >     ...
> >   #endif
> > 
> > so that the conditional code is always compiled, even if the
> > feature is disabled (so we would catch compile errors earlier).
> > But in this case, it introduces a warning.
> 
> Yes -- which makes this impossible to fix unless the code is changed to be
> #ifdef'd out, rather than using 'if (FEATURE)', which makes things harder to
> read anyway.

In that case I'd rather have a warning in a rare corner case than
the code becoming un-compileable over time because nobody ever
bothers to disable all optional configure features before building
a release.  Ifdefs are a maintenance nightmare.

But of course it is fixable, we'd just have to replace the dummy
macros with real functions that do nothing.  A decent compiler
will remove the dead code anyway.  But I won't do that unless I
really find no better way.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt

Reply via email to