From e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 17 Apr 2019 06:17:24 +0200 Subject: ClangFormat: apply to source, most of intern Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat --- source/blender/blenlib/BLI_assert.h | 50 ++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 18 deletions(-) (limited to 'source/blender/blenlib/BLI_assert.h') diff --git a/source/blender/blenlib/BLI_assert.h b/source/blender/blenlib/BLI_assert.h index 52d4858548a..44dc4324328 100644 --- a/source/blender/blenlib/BLI_assert.h +++ b/source/blender/blenlib/BLI_assert.h @@ -31,11 +31,11 @@ extern "C" { #endif #ifndef NDEBUG /* for BLI_assert */ -#include +# include #endif #ifdef _MSC_VER -#include /* for _STATIC_ASSERT */ +# include /* for _STATIC_ASSERT */ #endif /* BLI_assert(), default only to print @@ -46,50 +46,64 @@ extern "C" { #ifndef NDEBUG # include "BLI_system.h" - /* _BLI_ASSERT_PRINT_POS */ +/* _BLI_ASSERT_PRINT_POS */ # if defined(__GNUC__) # define _BLI_ASSERT_PRINT_POS(a) \ - fprintf(stderr, "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", __FILE__, __LINE__, __func__, #a) + fprintf(stderr, \ + "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", \ + __FILE__, \ + __LINE__, \ + __func__, \ + #a) # elif defined(_MSC_VER) # define _BLI_ASSERT_PRINT_POS(a) \ - fprintf(stderr, "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", __FILE__, __LINE__, __FUNCTION__, #a) + fprintf(stderr, \ + "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", \ + __FILE__, \ + __LINE__, \ + __FUNCTION__, \ + #a) # else # define _BLI_ASSERT_PRINT_POS(a) \ - fprintf(stderr, "BLI_assert failed: %s:%d, at \'%s\'\n", __FILE__, __LINE__, #a) + fprintf(stderr, "BLI_assert failed: %s:%d, at \'%s\'\n", __FILE__, __LINE__, #a) # endif - /* _BLI_ASSERT_ABORT */ +/* _BLI_ASSERT_ABORT */ # ifdef WITH_ASSERT_ABORT # define _BLI_ASSERT_ABORT abort # else # define _BLI_ASSERT_ABORT() (void)0 # endif - /* BLI_assert */ +/* BLI_assert */ # define BLI_assert(a) \ - (void)((!(a)) ? ((BLI_system_backtrace(stderr), _BLI_ASSERT_PRINT_POS(a), _BLI_ASSERT_ABORT(), NULL)) : NULL) + (void)((!(a)) ? ((BLI_system_backtrace(stderr), \ + _BLI_ASSERT_PRINT_POS(a), \ + _BLI_ASSERT_ABORT(), \ + NULL)) : \ + NULL) #else # define BLI_assert(a) ((void)0) #endif /* C++ can't use _Static_assert, expects static_assert() but c++0x only, * Coverity also errors out. */ -#if (!defined(__cplusplus)) && \ - (!defined(__COVERITY__)) && \ - (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) /* gcc4.6+ only */ +#if (!defined(__cplusplus)) && (!defined(__COVERITY__)) && \ + (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) /* gcc4.6+ only */ # define BLI_STATIC_ASSERT(a, msg) __extension__ _Static_assert(a, msg); #elif defined(_MSC_VER) # define BLI_STATIC_ASSERT(a, msg) _STATIC_ASSERT(a); -#else /* older gcc, clang... */ - /* Code adapted from http://www.pixelbeat.org/programming/gcc/static_assert.html */ - /* Note we need the two concats below because arguments to ## are not expanded, so we need to +#else /* older gcc, clang... */ +/* Code adapted from http://www.pixelbeat.org/programming/gcc/static_assert.html */ +/* Note we need the two concats below because arguments to ## are not expanded, so we need to * expand __LINE__ with one indirection before doing the actual concatenation. */ # define _BLI_ASSERT_CONCAT_(a, b) a##b # define _BLI_ASSERT_CONCAT(a, b) _BLI_ASSERT_CONCAT_(a, b) - /* This can't be used twice on the same line so ensure if using in headers +/* This can't be used twice on the same line so ensure if using in headers * that the headers are not included twice (by wrapping in #ifndef...#endif) * Note it doesn't cause an issue when used on same line of separate modules * compiled with gcc -combine -fwhole-program. */ # define BLI_STATIC_ASSERT(a, msg) \ - ; enum { _BLI_ASSERT_CONCAT(assert_line_, __LINE__) = 1 / (int)(!!(a)) }; + ; \ + enum { _BLI_ASSERT_CONCAT(assert_line_, __LINE__) = 1 / (int)(!!(a)) }; #endif #define BLI_STATIC_ASSERT_ALIGN(st, align) \ @@ -99,4 +113,4 @@ extern "C" { } #endif -#endif /* __BLI_ASSERT_H__ */ +#endif /* __BLI_ASSERT_H__ */ -- cgit v1.2.3