skia2/include
Mike Klein 37bbfe3ea4 Make SkASSERT and co. constexpr compatible.
One of the nice bits of constexpr is that an expression is constexpr if
there exists any set of argument values that make it constant.  It
doesn't have to be constant for _all_ argument values.

This means that this expression is constexpr:

   condition ? constexpr_value
             : []{ arbitrary non-constexpr code; }();

... it's constant when condition is true.

We can use this to rewrite SkASSERT(condition) as

    ( (condition) ? (void)0
                  : []{ SK_ABORT(#condition); }() )

Both sides of the ?: are void, and when condition is true at compile
time the right hand side disappears completely.  In C++11 constexpr
functions we just have to use the comma operator to jam SkASSERT()
into the order of evaluation:

    constexpr uint32_t foo(int x, int y) {
        return SkASSERT(x > y),
               x - y;
    }

Change-Id: I21878d14fb2af76d93591d2ae229460ee825cfde
Reviewed-on: https://skia-review.googlesource.com/52663
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Trent Apted <tapted@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-09-29 13:49:04 +00:00
..
android Add SK_API to APIs used by the android framework. 2017-09-21 18:14:36 +00:00
c C API: document sk_matrix_t 2017-03-21 18:04:34 +00:00
codec Add SK_API to APIs used by the android framework. 2017-09-21 18:14:36 +00:00
config Revert "Revert "SkUserConfig.h: remove out-of-date comment on SK_SFNTLY_SUBSETTER"" 2017-01-27 14:40:01 +00:00
core Make SkASSERT and co. constexpr compatible. 2017-09-29 13:49:04 +00:00
effects Reland "Fix SkImageSource::filterBounds()" again 2017-09-25 19:05:20 +00:00
encode Add comments support for PNG encoder 2017-06-09 17:24:03 +00:00
gpu Enable caching of path mask textures by default 2017-09-28 13:06:57 +00:00
pathops use reversePathTo in place of addPathReverse 2016-11-07 05:09:28 -08:00
ports Revert "Revert "migrate to sk_sp for SkFontMgr API"" 2017-09-26 14:05:18 +00:00
private Revert "Revert "Revert "Revert "Make threaded proxy generation MDB-friendly, and defer instantiation"""" 2017-09-29 13:48:54 +00:00
svg Add a SkWStream-based SkSVGCanvas factory 2017-09-19 20:33:19 +00:00
utils Add missing onDrawDrawable() overrides to utility canvases 2017-09-22 14:01:27 +00:00
views Convert NULL and 0 to nullptr. 2017-08-28 17:48:57 +00:00