Re: Compiling in C++20 mode

2020-12-31 Thread Scott Kostyshak
On Wed, Dec 30, 2020 at 09:50:47AM +0200, Yuriy Skalko wrote:

> > (this one is a warning)
> > /home/vbox/lyxbuilds/master-clang/repo/src/LyXRC.cpp:2950:28: error:
> > comparison between two arrays is deprecated; to compare array addresses,
> > use unary '+' to decay operands to pointers [-Werror,-Wdeprecated-
> > array-compare]
> > || lyxrc_orig.font_sizes != lyxrc_new.font_sizes
> >~ ^  

> (leaving warning fix for future)

Warning fixed at eaebe404.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Compiling in C++20 mode

2020-12-30 Thread Scott Kostyshak
On Wed, Dec 30, 2020 at 09:50:47AM +0200, Yuriy Skalko wrote:
> > I used "-k" instead of "-k0" (my make version does not seem to support
> > "-k0". I get the following errors with GCC:
> > 
> > /home/vbox/lyxbuilds/master-clang/repo/src/tex2lyx/Parser.cpp:857:34:
> > error: use of deleted function ‘std::basic_ostream&
> > std::operator<<(std::basic_ostream&, wchar_t) [with
> > _Traits = std::char_traits]’
> >   857 |   cerr << "ignoring a char: " << c << "\n";
> >   |  ^
> > 
> > 
> > /home/vbox/lyxbuilds/master-clang/repo/src/Buffer.cpp:1774:27: error:
> > use of deleted function ‘std::basic_ostream&
> > std::operator<<(std::basic_ostream&, wchar_t) [with
> > _Traits = std::char_traits]’
> >  1774 |   oss << "0x" << hex << e.failed_char << dec;
> >   |   ^~~
> > 
> > 
> > /home/vbox/lyxbuilds/master-clang/repo/src/Server.cpp: In lambda function:
> > /home/vbox/lyxbuilds/master-clang/repo/src/Server.cpp:869:40: error:
> > implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20
> > [-Werror=deprecated]
> >   869 |   theApp()->registerSocketCallback(fd, [=](){
> >   |^
> > 
> > 
> > Clang gives the following:
> > 
> > /home/vbox/lyxbuilds/master-clang/repo/src/tex2lyx/Parser.cpp:857:31:
> > error: overload resolution selected deleted operator '<<'
> > cerr << "ignoring a char: " << c << "\n";
> > ~~~ ^  ~
> > 
> > 
> > /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/system_error:262:5:
> >  note: candidate function template not viable: no known conversion from
> > 'lyx::char_type' (aka 'wchar_t') to 'const std:: error_code' for 2nd
> > argument
> > operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
> > ^
> > 
> > 
> > /home/vbox/lyxbuilds/master-clang/repo/src/Buffer.cpp:1774:22: error:
> > overload resolution selected deleted operator '<<'
> > oss << "0x" << hex << e.failed_char << dec;
> > ~~ ^  ~
> > 
> > 
> > /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/system_error:262:5:
> >  note: candidate function template not viable: no known conversion from
> > 'const lyx::char_type' (aka 'const wchar_t') to  'const
> > std::error_code' for 2nd argument
> > operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
> > ^
> > 
> > 
> > 
> > (this one is a warning)
> > /home/vbox/lyxbuilds/master-clang/repo/src/LyXRC.cpp:2950:28: error:
> > comparison between two arrays is deprecated; to compare array addresses,
> > use unary '+' to decay operands to pointers [-Werror,-Wdeprecated-
> > array-compare]
> > || lyxrc_orig.font_sizes != lyxrc_new.font_sizes
> >~ ^  
> > 
> > 
> > /home/vbox/lyxbuilds/master-clang/repo/src/tex2lyx/Parser.cpp:857:31:
> > error: overload resolution selected deleted operator '<<'
> > cerr << "ignoring a char: " << c << "\n";
> > ~~~ ^  ~
> > 
> > No problem if you can't take a look at all or any of these. Also, let me
> > know if for the next time you prefer for me to attach complete logs,
> > rather than just the error lines. Thanks for working on this, Yuriy!
> > 
> > Scott
> 
> I've fixed these errors (leaving warning fix for future), error lines are
> enough so no need in complete logs. Does it compiles on your system now?

Thanks, works well!

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Compiling in C++20 mode

2020-12-29 Thread Yuriy Skalko
I used "-k" instead of "-k0" (my make version does not seem to support "-k0". I 
get the following errors with GCC:


/home/vbox/lyxbuilds/master-clang/repo/src/tex2lyx/Parser.cpp:857:34: error: 
use of deleted function ‘std::basic_ostream& 
std::operator<<(std::basic_ostream&, wchar_t) [with
_Traits = std::char_traits]’

  857 |   cerr << "ignoring a char: " << c << "\n";
  |  ^


/home/vbox/lyxbuilds/master-clang/repo/src/Buffer.cpp:1774:27: error: use of 
deleted function ‘std::basic_ostream& 
std::operator<<(std::basic_ostream&, wchar_t) [with _Traits =
 std::char_traits]’

 1774 |   oss << "0x" << hex << e.failed_char << dec;
  |   ^~~


/home/vbox/lyxbuilds/master-clang/repo/src/Server.cpp: In lambda function:
/home/vbox/lyxbuilds/master-clang/repo/src/Server.cpp:869:40: error: implicit 
capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Werror=deprecated]

  869 |   theApp()->registerSocketCallback(fd, [=](){
  |^


Clang gives the following:

/home/vbox/lyxbuilds/master-clang/repo/src/tex2lyx/Parser.cpp:857:31: error: 
overload resolution selected deleted operator '<<'

cerr << "ignoring a char: " << c << "\n";
~~~ ^  ~


/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/system_error:262:5:
 note: candidate function template not viable: no known conversion from 
'lyx::char_type' (aka 'wchar_t') to 'const std:: error_code' for 2nd 
argument

operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
^


/home/vbox/lyxbuilds/master-clang/repo/src/Buffer.cpp:1774:22: error: overload 
resolution selected deleted operator '<<'

oss << "0x" << hex << e.failed_char << dec;
~~ ^  ~


/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/system_error:262:5:
 note: candidate function template not viable: no known conversion from 'const 
lyx::char_type' (aka 'const wchar_t') to  'const std::error_code' for 2nd 
argument

operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
^



(this one is a warning)
/home/vbox/lyxbuilds/master-clang/repo/src/LyXRC.cpp:2950:28: error: comparison 
between two arrays is deprecated; to compare array addresses, use unary '+' to 
decay operands to pointers [-Werror,-Wdeprecated-   array-compare]

|| lyxrc_orig.font_sizes != lyxrc_new.font_sizes
   ~ ^  


/home/vbox/lyxbuilds/master-clang/repo/src/tex2lyx/Parser.cpp:857:31: error: 
overload resolution selected deleted operator '<<'

cerr << "ignoring a char: " << c << "\n";
~~~ ^  ~

No problem if you can't take a look at all or any of these. Also, let me
know if for the next time you prefer for me to attach complete logs,
rather than just the error lines. Thanks for working on this, Yuriy!

Scott


I've fixed these errors (leaving warning fix for future), error lines 
are enough so no need in complete logs. Does it compiles on your system now?



Yuriy

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Compiling in C++20 mode

2020-12-29 Thread Scott Kostyshak
On Tue, Dec 29, 2020 at 10:37:15PM +0200, Yuriy Skalko wrote:
> > Thanks, Yuriy. I now get the following error with GCC:
> > 
> > /home/vbox/lyxbuilds/master-clang/repo/src/Buffer.cpp:1774:27: error:
> > use of deleted function ‘std::basic_ostream&
> > std::operator<<(std::basic_ostream&, wchar_t) [with
> > _Traits = std::char_traits]’
> >  1774 |   oss << "0x" << hex << e.failed_char << dec;
> >   |   ^~~
> > 
> > Scott
> 
> It is the same error, we need static_cast(...) here too. If you'll
> add option "-k0" when doing build, then we'll be able to see all such errors
> at once and not one by one.

I used "-k" instead of "-k0" (my make version does not seem to support "-k0". I 
get the following errors with GCC:

/home/vbox/lyxbuilds/master-clang/repo/src/tex2lyx/Parser.cpp:857:34: error: 
use of deleted function ‘std::basic_ostream& 
std::operator<<(std::basic_ostream&, wchar_t) [with
_Traits = std::char_traits]’
  857 |   cerr << "ignoring a char: " << c << "\n";
  |  ^


/home/vbox/lyxbuilds/master-clang/repo/src/Buffer.cpp:1774:27: error: use of 
deleted function ‘std::basic_ostream& 
std::operator<<(std::basic_ostream&, wchar_t) [with _Traits =
 std::char_traits]’
 1774 |   oss << "0x" << hex << e.failed_char << dec;
  |   ^~~


/home/vbox/lyxbuilds/master-clang/repo/src/Server.cpp: In lambda function:
/home/vbox/lyxbuilds/master-clang/repo/src/Server.cpp:869:40: error: implicit 
capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Werror=deprecated]
  869 |   theApp()->registerSocketCallback(fd, [=](){
  |^


Clang gives the following:

/home/vbox/lyxbuilds/master-clang/repo/src/tex2lyx/Parser.cpp:857:31: error: 
overload resolution selected deleted operator '<<'
cerr << "ignoring a char: " << c << "\n";
~~~ ^  ~


/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/system_error:262:5:
 note: candidate function template not viable: no known conversion from 
'lyx::char_type' (aka 'wchar_t') to 'const std:: error_code' for 2nd 
argument
operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
^


/home/vbox/lyxbuilds/master-clang/repo/src/Buffer.cpp:1774:22: error: overload 
resolution selected deleted operator '<<'
oss << "0x" << hex << e.failed_char << dec;
~~ ^  ~


/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/system_error:262:5:
 note: candidate function template not viable: no known conversion from 'const 
lyx::char_type' (aka 'const wchar_t') to  'const std::error_code' for 2nd 
argument
operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
^



(this one is a warning)
/home/vbox/lyxbuilds/master-clang/repo/src/LyXRC.cpp:2950:28: error: comparison 
between two arrays is deprecated; to compare array addresses, use unary '+' to 
decay operands to pointers [-Werror,-Wdeprecated-   array-compare]
|| lyxrc_orig.font_sizes != lyxrc_new.font_sizes
   ~ ^  


/home/vbox/lyxbuilds/master-clang/repo/src/tex2lyx/Parser.cpp:857:31: error: 
overload resolution selected deleted operator '<<'
cerr << "ignoring a char: " << c << "\n";
~~~ ^  ~

No problem if you can't take a look at all or any of these. Also, let me
know if for the next time you prefer for me to attach complete logs,
rather than just the error lines. Thanks for working on this, Yuriy!

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Compiling in C++20 mode

2020-12-29 Thread Scott Kostyshak
On Tue, Dec 29, 2020 at 10:37:15PM +0200, Yuriy Skalko wrote:
> > Thanks, Yuriy. I now get the following error with GCC:
> > 
> > /home/vbox/lyxbuilds/master-clang/repo/src/Buffer.cpp:1774:27: error:
> > use of deleted function ‘std::basic_ostream&
> > std::operator<<(std::basic_ostream&, wchar_t) [with
> > _Traits = std::char_traits]’
> >  1774 |   oss << "0x" << hex << e.failed_char << dec;
> >   |   ^~~
> > 
> > Scott
> 
> It is the same error, we need static_cast(...) here too. If you'll
> add option "-k0" when doing build, then we'll be able to see all such errors
> at once and not one by one.

Indeed that seems more efficient :). I didn't know about that option.
Thanks. I'll do this tonight (US EST) and get back to you.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Compiling in C++20 mode

2020-12-29 Thread Yuriy Skalko

Thanks, Yuriy. I now get the following error with GCC:

/home/vbox/lyxbuilds/master-clang/repo/src/Buffer.cpp:1774:27: error: use of 
deleted function ‘std::basic_ostream& 
std::operator<<(std::basic_ostream&, wchar_t) [with _Traits = 
std::char_traits]’

 1774 |   oss << "0x" << hex << e.failed_char << dec;
  |   ^~~

Scott


It is the same error, we need static_cast(...) here too. If 
you'll add option "-k0" when doing build, then we'll be able to see all 
such errors at once and not one by one.



Yuriy
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Compiling in C++20 mode

2020-12-29 Thread Scott Kostyshak
On Tue, Dec 29, 2020 at 12:17:20PM +0200, Yuriy Skalko wrote:
> > I'm not sure how this line compiled at all with earlier standards on
> > Linux (where char_type is wchar_t). How wchar_t was outputted into char
> > stream?
> 
> It produced the integer value before C++20:
> https://en.cppreference.com/w/cpp/io/basic_ostream/operator_ltlt2
> 
> So, the patch attached here should work as in earlier standards.

Thanks, Yuriy. I now get the following error with GCC:

/home/vbox/lyxbuilds/master-clang/repo/src/Buffer.cpp:1774:27: error: use of 
deleted function ‘std::basic_ostream& 
std::operator<<(std::basic_ostream&, wchar_t) [with _Traits = 
std::char_traits]’
 1774 |   oss << "0x" << hex << e.failed_char << dec;
  |   ^~~

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Compiling in C++20 mode

2020-12-29 Thread Yuriy Skalko
I'm not sure how this line compiled at all with earlier standards on Linux (where char_type is wchar_t). How wchar_t was outputted into char stream? 


It produced the integer value before C++20:
https://en.cppreference.com/w/cpp/io/basic_ostream/operator_ltlt2

So, the patch attached here should work as in earlier standards.


Yuriy
diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp
index dd43dd9eac..478e906308 100644
--- a/src/mathed/MathParser.cpp
+++ b/src/mathed/MathParser.cpp
@@ -370,9 +370,9 @@ ostream & operator<<(ostream & os, Token const & t)
os << '\\' << to_utf8(cs);
}
else if (t.cat() == catLetter)
-   os << t.character();
+   os << static_cast(t.character());
else
-   os << '[' << t.character() << ',' << t.cat() << ']';
+   os << '[' << static_cast(t.character()) << ',' << 
t.cat() << ']';
return os;
 }
 
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Compiling in C++20 mode

2020-12-29 Thread Yuriy Skalko

Thanks for working on this, Yuriy! I'm not sure if the following is
helpful, but curent master fails for me with GCC and Clang with C++20 on
Ubuntu 20.10. Here are details in case you or anyone else is motivated
to take a look:

/home/vbox/lyxbuilds/master-clang/repo/src/mathed/MathParser.cpp:373:21: error: 
use of deleted function ‘std::basic_ostream& 
std::operator<<(std::basic_ostream&, wchar_t) [with _Traits = 
std::char_traits]’

  373 |   os << t.character();

Clang gives the following:

[ 72%] Building CXX object src/mathed/CMakeFiles/mathed.dir/MathParser.cpp.o

   
cd /home/vbox/lyxbuilds/master-clang/CMakeBuild/src/mathed && /usr/bin/clang++  
-DBOOST_USER_CONFIG="" -DHUNSPELL_STATIC -DQT_CORE_LIB 
-I/home/vbox/lyxbuilds/master-clang/CMakeBuild -I/home/vbox/lyxbui
lds/master-clang/repo/src -I/usr/include/enchant-2 
-I/home/vbox/lyxbuilds/master-clang/repo/3rdparty/hunspell/1.7.0/src/hunspell 
-I/home/vbox/lyxbuilds/master-clang/repo/3rdparty/hunspell/1.7.0/src 
-I/home/vbox/lyxbuilds/master-clang/repo/3rdparty/boost 
-I/home/vbox/lyxbuilds/master-clang/repo/3rdparty/nod 
-I/home/vbox/lyxbuilds/master-clang/repo/src/mathed -isystem 
/usr/include/x86_64-linux-gnu/qt5 -isystem /usr/inclu
de/x86_64-linux-gnu/qt5/QtCore -isystem 
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++  -Wall -Wextra 
-Wno-deprecated-copy --std=c++20 -Wno-deprecated-register -DENABLE_ASSERTIONS=1 
-D_GLIBCXX_DEBUG -D_GLIBCXX_
DEBUG_PEDANTIC -fno-strict-aliasing  -O0 -g3 -D_DEBUG   -Werror -fPIC 
-std=c++2a -o CMakeFiles/mathed.dir/MathParser.cpp.o -c 
/home/vbox/lyxbuilds/master-clang/repo/src/mathed/MathParser.cpp
 
/home/vbox/lyxbuilds/master-clang/repo/src/mathed/MathParser.cpp:373:6: error: 
overload resolution selected deleted operator '<<'  
os << 
t.character();  

 
~~ ^  ~ 

   
$ g++ --version

g++ (Ubuntu 10.2.0-13ubuntu1) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ clang++ --version
Ubuntu clang version 11.0.0-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Scott


Hi Scott,
Please try the attached patch. I'm not sure how this line compiled at 
all with earlier standards on Linux (where char_type is wchar_t). How 
wchar_t was outputted into char stream?



Yuriy

diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp
index dd43dd9eac..8659b59576 100644
--- a/src/mathed/MathParser.cpp
+++ b/src/mathed/MathParser.cpp
@@ -370,9 +370,9 @@ ostream & operator<<(ostream & os, Token const & t)
os << '\\' << to_utf8(cs);
}
else if (t.cat() == catLetter)
-   os << t.character();
+   os << to_utf8(docstring(1, t.character()));
else
-   os << '[' << t.character() << ',' << t.cat() << ']';
+   os << '[' << to_utf8(docstring(1, t.character())) << ',' << 
t.cat() << ']';
return os;
 }
 
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Compiling in C++20 mode

2020-12-28 Thread Scott Kostyshak
On Mon, Dec 28, 2020 at 09:12:05PM +0200, Yuriy Skalko wrote:
> > Tried at ab7ac800. At least it should be compilable with any c++ compiler.
> > 
> > Kornel
> 
> Now LyX can be successfully compiled with C++20 compiler. The attached patch
> fixes C++20-specific deprecation warning (`this` in lambdas must be captured
> explicitly), it should not affect earlier C++ versions.

Thanks for working on this, Yuriy! I'm not sure if the following is
helpful, but curent master fails for me with GCC and Clang with C++20 on
Ubuntu 20.10. Here are details in case you or anyone else is motivated
to take a look:

/home/vbox/lyxbuilds/master-clang/repo/src/mathed/MathParser.cpp:373:21: error: 
use of deleted function ‘std::basic_ostream& 
std::operator<<(std::basic_ostream&, wchar_t) [with _Traits = 
std::char_traits]’
  373 |   os << t.character();

Clang gives the following:

[ 72%] Building CXX object src/mathed/CMakeFiles/mathed.dir/MathParser.cpp.o

   
cd /home/vbox/lyxbuilds/master-clang/CMakeBuild/src/mathed && /usr/bin/clang++  
-DBOOST_USER_CONFIG="" -DHUNSPELL_STATIC -DQT_CORE_LIB 
-I/home/vbox/lyxbuilds/master-clang/CMakeBuild -I/home/vbox/lyxbui
lds/master-clang/repo/src -I/usr/include/enchant-2 
-I/home/vbox/lyxbuilds/master-clang/repo/3rdparty/hunspell/1.7.0/src/hunspell 
-I/home/vbox/lyxbuilds/master-clang/repo/3rdparty/hunspell/1.7.0/src 
-I/home/vbox/lyxbuilds/master-clang/repo/3rdparty/boost 
-I/home/vbox/lyxbuilds/master-clang/repo/3rdparty/nod 
-I/home/vbox/lyxbuilds/master-clang/repo/src/mathed -isystem 
/usr/include/x86_64-linux-gnu/qt5 -isystem /usr/inclu
de/x86_64-linux-gnu/qt5/QtCore -isystem 
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++  -Wall -Wextra 
-Wno-deprecated-copy --std=c++20 -Wno-deprecated-register -DENABLE_ASSERTIONS=1 
-D_GLIBCXX_DEBUG -D_GLIBCXX_
DEBUG_PEDANTIC -fno-strict-aliasing  -O0 -g3 -D_DEBUG   -Werror -fPIC 
-std=c++2a -o CMakeFiles/mathed.dir/MathParser.cpp.o -c 
/home/vbox/lyxbuilds/master-clang/repo/src/mathed/MathParser.cpp
 
/home/vbox/lyxbuilds/master-clang/repo/src/mathed/MathParser.cpp:373:6: error: 
overload resolution selected deleted operator '<<'  
os << 
t.character();  

 
~~ ^  ~ 

   
$ g++ --version
g++ (Ubuntu 10.2.0-13ubuntu1) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ clang++ --version
Ubuntu clang version 11.0.0-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Compiling in C++20 mode

2020-12-28 Thread Richard Kimberly Heck
On 12/28/20 2:12 PM, Yuriy Skalko wrote:
>> Tried at ab7ac800. At least it should be compilable with any c++
>> compiler.
>>
>>     Kornel
>
> Now LyX can be successfully compiled with C++20 compiler. The attached
> patch fixes C++20-specific deprecation warning (`this` in lambdas must
> be captured explicitly), it should not affect earlier C++ versions.

Looks fine.

Riki


-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Compiling in C++20 mode

2020-12-28 Thread Yuriy Skalko

Tried at ab7ac800. At least it should be compilable with any c++ compiler.

Kornel


Now LyX can be successfully compiled with C++20 compiler. The attached 
patch fixes C++20-specific deprecation warning (`this` in lambdas must 
be captured explicitly), it should not affect earlier C++ versions.



Yuriy
From 2f1c206c72a6eca082f4402b8406cd028c01faf1 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko 
Date: Mon, 28 Dec 2020 20:59:48 +0200
Subject: [PATCH] Fix C++20 warning on implicit capture of this via [=]

---
 src/frontends/qt/GuiBibtex.cpp | 2 +-
 src/frontends/qt/GuiCitation.cpp   | 2 +-
 src/frontends/qt/GuiDocument.cpp   | 2 +-
 src/frontends/qt/GuiLyXFiles.cpp   | 2 +-
 src/frontends/qt/GuiRef.cpp| 2 +-
 src/graphics/GraphicsCacheItem.cpp | 2 +-
 src/insets/InsetExternal.cpp   | 2 +-
 src/insets/InsetInclude.cpp| 4 ++--
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/frontends/qt/GuiBibtex.cpp b/src/frontends/qt/GuiBibtex.cpp
index a9e0e45c55..22b704ed76 100644
--- a/src/frontends/qt/GuiBibtex.cpp
+++ b/src/frontends/qt/GuiBibtex.cpp
@@ -113,7 +113,7 @@ GuiBibtex::GuiBibtex(GuiView & lv)
availableLV, SLOT(setFocus()));
 #else
connect(filter_, ::downPressed,
-   availableLV, [=](){ focusAndHighlight(availableLV); });
+   availableLV, [=, this](){ focusAndHighlight(availableLV); });
 #endif
 
