Deal with more agressive gcov 7.1; Reindent

This commit is contained in:
NHOrus 2017-07-16 16:00:19 +03:00
parent 33e546b746
commit 8d9c8e4d5c
2 changed files with 41 additions and 45 deletions

View file

@ -101,11 +101,10 @@ static int attack(struct command_t *command)
* fixed), move rug there (not fixed), and move him there, * fixed), move rug there (not fixed), and move him there,
* too. Then do a null motion to get new description. */ * too. Then do a null motion to get new description. */
rspeak(BARE_HANDS_QUERY); rspeak(BARE_HANDS_QUERY);
if (!silent_yes()) if (!silent_yes()) {
{ speak(arbitrary_messages[NASTY_DRAGON]);
speak(arbitrary_messages[NASTY_DRAGON]); return GO_MOVE;
return GO_MOVE; }
}
state_change(DRAGON, DRAGON_DEAD); state_change(DRAGON, DRAGON_DEAD);
game.prop[RUG] = RUG_FLOOR; game.prop[RUG] = RUG_FLOOR;
/* Hardcoding LOC_SECRET5 as the dragon's death location is ugly. /* Hardcoding LOC_SECRET5 as the dragon's death location is ugly.
@ -417,8 +416,8 @@ static int chain(verb_t verb)
game.prop[BEAR] = CONTENTED_BEAR; game.prop[BEAR] = CONTENTED_BEAR;
switch (game.prop[BEAR]) { switch (game.prop[BEAR]) {
// LCOV_EXCL_START
case BEAR_DEAD: case BEAR_DEAD:
// LCOV_EXCL_START
/* Can't be reached as long as the only way for the bear to die /* Can't be reached as long as the only way for the bear to die
* is from a bridge collapse. Leave in in case this changes, but * is from a bridge collapse. Leave in in case this changes, but
* exclude from coverage testing. */ * exclude from coverage testing. */
@ -545,7 +544,7 @@ static int discard(verb_t verb, obj_t obj)
} else } else
rspeak(OK_MAN); rspeak(OK_MAN);
game.prop[BIRD] = FOREST(game.loc) ? BIRD_FOREST_UNCAGED : BIRD_UNCAGED; game.prop[BIRD] = FOREST(game.loc) ? BIRD_FOREST_UNCAGED : BIRD_UNCAGED;
drop(obj, game.loc); drop(obj, game.loc);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
@ -1001,12 +1000,12 @@ static int lock(verb_t verb, obj_t obj)
case OYSTER: case OYSTER:
if (verb == LOCK) if (verb == LOCK)
rspeak(HUH_MAN); rspeak(HUH_MAN);
else if (TOTING(OYSTER)) else if (TOTING(OYSTER))
rspeak(DROP_OYSTER); rspeak(DROP_OYSTER);
else if (!TOTING(TRIDENT)) else if (!TOTING(TRIDENT))
rspeak(OYSTER_OPENER); rspeak(OYSTER_OPENER);
else else
rspeak(OYSTER_OPENS); rspeak(OYSTER_OPENS);
break; break;
case DOOR: case DOOR:
rspeak((game.prop[DOOR] == DOOR_UNRUSTED) ? OK_MAN : RUSTY_DOOR); rspeak((game.prop[DOOR] == DOOR_UNRUSTED) ? OK_MAN : RUSTY_DOOR);
@ -1448,7 +1447,7 @@ int action(struct command_t *command)
return listen(); return listen();
case PART: case PART:
return reservoir(); return reservoir();
default: default: // LCOV_EXCL_LINE
BUG(INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE BUG(INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
} }
} }
@ -1549,14 +1548,14 @@ int action(struct command_t *command)
} }
case PART: case PART:
return reservoir(); return reservoir();
default: default: // LCOV_EXCL_LINE
BUG(TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE BUG(TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
} }
case unknown: case unknown:
/* Unknown verb, couldn't deduce object - might need hint */ /* Unknown verb, couldn't deduce object - might need hint */
sspeak(WHAT_DO, command->raw1); sspeak(WHAT_DO, command->raw1);
return GO_CHECKHINT; return GO_CHECKHINT;
default: default: // LCOV_EXCL_LINE
BUG(SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN); // LCOV_EXCL_LINE BUG(SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN); // LCOV_EXCL_LINE
} }
} }

59
main.c
View file

