Ticket #10154: 10154.patch

File 10154.patch, 1.1 KB (added by csnover, 6 years ago)
  • common/scummsys.h

    diff --git a/common/scummsys.h b/common/scummsys.h
    index 4740127d2f..5486ba27c6 100644
    a b  
    154154#endif
    155155
    156156#ifndef STATIC_ASSERT
     157#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER > 1600)
    157158        /**
    158159         * Generates a compile-time assertion.
    159160         *
     
    162163         * time if the expression evaluates to false.
    163164         */
    164165        #define STATIC_ASSERT(expression, message) \
    165                 extern int STATIC_ASSERT_##message[(expression) ? 1 : -1]; \
    166                 (void)(STATIC_ASSERT_##message);
     166                static_assert((expression), #message)
     167#else
     168        /**
     169         * Generates a compile-time assertion.
     170         *
     171         * @param expression An expression that can be evaluated at compile time.
     172         * @param message An underscore-delimited message to be presented at compile
     173         * time if the expression evaluates to false.
     174         */
     175        #define STATIC_ASSERT(expression, message) \
     176                do { \
     177                        extern int STATIC_ASSERT_##message[(expression) ? 1 : -1]; \
     178                        (void)(STATIC_ASSERT_##message); \
     179                } while (false)
     180#endif
    167181#endif
    168182
    169183// The following math constants are usually defined by the system math.h header, but