Skip to content

Commit

Permalink
Bug 1230311 - add annotation to enforce that if a method is overridde…
Browse files Browse the repository at this point in the history
…n also base method is called. r=nfroyd

MozReview-Commit-ID: AQ3Kx2qidU0
  • Loading branch information
abpostelnicu committed Oct 4, 2016
1 parent cc503bd commit 8240ade
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mfbt/Attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,10 @@
* use `auto` in place of this type in variable declarations. This is intended to
* be used with types which are intended to be implicitly constructed into other
* other types before being assigned to variables.
* MOZ_REQUIRED_BASE_METHOD: Applies to virtual class method declarations.
* Sometimes derived classes override methods that need to be called by their
* overridden counterparts. This marker indicates that the marked method must
* be called by the method that it overrides.
*/
#ifdef MOZ_CLANG_PLUGIN
# define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override")))
Expand Down Expand Up @@ -501,6 +505,8 @@
__attribute__((annotate("moz_ignore_ctor_initialization")))
# define MOZ_IS_CLASS_INIT \
__attribute__((annotate("moz_is_class_init")))
# define MOZ_REQUIRED_BASE_METHOD \
__attribute__((annotate("moz_required_base_method")))
/*
* It turns out that clang doesn't like void func() __attribute__ {} without a
* warning, so use pragmas to disable the warning. This code won't work on GCC
Expand Down Expand Up @@ -535,6 +541,7 @@
# define MOZ_INIT_OUTSIDE_CTOR /* nothing */
# define MOZ_IS_CLASS_INIT /* nothing */
# define MOZ_NON_AUTOABLE /* nothing */
# define MOZ_REQUIRED_BASE_METHOD /* nothing */
#endif /* MOZ_CLANG_PLUGIN */

#define MOZ_RAII MOZ_NON_TEMPORARY_CLASS MOZ_STACK_CLASS
Expand Down

0 comments on commit 8240ade

Please sign in to comment.