[LyX/master] When a displayed inset is aligned left, align it left

Scott Kostyshak skostysh at lyx.org
Wed Apr 26 18:01:24 UTC 2023


On Thu, Apr 13, 2023 at 01:15:59PM +0100, José Matos wrote:
> On Thu, 2023-04-13 at 10:24 +0200, Pavel Sanda wrote:
> > Jose,
> > 
> > can you try the current gcc, whether the warning is still there?
> > 
> > I believe their view on what's fixable WRT dangling-reference
> > stabilized.
> > If it's still there -Wno-dangling-reference might be the best
> > way to go forward (unless you want to produce minimal example).
> > 
> > Pavel
> 
> As far as I can see they are still there:
> $ g++ -v
> Using built-in specs.
> COLLECT_GCC=/usr/bin/g++
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/13/lto-wrapper
> OFFLOAD_TARGET_NAMES=nvptx-none
> OFFLOAD_TARGET_DEFAULT=1
> Target: x86_64-redhat-linux
> Configured with: ../configure --enable-bootstrap --enable-
> languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr --
> mandir=/usr/share/man --infodir=/usr/share/info --with-
> bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-
> threads=posix --enable-checking=release --enable-multilib --with-
> system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --
> enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-
> version-only --enable-libstdcxx-backtrace --with-libstdcxx-
> zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-
> plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-
> 13.0.1-20230401/obj-x86_64-redhat-linux/isl-install --enable-offload-
> targets=nvptx-none --without-cuda-driver --enable-offload-defaulted --
> enable-gnu-indirect-function --enable-cet --with-tune=generic --with-
> arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-
> lto --enable-link-serialization=1
> Thread model: posix
> Supported LTO compression algorithms: zlib zstd
> gcc version 13.0.1 20230401 (Red Hat 13.0.1-0) (GCC) 
> 
> And configure says:
> 
> Configuration
>   Host type:               x86_64-pc-linux-gnu
>   Special build flags:      build=development warnings assertions
> stdlib-debug callback-printing use-hunspell use-enchant
>   Bundled libraries:        nod
>   C++ Compiler:            g++ (13.0.1)
>   C++ Compiler flags:       -Wall -Wextra -fPIC -g -O -std=c++17  -Wno-
> deprecated-copy
>   C++ Compiler user flags:
>   Linker flags:             -rdynamic
>   Linker user flags:
>   Qt Frontend:
>       Qt version:          5.15.8
>   Packaging:               posix
>   LyX binary dir:          /usr/local/bin
>   LyX files dir:           /usr/local/share/lyx-devel
> 
> I would suggest to leave this as it is for the moment.
> I prefer to see those warnings than to hide them under the rug.  :-)
> 
> Best regards,
> -- 
> José Abílio

I have the following:

$ gcc --version
gcc (Ubuntu 13-20230320-1ubuntu1) 13.0.1 20230320 (experimental) [master r13-6759-g5194ad1958c]

and I see the warning in InsetGraphics.cpp:

/home/vbox/lyxbuilds/master-master/repo/src/insets/InsetGraphics.cpp: In function ‘const std::pair<lyx::{anonymous}::GraphicsCopyStatus, lyx::support::FileName> lyx::{anonymous}::copyFileIfNeeded(const lyx::support::FileName&, const lyx::support::FileName&)’:
/home/vbox/lyxbuilds/master-master/repo/src/insets/InsetGraphics.cpp:558:23: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
  558 |         Mover const & mover = getMover(theFormats().getFormatFromFile(file_in));
      |                       ^~~~~
/home/vbox/lyxbuilds/master-master/repo/src/insets/InsetGraphics.cpp:558:39: note: the temporary was destroyed at the end of the full expression ‘lyx::getMover(lyx::Formats::getFormatFromFile(const lyx::support::FileName&) const((* & file_in)))’
  558 |         Mover const & mover = getMover(theFormats().getFormatFromFile(file_in));
      |                               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note that with Clang (version 16) I don't see a warning regarding this.

If I understand correctly, we think the warning will stick around for GCC. I think we should then address the warning. The reason is because I think it's good to keep the warnings list clean so that we can compile with -Werror so that we can catch warnings that we do think could be serious. If you want to make sure we don't forget about the dangling reference warning, I propose we make a track ticket.

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20230426/55effcad/attachment-0001.asc>


More information about the lyx-devel mailing list