re-fresh
[nedit-bw.git] / parse_y-macro-cleanup.patch
blobf869c9d1b13e7e4ae1f577184f2ea58581cc6154
1 Subject: parse.y: macro cleanup
3 ---
5 source/parse.y | 33 ++++++++++++++++++++++++++++-----
6 1 file changed, 28 insertions(+), 5 deletions(-)
8 diff --quilt old/source/parse.y new/source/parse.y
9 --- old/source/parse.y
10 +++ new/source/parse.y
11 @@ -29,11 +29,34 @@
12 #endif
14 /* Macros to add error processing to AddOp and AddSym calls */
15 -#define ADD_OP(op) if (!AddOp(op, &ErrMsg)) return 1
16 -#define ADD_SYM(sym) if (!AddSym(sym, &ErrMsg)) return 1
17 -#define ADD_IMMED(val) if (!AddImmediate(val, &ErrMsg)) return 1
18 -#define ADD_BR_OFF(to) if (!AddBranchOffset(to, &ErrMsg)) return 1
19 -#define SET_BR_OFF(from, to) ((from)->value) = ((Inst *)(to)) - ((Inst *)(from))
20 +#define ADD_OP(op) \
21 + do { \
22 + if (!AddOp(op, &ErrMsg)) { \
23 + return 1; \
24 + } \
25 + } while (0)
26 +#define ADD_SYM(sym) \
27 + do { \
28 + if (!AddSym(sym, &ErrMsg)) { \
29 + return 1; \
30 + } \
31 + } while (0)
32 +#define ADD_IMMED(val) \
33 + do { \
34 + if (!AddImmediate(val, &ErrMsg)) { \
35 + return 1; \
36 + } \
37 + } while (0)
38 +#define ADD_BR_OFF(to) \
39 + do { \
40 + if (!AddBranchOffset(to, &ErrMsg)) { \
41 + return 1; \
42 + } \
43 + } while (0)
44 +#define SET_BR_OFF(from, to) \
45 + do { \
46 + ((from)->value) = ((Inst *)(to)) - ((Inst *)(from)); \
47 + } while (0)
49 /* Max. length for a string constant (... there shouldn't be a maximum) */
50 #define MAX_STRING_CONST_LEN 5000