Skip to content

Commit c31f3cb

Browse files
zixu-wShivam Gupta
authored and
Shivam Gupta
committed
[18.x][Docs] Add release note about Clang-defined target OS macros (llvm#80044)
The change is included in the 18.x release. Move the release note to the release branch and reformat. (cherry picked from commit b40d5b1)
1 parent 709e355 commit c31f3cb

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,22 @@ Clang Python Bindings Potentially Breaking Changes
9696
but after the end of the ``SourceRange``, ``SourceRange.__contains__``
9797
used to incorrectly return ``True``. (#GH22617), (#GH52827)
9898

99+
Clang Frontend Potentially Breaking Changes
100+
-------------------------------------------
101+
- Target OS macros extension
102+
A new Clang extension (see :ref:`here <target_os_detail>`) is enabled for
103+
Darwin (Apple platform) targets. Clang now defines ``TARGET_OS_*`` macros for
104+
these targets, which could break existing code bases with improper checks for
105+
the ``TARGET_OS_`` macros. For example, existing checks might fail to include
106+
the ``TargetConditionals.h`` header from Apple SDKs and therefore leaving the
107+
macros undefined and guarded code unexercised.
108+
109+
Affected code should be checked to see if it's still intended for the specific
110+
target and fixed accordingly.
111+
112+
The extension can be turned off by the option ``-fno-define-target-os-macros``
113+
as a workaround.
114+
99115
What's New in Clang |release|?
100116
==============================
101117
Some of the major new features and improvements to Clang are listed
@@ -196,6 +212,15 @@ New Compiler Flags
196212
existing ``-fno-c++-static-destructors`` flag) skips all static
197213
destructors registration.
198214

215+
.. _target_os_detail:
216+
217+
* ``-fdefine-target-os-macros`` and its complement
218+
``-fno-define-target-os-macros``. Enables or disables the Clang extension to
219+
provide built-in definitions of a list of ``TARGET_OS_*`` macros based on the
220+
target triple.
221+
222+
The extension is enabled by default for Darwin (Apple platform) targets.
223+
199224
Deprecated Compiler Flags
200225
-------------------------
201226

0 commit comments

Comments
 (0)