Skip to content

Commit df403da

Browse files
committed
release note
1 parent 37da445 commit df403da

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,33 @@ Improvements to Clang's diagnostics
497497
- ``-Wreserved-identifier`` now fires on reserved parameter names in a function
498498
declaration which is not a definition.
499499

500+
- ``-Wswitch`` will now diagnose unhandled enumerators in switches also when
501+
the enumerator is deprecated. Warnings about using deprecated enumerators in
502+
switch cases have moved behind a new ``-Wdeprecated-switch-case`` flag.
503+
504+
For example:
505+
506+
.. code-block:: c
507+
508+
enum E {
509+
Red,
510+
Green,
511+
Blue [[deprecated]]
512+
};
513+
void example(enum E e) {
514+
switch (e) {
515+
case Red: // stuff...
516+
case Green: // stuff...
517+
}
518+
}
519+
520+
will result in a warning about ``Blue`` not being handled in the switch.
521+
522+
The warning can be fixed either by adding a ``default:``, or by adding
523+
``case Blue:``. Since the enumerator is deprecated, the latter approach will
524+
trigger a ``'Blue' is deprecated`` warning, which can be turned off with
525+
``-Wno-deprecated-switch-case``.
526+
500527
Improvements to Clang's time-trace
501528
----------------------------------
502529

0 commit comments

Comments
 (0)