pioneerspacesim / pioneer

A game of lonely space adventure
https://pioneerspacesim.net
1.62k stars 376 forks source link

Uninitialised variables #382

Closed Brianetta closed 12 years ago

Brianetta commented 13 years ago

p1, p2 and p3 in CustomSystem.h (with many instances of p1) are causing compiler warnings:

In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSystem>::bodies(lua_State*)’:
CustomSystem.h:152: warning: ‘p2’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::eccentricity(lua_State*)’:
CustomSystem.h:89: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSystem>::add_to_sector(lua_State*)’:
CustomSystem.h:153: warning: ‘p3’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::life(lua_State*)’:
CustomSystem.h:103: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::semi_major_axis(lua_State*)’:
CustomSystem.h:88: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::mass(lua_State*)’:
CustomSystem.h:86: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::radius(lua_State*)’:
CustomSystem.h:85: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::ice_cover(lua_State*)’:
CustomSystem.h:102: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::ocean_cover(lua_State*)’:
CustomSystem.h:101: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::atmos_oxidizing(lua_State*)’:
CustomSystem.h:100: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::atmos_density(lua_State*)’:
CustomSystem.h:99: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::volcanicity(lua_State*)’:
CustomSystem.h:98: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::metallicity(lua_State*)’:
CustomSystem.h:97: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::axial_tilt(lua_State*)’:
CustomSystem.h:95: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::rotation_period(lua_State*)’:
CustomSystem.h:94: warning: ‘p1’ may be used uninitialized in this function
In file included from CustomSystem.cpp:2:
CustomSystem.h: In member function ‘int OOLUA::Proxy_class<CustomSBody>::orbital_offset(lua_State*)’:
CustomSystem.h:90: warning: ‘p1’ may be used uninitialized in this function

also in PiLuaClasses.cpp and PiLuaClasses.h:

PiLuaClasses.cpp: In function ‘int static_matrix::scale(lua_State*)’:
PiLuaClasses.cpp:23: warning: ‘p1’ may be used uninitialized in this function
PiLuaClasses.cpp: In function ‘int static_matrix::translation(lua_State*)’:
PiLuaClasses.cpp:20: warning: ‘p1’ may be used uninitialized in this function
PiLuaClasses.cpp: In function ‘int static_matrix::rotation(lua_State*)’:
PiLuaClasses.cpp:17: warning: ‘p2’ may be used uninitialized in this function
In file included from PiLuaClasses.cpp:2:
PiLuaClasses.h: In member function ‘int OOLUA::Proxy_class<pi_vector>::dot(lua_State*) const’:
PiLuaClasses.h:99: warning: ‘p1’ may be used uninitialized in this function
In file included from PiLuaClasses.cpp:2:
PiLuaClasses.h: In member function ‘int OOLUA::Proxy_class<pi_vector>::cross(lua_State*) const’:
PiLuaClasses.h:100: warning: ‘p1’ may be used uninitialized in this function
PiLuaClasses.cpp: In function ‘int static_matrix::orient(lua_State*)’:
PiLuaClasses.cpp:26: warning: ‘p3’ may be used uninitialized in this function
PiLuaClasses.cpp:26: warning: ‘p2’ may be used uninitialized in this function
PiLuaClasses.cpp:26: warning: ‘p1’ may be used uninitialized in this function
johnbartholomew commented 13 years ago

These are in OOLua macros -- they'll go away when the last few bits using OOLua are removed.

Brianetta commented 13 years ago

In which case, whoever removes them can close this call from their commit. (-:

robn commented 13 years ago

That'll be me. Its my next job after 3dgalaxy. OOLua will be gone by alpha 14 :)

richardpl commented 13 years ago
GeoSphereStyle.cpp: In member function 'vector3d GeoSphereStyle::GetColor(const vector3d&, double, const vector3d&)':
GeoSphereStyle.cpp:2243: warning: 'grass2' may be used uninitialized in this function
GeoSphereStyle.cpp:2243: warning: 'grass' may be used uninitialized in this function
GeoSphereStyle.cpp:2243: warning: 'sand2' may be used uninitialized in this function
GeoSphereStyle.cpp:2243: warning: 'sand' may be used uninitialized in this function
GeoSphereStyle.cpp:2243: warning: 'mud' may be used uninitialized in this function
GeoSphereStyle.cpp:2243: warning: 'rock2' may be used uninitialized in this function
GeoSphereStyle.cpp:2243: warning: 'rock' may be used uninitialized in this function
robn commented 12 years ago

master now compiles with gcc 4.6.1 without warnings.

Brianetta commented 12 years ago

Awesome. (-: