It is used in lib/Makefile.am and we were relying some autoconf macros
to define it as a side-effect. This is not the case anymore as of
autoconf 2.72.
This new warning in gcc 13 is annoying because it happens in certain
parts of our code where it is harmless to pass a temporary variable to
a function that returns a reference.
This patch introduces a new pair of macros,
LYX_BEGIN_MUTE_GCC_WARNING(warn) and LYX_END_MUTE_GCC_WARNING, which
can be used to define a block of code where a given GCC warning is disabled.
The macros are no-ops with compilers other than gcc, although some
compilers that pretend to be GCC make be mis-detected. The worse that
can happen AFAIU is a bunch of warnings.
The macro relies on an intimidating set of for nested macros. The goal
of these macros is to build a nested string bit by bit. Here is how it
works:
PRAGMA_IGNORE(dangling-reference)
=> PRAGMA_IGNORE_1(-Wdangling-reference)
=> PRAGMA_IGNORE_2("-Wdangling-reference")
=> PRAGMA_IGNORE_3(GCC diagnostic ignored "-Wdangling-reference")
=> _Pragma("GCC diagnostic ignored \""-Wdangling-reference\"")
The next question is: what is _Pragma() good for? Well, it is a
version of #pragma that can be used in a macro.
And finally, what are those pragmas good for? The 'push' and 'pop'
ones make changes to warnings local. The 'ignored' ones allow
to disable some warnings. And disabling -Wpragmas ensures that we do
not have a warning if we try to disable a warning that is not
supported by the compiler.
This commit allows compiling LyX with Qt6 when using autotools.
For a successful compilation the following 2 conditions must be met.
1) The Qt6 qmake has to come first in PATH, so that the command
"qmake -v | grep -o 'Qt version .'" returns "Qt version 6".
2) The --enable-qt6 switch has to be passed to the configure command.
If --enable-qt6 is used but Qt6 is not found, Qt5 is tried as a fallback.
If also Qt5 is not found, configuring for Qt4 is attempted.
If --enable-qt6 is not used, then things go as usual. This means that Qt5
is tried first and then Qt4, unless --disable-qt5 is used, in which case
Qt4 is directly attempted. This means that existing scripts should
continue working unmodified.
LyX should compile with Qt6 on windows and linux, and possibly also on
mac, but I could not test that. However, it is not guaranteed that it
works as it should. In particular I am not sure that I got right the
conversion from QRegExp to QRegularExpression. For sure, the syntax
highlighting seems to not work right. Someone in the know should take
a look at that. I am able to load documents and compile them but some
thourough testing is needed. However, when compiling for Qt5 or Qt4,
I tried to make sure that the functionality is preserved.
In particular, the directory frontends/qt4 is renamed to frontends/qt.
Many configurations file have to be updated. All mentions of qt4 in
the source have been audited, and changed to qt if necessary.
The only part that has not been updated is the CMake build system.