Skip to content

Commit

Permalink
fix: Return default value from ‘GetCacheTypeString’
Browse files Browse the repository at this point in the history
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 NULL from that function. The
return value is then checked by an assert in the
AddMapEntry. The assert will only work in debug mode,
but that seems to be enough.
  • Loading branch information
kriskwiatkowski committed Jun 23, 2021
1 parent bc2846e commit 892991f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/utils/list_cpu_features.c
Expand Up @@ -340,6 +340,8 @@ static Node* GetCacheTypeString(CacheType cache_type) {
case CPU_FEATURE_CACHE_PREFETCH:
return CreateConstantString("prefetch");
}
/* Should never happen */
return NULL;
}

static void AddCacheInfo(Node* root, const CacheInfo* cache_info) {
Expand Down

0 comments on commit 892991f

Please sign in to comment.