From owner-freebsd-standards@FreeBSD.ORG Tue Oct 22 21:23:29 2013 Return-Path: Delivered-To: freebsd-standards@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 46983560; Tue, 22 Oct 2013 21:23:29 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0A8D229CA; Tue, 22 Oct 2013 21:23:29 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id B22A1359315; Tue, 22 Oct 2013 23:23:27 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 7EDAACB4E; Tue, 22 Oct 2013 23:23:27 +0200 (CEST) Date: Tue, 22 Oct 2013 23:23:27 +0200 From: Jilles Tjoelker To: Tijl Coosemans Subject: Re: VLC 2.1.0 Message-ID: <20131022212327.GB20055@stack.nl> References: <20131022152502.61214646@kalimero.tijl.coosemans.org> <20131022174715.59433270@kalimero.tijl.coosemans.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131022174715.59433270@kalimero.tijl.coosemans.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: multimedia-list freebsd , William Grzybowski , freebsd-standards@FreeBSD.org X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 21:23:29 -0000 On Tue, Oct 22, 2013 at 05:47:15PM +0200, Tijl Coosemans wrote: > On Tue, 22 Oct 2013 12:30:38 -0200 William Grzybowski wrote: > > On Tue, Oct 22, 2013 at 11:25 AM, Tijl Coosemans wrote: > >> On Tue, 22 Oct 2013 10:55:28 -0200 William Grzybowski wrote: > >>> I am trying to update vlc to 2.1.0, its the final step to get rid of > >>> ffmpeg1 as well. > >>> I was wondering if any c++ guru out there have any clues on how to fix this: > >>> http://pastebin.ca/2469885 > >>> http://people.freebsd.org/~wg/vlc2.1.0.txt > >> I think the problem is that clang doesn't expect } after a label. > >> So try adding a ; or (void)0; between the label and vlc_cleanup_run(). > > That works, thank you! > I suspect that clang is correct to complain about this and if so we > might want to add (void)0; to the definition of pthread_cleanup_pop > in /usr/include/pthread.h. Let's see what -standards has to say > about this. > Summarised: the idiom that VLC uses is this: > pthread_cleanup_push(...); > ... > if (error) goto cleanup; > ... > cleanup: > pthread_cleanup_pop(...); > Because the definition of the pthread_cleanup_pop macro starts with } > clang complains. glibc has do { } while (0); at the start of the pthread_cleanup_pop define. I think this is a better option than ; or (void)0; as it minimizes the wrong things it can combine with. Reading POSIX, it seems valid to put a label right before an invocation of pthread_cleanup_pop. In such a case, the invocation still appears as a statement and can be paired with a pthread_cleanup_push in the same lexical scope. Therefore the following patch to src seems appropriate. Index: include/pthread.h =================================================================== --- include/pthread.h (revision 256728) +++ include/pthread.h (working copy) @@ -175,6 +175,7 @@ { #define pthread_cleanup_pop(execute) \ + do { } while (0); \ } \ __pthread_cleanup_pop_imp(execute); \ } -- Jilles Tjoelker