Clang compile issues with unused variable in ReflectionImplement.h
For NS_IMPLEMENT_REFLECTION2, 'helper' is not used, fix is adding '[[maybe_unused]]':
NS_COLD_FUNC void classType::StaticFillClassType([[maybe_unused]] Noesis::TypeClassCreator& helper)
Same with NS_IMPLEMENT_INLINE_REFLECTION3:
NS_COLD_FUNC static void StaticFillClassType([[maybe_unused]] Noesis::TypeClassCreator& helper)
Thanks!
NS_COLD_FUNC void classType::StaticFillClassType([[maybe_unused]] Noesis::TypeClassCreator& helper)
Same with NS_IMPLEMENT_INLINE_REFLECTION3:
NS_COLD_FUNC static void StaticFillClassType([[maybe_unused]] Noesis::TypeClassCreator& helper)
Thanks!
Re: Clang compile issues with unused variable in ReflectionImplement.h
Also getting an issue in non-debug Clang build
15>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\App.Providers.cpp(13,1): error : unexpected argument 's' to '#pragma optimize'; expected "" [-Werror,-Wignored-pragmas]
15>C:\_Development\Repositories\rtg\third_party\Noesis\Include\NsCore\CompilerSettings.h(64,47): note: expanded from macro 'NS_BEGIN_COLD_REGION'
15>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\Behavior.cpp(38,1): error : unexpected argument 's' to '#pragma optimize'; expected "" [-Werror,-Wignored-pragmas]
15>C:\_Development\Repositories\rtg\third_party\Noesis\Include\NsCore\CompilerSettings.h(64,47): note: expanded from macro 'NS_BEGIN_COLD_REGION'
Temp fix:
Another:
2>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\LocExtension.cpp(125,22): error : inequality comparison result unused [-Werror,-Wunused-comparison]
2>C:\_Development\Repositories\rtg\third_party\Noesis\Include\NsCore\Error.h(65,41): note: expanded from macro 'NS_CHECK'
2>C:\_Development\Repositories\rtg\third_party\Noesis\Include\NsCore\CompilerSettings.h(58,60): note: expanded from macro 'NS_UNUSED'
2>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\LocExtension.cpp(125,22): note: use '|=' to turn this inequality comparison into an or-assignment
15>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\App.Providers.cpp(13,1): error : unexpected argument 's' to '#pragma optimize'; expected "" [-Werror,-Wignored-pragmas]
15>C:\_Development\Repositories\rtg\third_party\Noesis\Include\NsCore\CompilerSettings.h(64,47): note: expanded from macro 'NS_BEGIN_COLD_REGION'
15>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\Behavior.cpp(38,1): error : unexpected argument 's' to '#pragma optimize'; expected "" [-Werror,-Wignored-pragmas]
15>C:\_Development\Repositories\rtg\third_party\Noesis\Include\NsCore\CompilerSettings.h(64,47): note: expanded from macro 'NS_BEGIN_COLD_REGION'
Temp fix:
Code: Select all
#if defined(_DEBUG) || __clang__
#define NS_BEGIN_COLD_REGION
#define NS_END_COLD_REGION
#else
#define NS_BEGIN_COLD_REGION __pragma(optimize("s", on))
#define NS_END_COLD_REGION __pragma(optimize("", on))
#endif
2>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\LocExtension.cpp(125,22): error : inequality comparison result unused [-Werror,-Wunused-comparison]
2>C:\_Development\Repositories\rtg\third_party\Noesis\Include\NsCore\Error.h(65,41): note: expanded from macro 'NS_CHECK'
2>C:\_Development\Repositories\rtg\third_party\Noesis\Include\NsCore\CompilerSettings.h(58,60): note: expanded from macro 'NS_UNUSED'
2>C:\_Development\Repositories\rtg\libs\NoesisUtils\Private\LocExtension.cpp(125,22): note: use '|=' to turn this inequality comparison into an or-assignment
Re: Clang compile issues with unused variable in ReflectionImplement.h
Okay, I think I know what's going on here. I'm using Visual Studio and Clang together, i.e. I generate my CMake solution for Visual Studio using the following:
This means that when compiling, the following two statements are true
So it might be worth trying that build path, as it ships with VS and uses the Microsoft-provided clang-cl (if you tick the right installer option), thus some of the code in e.g. CompilerSettings.h has issues.
Code: Select all
cmake .. -G "Visual Studio 17 2022" -T "ClangCL"
Code: Select all
#if defined(_MSC_VER) && _MSC_VER >= 1400
#if __clang__
Re: Clang compile issues with unused variable in ReflectionImplement.h
For cases where the reflection block is empty, we provide NS_IMPLEMENT_REFLECTION_ and NS_IMPLEMENT_INLINE_REFLECTION_. These macros are provided in a separate header (ReflectionImplementEmpty.h) to optimize compiling in this specific scenarios.For NS_IMPLEMENT_REFLECTION2, 'helper' is not used, fix is adding '[[maybe_unused]]':
Same with NS_IMPLEMENT_INLINE_REFLECTION3:
Code: Select all
class BaseNullable
{
public:
NS_IMPLEMENT_INLINE_REFLECTION_(BaseNullable, NoParent)
};
Re: Clang compile issues with unused variable in ReflectionImplement.h
Could you please also report this? So far we haven't tried Visual Studio with clang.So it might be worth trying that build path, as it ships with VS and uses the Microsoft-provided clang-cl (if you tick the right installer option), thus some of the code in e.g. CompilerSettings.h has issues.
Who is online
Users browsing this forum: Bing [Bot] and 8 guests