Changers

Pavel Sanda sanda at lyx.org
Sun Nov 15 10:08:22 UTC 2020


On Thu, Nov 12, 2020 at 02:21:21PM +0200, Yuriy Skalko wrote:
> >I still prefer noChange() or nullChange() to changeNone(), but we would have to ask a native English speaker.
> 
> I proposed `changeNone` to have consistent naming for all change`Something`
> functions. But noChange is also good. If there will be any comments from
> native speakers, it can be renamed any moment.
> 
> >Concerning changeRef, I would say that the fact that this is a reference is an implementation detail. Maybe change(ref, val) is good enough, or else changeVar(ref, val).
> 
> Agree, changeVar is better than changeRef. `change` is too common word to
> use it alone, so better have `Var` suffix.
> 
> >Sorry for the nitpicking, but since this Changer stuff is not intuitive at first sight, it is nice to have clear names.
> >
> >JMarc
> 
> Not a problem. Good naming can make code really intuitive and easy to
> understand. It is worth to spend some time on this.
> 
> I've committed the updated patch.

Yuriy,

this fails on older gccs, could you have a look?


make[4]: Entering directory '/lyx/src'
  CXX      FontInfo.o                  
In file included from FontInfo.h:22:0,
                 from FontInfo.cpp:17:
support/Changer.h: In instantiation of 'lyx::Changer lyx::changeVar(X&, X) [with X = lyx::ColorCode; lyx::Changer = std::unique_ptr<lyx::Revertible>]':
FontInfo.cpp:329:32:   required from here
support/Changer.h:80:9: error: cannot bind 'std::unique_ptr<lyx::RevertibleRef<lyx::ColorCode>, std::default_delete<lyx::RevertibleRef<lyx::ColorCode> > >' lvalue to 'std::unique_ptr<lyx::RevertibleRef<lyx::Co
lorCode>, std::default_delete<lyx::RevertibleRef<lyx::ColorCode> > >&&'
  return rc;
         ^
In file included from /usr/include/c++/4.9/memory:81:0,
                 from ./support/unique_ptr.h:15,
                 from support/Changer.h:15,
                 from FontInfo.h:22,
                 from FontInfo.cpp:17:
/usr/include/c++/4.9/bits/unique_ptr.h:220:2: note: initializing argument 1 of 'std::unique_ptr<_Tp, _Dp>::unique_ptr(std::unique_ptr<_Up, _Ep>&&) [with _Up = lyx::RevertibleRef<lyx::ColorCode>; _Ep = std::def
ault_delete<lyx::RevertibleRef<lyx::ColorCode> >; <template-parameter-2-3> = void; _Tp = lyx::Revertible; _Dp = std::default_delete<lyx::Revertible>]'
  unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
  ^
In file included from FontInfo.h:22:0,
                 from FontInfo.cpp:17:
support/Changer.h: In instantiation of 'lyx::Changer lyx::changeVar(X&, X) [with X = lyx::FontShape; lyx::Changer = std::unique_ptr<lyx::Revertible>]':
FontInfo.cpp:335:32:   required from here
support/Changer.h:80:9: error: cannot bind 'std::unique_ptr<lyx::RevertibleRef<lyx::FontShape>, std::default_delete<lyx::RevertibleRef<lyx::FontShape> > >' lvalue to 'std::unique_ptr<lyx::RevertibleRef<lyx::Fo
ntShape>, std::default_delete<lyx::RevertibleRef<lyx::FontShape> > >&&'
  return rc;
         ^
In file included from /usr/include/c++/4.9/memory:81:0,
                 from ./support/unique_ptr.h:15,
                 from support/Changer.h:15,
                 from FontInfo.h:22,
                 from FontInfo.cpp:17:
/usr/include/c++/4.9/bits/unique_ptr.h:220:2: note: initializing argument 1 of 'std::unique_ptr<_Tp, _Dp>::unique_ptr(std::unique_ptr<_Up, _Ep>&&) [with _Up = lyx::RevertibleRef<lyx::FontShape>; _Ep = std::def
ault_delete<lyx::RevertibleRef<lyx::FontShape> >; <template-parameter-2-3> = void; _Tp = lyx::Revertible; _Dp = std::default_delete<lyx::Revertible>]'
  unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
  ^
In file included from FontInfo.h:22:0,
                 from FontInfo.cpp:17:
