• Hans Wennborg's avatar
    Update asserts in mojo about int64_t's alignment · 16035729
    Hans Wennborg authored
    The purpose of these asserts is to check that the options structs are aligned
    sufficiently that an int64_t (or similar) could be added to them. The asserts
    were added in https://codereview.chromium.org/295383012
    
    However, the alignment of int64_t on 32-bit x86 is actually 4 bytes, not 8. So
    how did this ever work? Before Clang r345419, the alignof() operator (which is what
    MOJO_ALIGNOF maps to) would return the *preferred alignment* of a type, not
    the *ABI alignment*. That's not what the C and C++ standards specify, so the
    bug was fixed and the asserts started firing. (See also
    https://llvm.org/pr26547)
    
    To fix the build, change the asserts to check that int64_t requires 8 bytes
    alignment *or less*.
    
    Bug: 900406
    Change-Id: Icf80cea80ac31082423faab8c192420d0b98d515
    Reviewed-on: https://chromium-review.googlesource.com/c/1318971
    Commit-Queue: Ken Rockot <rockot@google.com>
    Reviewed-by: default avatarKen Rockot <rockot@google.com>
    Cr-Commit-Position: refs/heads/master@{#605699}
    16035729
data_pipe.h 18.2 KB