unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34789: Scan of regexp mistakes
       [not found]         ` <61035fed-564a-8766-8982-0d05acea341c@cs.ucla.edu>
@ 2019-03-08 20:46           ` Davis Herring
  2019-03-11 14:20             ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Davis Herring @ 2019-03-08 20:46 UTC (permalink / raw)
  To: 34789

> But I'd like first to hear in more detail why "C++ compilers haven't
> worked that way for any standard library type (and most user-defined
> types) in a very long time."  We should at least have this information
> recorded here for posterity.

The situation in question (based on the comments in mantemp.el) concerns 
code like

   #include<vector>
   int main() {
     std::vector<double> v(1);
     return *v.begin();  // 0
   }

where, once upon a time, the compiler would emit undefined references to 
functions like "std::vector<double>::begin()" that had to be explicitly 
instantiated (in a single translation unit chosen by the user).  (The 
age of this era is indicated by the missing "std::" in the example error 
messages.)

In all compilers newer than about 2003, such functions are automatically 
_generated_ when used, so that there are no undefined references (and no 
need to manually request instantiation).  It is still _possible_ to 
instantiate things this way for performance reasons in certain 
complicated cases, but you have to ask for it:

   // foo.hxx
   #ifndef FOO_HXX
   #define FOO_HXX
   #include<vector>
   struct A {};    // a user-defined type must be involved
   extern template class std::vector<A>;  // block implicit instantiation
   #endif

   // templates.cxx
   #include"foo.hxx"
   // The one shared instantiation, as mantemp.el could generate:
   template class std::vector<A>;

   // client.cxx
   #include"foo.hxx"
   vector<A> gv;       // relies on templates.cxx

   // possibly more clients...

   // main.cxx
   #include"foo.hxx"
   int main() {
     vector<A> v;      // relies on templates.cxx
     return v.size();
   }

