You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rainer Jung <ra...@kippdata.de> on 2009/05/12 23:06:50 UTC

GCC 4, NULL and missing sentinel warnings

In revision 683278 Joe introduced a sentinel attribute mark to some APR
functions (trunk and 1.4).

When compiling httpd trunk I noticed, that on Solaris 8 and 10 using GCC
4 I get warnings about missing sentinels in function calls. I also get
it on some apr files, like e.g. apr_tables.c.

It turns out, that this is due to "NULL" being defined as "0" instead of
e.g. (void *)0.

I can see, that this comes from the inclusion of sys/types.h, which
leads to /usr/include/iso/time_iso.h being included. That file defines
NULL as 0.

sys/types.h occurs very early in the list of includes in apr.h

For gcc 4.1.2 I can add stddef.h, but only because the fixincludes
version of it defines NULL as (void *)0. For gcc 3.4.3 this does not
work (but there is no warning to fix either).

Now apr does set HAVE_STDDEF_H only in apr_private.h, so I can't simply
add something like

#ifdef HAVE_STDDEF_H
#include <stddef.h> /* NULL */
#endif

to apr_strings.h. I think we need to add a new APR_HAVE_STDDEF_H to
apr.h(.in) and then we can add

#if APR_HAVE_STDDEF_H
#include <stddef.h> /* NULL */
#endif

to apr_strings.h, apr_tables.h etc.

Should I prepare a patch along those lines?

Regards,

Rainer

Re: GCC 4, NULL and missing sentinel warnings

Posted by Rainer Jung <ra...@kippdata.de>.
On 13.05.2009 00:04, William A. Rowe, Jr. wrote:
> Rainer Jung wrote:
>> Should I prepare a patch along those lines?
> 
> Maybe bring this up on the dev@apr.apache.org list?

You're right, I opened an issue and attached a patch.

https://issues.apache.org/bugzilla/show_bug.cgi?id=47191

Once things are sorted out in APR land, there'll be an analogous patch
to do for ap_fputstrs() in util_filter.h.

Regards,

Rainer

Re: GCC 4, NULL and missing sentinel warnings

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Rainer Jung wrote:
> 
> Should I prepare a patch along those lines?

Maybe bring this up on the dev@apr.apache.org list?