diff options
author | smatz <smatz@openttd.org> | 2008-03-15 13:21:31 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-03-15 13:21:31 +0000 |
commit | bfae49aeb2affaf239f7e9b04b6b7e226830e962 (patch) | |
tree | 430a2db18c790d538b3473d93a0c95f2afbdde7d | |
parent | 5db7288ea961e1418d0983d8ef4c08c32d2fc879 (diff) | |
download | openttd-bfae49aeb2affaf239f7e9b04b6b7e226830e962.tar.xz |
(svn r12368) -Codechange: use explicit body for loops and conditions and remove -Wno-empty-body from the configure script
-rw-r--r-- | config.lib | 6 | ||||
-rw-r--r-- | src/newgrf.cpp | 2 | ||||
-rw-r--r-- | src/newgrf_gui.cpp | 10 | ||||
-rw-r--r-- | src/newgrf_station.cpp | 4 | ||||
-rw-r--r-- | src/settings.cpp | 6 | ||||
-rw-r--r-- | src/string_func.h | 4 | ||||
-rw-r--r-- | src/train_cmd.cpp | 4 |
7 files changed, 15 insertions, 21 deletions
diff --git a/config.lib b/config.lib index 75f4acbad..b75540888 100644 --- a/config.lib +++ b/config.lib @@ -970,12 +970,6 @@ make_cflags_and_ldflags() { if [ $cc_version -ge 42 ]; then CFLAGS="$CFLAGS -fno-strict-overflow" fi - - # GCC 4.3+ gives a warning about empty body of - # loops and conditions - if [ $cc_version -ge 43 ]; then - CFLAGS="$CFLAGS -Wno-empty-body" - fi fi if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 476747f95..37c1629e9 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -4644,7 +4644,7 @@ static void DefineGotoLabel(byte *buf, int len) } else { /* Attach the label to the end of the list */ GRFLabel *l; - for (l = _cur_grffile->label; l->next != NULL; l = l->next); + for (l = _cur_grffile->label; l->next != NULL; l = l->next) {} l->next = label; } diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 831490c05..f153caced 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -179,7 +179,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e) const GRFConfig *c; uint i = (e->we.click.pt.y - w->widget[ANGRFW_GRF_LIST].top) / 10 + w->vscroll.pos; - for (c = _all_grfs; c != NULL && i > 0; c = c->next, i--); + for (c = _all_grfs; c != NULL && i > 0; c = c->next, i--) {} WP(w, newgrf_add_d).sel = c; SetWindowDirty(w); break; @@ -304,7 +304,7 @@ static void SetupNewGRFWindow(Window *w) const GRFConfig *c; int i; - for (c = *WP(w, newgrf_d).list, i = 0; c != NULL; c = c->next, i++); + for (c = *WP(w, newgrf_d).list, i = 0; c != NULL; c = c->next, i++) {} w->vscroll.cap = (w->widget[SNGRFS_FILE_LIST].bottom - w->widget[SNGRFS_FILE_LIST].top) / 14 + 1; SetVScrollCount(w, i); @@ -327,9 +327,9 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed) ReloadNewGRFData(); /* Show new, updated list */ - for (c = *nd->list; c != NULL && c != nd->sel; c = c->next, i++); + for (c = *nd->list; c != NULL && c != nd->sel; c = c->next, i++) {} CopyGRFConfigList(nd->list, *nd->orig_list, false); - for (c = *nd->list; c != NULL && i > 0; c = c->next, i--); + for (c = *nd->list; c != NULL && i > 0; c = c->next, i--) {} nd->sel = c; SetWindowDirty(w); @@ -474,7 +474,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) GRFConfig *c; uint i = (e->we.click.pt.y - w->widget[SNGRFS_FILE_LIST].top) / 14 + w->vscroll.pos; - for (c = *WP(w, newgrf_d).list; c != NULL && i > 0; c = c->next, i--); + for (c = *WP(w, newgrf_d).list; c != NULL && i > 0; c = c->next, i--) {} WP(w, newgrf_d).sel = c; SetWindowDirty(w); diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 51fef9d35..aefef9ed1 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -105,7 +105,7 @@ StringID GetStationClassName(StationClassID sclass) uint GetNumStationClasses() { uint i; - for (i = 0; i < STAT_CLASS_MAX && _station_classes[i].id != 0; i++); + for (i = 0; i < STAT_CLASS_MAX && _station_classes[i].id != 0; i++) {} return i; } @@ -724,7 +724,7 @@ void DeallocateSpecFromStation(Station* st, byte specindex) /* If this was the highest spec index, reallocate */ if (specindex == st->num_specs - 1) { - for (; st->speclist[st->num_specs - 1].grfid == 0 && st->num_specs > 1; st->num_specs--); + for (; st->speclist[st->num_specs - 1].grfid == 0 && st->num_specs > 1; st->num_specs--) {} if (st->num_specs > 1) { st->speclist = ReallocT(st->speclist, st->num_specs); diff --git a/src/settings.cpp b/src/settings.cpp index 072e4eb18..7a257bf64 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -236,7 +236,7 @@ static IniFile *ini_load(const char *filename) while (fgets(buffer, sizeof(buffer), in)) { /* trim whitespace from the left side */ - for (s = buffer; *s == ' ' || *s == '\t'; s++); + for (s = buffer; *s == ' ' || *s == '\t'; s++) {} /* trim whitespace from right side. */ e = s + strlen(s); @@ -278,10 +278,10 @@ static IniFile *ini_load(const char *filename) /* find end of keyname */ if (*s == '\"') { s++; - for (t = s; *t != '\0' && *t != '\"'; t++); + for (t = s; *t != '\0' && *t != '\"'; t++) {} if (*t == '\"') *t = ' '; } else { - for (t = s; *t != '\0' && *t != '=' && *t != '\t' && *t != ' '; t++); + for (t = s; *t != '\0' && *t != '=' && *t != '\t' && *t != ' '; t++) {} } /* it's an item in an existing group */ diff --git a/src/string_func.h b/src/string_func.h index 074dc0837..3a4303293 100644 --- a/src/string_func.h +++ b/src/string_func.h @@ -48,7 +48,7 @@ static inline bool StrEmpty(const char *s) { return s == NULL || s[0] == '\0'; } static inline int ttd_strnlen(const char *str, int maxlen) { const char *t; - for (t = str; *t != '\0' && t - str < maxlen; t++); + for (t = str; *t != '\0' && t - str < maxlen; t++) {} return t - str; } @@ -128,7 +128,7 @@ static inline bool IsUtf8Part(char c) static inline char *Utf8PrevChar(const char *s) { const char *ret = s; - while (IsUtf8Part(*--ret)); + while (IsUtf8Part(*--ret)) {} return (char*)ret; } diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 38c35609a..5a830608d 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1214,7 +1214,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p { Vehicle *v; - for (v = src; GetNextVehicle(v) != NULL; v = GetNextVehicle(v)); + for (v = src; GetNextVehicle(v) != NULL; v = GetNextVehicle(v)) {} GetLastEnginePart(v)->SetNext(dst->Next()); } dst->SetNext(src); @@ -3745,7 +3745,7 @@ void ConnectMultiheadedTrains() } Vehicle *w; - for (w = u->Next(); w != NULL && (w->engine_type != u->engine_type || w->u.rail.other_multiheaded_part != NULL); w = GetNextVehicle(w)); + for (w = u->Next(); w != NULL && (w->engine_type != u->engine_type || w->u.rail.other_multiheaded_part != NULL); w = GetNextVehicle(w)) {} if (w != NULL) { /* we found a car to partner with this engine. Now we will make sure it face the right way */ if (IsTrainEngine(w)) { |