Warnings at compile-time (clang/llvm)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Low
|
Mark Scott |
Bug Description
First of all, note that builds compiled with clang has some problems and will currently crash (see bug 744595 for details). That is naturally a lot more severe issue which should be sorted out, before we can start using clang normally.
However, compiling with clang will output a ton of warnings (a lot more than GCC). I realize in the current state it looks rather noisy (more than 27000 lines), however I believe that fixing these warnings will sort out issues in the code, and also make it easier to spot when new warnings are introduced by new code.
At a glance there seem to be a couple of issues which seem to trigger the most warnings:
* Mixed use of struct/class. Declared as one, but refered to as the other in another place. I suspect this could be easily fixed by a) checking what it is declared as in the first place and b) run some combination of find/sed replacing all occurances of "struct name" with "class name" or vice versa.
* Virtual functions are overloaded.
* Several other minor issues
I suspect there is a lot of low-hanging fruit in here, and it might be suitable new contributors. Though note that since clang is not used currently, so consider this EXTREMELY LOW priority. Still, it would always be nice to reduce the amount of warnings :)
PS. See also bug 825957 for warnings reported by GCC, and bug 986611 for issues reported by cppcheck.
Some technical info:
Widelands bzr r6183 compiled with Clang (LLVM) 3.0-1 on Arch.
Compiled with the following options
cmake ../widelands -DCMAKE_
Note that -DWL_EXTRAWARNINGS include -Wextra in addition to -Wall which is enabled by default.
Related branches
- Widelands Developers: Pending requested
-
Diff: 220 lines (+31/-20)13 files modifiedsrc/cookie_priority_queue.h (+8/-4)
src/economy/road.cc (+2/-1)
src/economy/ware_instance.h (+1/-1)
src/editor/editorinteractive.h (+2/-2)
src/gamecontroller.h (+6/-1)
src/graphic/surface.h (+5/-5)
src/io/filesystem/filesystem.h (+1/-1)
src/logic/map.h (+1/-1)
src/logic/productionsite.cc (+1/-1)
src/logic/productionsite.h (+1/-1)
src/md5.h (+1/-1)
src/scripting/luna.h (+1/-0)
src/wui/interactive_base.h (+1/-1)
- Widelands Developers: Pending requested
-
Diff: 102 lines (+10/-15)6 files modifiedsrc/economy/idleworkersupply.h (+1/-2)
src/economy/ware_instance.cc (+1/-2)
src/io/filesystem/zip_filesystem.h (+4/-6)
src/io/streamread.h (+1/-1)
src/logic/building.h (+2/-3)
src/wlapplication.cc (+1/-1)
- Widelands Developers: Pending requested
-
Diff: 115 lines (+15/-9)8 files modifiedsrc/logic/editor_game_base.cc (+1/-1)
src/logic/game.cc (+1/-1)
src/logic/soldier.cc (+2/-1)
src/logic/warehouse.cc (+2/-2)
src/map_io/widelands_map_building_data_packet.cc (+1/-1)
src/network/nethost.cc (+1/-1)
src/upcast.h (+5/-0)
src/wui/general_statistics_menu.cc (+2/-2)
- SirVer: Approve
-
Diff: 1168 lines (+181/-134)51 files modifiedcmake/codecheck/CodeCheck.py (+22/-25)
cmake/codecheck/rules/missing_padding (+4/-1)
cmake/codecheck/run_tests.py (+38/-0)
src/economy/economy.cc (+1/-1)
src/economy/fleet.cc (+5/-5)
src/editor/tools/editor_decrease_height_tool.cc (+2/-2)
src/editor/tools/editor_decrease_resources_tool.cc (+1/-1)
src/editor/tools/editor_draw_tool.cc (+4/-4)
src/editor/tools/editor_increase_height_tool.cc (+1/-1)
src/editor/tools/editor_increase_resources_tool.cc (+1/-1)
src/editor/tools/editor_info_tool.cc (+1/-1)
src/editor/tools/editor_make_infrastructure_tool.cc (+1/-1)
src/editor/tools/editor_noise_height_tool.cc (+1/-1)
src/editor/tools/editor_set_height_tool.cc (+2/-2)
src/editor/tools/editor_set_origin_tool.cc (+2/-2)
src/editor/tools/editor_set_resources_tool.cc (+2/-2)
src/editor/tools/editor_set_terrain_tool.cc (+2/-2)
src/graphic/render/gameview.cc (+10/-10)
src/logic/carrier.cc (+1/-1)
src/logic/immovable.cc (+1/-1)
src/logic/legacy.cc (+2/-2)
src/logic/mapastar.h (+1/-1)
src/logic/production_program.cc (+2/-2)
src/logic/productionsite.cc (+2/-2)
src/logic/warehouse.cc (+7/-7)
src/logic/warehouse.h (+1/-1)
src/logic/worker.cc (+7/-7)
src/map_io/widelands_map_bob_data_packet.cc (+1/-1)
src/map_io/widelands_map_bobdata_data_packet.cc (+1/-1)
src/map_io/widelands_map_ware_data_packet.cc (+1/-1)
src/map_io/widelands_map_waredata_data_packet.cc (+1/-1)
src/network/netclient.cc (+7/-3)
src/network/nethost.cc (+1/-1)
src/scripting/lua_bases.cc (+2/-2)
src/scripting/lua_map.cc (+2/-2)
src/scripting/lua_root.cc (+6/-6)
src/scripting/lua_ui.cc (+6/-6)
src/scripting/persistence.cc (+1/-1)
src/scripting/pluto.cc (+1/-1)
src/scripting/test/test_luna.cc (+9/-9)
src/ui_basic/multilinetextarea.cc (+1/-1)
src/ui_basic/panel.cc (+1/-1)
src/ui_basic/textarea.cc (+1/-1)
src/ui_fsmenu/launchSPG.cc (+1/-1)
src/wui/chatoverlay.cc (+1/-1)
src/wui/game_message_menu.cc (+1/-1)
src/wui/multiplayersetupgroup.cc (+3/-3)
src/wui/plot_area.cc (+1/-1)
src/wui/soldierlist.cc (+6/-1)
src/wui/ware_statistics_menu.cc (+1/-1)
src/wui/waresdisplay.cc (+1/-1)
- SirVer: Approve
- Mark Scott: Approve
-
Diff: 198 lines (+19/-16)13 files modifiedsrc/game_io/game_data_packet.h (+1/-1)
src/game_io/game_loader.h (+1/-1)
src/game_io/game_saver.h (+1/-1)
src/graphic/font_handler1.h (+1/-1)
src/io/filesystem/disk_filesystem.h (+2/-1)
src/io/filesystem/filesystem.h (+2/-1)
src/io/filesystem/layered_filesystem.h (+4/-2)
src/io/filesystem/zip_filesystem.h (+2/-3)
src/map_io/widelands_map_data_packet.h (+1/-1)
src/map_io/widelands_map_loader.h (+1/-1)
src/map_io/widelands_map_object_packet.h (+1/-1)
src/map_io/widelands_map_saver.h (+1/-1)
src/profile/profile.h (+1/-1)
- Mark Scott: Needs Resubmitting
- SirVer: Needs Fixing
-
Diff: 1018 lines (+148/-139)30 files modifiedsrc/compile_diagnostics.h (+18/-2)
src/editor/editorinteractive.h (+1/-1)
src/editor/tools/editor_set_port_space_tool.cc (+1/-2)
src/editor/tools/editor_set_port_space_tool.h (+4/-5)
src/editor/tools/editor_tool.h (+2/-1)
src/editor/tools/editor_tool_action.h (+1/-1)
src/editor/ui_menus/editor_player_menu.h (+2/-4)
src/gamecontroller.h (+2/-2)
src/graphic/text/rt_render.cc (+1/-4)
src/io/filesystem/filesystem.cc (+15/-25)
src/io/filesystem/filesystem.h (+9/-3)
src/logic/building.h (+1/-1)
src/logic/game.h (+4/-4)
src/logic/player.cc (+2/-2)
src/logic/playercommand.cc (+6/-9)
src/logic/playercommand.h (+7/-9)
src/logic/replay.cc (+14/-13)
src/logic/replay.h (+9/-8)
src/logic/ship.h (+1/-1)
src/map_io/widelands_map_players_view_data_packet.cc (+3/-3)
src/md5.h (+5/-4)
src/network/netclient.cc (+2/-2)
src/network/nethost.cc (+1/-1)
src/network/network.cc (+3/-3)
src/network/network.h (+5/-5)
src/scripting/pluto.cc (+1/-1)
src/ui_basic/table.cc (+0/-1)
src/ui_basic/table.h (+18/-12)
src/ui_basic/window.h (+4/-3)
src/wui/warehousewindow.cc (+6/-7)
Changed in widelands: | |
status: | Triaged → In Progress |
Updated list of warnings. High five to aber for reducing it by 20.000 lines :)