NetBSD Problem Report #50064

From www@NetBSD.org  Sun Jul 19 20:04:07 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id BD26DA5674
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 19 Jul 2015 20:04:07 +0000 (UTC)
Message-Id: <20150719200406.9C382A6552@mollari.NetBSD.org>
Date: Sun, 19 Jul 2015 20:04:06 +0000 (UTC)
From: jan.m.danielsson@gmail.com
Reply-To: jan.m.danielsson@gmail.com
To: gnats-bugs@NetBSD.org
Subject: netbsd-6 clang build failure due to non-inline declarations
X-Send-Pr-Version: www-1.0

>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
>Last-Modified:  Sun Jul 19 21:40:00 +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;


>Audit-Trail:
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: misc/50064: netbsd-6 clang build failure due to non-inline
 declarations
Date: Sun, 19 Jul 2015 23:37:53 +0200

 On Sun, Jul 19, 2015 at 08:05:01PM +0000, jan.m.danielsson@gmail.com wrote:
 > 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

 That should be a merge of
 src/external/bsd/libevent/dist/minheap-internal.h's r1.2. The file is
 not used on current as it comes with a new enough libevent itself.

 Joerg

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.