Skip to content

Commit

Permalink
Remove implicit fallback from bfopt.cc
Browse files Browse the repository at this point in the history
This is an alternative solution for #48, and this does not
have potential memory leak.
  • Loading branch information
shinh committed Mar 28, 2019
1 parent 59166bf commit 83dc222
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tools/bfopt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
#include <string>
#include <vector>

#ifdef __GNUC__
#if __has_attribute(fallthrough)
#define FALLTHROUGH __attribute__((fallthrough))
#else
#define FALLTHROUGH
#endif
#else
#define FALLTHROUGH
#endif

typedef unsigned char byte;

using namespace std;
Expand Down Expand Up @@ -141,6 +151,7 @@ void parse(const char* code, vector<Op*>* ops) {
op->op = c;
break;
}
FALLTHROUGH;

default:
delete op;
Expand Down

0 comments on commit 83dc222

Please sign in to comment.