waf checking - fail on warnings?

Hal Murray hmurray at megapathdsl.net
Tue Aug 27 03:02:16 UTC 2019


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.



-- 
These are my opinions.  I hate spam.





More information about the devel mailing list