availableLV->setToolTip(formatToolTip(qt_("This list consists of all 
databases that are indexed by LaTeX and thus are found without a file path. "
diff --git a/src/frontends/qt/GuiCitation.cpp b/src/frontends/qt/GuiCitation.cpp
index b2656b132a..9ff03f30a0 100644
--- a/src/frontends/qt/GuiCitation.cpp
+++ b/src/frontends/qt/GuiCitation.cpp
@@ -157,7 +157,7 @@ GuiCitation::GuiCitation(GuiView & lv)
availableLV, SLOT(setFocus()));
 #else
connect(filter_, ::downPressed,
-   availableLV, [=](){ focusAndHighlight(availableLV); });
+   availableLV, [=, this](){ focusAndHighlight(availableLV); });
 #endif
connect(regexp_, SIGNAL(triggered()),
this, SLOT(regexChanged()));
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index c21c3a00a0..4b9bdff5cc 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -1673,7 +1673,7 @@ GuiDocument::GuiDocument(GuiView & lv)
modulesModule->availableLV, SLOT(setFocus()));
 #else
connect(filter_, ::downPressed,
-   modulesModule->availableLV, [=](){ 
focusAndHighlight(modulesModule->availableLV); });
+   modulesModule->availableLV, [=, this](){ 
focusAndHighlight(modulesModule->availableLV); });
 #endif
 
 
