[PATCH] D133574: [C2x] reject type definitions in offsetof

YingChi Long via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 26 07:01:37 PDT 2022


inclyc added a comment.

Hi @aaron.ballman, I've noticed in the linux kernel, type alignment was implemented by a tricky way using offsetof.

  #define TYPE_ALIGN(TYPE) offsetof(struct { char x; TYPE test; }, test)

Does this always has the same semantic with C11 `_Alignof`? If this is not true, I think unfortunately we may emit a switchable warning instead of an error to preserve semantics here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133574/new/

https://reviews.llvm.org/D133574



More information about the cfe-commits mailing list