mirror of
https://github.com/google/cpu_features.git
synced 2025-04-27 15:12:30 +02:00
fix: Return default value from ‘GetCacheTypeString’ (#162)
The build fails with following message when -Werror and -Werror=return-type are enabled. In function ‘GetCacheTypeString’: error: control reaches end of non-void function [-Werror=return-type] Simple fix is to return explicitly communicate to the compiler that certain block is not reachable.
This commit is contained in:
parent
646b80fa3a
commit
001faefdc3
@ -213,4 +213,17 @@
|
||||
#endif // defined(__mips_msa)
|
||||
#endif // defined(CPU_FEATURES_ARCH_MIPS)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Utils
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Communicates to the compiler that the block is unreachable
|
||||
#if defined(CPU_FEATURES_COMPILER_CLANG) || defined(CPU_FEATURES_COMPILER_GCC)
|
||||
#define UNREACHABLE() __builtin_unreachable()
|
||||
#elif defined(CPU_FEATURES_COMPILER_MSC)
|
||||
#define UNREACHABLE() __assume(0)
|
||||
#else
|
||||
#define UNREACHABLE()
|
||||
#endif
|
||||
|
||||
#endif // CPU_FEATURES_INCLUDE_CPU_FEATURES_MACROS_H_
|
||||
|
@ -340,6 +340,7 @@ static Node* GetCacheTypeString(CacheType cache_type) {
|
||||
case CPU_FEATURE_CACHE_PREFETCH:
|
||||
return CreateConstantString("prefetch");
|
||||
}
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
static void AddCacheInfo(Node* root, const CacheInfo* cache_info) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user