Skip to content

Commit d3517fd

Browse files
Fix clang-16 compile errors (o3de#17428)
* Fix clang-16 compile errors * Use PAL instead of AZ_PLATFORM_WINDOWS query Signed-off-by: Markus Prettner <[email protected]>
1 parent 962a001 commit d3517fd

File tree

6 files changed

+53
-1
lines changed

6 files changed

+53
-1
lines changed

Code/Framework/AzCore/AzCore/Component/Component.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <AzCore/Memory/SystemAllocator.h> // Used as the allocator for most components.
2424
#include <AzCore/Memory/ChildAllocatorSchema.h>
2525
#include <AzCore/Outcome/Outcome.h>
26+
#include <AzCore/PlatformDef.h> // Needed for Component_Platform.inl include
2627
#include <AzCore/std/containers/unordered_set.h>
2728

2829
namespace AZ
@@ -467,6 +468,15 @@ namespace AZ
467468
//! The `AZ_CLASS` is a placeholder macro that is used to substitute `class` template parameters
468469
//! For non-type template parameters such as `size_t` or `int` the `AZ_AUTO` placeholder can be used
469470

471+
// Include the platform specific implementation of AZ_RTTI_NO_TYPE_INFO_IMPL_VA_OPT_HELPER
472+
#include <AzCore/Component/Component_Platform.inl>
473+
474+
// If there was no platform specific implementation defined, use a default one:
475+
#if !defined(AZ_RTTI_NO_TYPE_INFO_IMPL_VA_OPT_HELPER)
476+
#define AZ_RTTI_NO_TYPE_INFO_IMPL_VA_OPT_HELPER(_ComponentClassOrTemplate, _BaseClass, ...) \
477+
AZ_RTTI_NO_TYPE_INFO_IMPL(_ComponentClassOrTemplate, __VA_ARGS__ AZ_VA_OPT(AZ_COMMA_SEPARATOR, __VA_ARGS__) _BaseClass)
478+
#endif
479+
470480
#define AZ_COMPONENT_IMPL_WITH_ALLOCATOR(_ComponentClassOrTemplate, _DisplayName, _Uuid, _Allocator, ...) \
471481
AZ_COMPONENT_MACRO_CALL(AZ_TYPE_INFO_WITH_NAME_IMPL, \
472482
AZ_USE_FIRST_ARG(AZ_UNWRAP(_ComponentClassOrTemplate)), \
@@ -475,7 +485,7 @@ namespace AZ
475485
AZ_VA_OPT(AZ_COMMA_SEPARATOR, AZ_SKIP_FIRST_ARG(AZ_UNWRAP(_ComponentClassOrTemplate))) \
476486
AZ_SKIP_FIRST_ARG(AZ_UNWRAP(_ComponentClassOrTemplate)) \
477487
) \
478-
AZ_RTTI_NO_TYPE_INFO_IMPL(_ComponentClassOrTemplate, __VA_ARGS__ AZ_VA_OPT(AZ_COMMA_SEPARATOR, __VA_ARGS__) AZ::Component) \
488+
AZ_RTTI_NO_TYPE_INFO_IMPL_VA_OPT_HELPER(_ComponentClassOrTemplate, AZ::Component, __VA_ARGS__) \
479489
AZ_COMPONENT_MACRO_CALL(AZ_COMPONENT_BASE_IMPL, \
480490
AZ_USE_FIRST_ARG(AZ_UNWRAP(_ComponentClassOrTemplate)) \
481491
AZ_VA_OPT(AZ_COMMA_SEPARATOR, AZ_SKIP_FIRST_ARG(AZ_UNWRAP(_ComponentClassOrTemplate))) \
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) Contributors to the Open 3D Engine Project.
3+
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
4+
*
5+
* SPDX-License-Identifier: Apache-2.0 OR MIT
6+
*
7+
*/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) Contributors to the Open 3D Engine Project.
3+
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
4+
*
5+
* SPDX-License-Identifier: Apache-2.0 OR MIT
6+
*
7+
*/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) Contributors to the Open 3D Engine Project.
3+
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
4+
*
5+
* SPDX-License-Identifier: Apache-2.0 OR MIT
6+
*
7+
*/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (c) Contributors to the Open 3D Engine Project.
3+
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
4+
*
5+
* SPDX-License-Identifier: Apache-2.0 OR MIT
6+
*
7+
*/
8+
9+
// Clang on Windows uses the preprocessor in MSVC compatibility mode, which cannot parse the AZ_VA_OPT macro in some instances, but
10+
// since the comma after __VA_ARGS__ is removed automatically if __VA_ARGS__ is empty, it does not have to be used.
11+
#if defined(AZ_COMPILER_CLANG)
12+
#define AZ_RTTI_NO_TYPE_INFO_IMPL_VA_OPT_HELPER(_ComponentClassOrTemplate, _BaseClass, ...) \
13+
AZ_RTTI_NO_TYPE_INFO_IMPL(_ComponentClassOrTemplate, __VA_ARGS__, _BaseClass)
14+
#endif
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) Contributors to the Open 3D Engine Project.
3+
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
4+
*
5+
* SPDX-License-Identifier: Apache-2.0 OR MIT
6+
*
7+
*/

0 commit comments

Comments
 (0)