(This is C++11 code; in C++03, only user-defined types can be made to 
behave this way, and it's harder.)

This style of code is rare, and will if anything become rarer still in 
C++20, when code in a header file that uses a particular specialization 
(e.g., std::vector<A>) can be put into a module that is compiled only 
once.  Even if someone were doing this, mantemp.el could at most 
generate the one indicated line in templates.cxx _after_ the very 
similar line in foo.hxx was added in some other fashion.

Hope this helps clarify,
Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or 
too sparse, it is because mass-energy conversion has occurred during 
shipping.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#34789: Scan of regexp mistakes
  2019-03-08 20:46           ` bug#34789: Scan of regexp mistakes Davis Herring
@ 2019-03-11 14:20             ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2019-03-11 14:20 UTC (permalink / raw)
  To: Davis Herring; +Cc: 34789

> From: Davis Herring <herring@lanl.gov>
> Date: Fri, 8 Mar 2019 13:46:38 -0700
> 
> This style of code is rare, and will if anything become rarer still in 
> C++20, when code in a header file that uses a particular specialization 
> (e.g., std::vector<A>) can be put into a module that is compiled only 
> once.  Even if someone were doing this, mantemp.el could at most 
> generate the one indicated line in templates.cxx _after_ the very 
> similar line in foo.hxx was added in some other fashion.
> 
> Hope this helps clarify,

Thanks, it does.  I think we indeed should move this package into
obsolete/.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#34789: Scan of regexp mistakes
  2019-03-08 19:16 bug#34789: mantemp.el should be obsoleted Paul Eggert
@ 2019-06-13 12:13 ` Stefan Kangas
  2019-06-13 12:48   ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2019-06-13 12:13 UTC (permalink / raw)
  To: 34789; +Cc: Davis Herring

[-- Attachment #1: Type: text/plain, Size: 170 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:
> Thanks, it does.  I think we indeed should move this package into
> obsolete/.

Does this patch do the job?

Thanks,
Stefan Kangas

[-- Attachment #2: 0001-lisp-progmodes-mantemp.el-Move-to-obsolete-.-bug-347.patch --]
[-- Type: application/octet-stream, Size: 1620 bytes --]

From 34699af2c639d77de9a09320c20f798131b741f6 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Thu, 13 Jun 2019 14:07:12 +0200
Subject: [PATCH] * lisp/progmodes/mantemp.el: Move to obsolete/. (bug#34789)

---
 etc/NEWS                                | 5 +++++
 lisp/{progmodes => obsolete}/mantemp.el | 4 ++++
 2 files changed, 9 insertions(+)
 rename lisp/{progmodes => obsolete}/mantemp.el (98%)

diff --git a/etc/NEWS b/etc/NEWS
index 6efa7642f8..4bdd67f177 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1524,6 +1524,11 @@ buffer periodically when 'auto-revert-avoid-polling' is non-nil.
 *** 'bookmark-old-default-file' is now an obsolete alias of
 'bookmark-default-file'.
 
+---
+** The mantemp.el library is now marked obsolete.
+It should no longer be useful on modern C++ compilers, which do the
+same things automatically.
+
 \f
 * New Modes and Packages in Emacs 27.1
 
diff --git a/lisp/progmodes/mantemp.el b/lisp/obsolete/mantemp.el
similarity index 98%
rename from lisp/progmodes/mantemp.el
rename to lisp/obsolete/mantemp.el
index 4190a84727..9c2bdc09d0 100644
--- a/lisp/progmodes/mantemp.el
+++ b/lisp/obsolete/mantemp.el
@@ -5,6 +5,7 @@
 ;; Author: Tom Houlder <thoulder@icor.fr>
 ;; Created: 10 Dec 1996
 ;; Keywords: g++, templates
+;; Obsolete-since: 27.1
 
 ;; This file is part of GNU Emacs.
 
@@ -82,6 +83,9 @@
 ;; messages after the first instantiations have been included and you
 ;; must repeat the operation.
 
+;; For more information on why this was marked obsolete, see:
+;; https://debbugs.gnu.org/34789
+
 ;;; Code:
 
 (defun mantemp-remove-comments ()
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#34789: Scan of regexp mistakes
  2019-06-13 12:13 ` bug#34789: Scan of regexp mistakes Stefan Kangas
@ 2019-06-13 12:48   ` Eli Zaretskii
  2019-06-13 13:42     ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2019-06-13 12:48 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: herring, 34789

> From: Stefan Kangas <stefan@marxist.se>
> Date: Thu, 13 Jun 2019 14:13:45 +0200
> Cc: Eli Zaretskii <eliz@gnu.org>, Davis Herring <herring@lanl.gov>
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> > Thanks, it does.  I think we indeed should move this package into
> > obsolete/.
> 
> Does this patch do the job?

Works for me, but I'm not sure we have the procedure for obsoleting a
package documented anywhere, so maybe something else needs to be
done.  Anyone?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#34789: Scan of regexp mistakes
  2019-06-13 12:48   ` Eli Zaretskii
@ 2019-06-13 13:42     ` Stefan Kangas
  2019-06-22  9:09       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2019-06-13 13:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Davis Herring, 34789

[-- Attachment #1: Type: text/plain, Size: 515 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:
> > > Thanks, it does.  I think we indeed should move this package into
> > > obsolete/.
> >
> > Does this patch do the job?
>
> Works for me, but I'm not sure we have the procedure for obsoleting a
> package documented anywhere, so maybe something else needs to be
> done.  Anyone?

I had a look at this:
https://git.savannah.gnu.org/gitweb/?p=emacs.git;a=commit;h=ef65424de8cae00209f6a0974245822602709df3

And did some improvements, see attached patch.

Thanks,
Stefan Kangas

[-- Attachment #2: 0001-Move-mantemp.el-to-obsolete.patch --]
[-- Type: application/octet-stream, Size: 3024 bytes --]

From 37373dd44ede4fd097df022aa78e2b3aa93d9774 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Thu, 13 Jun 2019 14:07:12 +0200
Subject: [PATCH] Move mantemp.el to obsolete/

* lisp/progmodes/mantemp.el: Move to obsolete/. (bug#34789)
* doc/emacs/ack.texi (Acknowledgments): Remove obsolete library
mantemp.el.
---
 doc/emacs/ack.texi                      | 4 ----
 etc/NEWS                                | 5 +++++
 etc/TODO                                | 5 ++---
 lisp/{progmodes => obsolete}/mantemp.el | 4 ++++
 4 files changed, 11 insertions(+), 7 deletions(-)
 rename lisp/{progmodes => obsolete}/mantemp.el (98%)

diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi
index 0e4a982da4..06e75f3077 100644
--- a/doc/emacs/ack.texi
+++ b/doc/emacs/ack.texi
@@ -502,10 +502,6 @@ Acknowledgments
 Tassilo Horn wrote DocView mode, allowing viewing of PDF, PostScript and
 DVI documents.
 
-@item
-Tom Houlder wrote @file{mantemp.el}, which generates manual C@t{++}
-template instantiations.
-
 @item
 Joakim Hove wrote @file{html2text.el}, a html to plain text converter.
 
diff --git a/etc/NEWS b/etc/NEWS
index 5632ccc6d7..7dc0764c60 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1524,6 +1524,11 @@ buffer periodically when 'auto-revert-avoid-polling' is non-nil.
 *** 'bookmark-old-default-file' is now an obsolete alias of
 'bookmark-default-file'.
 
+---
+** The mantemp.el library is now marked obsolete.
+This library generates manual C++ template instantiations.  It should
+no longer be useful on modern compilers, which do this automatically.
+
 \f
 * New Modes and Packages in Emacs 27.1
 
diff --git a/etc/TODO b/etc/TODO
index f8c2d285ee..273455c386 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -560,9 +560,8 @@ from the emacsclient process.
   snmp-mode [?], soundex [should be interactive?], strokes [start from
   the web page], talk, thingatpt [interactive functions?], type-break,
   vcursor, xscheme, zone-mode [?], mlconvert [?], iso-cvt,
-  feedmail [?], uce, gametree, page-ext,
-  refbib, refer, scribe, texinfo, underline,
-  cmacexp, hideif, mantemp [obsolete?], pcomplete, xml,
+  feedmail [?], uce, gametree, page-ext, refbib, refer, scribe,
+  texinfo, underline, cmacexp, hideif, pcomplete, xml,
   cvs-status (should be described in PCL-CVS manual); other progmodes,
   probably in separate manual.
 
diff --git a/lisp/progmodes/mantemp.el b/lisp/obsolete/mantemp.el
similarity index 98%
rename from lisp/progmodes/mantemp.el
rename to lisp/obsolete/mantemp.el
index 4190a84727..ad638422c2 100644
--- a/lisp/progmodes/mantemp.el
+++ b/lisp/obsolete/mantemp.el
@@ -5,6 +5,7 @@
 ;; Author: Tom Houlder <thoulder@icor.fr>
 ;; Created: 10 Dec 1996
 ;; Keywords: g++, templates
+;; Obsolete-since: 27.1
 
 ;; This file is part of GNU Emacs.
 
@@ -23,6 +24,9 @@
 
 ;;; Commentary:
 
+;; This file is obsolete.  For more information, see:
+;; https://debbugs.gnu.org/34789
+
 ;; The following is a typical error message from g++ using STL (here
 ;; with split lines):
 ;;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#34789: Scan of regexp mistakes
  2019-06-13 13:42     ` Stefan Kangas
@ 2019-06-22  9:09       ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2019-06-22  9:09 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: herring, 34789-done

> From: Stefan Kangas <stefan@marxist.se>
> Date: Thu, 13 Jun 2019 15:42:40 +0200
> Cc: 34789@debbugs.gnu.org, Davis Herring <herring@lanl.gov>
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> > > > Thanks, it does.  I think we indeed should move this package into
> > > > obsolete/.
> > >
> > > Does this patch do the job?
> >
> > Works for me, but I'm not sure we have the procedure for obsoleting a
> > package documented anywhere, so maybe something else needs to be
> > done.  Anyone?
> 
> I had a look at this:
> https://git.savannah.gnu.org/gitweb/?p=emacs.git;a=commit;h=ef65424de8cae00209f6a0974245822602709df3
> 
> And did some improvements, see attached patch.

Thanks, pushed.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-22  9:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <EDAEDDB6-5182-41F4-91CD-8B6FA3C57A31@acm.org>
     [not found] ` <3ef768c2-98d9-a42d-067a-4a5ffc945cf4@cs.ucla.edu>
     [not found]   ` <D3E6A383-1368-46F0-8D37-7C45FD322DDC@acm.org>
     [not found]     ` <e2c83a03-a6ba-5b44-b49e-d2c4da447213@cs.ucla.edu>
     [not found]       ` <1c44342f-01ab-1bc6-4b5c-3485a6f01fda@lanl.gov>
     [not found]         ` <61035fed-564a-8766-8982-0d05acea341c@cs.ucla.edu>
2019-03-08 20:46           ` bug#34789: Scan of regexp mistakes Davis Herring
2019-03-11 14:20             ` Eli Zaretskii
2019-03-08 19:16 bug#34789: mantemp.el should be obsoleted Paul Eggert
2019-06-13 12:13 ` bug#34789: Scan of regexp mistakes Stefan Kangas
2019-06-13 12:48   ` Eli Zaretskii
2019-06-13 13:42     ` Stefan Kangas
2019-06-22  9:09       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).