NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

misc/50064: netbsd-6 clang build failure due to non-inline declarations



>Number:         50064
>Category:       misc
>Synopsis:       netbsd-6 clang build failure due to non-inline declarations
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 19 20:05:01 +0000 2015
>Originator:     Jan Danielsson
>Release:        netbsd-6
>Organization:
La Cosa Nostra Ltd
>Environment:
NetBSD gauss 6.1_STABLE NetBSD 6.1_STABLE (GAUSS) #1: Thu Mar 26 15:17:01 CET 2015  jan@gauss:/home/jan/tmp/sysbuild/obj.amd64/usr/src/sys/arch/amd64/compile/GAUSS amd64

>Description:
clang in netbsd-6 (checked out from subversion using "make checkout") is a little bit more picky about inline declarations than gcc, which causes libevent (minheap-internal.h) build to fail
>How-To-Repeat:
Check out netbsd-6, check out llvm, install gmake, then attempt to build using MKLLVM and HAVE_LLVM. While building libevent the build will fail because clang complains about some prototypes.
>Fix:

Index: external/bsd/ntp/dist/sntp/libevent/minheap-internal.h
==================================================================
--- external/bsd/ntp/dist/sntp/libevent/minheap-internal.h
+++ external/bsd/ntp/dist/sntp/libevent/minheap-internal.h
@@ -61,26 +61,26 @@
 static inline void	     min_heap_shift_down_(min_heap_t* s, unsigned hole_index, struct event* e);
 
 #define min_heap_elem_greater(a, b) \
 	(evutil_timercmp(&(a)->ev_timeout, &(b)->ev_timeout, >))
 
-void min_heap_ctor_(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; }
-void min_heap_dtor_(min_heap_t* s) { if (s->p) mm_free(s->p); }
-void min_heap_elem_init_(struct event* e) { e->ev_timeout_pos.min_heap_idx = -1; }
-int min_heap_empty_(min_heap_t* s) { return 0u == s->n; }
-unsigned min_heap_size_(min_heap_t* s) { return s->n; }
-struct event* min_heap_top_(min_heap_t* s) { return s->n ? *s->p : 0; }
+inline void min_heap_ctor_(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; }
+inline void min_heap_dtor_(min_heap_t* s) { if (s->p) mm_free(s->p); }
+inline void min_heap_elem_init_(struct event* e) { e->ev_timeout_pos.min_heap_idx = -1; }
+inline int min_heap_empty_(min_heap_t* s) { return 0u == s->n; }
+inline unsigned min_heap_size_(min_heap_t* s) { return s->n; }
+inline struct event* min_heap_top_(min_heap_t* s) { return s->n ? *s->p : 0; }
 
 int min_heap_push_(min_heap_t* s, struct event* e)
 {
 	if (min_heap_reserve_(s, s->n + 1))
 		return -1;
 	min_heap_shift_up_(s, s->n++, e);
 	return 0;
 }
 
-struct event* min_heap_pop_(min_heap_t* s)
+inline struct event* min_heap_pop_(min_heap_t* s)
 {
 	if (s->n)
 	{
 		struct event* e = *s->p;
 		min_heap_shift_down_(s, 0u, s->p[--s->n]);
@@ -88,16 +88,16 @@
 		return e;
 	}
 	return 0;
 }
 
-int min_heap_elt_is_top_(const struct event *e)
+inline int min_heap_elt_is_top_(const struct event *e)
 {
 	return e->ev_timeout_pos.min_heap_idx == 0;
 }
 
-int min_heap_erase_(min_heap_t* s, struct event* e)
+inline int min_heap_erase_(min_heap_t* s, struct event* e)
 {
 	if (-1 != e->ev_timeout_pos.min_heap_idx)
 	{
 		struct event *last = s->p[--s->n];
 		unsigned parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2;
@@ -114,11 +114,11 @@
 		return 0;
 	}
 	return -1;
 }
 
-int min_heap_adjust_(min_heap_t *s, struct event *e)
+inline int min_heap_adjust_(min_heap_t *s, struct event *e)
 {
 	if (-1 == e->ev_timeout_pos.min_heap_idx) {
 		return min_heap_push_(s, e);
 	} else {
 		unsigned parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2;




Home | Main Index | Thread Index | Old Index