Tests broken...

Mark Atwood fallenpegasus at gmail.com
Wed Nov 25 20:57:16 UTC 2015


| It's because packetLength, keyIdLength, digestLength could be redefined
using
#define so it may not be constant.  It wants it to be:

That can't be right.  #define is done by the preprocessor, so what the
compiler sees *is*
  const int totalLength = 16 + 4 + 16;

Hal, I suggest seting the flag in the compiler to dump the output of the
prepropressor, and find the expression, and see if it's a constant
expression or not.

..m

On Wed, Nov 25, 2015 at 12:38 PM Amar Takhar <verm at darkbeer.org> wrote:

> On 2015-11-25 12:24 -0800, Hal Murray wrote:
> > [175/204] Compiling tests/libntp/a_md5encrypt.c
> > ../tests/libntp/a_md5encrypt.c:30:25: error: initializer element is not
> constant
> >  const int totalLength = packetLength + keyIdLength + digestLength;
> >
> > I can't figure out what's going on.  It looks reasonable to me.
> >
> >   const int packetLength = 16;
> >   const int keyIdLength = 4;
> >   const int digestLength = 16;
> >   const int totalLength = packetLength + keyIdLength + digestLength;
> >
> > In case it matters, that's from a Fedora 22 system.
> >   gcc (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4)
>
> It's because packetLength, keyIdLength, digestLength could be redefined
> using
> #define so it may not be constant.  It wants it to be:
>
>   const int totalLength = 36; or 16 + 4 + 16 this way it cannot be changed.
>
> That's quite pedantic I like it.  I didn't even get a warning under CLang
> 3.4.1.
>
> I'll put in a temp fix and mark it for looking at later on.
>
>
> Amar.
> _______________________________________________
> devel mailing list
> devel at ntpsec.org
> http://lists.ntpsec.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/devel/attachments/20151125/2e5a0846/attachment.html>


More information about the devel mailing list