support/Changer.h: In instantiation of 'lyx::Changer lyx::changeVar(X&, X) [with X = lyx::MathStyle; lyx::Changer = std::unique_ptr<lyx::Revertible>]':
FontInfo.cpp:341:36:   required from here
support/Changer.h:80:9: error: cannot bind 'std::unique_ptr<lyx::RevertibleRef<lyx::MathStyle>, std::default_delete<lyx::RevertibleRef<lyx::MathStyle> > >' lvalue to 'std::unique_ptr<lyx::RevertibleRef<lyx::MathStyle>, std::default_delete<lyx::RevertibleRef<lyx::MathStyle> > >&&'
  return rc;                           
         ^                             
In file included from /usr/include/c++/4.9/memory:81:0,
                 from ./support/unique_ptr.h:15,
                 from support/Changer.h:15,
                 from FontInfo.h:22,   
                 from FontInfo.cpp:17: 
/usr/include/c++/4.9/bits/unique_ptr.h:220:2: note: initializing argument 1 of 'std::unique_ptr<_Tp, _Dp>::unique_ptr(std::unique_ptr<_Up, _Ep>&&) [with _Up = lyx::RevertibleRef<lyx::MathStyle>; _Ep = std::default_delete<lyx::RevertibleRef<lyx::MathStyle> >; <template-parameter-2-3> = void; _Tp = lyx::Revertible; _Dp = std::default_delete<lyx::Revertible>]'
  unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
  ^                                    
In file included from FontInfo.h:22:0, 
                 from FontInfo.cpp:17: 
support/Changer.h: In instantiation of 'lyx::Changer lyx::changeVar(X&, X) [with X = lyx::FontInfo; lyx::Changer = std::unique_ptr<lyx::Revertible>]':
FontInfo.cpp:349:30:   required from here
support/Changer.h:80:9: error: cannot bind 'std::unique_ptr<lyx::RevertibleRef<lyx::FontInfo>, std::default_delete<lyx::RevertibleRef<lyx::FontInfo> > >' lvalue to 'std::unique_ptr<lyx::RevertibleRef<lyx::FontInfo>, std::default_delete<lyx::RevertibleRef<lyx::FontInfo> > >&&'
  return rc;            

         ^               
In file included from /usr/include/c++/4.9/memory:81:0,
                 from ./support/unique_ptr.h:15,
                 from support/Changer.h:15,
                 from FontInfo.h:22,
                 from FontInfo.cpp:17:
/usr/include/c++/4.9/bits/unique_ptr.h:220:2: note: initializing argument 1 of 'std::unique_ptr<_Tp, _Dp>::unique_ptr(std::unique_ptr<_Up, _Ep>&&) [with _Up = lyx::RevertibleRef<lyx::FontInfo>; _Ep = std::default_delete<lyx::RevertibleRef<lyx::FontInfo> >; <template-parameter-2-3> = void; _Tp = lyx::Revertible; _Dp = std::default_delete<lyx::Revertible>]'
  unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
  ^                      
In file included from FontInfo.h:22:0,
                 from FontInfo.cpp:17:
support/Changer.h: In function 'lyx::Changer lyx::changeVar(X&, X) [with X = lyx::ColorCode; lyx::Changer = std::unique_ptr<lyx::Revertible>]':
support/Changer.h:81:1: warning: control reaches end of non-void function [-Wreturn-type]
 }                       
 ^                       
support/Changer.h: In function 'lyx::Changer lyx::changeVar(X&, X) [with X = lyx::FontShape; lyx::Changer = std::unique_ptr<lyx::Revertible>]':
support/Changer.h:81:1: warning: control reaches end of non-void function [-Wreturn-type]
 }                       
 ^                       
support/Changer.h: In function 'lyx::Changer lyx::changeVar(X&, X) [with X = lyx::MathStyle; lyx::Changer = std::unique_ptr<lyx::Revertible>]':
support/Changer.h:81:1: warning: control reaches end of non-void function [-Wreturn-type]
 }                       
 ^                       
support/Changer.h: In function 'lyx::Changer lyx::changeVar(X&, X) [with X = lyx::FontInfo; lyx::Changer = std::unique_ptr<lyx::Revertible>]':
support/Changer.h:81:1: warning: control reaches end of non-void function [-Wreturn-type]
 }                       
 ^                       
At global scope:         
cc1plus: warning: unrecognized command line option "-Wno-deprecated-copy"
Makefile:2200: recipe for target 'FontInfo.o' failed
make[4]: *** [FontInfo.o] Error 1



More information about the lyx-devel mailing list