Skip to content

Commit b40d5b1

Browse files
authored
[Docs] Add release note about Clang-defined target OS macros (llvm#79879)
1 parent d17b005 commit b40d5b1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@ ABI Changes in This Version
4949
AST Dumping Potentially Breaking Changes
5050
----------------------------------------
5151

52+
Clang Frontend Potentially Breaking Changes
53+
-------------------------------------------
54+
55+
Target OS macros extension
56+
^^^^^^^^^^^^^^^^^^^^^^^^^^
57+
A new Clang extension (see :ref:`here <target_os_detail>`) is enabled for
58+
Darwin (Apple platform) targets. Clang now defines ``TARGET_OS_*`` macros for
59+
these targets, which could break existing code bases with improper checks for
60+
the ``TARGET_OS_`` macros. For example, existing checks might fail to include
61+
the ``TargetConditionals.h`` header from Apple SDKs and therefore leaving the
62+
macros undefined and guarded code unexercised.
63+
64+
Affected code should be checked to see if it's still intended for the specific
65+
target and fixed accordingly.
66+
67+
The extension can be turned off by the option ``-fno-define-target-os-macros``
68+
as a workaround.
69+
5270
What's New in Clang |release|?
5371
==============================
5472
Some of the major new features and improvements to Clang are listed
@@ -97,6 +115,17 @@ Non-comprehensive list of changes in this release
97115
New Compiler Flags
98116
------------------
99117

118+
.. _target_os_detail:
119+
120+
Target OS macros extension
121+
^^^^^^^^^^^^^^^^^^^^^^^^^^
122+
A pair of new flags ``-fdefine-target-os-macros`` and
123+
``-fno-define-target-os-macros`` has been added to Clang to enable/disable the
124+
extension to provide built-in definitions of a list of ``TARGET_OS_*`` macros
125+
based on the target triple.
126+
127+
The extension is enabled by default for Darwin (Apple platform) targets.
128+
100129
Deprecated Compiler Flags
101130
-------------------------
102131

0 commit comments

Comments
 (0)