[all-commits] [llvm/llvm-project] 6abe19: [clang] Predefine `_CRT_USE_BUILTIN_OFFSETOF` in M...

A. Jiang via All-commits all-commits at lists.llvm.org
Wed Mar 12 23:03:06 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6abe19ac587d36edf202830cbbceecfd1a55f191
      https://github.com/llvm/llvm-project/commit/6abe19ac587d36edf202830cbbceecfd1a55f191
  Author: A. Jiang <de34 at live.cn>
  Date:   2025-03-13 (Thu, 13 Mar 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Basic/Targets/OSTargets.cpp
    A clang/test/Sema/offsetof-ucrt.c
    A clang/test/SemaCXX/offsetof-ucrt.cpp

  Log Message:
  -----------
  [clang] Predefine `_CRT_USE_BUILTIN_OFFSETOF` in MS-compatible modes (#127568)

This patch makes Clang predefine `_CRT_USE_BUILTIN_OFFSETOF` in
MS-compatible modes. The macro can make the `offsetof` provided by MS
UCRT's `<stddef.h>` to select the `__builtin_offsetof` version, so with
it Clang (Clang-cl) can directly consume UCRT's `offsetof`.

MSVC predefines the macro as `1` since at least VS 2017 19.14, but I
think it's also OK to define it in "older" compatible modes.

Fixes #59689.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list