diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-15 15:51:46 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-02-15 16:03:51 +0300 |
commit | f0c991a380e9d449ebc02cc91649ef3728848070 (patch) | |
tree | 52b32ea8839229ddbcf1eb9c6c7ada30bed17804 /intern | |
parent | 924fe50e97cd4cc130d96f0c4f23664052c31458 (diff) |
Cleanup: work around clang-format differences between versions
Ref T73747
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/util/util_defines.h | 5 | ||||
-rw-r--r-- | intern/cycles/util/util_static_assert.h | 28 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_ContextCGL.mm | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 2 |
4 files changed, 20 insertions, 21 deletions
diff --git a/intern/cycles/util/util_defines.h b/intern/cycles/util/util_defines.h index b29d4163133..24a20a969ab 100644 --- a/intern/cycles/util/util_defines.h +++ b/intern/cycles/util/util_defines.h @@ -15,6 +15,11 @@ * limitations under the License. */ +/* clang-format off */ + +/* #define __forceinline triggers a bug in some clang-format versions, disable + * format for entire file to keep results consistent. */ + #ifndef __UTIL_DEFINES_H__ #define __UTIL_DEFINES_H__ diff --git a/intern/cycles/util/util_static_assert.h b/intern/cycles/util/util_static_assert.h index ceb52830319..7d458bed14e 100644 --- a/intern/cycles/util/util_static_assert.h +++ b/intern/cycles/util/util_static_assert.h @@ -14,34 +14,20 @@ * limitations under the License. */ +/* clang-format off */ + +/* #define static_assert triggers a bug in some clang-format versions, disable + * format for entire file to keep results consistent. */ + #ifndef __UTIL_STATIC_ASSERT_H__ #define __UTIL_STATIC_ASSERT_H__ CCL_NAMESPACE_BEGIN -/* TODO(sergey): In theory CUDA might work with own static assert - * implementation since it's just pure C++. - */ -#ifdef __KERNEL_GPU__ -# ifndef static_assert -# define static_assert(statement, message) -# endif +#ifdef __KERNEL_OPECL__ +# define static_assert(statement, message) #endif /* __KERNEL_GPU__ */ -/* TODO(sergey): For until C++11 is a bare minimum for us, - * we do a bit of a trickery to show meaningful message so - * it's more or less clear what's wrong when building without - * C++11. - * - * The thing here is: our non-C++11 implementation doesn't - * have a way to print any message after preprocessor - * substitution so we rely on the message which is passed to - * static_assert() since that's the only message visible when - * compilation fails. - * - * After C++11 bump it should be possible to glue structure - * name to the error message, - */ #define static_assert_align(st, align) \ static_assert((sizeof(st) % (align) == 0), "Structure must be strictly aligned") // NOLINT diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm index df750fc50f6..e2e74a3113b 100644 --- a/intern/ghost/intern/GHOST_ContextCGL.mm +++ b/intern/ghost/intern/GHOST_ContextCGL.mm @@ -34,7 +34,9 @@ static void ghost_fatal_error_dialog(const char *msg) { + /* clang-format off */ @autoreleasepool { + /* clang-format on */ NSString *message = [NSString stringWithFormat:@"Error opening window:\n%s", msg]; NSAlert *alert = [[NSAlert alloc] init]; @@ -335,7 +337,9 @@ static const OSType METAL_CORE_VIDEO_PIXEL_FORMAT = kCVPixelFormatType_32BGRA; void GHOST_ContextCGL::metalInit() { + /* clang-format off */ @autoreleasepool { + /* clang-format on */ id<MTLDevice> device = m_metalLayer.device; // Create a command queue for blit/present operation @@ -530,7 +534,9 @@ void GHOST_ContextCGL::metalUpdateFramebuffer() void GHOST_ContextCGL::metalSwapBuffers() { + /* clang-format off */ @autoreleasepool { + /* clang-format on */ updateDrawingContext(); glFlush(); diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index c40b6445348..81eb27a129a 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -952,7 +952,9 @@ static NSCursor *getImageCursor(GHOST_TStandardCursor shape, NSString *name, NSP const int index = (int)shape; if (!loaded[index]) { /* Load image from file in application Resources folder. */ + /* clang-format off */ @autoreleasepool { + /* clang-format on */ NSImage *image = [NSImage imageNamed:name]; if (image != NULL) { cursors[index] = [[NSCursor alloc] initWithImage:image hotSpot:hotspot]; |