diff --git a/src/frontends/qt/GuiLyXFiles.cpp b/src/frontends/qt/GuiLyXFiles.cpp
index f14369a5a9..7859d4816d 100644
--- a/src/frontends/qt/GuiLyXFiles.cpp
+++ b/src/frontends/qt/GuiLyXFiles.cpp
@@ -197,7 +197,7 @@ GuiLyXFiles::GuiLyXFiles(GuiView & lv)
filesLW, SLOT(setFocus()));
 #else
connect(filter_, ::downPressed,
-   filesLW, [=](){ focusAndHighlight(filesLW); });
+   filesLW, [=, this](){ focusAndHighlight(filesLW); });
 #endif
 
filterBarL->addWidget(filter_, 0);
diff --git a/src/frontends/qt/GuiRef.cpp b/src/frontends/qt/GuiRef.cpp
index 39f97eab27..6cdd7c8aaa 100644
--- a/src/frontends/qt/GuiRef.cpp
+++ b/src/frontends/qt/GuiRef.cpp
@@ -67,7 +67,7 @@ GuiRef::GuiRef(GuiView & lv)
refsTW, SLOT(setFocus()));
 #else
connect(filter_, ::downPressed,
-   refsTW, [=](){ focusAndHighlight(refsTW); });
+   refsTW, [=, this](){ focusAndHighlight(refsTW); });
 #endif
 
