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>
2 files changed