diff options
author | Max Horn | 2009-02-21 03:32:13 +0000 |
---|---|---|
committer | Max Horn | 2009-02-21 03:32:13 +0000 |
commit | c8ea2dce5f1beb99f50e741fd66cbd4075ca8345 (patch) | |
tree | 7da24cdfb7da02d1e02f92f06d3296773d088107 /engines/sci/engine | |
parent | 031e3e3b9081ad955d4ef814829c83f4b51792f0 (diff) | |
download | scummvm-rg350-c8ea2dce5f1beb99f50e741fd66cbd4075ca8345.tar.gz scummvm-rg350-c8ea2dce5f1beb99f50e741fd66cbd4075ca8345.tar.bz2 scummvm-rg350-c8ea2dce5f1beb99f50e741fd66cbd4075ca8345.zip |
SCI: Fixed more warnings
svn-id: r38656
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/said.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/said.y | 20 |
2 files changed, 22 insertions, 6 deletions
diff --git a/engines/sci/engine/said.cpp b/engines/sci/engine/said.cpp index fa1979ff82..fd55082072 100644 --- a/engines/sci/engine/said.cpp +++ b/engines/sci/engine/said.cpp @@ -189,7 +189,7 @@ static int yylex(void); static int -yyerror(char *s) { +yyerror(const char *s) { said_parse_error = sci_strdup(s); return 1; /* Abort */ } @@ -1844,7 +1844,11 @@ static int yylex(void) { return retval; } -#define SAID_NEXT_NODE ((said_tree_pos == 0) || (said_tree_pos >= VOCAB_TREE_NODES)) ? said_tree_pos = 0 : said_tree_pos++ +static inline int said_next_node() { + return ((said_tree_pos == 0) || (said_tree_pos >= VOCAB_TREE_NODES)) ? said_tree_pos = 0 : said_tree_pos++; +} + +#define SAID_NEXT_NODE said_next_node() static inline int said_leaf_node(tree_t pos, int value) { said_tree[pos].type = PARSE_TREE_NODE_LEAF; diff --git a/engines/sci/engine/said.y b/engines/sci/engine/said.y index 25caffc014..9459405f79 100644 --- a/engines/sci/engine/said.y +++ b/engines/sci/engine/said.y @@ -92,7 +92,7 @@ static tree_t said_terminal(int); static int yylex(void); -static int yyerror(char *s) { +static int yyerror(const char *s) { said_parse_error = sci_strdup(s); return 1; /* Abort */ } @@ -258,7 +258,11 @@ static int yylex(void) { return retval; } -#define SAID_NEXT_NODE ((said_tree_pos == 0) || (said_tree_pos >= VOCAB_TREE_NODES)) ? said_tree_pos = 0 : said_tree_pos++ +static inline int said_next_node() { + return ((said_tree_pos == 0) || (said_tree_pos >= VOCAB_TREE_NODES)) ? said_tree_pos = 0 : said_tree_pos++; +} + +#define SAID_NEXT_NODE said_next_node() static inline int said_leaf_node(tree_t pos, int value) { said_tree[pos].type = PARSE_TREE_NODE_LEAF; @@ -300,8 +304,16 @@ static tree_t said_terminal(int val) { static tree_t said_aug_branch(int n1, int n2, tree_t t1, tree_t t2) { int retval; - retval = said_branch_node(SAID_NEXT_NODE, said_branch_node(SAID_NEXT_NODE, said_leaf_node(SAID_NEXT_NODE, n1), - said_branch_node(SAID_NEXT_NODE, said_leaf_node(SAID_NEXT_NODE, n2), t1)), t2); + // FIXME: The following code is ambiguous and *not* safely portable, + // due to the way the SAID_NEXT_NODE macro is implemented + retval = said_branch_node(SAID_NEXT_NODE, + said_branch_node(SAID_NEXT_NODE, + said_leaf_node(SAID_NEXT_NODE, n1), + said_branch_node(SAID_NEXT_NODE, + said_leaf_node(SAID_NEXT_NODE, n2), + t1) + ), + t2); #ifdef SAID_DEBUG fprintf(stderr, "AUG(0x%x, 0x%x, [%04x], [%04x]) = [%04x]\n", n1, n2, t1, t2, retval); |