waf checking - fail on warnings?

James Browning jamesb.fe80 at gmail.com
Tue Aug 27 03:23:11 UTC 2019


On Mon, Aug 26, 2019, 8:02 PM Hal Murray via devel <devel at ntpsec.org> wrote:

>
> How do I tell waf to fail on warnings?
>
> I'm trying to use this to detect which API I'm getting.
>
> STRERROR_FRAG = """
> #include <string.h>
> int main(void) {
>   char buf [100];
>   const char *foo = strerror_r(6, buf, sizeof(buf));
>   return foo == NULL;
> }
> """
>
>     ctx.check_cc(
>         fragment=STRERROR_FRAG,
>         define_name="STRERROR_CHAR",
>         features="c",
>         msg="Checking if strerror_r returns char*",
>         mandatory=False,
>         comment="Whether strerror_r returns char*"
>     )
>
> Unfortunately, it gives a warning rather than an error so it looks like it
> works.
> ../../test.c:5:21: warning: initialization makes pointer from integer
> without a c
> ast [-Wint-conversion]
>    const char *foo = strerror_r(6, buf, sizeof(buf));
>
> How to I tell waf to fail on warnings?
> Plan B would be to run the test code and see if the answer is NULL.
>

A relatively quick search suggests mandatory=True as an argument.

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20190826/7bb06663/attachment.htm>


More information about the devel mailing list