The open source OpenXR runtime

xrt: clang-format workaround fix

It appears that different versions of clang-format
format the struct-init macros differently, with
newer versions making them inlined/one-liners

This commit applies the formatting of the newer
versions and disables formatting to prevent
older versions re-formating them back to
the old way.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2510>

+21 -28
+21 -28
src/xrt/include/xrt/xrt_defines.h
··· 228 228 * @ingroup xrt_iface math 229 229 * @relates xrt_quat 230 230 */ 231 - #define XRT_QUAT_IDENTITY \ 232 - { \ 233 - 0.f, 0.f, 0.f, 1.f \ 234 - } 231 + // clang-format off 232 + #define XRT_QUAT_IDENTITY {0.f, 0.f, 0.f, 1.f} 233 + // clang-format on 235 234 236 235 /*! 237 236 * A 1 element vector with single floats. ··· 294 293 * @ingroup xrt_iface math 295 294 * @relates xrt_vec3 296 295 */ 297 - #define XRT_VEC3_ZERO \ 298 - { \ 299 - 0.f, 0.f, 0.f \ 300 - } 296 + // clang-format off 297 + #define XRT_VEC3_ZERO {0.f, 0.f, 0.f} 298 + // clang-format on 301 299 /*! 302 300 * Value for @ref xrt_vec3 with 1 in the @p x coordinate. 303 301 * 304 302 * @ingroup xrt_iface math 305 303 * @relates xrt_vec3 306 304 */ 307 - #define XRT_VEC3_UNIT_X \ 308 - { \ 309 - 1.f, 0.f, 0.f \ 310 - } 305 + // clang-format off 306 + #define XRT_VEC3_UNIT_X {1.f, 0.f, 0.f} 307 + // clang-format on 311 308 /*! 312 309 * Value for @ref xrt_vec3 with 1 in the @p y coordinate. 313 310 * 314 311 * @ingroup xrt_iface math 315 312 * @relates xrt_vec3 316 313 */ 317 - #define XRT_VEC3_UNIT_Y \ 318 - { \ 319 - 0.f, 1.f, 0.f \ 320 - } 314 + // clang-format off 315 + #define XRT_VEC3_UNIT_Y {0.f, 1.f, 0.f} 316 + // clang-format on 321 317 /*! 322 318 * Value for @ref xrt_vec3 with 1 in the @p z coordinate. 323 319 * 324 320 * @ingroup xrt_iface math 325 321 * @relates xrt_vec3 326 322 */ 327 - #define XRT_VEC3_UNIT_Z \ 328 - { \ 329 - 0.f, 0.f, 1.f \ 330 - } 323 + // clang-format off 324 + #define XRT_VEC3_UNIT_Z {0.f, 0.f, 1.f} 325 + // clang-format on 331 326 332 327 /*! 333 328 * A 3 element vector with 32 bit integers. ··· 474 469 * @ingroup xrt_iface math 475 470 * @relates xrt_pose 476 471 */ 477 - #define XRT_POSE_IDENTITY \ 478 - { \ 479 - XRT_QUAT_IDENTITY, XRT_VEC3_ZERO \ 480 - } 472 + // clang-format off 473 + #define XRT_POSE_IDENTITY {XRT_QUAT_IDENTITY, XRT_VEC3_ZERO} 474 + // clang-format on 481 475 482 476 /*! 483 477 * Describes a projection matrix fov. ··· 672 666 * @ingroup xrt_iface math 673 667 * @relates xrt_space_relation 674 668 */ 675 - #define XRT_SPACE_RELATION_ZERO \ 676 - { \ 677 - XRT_SPACE_RELATION_BITMASK_NONE, XRT_POSE_IDENTITY, XRT_VEC3_ZERO, XRT_VEC3_ZERO \ 678 - } 669 + // clang-format off 670 + #define XRT_SPACE_RELATION_ZERO {XRT_SPACE_RELATION_BITMASK_NONE, XRT_POSE_IDENTITY, XRT_VEC3_ZERO, XRT_VEC3_ZERO} 671 + // clang-format on 679 672 680 673 /*! 681 674 * The maximum number of steps that can be in a relation chain.