Skip to contentSkip to conversation

LVM2/daemons/clvmd clvmd.c

PATCH [email protected] 3 participants 4 messages Oct 26, 2010 – Nov 8, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2010-10-26 09:57:03

Modified files:
daemons/clvmd : clvmd.c

Log message:
Hotfix usage of __builtin_unreachable()

It's quite new feature which is not supported by older compilers. So until some better macros are introduced into LVM code - hotfix current compilation problems and compile this code only for __clang__ defining compilers.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.79&r2=1.80

daemons/clvmd/clvmd.c +4 -0
@@ -491,7 +491,9 @@
 		DEBUGLOG("Can't initialise cluster interface\n");
 		log_error("Can't initialise cluster interface\n");
 		child_init_signal(DFAIL_CLUSTER_IF);
+#ifdef __clang__
 		__builtin_unreachable();
+#endif
 	}
 	DEBUGLOG("Cluster ready, doing some more initialisation\n");
 
@@ -508,7 +510,9 @@
 	newfd = malloc(sizeof(struct local_client));
 	if (!newfd) {
 		child_init_signal(DFAIL_MALLOC);
+#ifdef __clang__
 		__builtin_unreachable();
+#endif
 	}
 
 	newfd->fd = local_sock;
#1 lore raw

daemons/clvmd/clvmd.c line 496

Quoted 3 lines · zkabelac at sourceware.org
daemons/clvmd/clvmd.c +2 -0
+#ifdef __clang__
 		__builtin_unreachable();
+#endif

Please do not scatter #ifdefs like that through the code.
If the standard /* NOTREACHED */ really doesn't work, then hide the ifdef in a header file and use a #define to make it available precisely where the compiler supports it, defining it to something empty elsewhere.

Alasdair

#2 lore raw

Dne 26.10.2010 12:46, Alasdair G Kergon napsal(a):

Quoted 10 lines · zkabelac at sourceware.org

daemons/clvmd/clvmd.c line 496

Quoted 3 lines
daemons/clvmd/clvmd.c +2 -0
+#ifdef __clang__
 		__builtin_unreachable();
+#endif

Please do not scatter #ifdefs like that through the code.
If the standard /* NOTREACHED */ really doesn't work, then hide the ifdef in a header file and use a #define to make it available precisely where the compiler supports it, defining it to something empty elsewhere.

Yes - This patch only provides quick compilation hotfix - and I'll prepare better solution later.

Zdenek

#3 lore raw
In reply to [email protected]
Quoted 1 line · zkabelac at sourceware.org

Hotfix usage of __builtin_unreachable()

Changing this for the current release: removing the ugly ifdef and using an __attribute__((noreturn)) function instead.

Alasdair