Junxiao Shi | 1c93cae | 2014-12-09 22:52:17 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | |
| 3 | from waflib.Configure import conf |
| 4 | |
| 5 | OVERRIDE = ''' |
| 6 | class Base |
| 7 | { |
| 8 | virtual void |
| 9 | f(int a); |
| 10 | }; |
| 11 | |
| 12 | class Derived : public Base |
| 13 | { |
| 14 | virtual void |
| 15 | f(int a) override; |
| 16 | }; |
| 17 | ''' |
| 18 | |
| 19 | @conf |
| 20 | def check_override(self): |
Alexander Afanasyev | ce81230 | 2015-04-14 14:06:29 -0700 | [diff] [blame] | 21 | self.check_cxx(msg='Checking for override specifier', |
| 22 | fragment=OVERRIDE, |
| 23 | define_name='HAVE_CXX_OVERRIDE', |
| 24 | features='cxx', mandatory=False) |
| 25 | |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 26 | FINAL = ''' |
| 27 | class Base |
| 28 | { |
| 29 | virtual void |
| 30 | f(int a); |
| 31 | }; |
| 32 | |
| 33 | class Derived : public Base |
| 34 | { |
| 35 | virtual void |
| 36 | f(int a) final; |
| 37 | }; |
| 38 | ''' |
| 39 | |
| 40 | @conf |
| 41 | def check_final(self): |
| 42 | self.check_cxx(msg='Checking for final specifier on method', |
| 43 | fragment=FINAL, |
| 44 | define_name='HAVE_CXX_FINAL', |
| 45 | features='cxx', mandatory=False) |
| 46 | |
| 47 | CLASS_FINAL = ''' |
| 48 | class A final |
| 49 | { |
| 50 | }; |
| 51 | ''' |
| 52 | |
| 53 | @conf |
| 54 | def check_class_final(self): |
| 55 | self.check_cxx(msg='Checking for final specifier on class', |
| 56 | fragment=CLASS_FINAL, |
| 57 | define_name='HAVE_CXX_CLASS_FINAL', |
| 58 | features='cxx', mandatory=False) |
| 59 | |
Junxiao Shi | 1c93cae | 2014-12-09 22:52:17 -0700 | [diff] [blame] | 60 | def configure(conf): |
| 61 | conf.check_override() |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 62 | conf.check_final() |
| 63 | conf.check_class_final() |