From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?SmFuIERqw6Rydg==?= Newsgroups: gmane.emacs.devel Subject: Re: Type-error in C code Date: Fri, 12 Nov 2010 16:12:17 +0100 Message-ID: <4CDD5951.4030904@swipnet.se> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1289574862 26998 80.91.229.12 (12 Nov 2010 15:14:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 12 Nov 2010 15:14:22 +0000 (UTC) To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 12 16:14:18 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PGvKP-00016c-Jw for ged-emacs-devel@m.gmane.org; Fri, 12 Nov 2010 16:14:16 +0100 Original-Received: from localhost ([127.0.0.1]:48186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGvK4-0004Y6-5N for ged-emacs-devel@m.gmane.org; Fri, 12 Nov 2010 10:13:52 -0500 Original-Received: from [140.186.70.92] (port=59995 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGvJx-0003gq-Sv for emacs-devel@gnu.org; Fri, 12 Nov 2010 10:13:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGvIa-0002uz-Tq for emacs-devel@gnu.org; Fri, 12 Nov 2010 10:12:21 -0500 Original-Received: from smtprelay-b12.telenor.se ([62.127.194.21]:57665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGvIa-0002uW-J6 for emacs-devel@gnu.org; Fri, 12 Nov 2010 10:12:20 -0500 Original-Received: from ipb2.telenor.se (ipb2.telenor.se [195.54.127.165]) by smtprelay-b12.telenor.se (Postfix) with ESMTP id 09F85E9A54 for ; Fri, 12 Nov 2010 16:12:18 +0100 (CET) X-SENDER-IP: [85.225.45.100] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoIyANLn3ExV4S1kPGdsb2JhbACDPYRSmkQMAQEBATUtrVaRDIEigzVzBI1j X-IronPort-AV: E=Sophos;i="4.59,188,1288566000"; d="scan'208";a="149878888" Original-Received: from c-642de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.100]) by ipb2.telenor.se with ESMTP; 12 Nov 2010 16:12:18 +0100 Original-Received: from [172.20.199.13] (zeplin [172.20.199.13]) by coolsville.localdomain (Postfix) with ESMTPSA id 011BC7FA05A; Fri, 12 Nov 2010 16:12:17 +0100 (CET) User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.11) Gecko/20101004 Thunderbird/3.1.5 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:132574 Archived-At: An Atom is 32 bits. make_number can't cover that range when long is 32 bits, so it is an unsafe thing to do. Best is to revert and go back to using a string. Jan D. Julien Danjou skrev 2010-11-12 15.21: > On Fri, Nov 12 2010, Stefan Monnier wrote: > >> static void >> set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value) >> { >> struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (frame)); >> >> x_send_client_event (frame, make_number (0), frame, >> dpyinfo->Xatom_net_wm_state, >> make_number (32), >> /* 1 = add, 0 = remove */ >> Fcons >> (make_number (add ? 1 : 0), >> Fcons >> (atom, >> value != 0 ? value : Qnil))); >> } >> >> The error is to put an "Atom" into a cons cell: those can only hold >> Lisp_Objects. The usual compilation flags won't catch the error because >> both types are actually some kind of integer, but if you >> compile --enable-use-lisp-union-type, the C compiler will >> dutyfully burp. > > Good catch Stefan. I should use this flag to compile my code now. > > The fix should be easy I think, you just need to replace atom with > make_number (atom). > > I can provide a patch is that handier. >