view clang/test/Sema/switch-availability.c @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900 (2021-06-07)
parents 1d019706d866
children
line wrap: on
line source
// RUN: %clang_cc1 -verify -Wswitch -triple x86_64-apple-macosx10.12 %s

enum SwitchOne {
  Unavail __attribute__((availability(macos, unavailable))),
};

void testSwitchOne(enum SwitchOne so) {
  switch (so) {} // no warning
}

enum SwitchTwo {
  Ed __attribute__((availability(macos, deprecated=10.12))),
  Vim __attribute__((availability(macos, deprecated=10.13))),
  Emacs,
};

void testSwitchTwo(enum SwitchTwo st) {
  switch (st) {} // expected-warning{{enumeration values 'Vim' and 'Emacs' not handled in switch}}
}

enum SwitchThree {
  New __attribute__((availability(macos, introduced=1000))),
};

void testSwitchThree(enum SwitchThree st) {
  switch (st) {} // expected-warning{{enumeration value 'New' not handled in switch}}
}