Merge lp:~widelands-dev/widelands/assert_removed into lp:widelands

Proposed by TiborB
Status: Merged
Merged at revision: 7638
Proposed branch: lp:~widelands-dev/widelands/assert_removed
Merge into: lp:widelands
Diff against target: 13 lines (+1/-2)
1 file modified
src/ai/defaultai.cc (+1/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/assert_removed
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+278269@code.launchpad.net

Description of the change

This is to fix today's compilation problems. I know Tino fixed it with exit(), but here I added throw, it is better because it prints something to terminal...

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

I like this suggestion better too - it is how we deal with unreachable code everywhere else.

An even nicer solution would be if we had an UNREACHABLE macro that does behave exactly the same in every place. It could be implemented differently for each compiler, for example for clang there is http://clang.llvm.org/docs/LanguageExtensions.html#builtin-unreachable.

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

I have created a bug report, in case somebody want to work on a macro

https://bugs.launchpad.net/widelands/+bug/1518929

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ai/defaultai.cc'
2--- src/ai/defaultai.cc 2015-11-22 11:20:09 +0000
3+++ src/ai/defaultai.cc 2015-11-23 18:32:18 +0000
4@@ -5523,8 +5523,7 @@
5 }
6 }
7
8- assert (false);
9- exit(1);
10+ throw wexception("AI internal error: nonexistent task.");
11 }
12
13 // This performs one "iteration" of sorting based on due_time

Subscribers

People subscribed via source and target branches

to status/vote changes: