Fix exception warning (patch)

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
spikethehobbit
Space Squid
Posts: 66
Joined: Mon Aug 27, 2012 7:24 pm

Fix exception warning (patch)

#1 Post by spikethehobbit »

There are nine places where exceptions are caught by value instead of by reference. Attached is a trivial patch to change these to const&.
Attachments
fix-exception-warnings.diff.txt
(3.77 KiB) Downloaded 133 times
All contributions are submitted under GPL or LGPL v2 or later, or under appropriate Creative Commons licence, consistent with project guidlines.

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Fix exception warning (patch)

#2 Post by o01eg »

spikethehobbit wrote: Thu Oct 31, 2019 10:55 am There are nine places where exceptions are caught by value instead of by reference. Attached is a trivial patch to change these to const&.
What about to open PR on the Github?
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

spikethehobbit
Space Squid
Posts: 66
Joined: Mon Aug 27, 2012 7:24 pm

Re: Fix exception warning (patch)

#3 Post by spikethehobbit »

o01eg wrote: Thu Oct 31, 2019 11:03 am
spikethehobbit wrote: Thu Oct 31, 2019 10:55 am There are nine places where exceptions are caught by value instead of by reference. Attached is a trivial patch to change these to const&.
What about to open PR on the Github?
I closed my Github account when Microsoft bought them.
All contributions are submitted under GPL or LGPL v2 or later, or under appropriate Creative Commons licence, consistent with project guidlines.

User avatar
Vezzra
Release Manager, Design
Posts: 6090
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Fix exception warning (patch)

#4 Post by Vezzra »

I have created a PR with this patch: #2625

spikethehobbit
Space Squid
Posts: 66
Joined: Mon Aug 27, 2012 7:24 pm

Re: Fix exception warning (patch)

#5 Post by spikethehobbit »

Sorry for the delay. There are nine changed lines in the submitted patch, of which only six were applied. Geoff's suggestion of using catch (...) is a viable alternative in several cases as noted.

The following files are each missing one change:
network/Message.cpp
server/ServerApp.cpp
util/Directories.cpp
All contributions are submitted under GPL or LGPL v2 or later, or under appropriate Creative Commons licence, consistent with project guidlines.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Fix exception warning (patch)

#6 Post by Geoff the Medio »


User avatar
Vezzra
Release Manager, Design
Posts: 6090
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Fix exception warning (patch)

#7 Post by Vezzra »

Should that get cherry picked into the release branch?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Fix exception warning (patch)

#8 Post by Geoff the Medio »

Vezzra wrote: Sun Dec 08, 2019 7:34 pm
Should that get cherry picked into the release branch?
https://github.com/freeorion/freeorion/ ... 83a6b42cec

User avatar
Vezzra
Release Manager, Design
Posts: 6090
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Fix exception warning (patch)

#9 Post by Vezzra »

Oh, good. Should have checked before asking... ;)

Post Reply