filterBarL->addWidget(filter_, 0);
diff --git a/src/graphics/GraphicsCacheItem.cpp 
b/src/graphics/GraphicsCacheItem.cpp
index 918dc02857..49132cc33b 100644
--- a/src/graphics/GraphicsCacheItem.cpp
+++ b/src/graphics/GraphicsCacheItem.cpp
@@ -220,7 +220,7 @@ void CacheItem::Impl::startMonitor()
return;
monitor_ = FileSystemWatcher::activeMonitor(filename_);
// Disconnected at the same time as this is destroyed.
-   monitor_->connect([=](bool /* exists */){ startLoading(); });
+   monitor_->connect([this](bool /* exists */){ startLoading(); });
 }
 
 
diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp
index 655371ee9d..42918ec81d 100644
--- a/src/insets/InsetExternal.cpp
+++ b/src/insets/InsetExternal.cpp
@@ -656,7 +656,7 @@ void InsetExternal::updatePreview() const
renderer_ = make_unique(this);
RenderMonitoredPreview * preview_ptr = 
renderer_->asMonitoredPreview();
// This connection is closed at the same time as this is 
destroyed.
-   preview_ptr->connect([=]() { fileChanged(); });
+   preview_ptr->connect([this]() { fileChanged(); });

Re: Compiling in C++20 mode

