From ae2f281d891d4fca16ef8f6d69c4aa9436ffdf60 Mon Sep 17 00:00:00 2001 From: Vladimir Marek Date: Mon, 9 Apr 2012 20:15:43 +0200 Subject: [PATCH] Re: [PATCH 4/4] Explicitly type void* pointers --- da/3e817a57fc8976a364d66e774e70469d35280a | 114 ++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 da/3e817a57fc8976a364d66e774e70469d35280a diff --git a/da/3e817a57fc8976a364d66e774e70469d35280a b/da/3e817a57fc8976a364d66e774e70469d35280a new file mode 100644 index 000000000..baca7f381 --- /dev/null +++ b/da/3e817a57fc8976a364d66e774e70469d35280a @@ -0,0 +1,114 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id E8B8B414B8D + for ; Mon, 9 Apr 2012 11:16:16 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -4.999 +X-Spam-Level: +X-Spam-Status: No, score=-4.999 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_HI=-5, UNPARSEABLE_RELAY=0.001] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id xvF+Ljw03T1D for ; + Mon, 9 Apr 2012 11:16:16 -0700 (PDT) +Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 5A4EF41735F + for ; Mon, 9 Apr 2012 11:16:16 -0700 (PDT) +Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) + by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with + ESMTP id q39IGEMf026954 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) + for ; Mon, 9 Apr 2012 18:16:15 GMT +Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) + by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id + q39IGEFm000337 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) + for ; Mon, 9 Apr 2012 18:16:14 GMT +Received: from abhmt103.oracle.com (abhmt103.oracle.com [141.146.116.55]) + by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id + q39IGDdc006260 + for ; Mon, 9 Apr 2012 13:16:13 -0500 +Received: from pub.czech.sun.com (/10.163.20.32) + by default (Oracle Beehive Gateway v4.0) + with ESMTP ; Mon, 09 Apr 2012 11:16:13 -0700 +Date: Mon, 9 Apr 2012 20:15:43 +0200 +From: Vladimir Marek +To: Notmuch Mail +Subject: Re: [PATCH 4/4] Explicitly type void* pointers +Message-ID: <20120409181543.GC10554@pub.czech.sun.com> +Mail-Followup-To: Notmuch Mail +References: <1333966665-10469-1-git-send-email-Vladimir.Marek@oracle.com> + <1333966665-10469-5-git-send-email-Vladimir.Marek@oracle.com> + +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: + +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Source-IP: acsinet22.oracle.com [141.146.126.238] +X-CT-RefId: str=0001.0A090207.4F83276F.00EC,ss=1,re=0.000,fgs=0 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 09 Apr 2012 18:16:17 -0000 + +Hi, + +> Hi, does notmuch not compile without this? IIRC talloc_steal is a macro +> that's supposed to provide type safety (at least with GCC), and I'd be +> hesitant about adding the casts. Please look in your talloc.h. + +It does not compile. It might be that I'm using Sun/Oracle CC instead of +gcc. The error looks like this: + +"lib/database.cc", line 1368: Error: Cannot assign void* to const char*. + + +When looking into talloc documentation, the definition seems to be: + +void* talloc_steal ( const void * new_ctx, const void * ptr ) + +http://talloc.samba.org/talloc/doc/html/group__talloc.html#gaccc66139273e727183fb5bdda11ef82c + + +When looking into talloc.h, it says: + +/* try to make talloc_set_destructor() and talloc_steal() type safe, + if we have a recent gcc */ + +So, maybe the way to satisfy everyone would be: + +notmuch_message_t *tmp_message = message; +talloc_steal(notmuch, tmp_message); +return(tmp_message); + +Or alternatively, + +#if (__GNUC__ >= 3) + return talloc_steal (notmuch, message); +#else + return (notmuch_message_t*) talloc_steal (notmuch, message); +#fi + + +Of course I'm happy either way :) + +Thank you +-- + Vlad -- 2.26.2