From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r117897: Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64. Date: Wed, 17 Sep 2014 22:43:22 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1411008235 2516 80.91.229.3 (18 Sep 2014 02:43:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Sep 2014 02:43:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 18 04:43:46 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XURhC-0002mV-7Y for ged-emacs-devel@m.gmane.org; Thu, 18 Sep 2014 04:43:46 +0200 Original-Received: from localhost ([::1]:48203 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XURhB-0001FE-TA for ged-emacs-devel@m.gmane.org; Wed, 17 Sep 2014 22:43:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XURh2-0001Ez-53 for emacs-devel@gnu.org; Wed, 17 Sep 2014 22:43:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XURgu-0006NG-Lj for emacs-devel@gnu.org; Wed, 17 Sep 2014 22:43:36 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:53510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XURgu-0006KT-Hn for emacs-devel@gnu.org; Wed, 17 Sep 2014 22:43:28 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNFpZEG/2dsb2JhbABZDoJ4g0rAPYEXF3SCJgEBBFYjEAs0EhQYDSSIDNIZF456B4Q4BKMqhW+BaoFxf1wh X-IPAS-Result: ArUGAIDvNVNFpZEG/2dsb2JhbABZDoJ4g0rAPYEXF3SCJgEBBFYjEAs0EhQYDSSIDNIZF456B4Q4BKMqhW+BaoFxf1wh X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="90144602" Original-Received: from 69-165-145-6.dsl.teksavvy.com (HELO pastel.home) ([69.165.145.6]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 17 Sep 2014 22:43:23 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id C1BDE60776; Wed, 17 Sep 2014 22:43:22 -0400 (EDT) In-Reply-To: (Paul Eggert's message of "Thu, 18 Sep 2014 01:03:44 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:174477 Archived-At: > +/* Alignment fixup needed for alloca. GCC aligns alloca properly already, > + Clang sometimes doesn't, and play it safe for other random compilers. */ > +# if __GNUC__ && !__clang__ > +enum { ALLOCA_FIXUP = 0 }; > +# else > +enum { ALLOCA_FIXUP = GCALIGNMENT - 1 }; > +# endif > + > +/* Declare a void * variable PTR and set it to a properly-aligned array of > + N newly allocated bytes with function lifetime. */ > +# define LOCAL_ALLOCA(ptr, n) \ > + void *ptr = alloca ((n) + ALLOCA_FIXUP); \ > + ptr = (void *) ((intptr_t) ptr_ & ~(ALLOCA_FIXUP)) I find this hideous. I'd prefer we just don't use alloca in those cases where alignment would be a problem. Stefan