@ -223,9 +223,8 @@ static void checkhints(void)
break; break;
game.hintlc[hint] = 0; game.hintlc[hint] = 0;
return; return;
default: default: // LCOV_EXCL_LINE
BUG(HINT_NUMBER_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE BUG(HINT_NUMBER_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
break;
} }
/* Fall through to hint display */ /* Fall through to hint display */
@ -756,7 +755,7 @@ static void playermove( int motion)
croak(); croak();
return; return;
} }
default: default: // LCOV_EXCL_LINE
BUG(SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE BUG(SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
} }
} }
@ -1122,28 +1121,26 @@ Lclearobj:
} }
if (command.id1 == ENTER && command.id2 != WORD_NOT_FOUND && command.id2 != WORD_EMPTY) { if (command.id1 == ENTER && command.id2 != WORD_NOT_FOUND && command.id2 != WORD_EMPTY) {
command.id1 = command.id2; command.id1 = command.id2;
command.type1 = command.type2; command.type1 = command.type2;
strncpy(command.raw1, command.raw2, LINESIZE - 1); strncpy(command.raw1, command.raw2, LINESIZE - 1);
command.id2 = WORD_EMPTY; command.id2 = WORD_EMPTY;
command.type2 = NO_WORD_TYPE; command.type2 = NO_WORD_TYPE;
strncpy(command.raw2, "", LINESIZE - 1); strncpy(command.raw2, "", LINESIZE - 1);
} else { } else {
if (!((command.id1 != WATER && command.id1 != OIL) || (command.id2 != PLANT && command.id2 != DOOR))) { if (!((command.id1 != WATER && command.id1 != OIL) || (command.id2 != PLANT && command.id2 != DOOR))) {
if (AT(command.id2)) if (AT(command.id2)) {
{ command.id2 = POUR;
command.id2 = POUR; command.type2 = ACTION;
command.type2 = ACTION; strncpy(command.raw2, "POUR", LINESIZE - 1);
strncpy(command.raw2, "POUR", LINESIZE - 1);
command.wd2 = token_to_packed("POUR"); command.wd2 = token_to_packed("POUR");
} }
} }
if (command.id1 == CAGE && command.id2 == BIRD && HERE(CAGE) && HERE(BIRD)) if (command.id1 == CAGE && command.id2 == BIRD && HERE(CAGE) && HERE(BIRD)) {
{ command.id1 = CARRY;
command.id1 = CARRY; command.type1 = ACTION;
command.type1 = ACTION; strncpy(command.raw2, "CATCH", LINESIZE - 1);
strncpy(command.raw2, "CATCH", LINESIZE - 1);
command.wd1 = token_to_packed("CATCH"); command.wd1 = token_to_packed("CATCH");
} }
} }
Lookup: Lookup:
if (strncasecmp(command.raw1, "west", sizeof("west")) == 0) { if (strncasecmp(command.raw1, "west", sizeof("west")) == 0) {
@ -1155,9 +1152,9 @@ Lookup:
rspeak(GO_UNNEEDED); rspeak(GO_UNNEEDED);
} }
packed_to_token(command.wd1, word1); packed_to_token(command.wd1, word1);
long defn; long defn;
enum wordtype type; enum wordtype type;
get_vocab_metadata(word1, &defn, &type); get_vocab_metadata(word1, &defn, &type);
if (command.id1 == WORD_NOT_FOUND) { if (command.id1 == WORD_NOT_FOUND) {
if (fallback_handler(command)) if (fallback_handler(command))
continue; continue;
@ -1181,7 +1178,7 @@ Lookup:
case SPECIAL: case SPECIAL:
speak(specials[command.id1].message); speak(specials[command.id1].message);
goto Lclearobj; goto Lclearobj;
default: default: // LCOV_EXCL_LINE
BUG(VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3); // LCOV_EXCL_LINE BUG(VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3); // LCOV_EXCL_LINE
} }
@ -1197,13 +1194,13 @@ Lookup:
goto Lookup; goto Lookup;
case GO_WORD2: case GO_WORD2:
/* Get second word for analysis. */ /* Get second word for analysis. */
command.id1 = command.id2; command.id1 = command.id2;
command.type1 = command.type2; command.type1 = command.type2;
strncpy(command.raw1, command.raw2, LINESIZE - 1); strncpy(command.raw1, command.raw2, LINESIZE - 1);
command.wd1 = command.wd2; command.wd1 = command.wd2;
command.id2 = WORD_EMPTY; command.id2 = WORD_EMPTY;
command.type2 = NO_WORD_TYPE; command.type2 = NO_WORD_TYPE;
command.raw2[0] = '\0'; command.raw2[0] = '\0';
wordclear(&command.wd2); wordclear(&command.wd2);
goto Lookup; goto Lookup;
case GO_UNKNOWN: case GO_UNKNOWN:
@ -1220,7 +1217,7 @@ Lookup:
/* Oh dear, he's disturbed the dwarves. */ /* Oh dear, he's disturbed the dwarves. */
rspeak(DWARVES_AWAKEN); rspeak(DWARVES_AWAKEN);
terminate(endgame); terminate(endgame);
default: default: // LCOV_EXCL_LINE
BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH); // LCOV_EXCL_LINE BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH); // LCOV_EXCL_LINE
} }
} }