compiling with -pedantic on linux

This commit is contained in:
Enno 2011-03-08 08:42:31 +01:00
parent d940f29a6c
commit b95f663087
3 changed files with 119 additions and 111 deletions

View File

@ -7,7 +7,7 @@ if (${CMAKE_C_COMPILER} MATCHES ".*tcc")
endif(${CMAKE_C_COMPILER} MATCHES ".*tcc") endif(${CMAKE_C_COMPILER} MATCHES ".*tcc")
if (${CMAKE_C_COMPILER} MATCHES ".*gcc") if (${CMAKE_C_COMPILER} MATCHES ".*gcc")
set(CMAKE_C_FLAGS "-g -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts") set(CMAKE_C_FLAGS "-g -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
endif(${CMAKE_C_COMPILER} MATCHES ".*gcc") endif(${CMAKE_C_COMPILER} MATCHES ".*gcc")
if (WIN32) if (WIN32)

View File

@ -379,8 +379,8 @@ static order *monster_move(region * r, unit * u)
return NULL; return NULL;
reduce_weight(u); reduce_weight(u);
return create_order(K_MOVE, u->faction->locale, "%s", LOC(u->faction->locale, return create_order(K_MOVE, u->faction->locale, "%s",
directions[d])); LOC(u->faction->locale, directions[d]));
} }
static int dragon_affinity_value(region * r, unit * u) static int dragon_affinity_value(region * r, unit * u)
@ -461,8 +461,8 @@ static order *make_movement_order(unit * u, const region * target, int moves,
return NULL; return NULL;
bytes = bytes =
(int)strlcpy(bufp, (const char *)LOC(u->faction->locale, keywords[K_MOVE]), (int)strlcpy(bufp,
size); (const char *)LOC(u->faction->locale, keywords[K_MOVE]), size);
if (wrptr(&bufp, &size, bytes) != 0) if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
@ -476,8 +476,8 @@ static order *make_movement_order(unit * u, const region * target, int moves,
--size; --size;
} }
bytes = bytes =
(int)strlcpy(bufp, (const char *)LOC(u->faction->locale, directions[dir]), (int)strlcpy(bufp,
size); (const char *)LOC(u->faction->locale, directions[dir]), size);
if (wrptr(&bufp, &size, bytes) != 0) if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
} }
@ -540,8 +540,8 @@ static order *monster_seeks_target(region * r, unit * u)
} }
assert(d != NODIRECTION); assert(d != NODIRECTION);
return create_order(K_MOVE, u->faction->locale, "%s", LOC(u->faction->locale, return create_order(K_MOVE, u->faction->locale, "%s",
directions[d])); LOC(u->faction->locale, directions[d]));
} }
#endif #endif
@ -711,14 +711,19 @@ static order *plan_dragon(unit * u)
case RC_WYRM: case RC_WYRM:
long_order = make_movement_order(u, tr, 1, allowed_dragon); long_order = make_movement_order(u, tr, 1, allowed_dragon);
break; break;
default:
break;
} }
if (rng_int() % 100 < 15) { if (rng_int() % 100 < 15) {
const struct locale *lang = u->faction->locale; const struct locale *lang = u->faction->locale;
/* do a growl */ /* do a growl */
if (rname(tr, lang)) { if (rname(tr, lang)) {
addlist(&u->orders, create_order(K_MAIL, lang, "%s '%s... %s %s %s'", addlist(&u->orders,
LOC(lang, parameters[P_REGION]), random_growl(), create_order(K_MAIL, lang, "%s '%s... %s %s %s'",
u->number == 1 ? "Ich rieche" : "Wir riechen", LOC(lang, parameters[P_REGION]),
random_growl(),
u->number ==
1 ? "Ich rieche" : "Wir riechen",
"etwas in", rname(tr, u->faction->locale))); "etwas in", rname(tr, u->faction->locale)));
} }
} }
@ -797,8 +802,8 @@ void plan_monsters(faction * f)
if (ta && !monster_is_waiting(u)) { if (ta && !monster_is_waiting(u)) {
unit *tu = (unit *) ta->data.v; unit *tu = (unit *) ta->data.v;
if (tu && tu->region == r) { if (tu && tu->region == r) {
addlist(&u->orders, create_order(K_ATTACK, u->faction->locale, "%i", addlist(&u->orders,
tu->no)); create_order(K_ATTACK, u->faction->locale, "%i", tu->no));
} else if (tu) { } else if (tu) {
tu = findunitg(ta->data.i, NULL); tu = findunitg(ta->data.i, NULL);
if (tu != NULL) { if (tu != NULL) {
@ -833,8 +838,8 @@ void plan_monsters(faction * f)
if (u->race->bonus[SK_WEAPONLESS] != -99) { if (u->race->bonus[SK_WEAPONLESS] != -99) {
if (eff_skill(u, SK_WEAPONLESS, u->region) < 1) { if (eff_skill(u, SK_WEAPONLESS, u->region) < 1) {
long_order = long_order =
create_order(K_STUDY, f->locale, "'%s'", skillname(SK_WEAPONLESS, create_order(K_STUDY, f->locale, "'%s'",
f->locale)); skillname(SK_WEAPONLESS, f->locale));
} }
} }
} }
@ -891,7 +896,8 @@ static int nrand(int start, int sub)
if (rng_int() % 100 < start) if (rng_int() % 100 < start)
res++; res++;
start -= sub; start -= sub;
} while (start > 0); }
while (start > 0);
return res; return res;
} }
@ -925,8 +931,8 @@ void spawn_dragons(void)
if (verbosity >= 2) { if (verbosity >= 2) {
log_printf("%d %s in %s.\n", u->number, log_printf("%d %s in %s.\n", u->number,
LOC(default_locale, rc_name(u->race, u->number != 1)), regionname(r, LOC(default_locale,
NULL)); rc_name(u->race, u->number != 1)), regionname(r, NULL));
} }
name_unit(u); name_unit(u);
@ -1000,8 +1006,8 @@ void spawn_undead(void)
if (verbosity >= 2) { if (verbosity >= 2) {
log_printf("%d %s in %s.\n", u->number, log_printf("%d %s in %s.\n", u->number,
LOC(default_locale, rc_name(u->race, u->number != 1)), regionname(r, LOC(default_locale,
NULL)); rc_name(u->race, u->number != 1)), regionname(r, NULL));
} }
{ {

View File

@ -88,6 +88,8 @@ static void equip_newunits(const struct equipment *eq, struct unit *u)
case RC_CENTAUR: case RC_CENTAUR:
rsethorses(r, 250 + rng_int() % 51 + rng_int() % 51); rsethorses(r, 250 + rng_int() % 51 + rng_int() % 51);
break; break;
default:
break;
} }
} }