Re: [PATCH 6/7] Protect 'orig_len' in |recover_unused_bytes| by DBUS_ENABLE_VERBOSE_MODE

Thiago Macieira <[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Message-ID <1723937.337tzxfgZZ@tjmaciei-mobl1>
On quarta-feira, 10 de agosto de 2016 11:35:21 PDT Simon McVittie wrote:
> On 09/08/16 20:18, Thomas Zimmermann wrote:
> > +#ifdef DBUS_ENABLE_VERBOSE_MODE
> > 
> >        int orig_len;
> > 
> > +#endif
> > 
> >        dbus_bool_t succeeded;
> >        
> >        _dbus_message_loader_get_buffer (transport->loader,
> >        
> >                                         &buffer);
> > 
> > +#ifdef DBUS_ENABLE_VERBOSE_MODE
> > 
> >        orig_len = _dbus_string_get_length (buffer);
> > 
> > +#endif
> 
> This is the sort of thing that makes me wonder whether we should just be
> disabling the compiler warnings for unused(-but-set) variables when
> verbose mode is not enabled... but I think it's OK for master.

One way I've solved this problem is to "use" the expression in even disabled 
asserts:

#    define Q_ASSERT(cond) do { } while ((false) && (cond))

This shuts GCC, ICC and Clang up. It seems MSVC sees through our scheming and 
still complains though.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

_______________________________________________
dbus mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.