]> git.ipfire.org Git - thirdparty/git.git/commit
flex-array: simplify compiler-specific workaround
authorJunio C Hamano <gitster@pobox.com>
Thu, 9 Dec 2021 01:39:39 +0000 (17:39 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 9 Dec 2021 01:45:16 +0000 (17:45 -0800)
commitdeefc2d9f6a24a5787598fa70ddfa4a91601f202
treeffea5ad498fe2029975112b6735e10ba54cfae9a
parente9d7761bb94f20acc98824275e317fa82436c25d
flex-array: simplify compiler-specific workaround

We use "type array[];" syntax for the flex-array member at the end
of a struct under C99 or later, except when we are building with
older SUNPRO_C compilers.  As we find more vendor compilers that
claim to grok C99 but not understand the flex-array syntax, the
existing "If we are using C99, but not with these compilers..."
conditional will keep growing.

Make it more manageable by listing vendor-specific exceptions
earlier, with the expectation that new exceptions will not be
combined into existing ones to make the condition longer, and
instead will be implemented as a new "#elif" in the cascade of
similar to old SUNPRO_C, we can just add a single line

    #elif defined(_MSC_VER)

immediately before "#elif defined(__GNUC__)" to cause us to fallback
to the safer but a bit wasteful version.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-compat-util.h