Fix C++ includability of crypto headers with static array sizes
authorasomers <asomers@FreeBSD.org>
Tue, 18 Oct 2016 23:20:49 +0000 (23:20 +0000)
committerasomers <asomers@FreeBSD.org>
Tue, 18 Oct 2016 23:20:49 +0000 (23:20 +0000)
commit1bd8919011e29efa903ff7bcd97da840d97f61fb
tree4d80ff05ed28ceb66321809f11a87e9b4e1b87be
parent3d8bdcbad65189be39ba829ada2f85b3e12f933e
Fix C++ includability of crypto headers with static array sizes

C99 allows array function parameters to use the static keyword for their
sizes. This tells the compiler that the parameter will have at least the
specified size, and calling code will fail to compile if that guarantee is
not met. However, this syntax is not legal in C++.

This commit reverts r300824, which worked around the problem for
sys/sys/md5.h only, and introduces a new macro: min_size(). min_size(x) can
be used in headers as a static array size, but will still compile in C++
mode.

Reviewed by: cem, ed
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D8277
12 files changed:
lib/libmd/md5.h
sys/crypto/aesni/aesni.h
sys/crypto/sha1.h
sys/crypto/sha2/sha256.h
sys/crypto/sha2/sha384.h
sys/crypto/sha2/sha512.h
sys/crypto/sha2/sha512t.h
sys/crypto/siphash/siphash.h
sys/crypto/skein/skein_freebsd.h
sys/sys/cdefs.h
sys/sys/md4.h
sys/sys/md5.h