From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Correct byte compiler error/warning positions. The solution! Date: Mon, 29 Nov 2021 19:16:26 +0000 Message-ID: References: <83pmqm16vz.fsf@gnu.org> <8335nh29pt.fsf@gnu.org> <83wnktzxb2.fsf@gnu.org> <83ilwcyc6o.fsf@gnu.org> <87v90b5c2o.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14045"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 29 20:21:30 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mrmDS-0003Ri-5K for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Nov 2021 20:21:30 +0100 Original-Received: from localhost ([::1]:46822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrmDR-0006dE-3y for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Nov 2021 14:21:29 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrm8i-0001Ou-UN for emacs-devel@gnu.org; Mon, 29 Nov 2021 14:16:40 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:25021 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1mrm8c-0001F7-Dr for emacs-devel@gnu.org; Mon, 29 Nov 2021 14:16:36 -0500 Original-Received: (qmail 80135 invoked by uid 3782); 29 Nov 2021 19:16:27 -0000 Original-Received: from acm.muc.de (p4fe15bd7.dip0.t-ipconnect.de [79.225.91.215]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 29 Nov 2021 20:16:27 +0100 Original-Received: (qmail 8626 invoked by uid 1000); 29 Nov 2021 19:16:26 -0000 Content-Disposition: inline In-Reply-To: <87v90b5c2o.fsf@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:280504 Archived-At: Hello, Robert. On Mon, Nov 29, 2021 at 14:24:47 +0100, Robert Pluim wrote: > >>>>> On Mon, 29 Nov 2021 11:50:19 +0000, Alan Mackenzie said: > Alan> Anyhow, I've committed the current state in the new branch > Alan> scratch/correct-warning-pos. It should build and run OK, although I > Alan> haven't tried it out with native compilation, yet. It is marginally > Alan> slower than master. Maybe we can merge it into master some time for > Alan> Emacs 29. > "Thou shalt listen to Eli's warnings about '==', else your branch > shall not compile" :-) > ./configure --enable-check-lisp-object-type --enable-checking > make[1]: Entering directory '/home/rpluim/repos/emacs-pos/src' > CC dispnew.o > In file included from dispnew.c:27: > lisp.h: In function ‘EQ’: > lisp.h:385:40: error: invalid operands to binary == (have ‘Lisp_Object’ and ‘Lisp_Object’) > 385 | ? (XSYMBOL_WITH_POS((x)))->sym == (y) \ > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~ > | | > | Lisp_Object > lisp.h:1329:10: note: in expansion of macro ‘lisp_h_EQ’ > 1329 | return lisp_h_EQ (x, y); > | ^~~~~~~~~ > lisp.h:388:15: error: invalid operands to binary == (have ‘Lisp_Object’ and ‘Lisp_Object’) > 387 | && ((XSYMBOL_WITH_POS((x)))->sym \ > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > | | > | Lisp_Object > 388 | == (XSYMBOL_WITH_POS((y)))->sym) \ > | ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > | | > | Lisp_Object > lisp.h:1329:10: note: in expansion of macro ‘lisp_h_EQ’ > 1329 | return lisp_h_EQ (x, y); > | ^~~~~~~~~ > lisp.h:391:18: error: invalid operands to binary == (have ‘Lisp_Object’ and ‘Lisp_Object’) > 391 | && ((x) == ((XSYMBOL_WITH_POS ((y)))->sym)))))) > | ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > | | > | Lisp_Object > lisp.h:1329:10: note: in expansion of macro ‘lisp_h_EQ’ > 1329 | return lisp_h_EQ (x, y); > | ^~~~~~~~~ > In file included from dispnew.c:27: > lisp.h:1330:1: warning: control reaches end of non-void function [-Wreturn-type] > 1330 | } > | ^ > make[1]: *** [Makefile:406: dispnew.o] Error 1 Yes. I think the patch below will fix this. I must admit, I didn't know about --enable-check-lisp-object-type. When I tried it out with the fixed lisp_h_EQ, I got lots of other warnings. But this option generates slower code. On a 20 second benchmark, the code was ~0.5s slower than when compiled without the option. This probably shouldn't happen, and I don't know why it does. I need to tidy up the backslashes too. Anyhow, here's the patch which at least keeps the compiler messages as warnings: diff --git a/src/lisp.h b/src/lisp.h index 08013e94d1..00d9843d6a 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -366,7 +366,7 @@ #define LISP_WORDS_ARE_POINTERS (EMACS_INT_MAX == INTPTR_MAX) #define lisp_h_PSEUDOVECTORP(a,code) \ (lisp_h_VECTORLIKEP((a)) && \ - ((XUNTAG ((a), Lisp_Vectorlike, union vectorlike_header)->size \ + ((XUNTAG ((a), Lisp_Vectorlike, union vectorlike_header)->size \ & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) \ == (PSEUDOVECTOR_FLAG | ((code) << PSEUDOVECTOR_AREA_BITS)))) @@ -382,13 +382,13 @@ #define lisp_h_EQ(x, y) ((XLI ((x)) == XLI ((y))) \ || (symbols_with_pos_enabled \ && (SYMBOL_WITH_POS_P ((x)) \ ? BARE_SYMBOL_P ((y)) \ - ? (XSYMBOL_WITH_POS((x)))->sym == (y) \ + ? XLI (XSYMBOL_WITH_POS((x))->sym) == XLI (y) \ : SYMBOL_WITH_POS_P((y)) \ - && ((XSYMBOL_WITH_POS((x)))->sym \ - == (XSYMBOL_WITH_POS((y)))->sym) \ + && (XLI (XSYMBOL_WITH_POS((x))->sym) \ + == XLI (XSYMBOL_WITH_POS((y))->sym)) \ : (SYMBOL_WITH_POS_P ((y)) \ && BARE_SYMBOL_P ((x)) \ - && ((x) == ((XSYMBOL_WITH_POS ((y)))->sym)))))) + && (XLI (x) == XLI ((XSYMBOL_WITH_POS ((y)))->sym)))))) #define lisp_h_FIXNUMP(x) \ (! (((unsigned) (XLI (x) >> (USE_LSB_TAG ? 0 : FIXNUM_BITS)) \ > Robert > -- -- Alan Mackenzie (Nuremberg, Germany).