Since wherever AP_DECLARE_MODULE is used we don't need the APLOG_USE_MODULE part (ie. the static declaration of aplog_module_index), that would possibly be better to use a new AP_DEFINE_MODULE, simply as:
#define AP_DECLARE_MODULE(foo) \
module AP_MODULE_DECLARE_DATA foo##_module
The attached patch (quite huge since it touches many modules) compiles
with no issue (with gcc which does no warn w/o the patch though).
No missing/undeclared aplog_module_index reported anywhere.
That's mainly (so to preserve the "legacy" AP_DECLARE_MODULE):
Index: include/http_config.h
===================================================================
--- include/http_config.h (revision 1686298)
+++ include/http_config.h (working copy)
@@ -427,6 +427,12 @@ struct module_struct {
static int * const aplog_module_index = &(foo##_module.module_index)
/**
+ * AP_DEFINE_MODULE is a convenience macro to define the module symbol.
+ */
+#define AP_DEFINE_MODULE(foo) \
+ module AP_MODULE_DECLARE_DATA foo##_module
+
+/**
* AP_DECLARE_MODULE is a convenience macro that combines a call of
* APLOG_USE_MODULE with the definition of the module symbol.
*
@@ -434,8 +440,8 @@ struct module_struct {
* APLOG_USE_MODULE should be used explicitly instead of AP_DECLARE_MODULE.
*/
#define AP_DECLARE_MODULE(foo) \
- APLOG_USE_MODULE(foo); \
- module AP_MODULE_DECLARE_DATA foo##_module
+ APLOG_USE_MODULE(foo); \
+ APLOG_DEFINE_MODULE(foo)
/**
* @defgroup ModuleInit Module structure initializers
--
with the remainder being "s/AP_DECLARE_MODULE/AP_DEFINE_MODULE/g" in
the modules...
On Thu, Jun 18, 2015 at 10:17 PM, Rainer Jung <[email protected]> wrote:
> Am 18.06.2015 um 21:54 schrieb Jeff Trawick:
>>
>> On Thu, Jun 18, 2015 at 3:03 PM, olli hauer <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> On 2015-06-18 19:08, Jim Jagielski wrote:
>> > Subj sez it all.
>> >
>>
>> I don't know if it is worth to report this, but the on 2.4.12. I
>> don't see the following warnings
>>
>>
>> Are you using clang for both compiles?
>>
>> (I think I saw those for 2.4.12,13,14 on FreeBSD 10.1 + Clang.)
>
>
> At least technically they are correct. aplog_module_index is used only in
> APLOG_MODULE_INDEX and this macro is redefined in core.c to use a known
> constant instead (likely for performance reasons).
>
> And modules/http/http_core.c doesn't have any log statement which is
> probably the reason for not using aplog_module_index in that file.
>
> So those are expected. The warnings don't actually point to a real problem
> except for any warning always make one feel uncomfortable.
>
> The second warning could be silenced by adding a log statement.For the first
> I don't have an easy solution.
>
> Regards,
>
> Rainer
>
>
>> Test build 2.4.15 (Last Changed Rev: 1686275)
>>
>> --- core.lo ---
>> core.c:5003:1: warning: unused variable 'aplog_module_index'
>> [-Wunused-const-variable]
>> AP_DECLARE_MODULE(core) = {
>> ^
>> /usr/ports/www/apache24/work/httpd-2.4.14/include/http_config.h:437:5:
>> note: expanded from macro 'AP_DECLARE_MODULE'
>> APLOG_USE_MODULE(foo); \
>> ^
>>
>> /usr/ports/www/apache24/work/httpd-2.4.14/include/http_config.h:427:24:
>> note: expanded from macro 'APLOG_USE_MODULE'
>> static int * const aplog_module_index =
>> &(foo##_module.module_index)
>> ^
>> --- http_core.lo ---
>> http_core.c:320:1: warning: unused variable 'aplog_module_index'
>> [-Wunused-const-variable]
>> AP_DECLARE_MODULE(http) = {
>> ^
>> /usr/ports/www/apache24/work/httpd-2.4.14/include/http_config.h:437:5:
>> note: expanded from macro 'AP_DECLARE_MODULE'
>> APLOG_USE_MODULE(foo); \
>> ^
>>
>> /usr/ports/www/apache24/work/httpd-2.4.14/include/http_config.h:427:24:
>> note: expanded from macro 'APLOG_USE_MODULE'
>> static int * const aplog_module_index =
>> &(foo##_module.module_index)
>> ^
>> --- mod_buffer.slo ---
>> ...
httpd-2.4.x-AP_DEFINE_MODULE.patch
Description: application/download
