#define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override"))) // Ignore warnings not related to static analysis here #pragma GCC diagnostic ignored "-Woverloaded-virtual"
struct S { virtualvoid f() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}} virtualvoid g() MOZ_MUST_OVERRIDE; virtualvoid h() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
}; struct C : S { // expected-error {{'C' must override 'f'}} expected-error {{'C' must override 'h'}} virtualvoid g() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}} virtualvoid h(int); void q() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
}; struct D : C { // expected-error {{'D' must override 'g'}} expected-error {{'D' must override 'q'}} virtualvoid f();
};
struct Base { virtualvoid VirtMethod() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}} void NonVirtMethod() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}} staticvoid StaticMethod() MOZ_MUST_OVERRIDE;
};
struct Propagates : Base { virtualvoid VirtMethod() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}} void NonVirtMethod() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}} staticvoid StaticMethod() MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
};
struct FailsFinal : Propagates { }; // expected-error {{'FailsFinal' must override 'VirtMethod'}} expected-error {{'FailsFinal' must override 'NonVirtMethod'}} expected-error {{'FailsFinal' must override 'StaticMethod'}}
struct WrongOverload : Base { // expected-error {{'WrongOverload' must override 'VirtMethod'}} expected-error {{'WrongOverload' must override 'NonVirtMethod'}} virtualvoid VirtMethod() const; void NonVirtMethod(int param); staticvoid StaticMethod();
};
namespace A { namespace B { namespace C { struct Param {}; struct Base { void f(Param p) MOZ_MUST_OVERRIDE; // expected-note {{function to override is here}}
};
}}}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.