Ticket #42881

can_unit_do_activity_targeted_at(): ACTIVITY_PILLAGE case may fall through

Open Date: 2021-09-19 14:41 Last Update: 2021-10-01 13:27

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
1

Details

With -Wimplicit-fallthrough in master:

../../../src/common/unit.c: In function ‘can_unit_do_activity_targeted_at’:
../../../src/common/unit.c:913:5: error: this statement may fall through -Werror=implicit-fallthrough=

913 | switch (action_get_target_kind(paction)) { \
| ~

../../../src/common/unit.c:913:5: note: in definition of macro ‘RETURN_IS_ACTIVITY_ENABLED_UNIT_ON’

913 | switch (action_get_target_kind(paction)) { \
| ~

../../../src/common/unit.c:1019:3: note: here

1019 | case ACTIVITY_EXPLORE:
| ~

Ticket History (3/5 Histories)

2021-09-19 14:41 Updated by: cazfi
  • New Ticket "can_unit_do_activity_targeted_at(): ACTIVITY_EXPLORE case may fall through" created
2021-09-23 11:23 Updated by: cazfi
  • Summary Updated
Comment

It's the ACTIVITY_PILLAGE case above that is falling through *to* ACTIVITY_EXPLORE.

The problem is in macro RETURN_IS_ACTIVITY_ENABLED_UNIT_ON() that has no return for invalid value.

2021-09-23 11:29 Updated by: cazfi
  • Resolution Update from None to Accepted
  • Milestone Update from (None) to 3.1.0 (closed)
2021-10-01 13:27 Updated by: cazfi
  • Status Update from Open to Closed
  • Owner Update from (None) to cazfi
  • Resolution Update from Accepted to Fixed

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login