More waf confusion

Matthew Selsky Matthew.Selsky at twosigma.com
Thu Mar 30 02:25:39 UTC 2017


On Mon, Mar 27, 2017 at 12:37:59AM -0700, Hal Murray wrote:

Hey, Hal!

> Somebody recently removed some cruft from config.h
> That reminded me that there is more junk in there.
> 
> So I took a handy config.h and grep-ed the source code, looking for symbols 
> that were not used by any code.
> 
> First hit:
>   #define NTPSEC_VERSION_MAJOR 0 /* Major version number */
>   #define NTPSEC_VERSION_MINOR 9 /* Minor version number */
>   #define NTPSEC_VERSION_REV 7 /* Revision version number */
> They aren't used.  NTPSEC_VERSION_STRING is used.
> 
> They look like they might be needed some day, so I'm tempted to comment them 
> out rather than delete them.  (The similar names are used internally.  I'm 
> just talking about the code that puts them into config.h)
> #    ctx.define("NTPSEC_VERSION_MAJOR", ctx.env.NTPSEC_VERSION_MAJOR,
> #               comment="Major version number")

We may use this in the future, if we move away from autorevision.sh

> Here is the interesting one:
>   ##    ctx.check_cc(auto_add_header_name=True,
>   ##                 header_name="stddef.h",
>   ##                 mandatory=False)
> 
> Nobody references HAVE_STDDEF_H, but commenting out that code breaks things.  
> The test for HAVE_STRUCT_TIMEX_MODES uses size_t which isn't defined.
> 
> Working test code has an "#include <stddef.h>"
> I assume that drags in something that provides size_t and it's due to the 
> "auto_add_header_name=True"
> 
> Does anybody understand this area?  Is there any simple way to get that 
> header added to the test code without cluttering up config.h?

I added this in https://gitlab.com/NTPsec/ntpsec/commit/c03b2de16be3b8a7a73f33d4c137a782cacc6b4d to fix warnings in the checks for structure fields and size_t not being defined on some platforms (like Linux) without this header.  The comment says:

# waf's SNIP_FIELD should likely include this header itself
ctx.check_cc(header_name="stddef.h", auto_add_header_name=True, mandatory=False)

I asked on #waf and this was the best work-around that ita provided.  See https://github.com/waf-project/waf/issues/1905 for more information.  Note, the SNIP_FIELD checks are removed in waf-2.0 so we'll need to do this ourselves when we switch from 1.9.x to 2.0


Thanks,
-Matt


More information about the devel mailing list