On Tue, Sep 06, 2016 at 02:26:54PM +0200, Yann Ylavic wrote:
> Maybe we could backport r1702948 (and this commit, which I think is a
> better naming for the attribute) ?

+1 from me to doing both, these new warnings are annoying.  MAYBE_UNSUED 
is definitely a better name.

> Alternatively, if AP_MAYBE_UNUSED looks too (compiler) specific, the
> following works for me too...
> 
> @@ -424,7 +426,11 @@ struct module_struct {
>   */
>  #define APLOG_USE_MODULE(foo) \
>      extern module AP_MODULE_DECLARE_DATA foo##_module;                  \
> -    static int * const aplog_module_index = &(foo##_module.module_index)
> +    static int * const aplog_module_index = &(foo##_module.module_index); \
> +    static APR_INLINE int aplog_foo##_module_index(void)                  \
> +    {                                                                     \
> +        return aplog_module_index ? *aplog_module_index : -1;             \
> +    }
> 
> This makes the static variable used in an inline function, which
> itself may be unused but compilers do not warn about this
> (usually...).
> 
> WDYT?

FWIW I'd substitute "usually" for "yet", I wouldn't try too hard here, 
just do the compiler-specific hacks.

Regards, Joe

Reply via email to