]> git.donarmstrong.com Git - lilypond.git/commit
Issue 4156: Define Smob<> constructors
authorDavid Kastrup <dak@gnu.org>
Wed, 8 Oct 2014 14:46:52 +0000 (16:46 +0200)
committerDavid Kastrup <dak@gnu.org>
Wed, 15 Oct 2014 05:45:45 +0000 (07:45 +0200)
commit7f309e69558db5225b92ae003c0818c68988013d
tree4ad83b6db8b0c9c82c9e23089de4e7f8b9d7ef42
parent6d391dc04f0faa3248d64aa36faf38cf9e4e5fa2
Issue 4156: Define Smob<> constructors

The purpose of this patch is to stop the previous implicit copying of
Smob<> data members in derived copy constructors.

To that purpose, Smob<> has received a private copy constructor (which
gcc unfortunately only considers worth a warning rather than an error
when implicitly used in a default copy constructor) and an inline
default constructor.

Several classes contained virtual copy constructors without being
actually copyable have had their copy constructor removed.

Several copy constructors just containing a failing assertion were
instead removed and left (privately) declared but not defined.  This
standard C++ practice leads to link time rather than run time errors in
case an instance of such a class is copied.

Other smob-defining base classes (Simple_smob and Smob{1,2,3}) do not
actually have non-static data members that could be initialized.

Prohibiting the copying of Simple_smob as a base class seems rather
pointless as all of the data members of a derived class are under the
control of the derived class.  However, Smob{1,2,3} "misuse" the this
pointer to contain an SCM value.  Creating a copy would change the
associated address, a very undesirable operation.  So Smob{1,2,3} have
its constructors private and/or disabled.
27 files changed:
lily/book.cc
lily/context-def.cc
lily/context.cc
lily/font-metric.cc
lily/grob.cc
lily/include/context.hh
lily/include/dispatcher.hh
lily/include/engraver-group.hh
lily/include/music-iterator.hh
lily/include/paper-score.hh
lily/include/performer-group.hh
lily/include/score-performer.hh
lily/include/small-smobs.hh
lily/include/smobs.hh
lily/include/sources.hh
lily/include/translator-group.hh
lily/lily-parser.cc
lily/music-iterator.cc
lily/output-def.cc
lily/page-marker.cc
lily/paper-score.cc
lily/prob.cc
lily/scale.cc
lily/scm-hash.cc
lily/score.cc
lily/sources.cc
lily/translator.cc