Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 #define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override")))
2 // Ignore warnings not related to static analysis here
3 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
5 struct S {
6 virtual void f() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
7 virtual void g() MOZ_MUST_OVERRIDE;
8 virtual void h() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
9 };
10 struct C : S { // expected-error {{'C' must override 'f'}} expected-error {{'C' must override 'h'}}
11 virtual void g() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
12 virtual void h(int);
13 void q() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
14 };
15 struct D : C { // expected-error {{'D' must override 'g'}} expected-error {{'D' must override 'q'}}
16 virtual void f();
17 };
19 struct Base {
20 virtual void VirtMethod() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
21 void NonVirtMethod() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
22 static void StaticMethod() MOZ_MUST_OVERRIDE;
23 };
25 struct DoesNotPropagate : Base {
26 virtual void VirtMethod();
27 void NonVirtMethod();
28 static void StaticMethod();
29 };
31 struct Final : DoesNotPropagate { };
33 struct Propagates : Base {
34 virtual void VirtMethod() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
35 void NonVirtMethod() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
36 static void StaticMethod() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
37 };
39 struct FailsFinal : Propagates { }; // expected-error {{'FailsFinal' must override 'VirtMethod'}} expected-error {{'FailsFinal' must override 'NonVirtMethod'}} expected-error {{'FailsFinal' must override 'StaticMethod'}}
41 struct WrongOverload : Base { // expected-error {{'WrongOverload' must override 'VirtMethod'}} expected-error {{'WrongOverload' must override 'NonVirtMethod'}}
42 virtual void VirtMethod() const;
43 void NonVirtMethod(int param);
44 static void StaticMethod();
45 };
47 namespace A { namespace B { namespace C {
48 struct Param {};
49 struct Base {
50 void f(Param p) MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
51 };
52 }}}
54 struct Param {};
56 struct Derived : A::B::C::Base {
57 typedef A::B::C::Param Typedef;
58 void f(Typedef t);
59 };
61 struct BadDerived : A::B::C::Base { // expected-error {{'BadDerived' must override 'f'}}
62 void f(Param p);
63 };