Skip to content

Commit

Permalink
[build] handle fallthru warning in flight plans due to NextStage
Browse files Browse the repository at this point in the history
  • Loading branch information
gautierhattenberger committed Feb 8, 2018
1 parent 3989057 commit f1c3753
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sw/airborne/subsystems/navigation/common_flight_plan.h
Expand Up @@ -43,16 +43,16 @@ void nav_goto_block(uint8_t block_id);

#define InitStage() nav_init_stage();

#define Block(x) /* Falls through. */ case x: nav_block=x;
#define Block(x) case x: nav_block=x;
#define NextBlock() nav_goto_block(nav_block + 1)
#define GotoBlock(b) nav_goto_block(b)

#define Stage(s) /* Falls through. */ case s: nav_stage=s;
#define NextStage() { nav_stage++; InitStage(); }
#define Stage(s) case s: nav_stage=s;
#define NextStage() { nav_stage++; InitStage(); } INTENTIONAL_FALLTHRU
#define NextStageAndBreak() { nav_stage++; InitStage(); break; }
#define NextStageAndBreakFrom(wp) { last_wp = wp; NextStageAndBreak(); }

#define Label(x) /* Falls through. */ label_ ## x:
#define Label(x) label_ ## x:
#define Goto(x) { goto label_ ## x; }
#define Return(x) { nav_block=last_block; if (x==1) {nav_stage=0;} else {nav_stage=last_stage;} block_time=0;}

Expand Down
6 changes: 6 additions & 0 deletions sw/include/std.h
Expand Up @@ -235,4 +235,10 @@ static inline bool str_equal(const char *a, const char *b)
# define WEAK
#endif

#if __GNUC__ >= 7
# define INTENTIONAL_FALLTHRU __attribute__ ((fallthrough));
#else
# define INTENTIONAL_FALLTHRU
#endif

#endif /* STD_H */

0 comments on commit f1c3753

Please sign in to comment.