Skip to content

Commit 0447ae4

Browse files
Sergei Trofimovichdormando
authored andcommitted
hash: fix build failure against gcc-10
On gcc-10 (and gcc-9 -fno-common) build fails as: ``` gcc -g -O2 -pthread -pthread -Wall -Werror -pedantic -Wmissing-prototypes \ -Wmissing-declarations -Wredundant-decls -o memcached ... -levent ld: memcached-hash.o:memcached/hash.h:5: multiple definition of `hash'; memcached-memcached.o:memcached/hash.h:5: first defined here ``` gcc-10 will change the default from -fcommon to fno-common: https://gcc.gnu.org/PR85678. The error also happens if CFLAGS=-fno-common passed explicitly. Reported-by: Brian Evans Bug: https://bugs.gentoo.org/706196 Signed-off-by: Sergei Trofimovich <[email protected]>
1 parent 32bf2c3 commit 0447ae4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

hash.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "jenkins_hash.h"
55
#include "murmur3_hash.h"
66

7+
hash_func hash;
8+
79
int hash_init(enum hashfunc_type type) {
810
switch(type) {
911
case JENKINS_HASH:

hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define HASH_H
33

44
typedef uint32_t (*hash_func)(const void *key, size_t length);
5-
hash_func hash;
5+
extern hash_func hash;
66

77
enum hashfunc_type {
88
JENKINS_HASH=0, MURMUR3_HASH

0 commit comments

Comments
 (0)