Blender  V2.93
util_static_assert.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /* clang-format off */
18 
19 /* #define static_assert triggers a bug in some clang-format versions, disable
20  * format for entire file to keep results consistent. */
21 
22 #ifndef __UTIL_STATIC_ASSERT_H__
23 #define __UTIL_STATIC_ASSERT_H__
24 
26 
27 #if defined(__KERNEL_OPENCL__) || defined(CYCLES_CUBIN_CC)
28 # define static_assert(statement, message)
29 #endif /* __KERNEL_OPENCL__ */
30 
31 #define static_assert_align(st, align) \
32  static_assert((sizeof(st) % (align) == 0), "Structure must be strictly aligned") // NOLINT
33 
35 
36 #endif /* __UTIL_STATIC_ASSERT_H__ */
#define CCL_NAMESPACE_END