]> git.ipfire.org Git - thirdparty/strongswan.git/commit
enum: Add compile-time check for missing strings
authorTobias Brunner <tobias@strongswan.org>
Wed, 16 Oct 2019 16:48:22 +0000 (18:48 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 28 Oct 2019 13:26:32 +0000 (14:26 +0100)
commit8b98482e041a7ee2a5c0327b16fcbec30d8d878b
tree34fa6b414cbd73aed80c5f0051ae49849db653d5
parent1bf58f6ad889a73d96208efd53c36667ef71bd25
enum: Add compile-time check for missing strings

If strings are missing (e.g. because the last value of a range changed
unknowingly or adding a string was simply forgotten) compilation will
now fail.

This could be problematic if the upper limit is out of our control (e.g.
from a system header like pfkeyv2.h), in which case patches might be
required on certain platforms (enforcing at least, and not exactly, the
required number of strings might also be an option to compile against
older versions of such a header - for internal enums it's obviously
better to enforce an exact match, though).
src/libstrongswan/tests/suites/test_enum.c
src/libstrongswan/utils/enum.h