You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Yann Ylavic <yl...@gmail.com> on 2016/09/06 12:26:54 UTC
Re: svn commit: r1759415 - /httpd/httpd/trunk/include/http_config.h
On Tue, Sep 6, 2016 at 2:07 PM, <yl...@apache.org> wrote:
> Author: ylavic
> Date: Tue Sep 6 12:07:39 2016
> New Revision: 1759415
>
> URL: http://svn.apache.org/viewvc?rev=1759415&view=rev
> Log:
> http_config: follow up to r1702948: maybe unused, yet maybe usefull too.
I get plenty of warnings compiling 2.4.x with recent gcc, like:
/home/yle/src/apache/httpd/2.4.x/include/http_config.h|429 col 24|
warning: ‘aplog_module_index’ defined but not used
[-Wunused-const-variable=]
|| static int * const aplog_module_index = &(foo##_module.module_index)
|| ^
/home/yle/src/apache/httpd/2.4.x/include/http_config.h|446 col 5|
note: in expansion of macro ‘APLOG_USE_MODULE’
|| APLOG_USE_MODULE(foo); \
|| ^~~~~~~~~~~~~~~~
/home/yle/src/apache/asf/httpd/httpd/branches/2.4.x/server/core.c|5314
col 1| note: in expansion of macro ‘AP_DECLARE_MODULE’
|| AP_DECLARE_MODULE(core) = {
|| ^~~~~~~~~~~~~~~~~
with several modules.
Maybe we could backport r1702948 (and this commit, which I think is a
better naming for the attribute) ?
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?
Re: svn commit: r1759415 - /httpd/httpd/trunk/include/http_config.h
Posted by Yann Ylavic <yl...@gmail.com>.
On Fri, Sep 9, 2016 at 1:32 PM, Joe Orton <jo...@redhat.com> wrote:
> 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.
Thanks, backport proposed.
Regards,
Yann.
Re: svn commit: r1759415 - /httpd/httpd/trunk/include/http_config.h
Posted by Jacob Champion <ch...@gmail.com>.
On 09/09/2016 04:32 AM, Joe Orton wrote:
> On Tue, Sep 06, 2016 at 02:26:54PM +0200, Yann Ylavic wrote:
>> 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.
+1
--Jacob
Re: svn commit: r1759415 - /httpd/httpd/trunk/include/http_config.h
Posted by Joe Orton <jo...@redhat.com>.
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