File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff 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+
500527Improvements to Clang's time-trace
501528----------------------------------
502529
You can’t perform that action at this time.
0 commit comments