enums: Add `sizeforce' member value
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 23 Oct 2014 19:02:59 +0000 (20:02 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 24 Oct 2014 17:58:43 +0000 (18:58 +0100)
commit58a876e5ac9539ff14acb7dc3ea3633f5bdb41d8
tree4b0bcc226190d6c40596c3a92562838f6de7611f
parent0b960a9f970798195043c47cf4bbe20adc2855b0
enums: Add `sizeforce' member value

The C standard helpfully permits enums with a small range of values to
be short.  This effect is not desirable in an API because it means that
adding new values (new flags, say) may cause ABI incompatibility.

Add some `sizeforce' members to relevant enums in the API.  In none of
the three cases do we expect this to actually cause an ABI break on
actual practical platforms, because the values we choose are within
the same power-of-two bitwidth.

Specifically:

                    max value in adns 1.4       new max value
  adns_initflags            0x0300                    0x7fff
  adns_queryflags       0x0ff00000                0x7fffffff
  adns_rrtype              0x20000                0x7fffffff
  adns_status                  499                 unchanged

The small max value of adns_initflags is unfortunate.  But we can't
change it without actually breaking the ABI on actual existing
platforms.  We can put off biting that bullet until we run out of
initflags - there are still three flags remaining.

This patch is not expected to have any practical effect with existing
platforms and compilers but it makes the code more correct and less
likely to be misoptimised by a future aggressive compiler.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/adns.h