Skip to content

Commit 5b32319

Browse files
zixu-wxgupta
authored andcommitted
[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 0e39e35 commit 5b32319

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
@@ -168,6 +168,22 @@ Clang Python Bindings Potentially Breaking Changes
168168
The previous name was incorrect, it was a duplicate of variant 28.
169169
- Refactored enum implementation, switching to the standard library `Enum` type.
170170

171+
Clang Frontend Potentially Breaking Changes
172+
-------------------------------------------
173+
- Target OS macros extension
174+
A new Clang extension (see :ref:`here <target_os_detail>`) is enabled for
175+
Darwin (Apple platform) targets. Clang now defines ``TARGET_OS_*`` macros for
176+
these targets, which could break existing code bases with improper checks for
177+
the ``TARGET_OS_`` macros. For example, existing checks might fail to include
178+
the ``TargetConditionals.h`` header from Apple SDKs and therefore leaving the
179+
macros undefined and guarded code unexercised.
180+
181+
Affected code should be checked to see if it's still intended for the specific
182+
target and fixed accordingly.
183+
184+
The extension can be turned off by the option ``-fno-define-target-os-macros``
185+
as a workaround.
186+
171187
What's New in Clang |release|?
172188
==============================
173189
Some of the major new features and improvements to Clang are listed
@@ -501,6 +517,15 @@ New Compiler Flags
501517
- ``-fpointer-tbaa`` enables emission of distinct type-based alias
502518
analysis tags for incompatible pointers.
503519

520+
.. _target_os_detail:
521+
522+
* ``-fdefine-target-os-macros`` and its complement
523+
``-fno-define-target-os-macros``. Enables or disables the Clang extension to
524+
provide built-in definitions of a list of ``TARGET_OS_*`` macros based on the
525+
target triple.
526+
527+
The extension is enabled by default for Darwin (Apple platform) targets.
528+
504529
Deprecated Compiler Flags
505530
-------------------------
506531

0 commit comments

Comments
 (0)