This is totally awesome - thank you mystor! On Sat, Sep 12, 2015 at 2:06 PM, Michael Layzell <mich...@thelayzells.com> wrote:
> Hey everyone, > > Bug 1201190 (https://bugzilla.mozilla.org/show_bug.cgi?id=1201190) just > landed on inbound, which means that we now have access to the new > annotation MOZ_RAII. This is a static-analysis annotation, intended to be > placed on RAII guards. It will cause the static analysis to cause > compilation to fail if the class is allocated anywhere other than in an > automatic variable - this includes temporaries, unlike MOZ_STACK_CLASS, > which also allows allocating the type in a temporary. > > This new analysis fills the role of the much more verbose MOZ_GUARD_OBJECT > annotations, which perform runtime analysis to prevent temporary > allocations. Unfortunately, as we currently only run static analysis on > Linux and Mac OS X, you should still use MOZ_GUARD_OBJECT (In addition to > MOZ_RAII - which is more likely to catch errors, as it checks at build time > and is more thorough) if the class might be used from windows-specific > code. > > To mark a class as MOZ_RAII, simply `#include "mfbt/Attributes.h"`, and > then change the class declaration to `class MOZ_RAII FooGuard`. > > If you're adding any new RAII guards, please use MOZ_RAII! Thanks :D > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform