• Leszek Swirski's avatar
    [csa] Fix MSVC handling of VA_ARGS in CSA_ASSERT · 80f6c19f
    Leszek Swirski authored
    MSVC's macro VA_ARGS support behaves slightly differently from
    gcc/clang, where VA_ARGS is treated as a single token when passed to
    other macros, e.g.
    
        #define FIRST(X, ...) 'X'
        #define FOO(...) FIRST(__VA_ARGS__)
        FOO(a,b,c)
    
    expands to
    
        gcc/clang: 'a'
        MSVC: 'a,b,c'
    
    The workaround to this is to wrap the call in a no-op macro, which
    expands VA_ARGS first, and only then passes it through:
    
        #define EXPAND(x) x
        #define FOO(...) EXPAND(FIRST(__VA_ARGS__))
    
    This was causing errors on windows builds when CSA_ASSERT was passed
    multiple additional expressions.
    
    Change-Id: Ia40bf23baf97af29c7f6f67c8a83918ecca15364
    Reviewed-on: https://chromium-review.googlesource.com/586831Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
    Commit-Queue: Leszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#46927}
    80f6c19f
code-stub-assembler.h 78.3 KB