2020-12-28 Thread Kornel Benko
Am Mon, 28 Dec 2020 12:08:00 +0200
schrieb Yuriy Skalko :

> Recently I've had necessity to install latest stable GCC version 10.2 
> that has C++20 support. So I didn't miss the opportunity to try 
> compiling LyX in C++20 mode too.
> 
> The only compilation error is due to recent commit 2d2e2f1c6d. These u8 
> string literals have incompatible type:
> 
>accents["hairspace"] = u8"\uf";// select from free unicode 
> plane 15
>accents["thinspace"] = u8"\uf0002";// and used _only_ by findadv
>accents["negthinspace"]  = u8"\uf0003";// to omit backslashed latex 
> macros
>accents["medspace"]  = u8"\uf0004";// See 
> https://en.wikipedia.org/wiki/Private_Use_Areas
>accents["negmedspace"]   = u8"\uf0005";
>accents["thickspace"]= u8"\uf0006";
>accents["negthickspace"] = u8"\uf0007";
> 
> Kornel, is it possible to express it differently to get rid of 
> compatibility problems in the future and make LyX compilable in C++20 
> mode now?
> As I understand this can be suitable solution:
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1423r2.html#ordinary
> 
> 
> Yuriy

Tried at ab7ac800. At least it should be compilable with any c++ compiler.

Kornel


pgpqgJlJTyNSh.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel