Tests broken...

Amar Takhar verm at darkbeer.org
Wed Nov 25 20:38:53 UTC 2015


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.


More information about the devel mailing list