You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The project compiles without issues, as it does with -O2 or -O3.
Actual result
Compiler logs this warning:
In file included from /home/user/projects/openttd-jgrpp/OpenTTD-patches/src/station_map.h:13:0,
from /home/user/projects/openttd-jgrpp/OpenTTD-patches/src/signal.cpp:12:
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/rail_map.h: In function ‘void UpdateSignalsAroundSegment(SigFlags)’:
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/rail_map.h:452:68: warning: ‘trackdir’ may be used uninitialized in this function [-Wmaybe-uninitialized]
SetSignalStates(tile, GetSignalStates(tile) | SignalAlongTrackdir(trackdir));
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/signal.cpp:411:11: note: ‘trackdir’ was declared here
Trackdir trackdir;
^~~~~~~~
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/signal.cpp: In function ‘SigFlags ExploreSegment(Owner)’:
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/signal.cpp:343:26: warning: ‘enterdir’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (dir != enterdir && (tracks & _enterdir_to_trackbits[dir])) { // any track incidating?
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/signal.cpp:121:4: warning: ‘tile’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (this->data[i].tile == tile && this->data[i].dir == dir) {
^~
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/signal.cpp:271:12: note: ‘tile’ was declared here
TileIndex tile;
^~~~
In file included from /home/user/projects/openttd-jgrpp/OpenTTD-patches/src/tile_map.h:14:0,
from /home/user/projects/openttd-jgrpp/OpenTTD-patches/src/rail_map.h:17,
from /home/user/projects/openttd-jgrpp/OpenTTD-patches/src/station_map.h:13,
from /home/user/projects/openttd-jgrpp/OpenTTD-patches/src/signal.cpp:12:
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/map_func.h: In function ‘SigSegState UpdateSignalsInBuffer(Owner)’:
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/map_func.h:345:29: warning: ‘dir’ may be used uninitialized in this function [-Wmaybe-uninitialized]
assert(IsValidDiagDirection(dir));
^
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/signal.cpp:478:16: note: ‘dir’ was declared here
DiagDirection dir;
^~~
In file included from /home/user/projects/openttd-jgrpp/OpenTTD-patches/src/station_map.h:13:0,
from /home/user/projects/openttd-jgrpp/OpenTTD-patches/src/signal.cpp:12:
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/rail_map.h:39:30: warning: ‘tile’ may be used uninitialized in this function [-Wmaybe-uninitialized]
return (RailTileType)GB(_m[t].m5, 6, 2);
^
/home/user/projects/openttd-jgrpp/OpenTTD-patches/src/signal.cpp:477:12: note: ‘tile’ was declared here
TileIndex tile;
^~~~
Steps to reproduce
Check out master, run cmake with CXXFLAGS='-Og -g'. Note this is the only warning produced.
Notes
I have had a preliminary look at the code, and this appears to be a benign warning; so possibly just initializing the variables appropriately upon declaration is enough to silence it.
The text was updated successfully, but these errors were encountered:
Version of OpenTTD
Since f44a9a5, I expect.
Expected result
The project compiles without issues, as it does with
-O2
or-O3
.Actual result
Compiler logs this warning:
Steps to reproduce
Check out master, run cmake with CXXFLAGS='-Og -g'. Note this is the only warning produced.
Notes
I have had a preliminary look at the code, and this appears to be a benign warning; so possibly just initializing the variables appropriately upon declaration is enough to silence it.
The text was updated successfully, but these errors were encountered: