From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Fangrui Song via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#43195: [PATCH] Remove definitions of UP, BC and PC which should be provided by terminfo Date: Fri, 4 Sep 2020 08:38:03 -0700 Message-ID: <20200904153803.esenh3j2af4ymyd7@google.com> References: <20200904005748.1538513-1-maskray@google.com> <83wo1at2lu.fsf@gnu.org> Reply-To: Fangrui Song Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10343"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43195@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 04 17:39:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1kEDnz-0002Z3-0J for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 04 Sep 2020 17:39:11 +0200 Original-Received: from localhost ([::1]:57108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEDny-0003eA-34 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 04 Sep 2020 11:39:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEDnr-0003cK-4n for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2020 11:39:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57082) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kEDnq-0006EH-SJ for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2020 11:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kEDnq-0007T8-Qa for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2020 11:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Fangrui Song Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Sep 2020 15:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43195 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 43195-submit@debbugs.gnu.org id=B43195.159923389528629 (code B ref 43195); Fri, 04 Sep 2020 15:39:02 +0000 Original-Received: (at 43195) by debbugs.gnu.org; 4 Sep 2020 15:38:15 +0000 Original-Received: from localhost ([127.0.0.1]:40390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEDn4-0007Rh-Rg for submit@debbugs.gnu.org; Fri, 04 Sep 2020 11:38:15 -0400 Original-Received: from mail-pf1-f176.google.com ([209.85.210.176]:34216) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEDn3-0007RT-7U for 43195@debbugs.gnu.org; Fri, 04 Sep 2020 11:38:13 -0400 Original-Received: by mail-pf1-f176.google.com with SMTP id v196so4821521pfc.1 for <43195@debbugs.gnu.org>; Fri, 04 Sep 2020 08:38:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=fVExDgdVoClVf1h2hdOBElrP+JoAmt7Hzes2Tfm0H6U=; b=QVMZs9eU7zqLzlI0MWjGG6HCaFmDJxDr3nNfJUGZuwil/B74ONB4UP4iMrPKzGRlD9 hNm8KIJG5hNzVfdpJ6oy/nfl305bLe1FIaW9hl/wQY/6XaF39OL5itiEUlSRu5QQs9SR g/sGW9bUeTJZ3nmdYL/MaG9Dn/2tiMzE8zKUTqDAKeKY9UmEkph9lYoQsTPO97s4byik +Uq6xZmwU+o4SIZg9Jh9LoXiN/PZHPYgK33xQHHaZCigeajA/E1oOCJO9NQCRM0dG/OZ TPhZJdRlJ/kZ9ARkTeLnxfLunI+/Js0JkrGIGybPwkcGz4vCX7qlz4jKnQVQMJyn57xT 4+jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fVExDgdVoClVf1h2hdOBElrP+JoAmt7Hzes2Tfm0H6U=; b=abBl9zcvIYxGCRdqZ0kVRpX4kxUg46W4GnsY5t5vlI/3lcQG5d2dTCTysqOY2Vxxyd zFJcvRs3rZ0d0Hp76kb9vNyZRru6qgRz7W5VtsiJY2VJL/aLj1bKs11DnpBGv4ZLiPCy v/zwTijsw10TvAzFxLlvgqq5WzOzKypDDOrtgaAkZ54wJiDx5nKOOgyzEnFAA3sfmKLH Y2O54B8b7a6uKIGO8YcBPnwfF7s0fHemo1H69Ct7v195vR/XejwxcQ1OZft7IOTjtYXZ X1X4bs44P6Jg/l5GU06o3dhSCViW0PoxScEegih17BH8SDkLQGchZJAlSYse7/9gsten 0tew== X-Gm-Message-State: AOAM531+GtBLYkWe7R50pfreg3gfXABsHl15hdE5nMhpUmtdPb+hhUjp HDC0urU0dnX7NF9YzShhgGc6Dw== X-Google-Smtp-Source: ABdhPJxtcypiaSeXqo0usbDV7I5Q8DzfcwBrIYW5bg7djxP+/ySEKnycmTeVvXfbfBAbNHfM4HzsuA== X-Received: by 2002:a65:6093:: with SMTP id t19mr7513942pgu.13.1599233886877; Fri, 04 Sep 2020 08:38:06 -0700 (PDT) Original-Received: from google.com ([2620:15c:2ce:0:a6ae:11ff:fe11:4abb]) by smtp.gmail.com with ESMTPSA id c3sm7071649pfo.120.2020.09.04.08.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 08:38:06 -0700 (PDT) Content-Disposition: inline In-Reply-To: <83wo1at2lu.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:187151 Archived-At: On 2020-09-04, Eli Zaretskii wrote: >> Cc: Fangrui Song >> Date: Thu, 3 Sep 2020 17:57:48 -0700 >> From: Fangrui Song via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> Otherwise if terminfo.c is compiled with -fno-common (GCC 10 and clang >> 11 default) and the archive version of the terminfo library is linked, >> there will be a multiple definition linker error. >> >> * src/terminfo.c (UP, BC, PC): Delete. > >Given the comment there, I think this should be conditioned on >actually using terminfo. Does the following patch work for you? > >diff --git a/src/terminfo.c b/src/terminfo.c >index 51fd32e..0765996 100644 >--- a/src/terminfo.c >+++ b/src/terminfo.c >@@ -23,9 +23,12 @@ > > /* Define these variables that serve as global parameters to termcap, > so that we do not need to conditionalize the places in Emacs >- that set them. */ >+ that set them. But don't do that for terminfo, as that could >+ cause link errors when using -fno-common. */ > >+#if !TERMINFO > char *UP, *BC, PC; >+#endif > > /* Interface to curses/terminfo library. > Turns out that all of the terminfo-level routines look > Looks great! Thanks! One nit, #if !TERMINFO probably should be #ifndef TERMINFO I don't know whether it is worth mentioning that -fcommon/-fno-common does not cause a linker error when libtinfo.so is linked (a common/regular definition preempts a shared definition). -fno-common + libtinfo.a => multiple definition error