The International Simutrans Forum

 

Author Topic: no asserts in simutrans-experimental  (Read 3691 times)

0 Members and 1 Guest are viewing this topic.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9353
  • Languages: De,EN,JP
no asserts in simutrans-experimental
« on: August 01, 2010, 06:41:43 PM »
Why are all asserts switched off, when I download the current source in config.template? That is a very bad idea, especially since this is a development version.

(On a side not, I get more than 350 warning, when compiling, lots of "statement has no effect" and happily converting uint16 to floats and back and "ignored trigraphs". Imho this needs to be addressed, since some may hid real errors. Worse, linking fails, isnce bzlib.h is INCLUDED in the main dir. This will fail when using mingw or on another platform using its own bzlib.h file.)
« Last Edit: August 01, 2010, 06:48:34 PM by prissi »

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18037
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: no asserts in simutrans-experimental
« Reply #1 on: August 01, 2010, 07:07:17 PM »
Prissi,

thank you for the feedback in relation to the setup of Simutrans-Experimental - that is most helpful. The reason that the asserts are turned off is because it is designed to be able to be compiled either with or without the symbol DEBUG being defined, for release builds without it being defined (with no asserts) and for debug builds with it defined (with asserts). I use MSVC++, and have it set up there: all of my debug builds have asserts enabled. I do not use Linux, so I do not use a makefile based configuration, which has been set up by others. If DEBUG is undefined on what are supposed to be debug builds there, then that is an error. Are you sure that the template is the one that refers to debug builds?

As to the warnings, is this compiling in MSVC++ or MINGW? I do not notice a significant number of additional warnings compared to Standard when using MSVC++. I do not use MINGW; can you upload an output of your warnings so that I can see the issues? Is this the -devel branch that you are using, incidentally?

As to the MINGW issue in relation to the bzlib.h file, I was not aware of that. How should I address that problem? Thank you again for your feedback - most helpful :-)

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9353
  • Languages: De,EN,JP
Re: no asserts in simutrans-experimental
« Reply #2 on: August 01, 2010, 08:47:31 PM »
bzlib.h must not be include in your sourcecode. Remove it form repositiory should do this (git rm bzlib.h ot how this command is called in git). In loadsave.h, it should be "#include <bzlib.h>.

In config.defualt the last line is the -DNDBEUG Just delete this line should remove this assertion problem.

I could not use MSVC, since I have to use MSVC express 5.0: this is the last version supported on W2k, which is my backup machine.

Here comes the error messages with Mingw:
"xyz has virtual functions but non-virtual destructor" should be taken serious: just make the destructor virtual
"statement has no effect": usually a logic error. You should check these
"passing `double' for converting 1 of `int abs(int)": use fabs()
"gui/savegame_frame.cc:636:21: warning: trigraph ??- ignored, use -trigraphs to enable": whatever you did, it seems not very portable
"comparing signed/unsigned": may hide errors, but are also some present in standard
Missing end of line at end of file and unused parameters you may ignore.

Code: [Select]
In file included from bauer/fabrikbauer.cc:11:
bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
bauer/fabrikbauer.cc: In static member function `static fabrik_t* fabrikbauer_t::baue_fabrik(karte_t*, koord3d*, const fabrik_besch_t*, int, koord3d, spieler_t*)':
bauer/fabrikbauer.cc:468: warning: comparison between signed and unsigned integer expressions
bauer/fabrikbauer.cc:468: warning: comparison between signed and unsigned integer expressions
bauer/fabrikbauer.cc:469: warning: comparison between signed and unsigned integer expressions
bauer/fabrikbauer.cc:469: warning: comparison between signed and unsigned integer expressions
bauer/fabrikbauer.cc: In static member function `static int fabrikbauer_t::increase_industry_density(karte_t*, bool, bool)':
bauer/fabrikbauer.cc:967: warning: converting to `uint32' from `float'
bauer/fabrikbauer.cc:1065:2: warning: no newline at end of file
In file included from bauer/hausbauer.cc:36:
bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
bauer/warenbauer.cc: In static member function `static bool warenbauer_t::register_besch(ware_besch_t*)':
bauer/warenbauer.cc:121: warning: cast from `const ware_besch_t* const' to `ware_besch_t*' discards qualifiers from pointer target type
In file included from besch/reader/building_reader.cc:3:
besch/reader/../../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
besch/reader/factory_reader.cc: In member function `virtual obj_besch_t* factory_reader_t::read_node(FILE*, obj_node_info_t&)':
besch/reader/factory_reader.cc:293: warning: comparison is always true due to limited range of data type
besch/reader/factory_reader.cc:296: warning: converting to `uint16' from `float'
besch/reader/factory_reader.cc:359: warning: converting to `uint16' from `float'
besch/reader/vehicle_reader.cc: In member function `virtual obj_besch_t* vehicle_reader_t::read_node(FILE*, obj_node_info_t&)':
besch/reader/vehicle_reader.cc:188: warning: comparison is always true due to limited range of data type
boden/grund.cc: In member function `virtual void grund_t::rdwr(loadsave_t*)':
boden/grund.cc:210: warning: cast from `const char*' to `void*' discards qualifiers from pointer target type
boden/wege/weg.cc: In destructor `virtual weg_t::~weg_t()':
boden/wege/weg.cc:194: warning: converting to `sint32' from `double'
boden/wege/weg.cc: In member function `virtual void weg_t::laden_abschliessen()':
boden/wege/weg.cc:608: warning: converting to `sint32' from `double'
In file included from dataobj/dingliste.cc:9:
dataobj/../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
dataobj/einstellungen.cc: In member function `void einstellungen_t::rdwr(loadsave_t*)':
dataobj/einstellungen.cc:647: warning: unused variable 'password'
dataobj/einstellungen.cc:810: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:816: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:853: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:854: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:856: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:857: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:858: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:859: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:860: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:861: warning: converting to `sint32' from `float'
dataobj/einstellungen.cc:862: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:863: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:974: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:1000: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc: In member function `void einstellungen_t::parse_simuconf(tabfile_t&, sint16&, sint16&, sint16&, cstring_t&)':
dataobj/einstellungen.cc:1056: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:1097: warning: cast from `const char*' to `void*' discards qualifiers from pointer target type
dataobj/einstellungen.cc:1294: warning: converting to `sint32' from `float'
dataobj/einstellungen.cc:1321: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:1322: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:1323: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:1324: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:1325: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:1333: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:1338: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:1339: warning: converting to `sint64' from `float'
dataobj/einstellungen.cc:1357: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:1358: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:1359: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:1396: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:1397: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:1398: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:1399: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:1400: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:1401: warning: converting to `uint16' from `float'
dataobj/einstellungen.cc:1428: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1430: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1438: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1440: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1448: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1450: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1458: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1460: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1468: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1470: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1478: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1480: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1540: warning: passing `float' for converting 2 of `int tabfileobj_t::get_int(const char*, int)'
dataobj/einstellungen.cc:1541: warning: converting to `uint16' from `float'
In file included from dataobj/fahrplan.cc:14:
dataobj/../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
dataobj/loadsave.cc: In member function `void loadsave_t::rdwr_str(char*, size_t)':
dataobj/loadsave.cc:738: warning: comparison between signed and unsigned integer expressions
dataobj/loadsave.cc:772: warning: comparison between signed and unsigned integer expressions
dataobj/loadsave.cc:795: warning: comparison between signed and unsigned integer expressions
dataobj/loadsave.cc: At global scope:
dataobj/loadsave.cc:961: warning: unused parameter 'mode'
dataobj/network.cc: In function `void network_core_shutdown()':
dataobj/network.cc:610: warning: cast from `const char*' to `void*' discards qualifiers from pointer target type
dataobj/network_cmd.cc: In member function `virtual void nwc_tool_t::do_command(karte_t*)':
dataobj/network_cmd.cc:402: warning: cast from `const char*' to `void*' discards qualifiers from pointer target type
dataobj/network_cmd.cc:413: warning: cast from `const char*' to `void*' discards qualifiers from pointer target type
In file included from dataobj/replace_data.cc:1:
dataobj/replace_data.h:122:7: warning: no newline at end of file
dataobj/replace_data.cc: In member function `void replace_data_t::sprintf_replace(cbuffer_t&) const':
dataobj/replace_data.cc:85: warning: statement has no effect
dataobj/replace_data.cc:85: warning: statement with no effect
dataobj/replace_data.cc: In member function `bool replace_data_t::sscanf_replace(const char*)':
dataobj/replace_data.cc:119: warning: statement with no effect
dataobj/replace_data.cc:268:2: warning: no newline at end of file
In file included from dings/gebaeude.cc:9:
dings/../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
dings/gebaeude.cc: In member function `virtual void gebaeude_t::entferne(spieler_t*)':
dings/gebaeude.cc:959: warning: passing `float' for converting 2 of `static void spieler_t::accounting(spieler_t*, sint64, koord, player_cost)'
dings/leitung2.cc: In member function `void senke_t::step(long int)':
dings/leitung2.cc:723: warning: comparison between signed and unsigned integer expressions
dings/leitung2.cc:791: warning: converting to `uint32' from `double'
dings/leitung2.cc:807: warning: passing `double' for converting 1 of `void stadt_t::add_power(uint32)'
dings/leitung2.cc:808: warning: passing `double' for converting 1 of `void stadt_t::add_power_demand(uint32)'
dings/leitung2.cc:812: warning: converting to `sint32' from `double'
In file included from gui/citybuilding_edit.cc:24:
gui/../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
gui/climates.cc: In member function `virtual bool climate_gui_t::action_triggered(gui_action_creator_t*, value_t)':
gui/climates.cc:232: warning: cast from `const sint16*' to `sint16*' discards qualifiers from pointer target type
gui/components/gui_component_table.cc:126: warning: unused parameter 'x'
gui/components/gui_component_table.cc:126: warning: unused parameter 'y'
In file included from gui/components/../replace_frame.h:23,
                 from gui/components/gui_convoy_assembler.cc:14:
gui/components/../../dataobj/replace_data.h:122:7: warning: no newline at end of file
In file included from gui/components/gui_convoy_assembler.cc:14:
gui/components/../replace_frame.h:147:7: warning: no newline at end of file
In file included from gui/components/gui_convoy_assembler.cc:19:
gui/components/../../convoy.h: In member function `uint32 convoy_t::get_force(double)':
gui/components/../../convoy.h:250: warning: passing `double' for converting 1 of `int abs(int)'
gui/components/../../convoy.h: At global scope:
gui/components/../../convoy.h:334: warning: unused parameter 'vehicle'
gui/components/../../convoy.h:335: warning: unused parameter 'adverse'
gui/components/../../convoy.h:336: warning: unused parameter 'freight'
gui/components/../../convoy.h: In constructor `potential_convoy_t::potential_convoy_t(karte_t&, vector_tpl<const vehikel_besch_t*>&)':
gui/components/../../convoy.h:490: warning: `potential_convoy_t::vehicles' will be initialized after
gui/components/../../convoy.h:489: warning:   `karte_t&potential_convoy_t::world'
gui/components/../../convoy.h:499: warning:   when initialized here
gui/components/../../convoy.h: At global scope:
gui/components/../../convoy.h:507: warning: `class vehicle_as_potential_convoy_t' has virtual functions but non-virtual destructor
In file included from gui/components/gui_convoy_assembler.cc:25:
gui/components/../../dataobj/replace_data.h:122:7: warning: no newline at end of file
gui/components/gui_convoy_assembler.h: In constructor `gui_convoy_assembler_t::gui_convoy_assembler_t(karte_t*, waytype_t, signed char, bool)':
gui/components/gui_convoy_assembler.h:115: warning: `gui_convoy_assembler_t::scrolly_waggons' will be initialized after
gui/components/gui_convoy_assembler.h:61: warning:   `bool gui_convoy_assembler_t::way_electrified'
gui/components/gui_convoy_assembler.cc:70: warning:   when initialized here
In file included from gui/components/gui_convoy_label.cc:15:
gui/components/../../convoy.h: In member function `uint32 convoy_t::get_force(double)':
gui/components/../../convoy.h:250: warning: passing `double' for converting 1 of `int abs(int)'
gui/components/../../convoy.h: At global scope:
gui/components/../../convoy.h:334: warning: unused parameter 'vehicle'
gui/components/../../convoy.h:335: warning: unused parameter 'adverse'
gui/components/../../convoy.h:336: warning: unused parameter 'freight'
gui/components/../../convoy.h: In constructor `potential_convoy_t::potential_convoy_t(karte_t&, vector_tpl<const vehikel_besch_t*>&)':
gui/components/../../convoy.h:490: warning: `potential_convoy_t::vehicles' will be initialized after
gui/components/../../convoy.h:489: warning:   `karte_t&potential_convoy_t::world'
gui/components/../../convoy.h:499: warning:   when initialized here
gui/components/../../convoy.h: At global scope:
gui/components/../../convoy.h:507: warning: `class vehicle_as_potential_convoy_t' has virtual functions but non-virtual destructor
gui/components/gui_table.cc:53: warning: unused parameter 'old_size'
gui/components/gui_table.cc:151: warning: unused parameter 'offset'
gui/components/gui_table.cc:151: warning: unused parameter 'x'
gui/components/gui_table.cc:151: warning: unused parameter 'y'
gui/components/gui_table.cc: In member function `virtual int gui_table_column_list_t::compare_items(const gui_table_column_t*, const gui_table_column_t*) const':
gui/components/gui_table.cc:285: warning: comparison between signed and unsigned integer expressions
gui/components/gui_table.cc: In member function `virtual int gui_table_row_list_t::compare_items(const gui_table_row_t*, const gui_table_row_t*) const':
gui/components/gui_table.cc:318: warning: comparison between signed and unsigned integer expressions
In file included from gui/replace_frame.h:23,
                 from gui/convoi_info_t.cc:11:
gui/../dataobj/replace_data.h:122:7: warning: no newline at end of file
In file included from gui/convoi_info_t.cc:11:
gui/replace_frame.h:147:7: warning: no newline at end of file
In file included from gui/convoi_info_t.cc:21:
gui/../convoy.h: In member function `uint32 convoy_t::get_force(double)':
gui/../convoy.h:250: warning: passing `double' for converting 1 of `int abs(int)'
gui/../convoy.h: At global scope:
gui/../convoy.h:334: warning: unused parameter 'vehicle'
gui/../convoy.h:335: warning: unused parameter 'adverse'
gui/../convoy.h:336: warning: unused parameter 'freight'
gui/../convoy.h: In constructor `potential_convoy_t::potential_convoy_t(karte_t&, vector_tpl<const vehikel_besch_t*>&)':
gui/../convoy.h:490: warning: `potential_convoy_t::vehicles' will be initialized after
gui/../convoy.h:489: warning:   `karte_t&potential_convoy_t::world'
gui/../convoy.h:499: warning:   when initialized here
gui/../convoy.h: At global scope:
gui/../convoy.h:507: warning: `class vehicle_as_potential_convoy_t' has virtual functions but non-virtual destructor
In file included from gui/curiosity_edit.cc:23:
gui/../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
gui/goods_frame_t.cc: In constructor `goods_frame_t::goods_frame_t(karte_t*)':
gui/goods_frame_t.cc:74: warning: converting to `uint16' from `float'
gui/goods_frame_t.cc: In static member function `static bool goods_frame_t::compare_goods(uint16, uint16)':
gui/goods_frame_t.cc:185: warning: converting to `uint16' from `double'
gui/goods_frame_t.cc:219: warning: converting to `sint32' from `float'
gui/goods_frame_t.cc:224: warning: converting to `sint32' from `float'
gui/goods_frame_t.cc:235: warning: converting to `sint32' from `float'
gui/goods_frame_t.cc:240: warning: converting to `sint32' from `float'
gui/goods_frame_t.cc: In member function `virtual bool goods_frame_t::action_triggered(gui_action_creator_t*, value_t)':
gui/goods_frame_t.cc:334: warning: converting to `uint16' from `float'
gui/goods_frame_t.cc:341: warning: converting to `uint16' from `float'
gui/goods_stats_t.cc: In member function `virtual void goods_stats_t::zeichnen(koord)':
gui/goods_stats_t.cc:57: warning: converting to `uint16' from `float'
gui/goods_stats_t.cc:89: warning: converting to `sint32' from `float'
gui/goods_stats_t.cc:94: warning: converting to `sint32' from `float'
gui/goods_stats_t.cc:106: warning: converting to `sint32' from `float'
gui/goods_stats_t.cc:111: warning: converting to `sint32' from `float'
gui/karte.cc: In member function `void reliefkarte_t::calc_map()':
gui/karte.cc:595: warning: cast from `const uint8*' to `void*' discards qualifiers from pointer target type
gui/loadsave_frame.cc:94: warning: unused parameter 'suffix'
gui/loadsave_frame.cc:94: warning: unused parameter 'path'
gui/loadsave_frame.cc:240:2: warning: no newline at end of file
In file included from gui/money_frame.cc:25:
gui/../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
gui/money_frame.h: In constructor `money_frame_t::money_frame_t(spieler_t*)':
gui/money_frame.h:110: warning: `money_frame_t::headquarter_view' will be initialized after
gui/money_frame.h:55: warning:   `gui_label_t money_frame_t::credit_limit'
gui/money_frame.cc:164: warning:   when initialized here
gui/pakselector.cc:22: warning: unused parameter 'suffix'
gui/pakselector.cc:22: warning: unused parameter 'path'
In file included from gui/replace_frame.h:23,
                 from gui/replace_frame.cc:8:
gui/../dataobj/replace_data.h:122:7: warning: no newline at end of file
In file included from gui/replace_frame.cc:8:
gui/replace_frame.h:147:7: warning: no newline at end of file
gui/replace_frame.cc: In member function `void replace_frame_t::layout(koord*)':
gui/replace_frame.cc:221: warning: converting of negative value `-0x000000001' to `unsigned int'
gui/replace_frame.cc:226: warning: comparison between signed and unsigned integer expressions
gui/replace_frame.cc: In member function `void replace_frame_t::update_data()':
gui/replace_frame.cc:331: warning: comparison between signed and unsigned integer expressions
gui/replace_frame.cc:361: warning: comparison between signed and unsigned integer expressions
gui/replace_frame.cc: In member function `uint8 replace_frame_t::get_present_state()':
gui/replace_frame.cc:403: warning: converting of negative value `-0x000000001' to `uint8'
gui/replace_frame.cc: In member function `void replace_frame_t::replace_convoy(convoihandle_t)':
gui/replace_frame.cc:421: warning: comparison between signed and unsigned integer expressions
gui/replace_frame.cc: At global scope:
gui/replace_frame.cc:477: warning: unused parameter 'p'
gui/replace_frame.cc: In member function `sint64 replace_frame_t::calc_total_cost()':
gui/replace_frame.cc:635: warning: unused variable 'test_old_vehicle'
gui/replace_frame.cc:659: warning: unused variable 'possible_upgrade_test'
gui/replace_frame.cc:630: warning: unused variable 'test_new_vehicle'
gui/savegame_frame.cc: In member function `virtual bool savegame_frame_t::action_triggered(gui_action_creator_t*, value_t)':
gui/savegame_frame.cc:375: warning: cast from `const void*' to `gui_table_event_t*' discards qualifiers from pointer target type
gui/savegame_frame.cc: At global scope:
gui/savegame_frame.cc:567: warning: unused parameter 'x'
gui/savegame_frame.cc:567: warning: unused parameter 'y'
gui/savegame_frame.cc:597: warning: unused parameter 'x'
gui/savegame_frame.cc:597: warning: unused parameter 'y'
gui/savegame_frame.cc:636:21: warning: trigraph ??- ignored, use -trigraphs to enable
gui/savegame_frame.cc:636:24: warning: trigraph ??- ignored, use -trigraphs to enable
gui/schedule_list.cc: In member function `virtual bool schedule_list_gui_t::action_triggered(gui_action_creator_t*, value_t)':
gui/schedule_list.cc:360: warning: comparison between signed and unsigned integer expressions
gui/schedule_list.cc: In member function `virtual void schedule_list_gui_t::zeichnen(koord, koord)':
gui/schedule_list.cc:395: warning: comparison between signed and unsigned integer expressions
gui/schedule_list.cc:402: warning: comparison between signed and unsigned integer expressions
gui/settings_frame.h: In constructor `settings_frame_t::settings_frame_t(einstellungen_t*)':
gui/settings_frame.h:46: warning: `settings_frame_t::scrolly_exp_revenue' will be initialized after
gui/settings_frame.h:40: warning:   `gui_scrollpane_t settings_frame_t::scrolly_costs'
gui/settings_frame.cc:36: warning:   when initialized here
gui/settings_stats.cc: In member function `void settings_experimental_revenue_stats_t::read(einstellungen_t*)':
gui/settings_stats.cc:314: warning: unused variable 'read_button'
gui/settings_stats.cc: In member function `void settings_costs_stats_t::read(einstellungen_t*)':
gui/settings_stats.cc:628: warning: unused variable 'read_button'
In file included from gui/welt.cc:21:
gui/../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
gui/welt.cc: In member function `virtual void welt_gui_t::zeichnen(koord, koord)':
gui/welt.cc:566: warning: int format, long int arg (arg 4)
In file included from player/ai.cc:20:
player/../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
In file included from player/ai_goods.cc:14:
player/../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
In file included from player/ai_passenger.cc:17:
player/../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
In file included from player/simplay.cc:34:
player/../bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
player/simplay.cc: In member function `virtual void spieler_t::neuer_monat()':
player/simplay.cc:381: warning: converting to `sint32' from `double'
player/simplay.cc:452: warning: converting to `sint32' from `double'
player/simplay.cc: In member function `sint64 spieler_t::calc_credit_limit()':
player/simplay.cc:556: warning: converting to `sint64' from `double'
player/simplay.cc:557: warning: converting to `sint64' from `double'
player/simplay.cc:565: warning: converting to `sint64' from `float'
In file included from simcity.cc:53:
bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
simcity.cc: In destructor `stadt_t::~stadt_t()':
simcity.cc:1177: warning: cast from `const char*' to `void*' discards qualifiers from pointer target type
simcity.cc: In member function `void stadt_t::calc_internal_passengers()':
simcity.cc:1314: warning: converting to `uint16' from `float'
simcity.cc: In member function `void stadt_t::set_name(const char*)':
simcity.cc:1657: warning: cast from `const char*' to `void*' discards qualifiers from pointer target type
simcity.cc: In member function `void stadt_t::neuer_monat(bool)':
simcity.cc:1846: warning: converting to `sint64' from `float'
simcity.cc:1963: warning: converting to `sint32' from `float'
simcity.cc: In member function `void stadt_t::calc_growth()':
simcity.cc:2045: warning: converting to `uint8' from `float'
simcity.cc:2055: warning: comparison between signed and unsigned integer expressions
simcity.cc:2058: warning: comparison between signed and unsigned integer expressions
simcity.cc:2069: warning: converting to `sint32' from `float'
simcity.cc: In member function `uint16 stadt_t::check_road_connexion(koord3d)':
simcity.cc:2312: warning: converting to `uint16' from `float'
simcity.cc:2314: warning: converting to `uint16' from `float'
simcity.cc: In member function `void stadt_t::step_passagiere()':
simcity.cc:2424: warning: comparison between signed and unsigned integer expressions
simcity.cc:2688: warning: converting to `sint16' from `float'
simcity.cc:2705: warning: converting to `uint8' from `double'
simcity.cc:2716: warning: converting to `sint16' from `float'
simcity.cc:2777: warning: converting to `uint8' from `float'
simcity.cc:2429: warning: unused variable 'passenger_routing_longdistance_chance'
simcity.cc:2941: warning: enumeration value `good' not handled in switch
simcity.cc: In member function `void stadt_t::check_bau_factory(bool)':
simcity.cc:3497: warning: comparison between signed and unsigned integer expressions
simcity.cc: In member function `uint32 stadt_t::get_power_demand() const':
simcity.cc:4331: warning: converting to `uint32' from `float'
simcity.cc: In member function `virtual int road_destination_finder_t::get_kosten(const grund_t*, uint32) const':
simcity.cc:4385: warning: converting to `int' from `double'
simcity.cc:4405:2: warning: no newline at end of file
In file included from convoy.cc:12:
convoy.h: In member function `uint32 convoy_t::get_force(double)':
convoy.h:250: warning: passing `double' for converting 1 of `int abs(int)'
convoy.h: At global scope:
convoy.h:334: warning: unused parameter 'vehicle'
convoy.h:335: warning: unused parameter 'adverse'
convoy.h:336: warning: unused parameter 'freight'
convoy.h: In constructor `potential_convoy_t::potential_convoy_t(karte_t&, vector_tpl<const vehikel_besch_t*>&)':
convoy.h:490: warning: `potential_convoy_t::vehicles' will be initialized after
convoy.h:489: warning:   `karte_t&potential_convoy_t::world'
convoy.h:499: warning:   when initialized here
convoy.h: At global scope:
convoy.h:507: warning: `class vehicle_as_potential_convoy_t' has virtual functions but non-virtual destructor
convoy.cc: In member function `void convoy_t::calc_move(long int, float, const weight_summary_t&, sint32, sint32&, sint32&)':
convoy.cc:189: warning: comparison between signed and unsigned integer expressions
convoy.cc:273: warning: passing `double' for converting 1 of `int abs(int)'
In file included from simconvoi.cc:41:
dataobj/replace_data.h:122:7: warning: no newline at end of file
In file included from simconvoi.cc:54:
convoy.h: In member function `uint32 convoy_t::get_force(double)':
convoy.h:250: warning: passing `double' for converting 1 of `int abs(int)'
convoy.h: At global scope:
convoy.h:334: warning: unused parameter 'vehicle'
convoy.h:335: warning: unused parameter 'adverse'
convoy.h:336: warning: unused parameter 'freight'
convoy.h: In constructor `potential_convoy_t::potential_convoy_t(karte_t&, vector_tpl<const vehikel_besch_t*>&)':
convoy.h:490: warning: `potential_convoy_t::vehicles' will be initialized after
convoy.h:489: warning:   `karte_t&potential_convoy_t::world'
convoy.h:499: warning:   when initialized here
convoy.h: At global scope:
convoy.h:507: warning: `class vehicle_as_potential_convoy_t' has virtual functions but non-virtual destructor
simconvoi.cc: In member function `void convoi_t::increment_odometer()':
simconvoi.cc:517: warning: converting to `uint8' from `float'
simconvoi.cc:522: warning: converting to `uint8' from `float'
simconvoi.cc: In member function `bool convoi_t::add_vehikel(vehikel_t*, bool)':
simconvoi.cc:1511: warning: converting to `sint32' from `float'
simconvoi.cc: In member function `void convoi_t::upgrade_vehicle(uint16, vehikel_t*)':
simconvoi.cc:1603: warning: converting to `sint32' from `float'
simconvoi.cc:1615: warning: converting to `sint32' from `float'
simconvoi.cc: In member function `vehikel_t* convoi_t::remove_vehikel_bei(uint16)':
simconvoi.cc:1665: warning: converting to `sint32' from `float'
simconvoi.cc: In member function `void convoi_t::vorfahren()':
simconvoi.cc:2091: warning: converting to `uint16' from `float'
simconvoi.cc: In member function `void convoi_t::reverse_order(bool)':
simconvoi.cc:2269: warning: statement has no effect
simconvoi.cc: In member function `void convoi_t::rdwr(loadsave_t*)':
simconvoi.cc:2456: warning: converting to `sint32' from `float'
simconvoi.cc:2629: warning: converting to `sint64' from `double'
simconvoi.cc:2647: warning: converting to `sint64' from `double'
simconvoi.cc: In member function `void convoi_t::laden()':
simconvoi.cc:3150: warning: converting to `uint16' from `double'
simconvoi.cc: In member function `sint64 convoi_t::calc_revenue(ware_t&)':
simconvoi.cc:3256: warning: converting to `uint32' from `double'
simconvoi.cc:3263: warning: converting to `uint16' from `float'
simconvoi.cc:3270: warning: converting to `sint32' from `float'
simconvoi.cc:3279: warning: converting to `sint64' from `float'
simconvoi.cc:3280: warning: converting to `sint64' from `float'
simconvoi.cc:3341: warning: converting to `sint64' from `float'
simconvoi.cc:3346: warning: converting to `sint64' from `float'
simconvoi.cc:3358: warning: converting to `sint64' from `float'
simconvoi.cc:3363: warning: converting to `sint64' from `float'
simconvoi.cc:3401: warning: converting to `sint64' from `float'
simconvoi.cc:3415: warning: converting to `sint64' from `float'
simconvoi.cc:3429: warning: converting to `sint64' from `float'
simconvoi.cc:3443: warning: converting to `sint64' from `float'
simconvoi.cc:3459: warning: converting to `sint64' from `float'
simconvoi.cc: In static member function `static uint8 convoi_t::calc_tolerable_comfort(uint16, karte_t*)':
simconvoi.cc:3489: warning: converting to `uint8' from `float'
simconvoi.cc:3501: warning: converting to `uint8' from `float'
simconvoi.cc:3513: warning: converting to `uint8' from `float'
simconvoi.cc:3524: warning: converting to `uint8' from `float'
simconvoi.cc: In static member function `static uint16 convoi_t::calc_adjusted_speed_bonus(uint16, uint32, karte_t*)':
simconvoi.cc:3540: warning: converting to `uint16' from `float'
simconvoi.cc:3548: warning: converting to `uint16' from `double'
simconvoi.cc:3561: warning: converting to `uint16' from `double'
simconvoi.cc:3568: warning: converting to `uint16' from `float'
simconvoi.cc:3569: warning: converting to `uint16' from `double'
simconvoi.cc: In member function `void convoi_t::hat_gehalten(koord, halthandle_t)':
simconvoi.cc:3663: warning: converting of negative value `-0x000000001' to `uint8'
In file included from simfab.cc:51:
bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
simfab.cc: In member function `void fabrik_t::neuer_monat()':
simfab.cc:1407: warning: passing `const double' for converting 1 of `uint32 simrand(uint32)'
simfab.cc:1413: warning: converting to `uint16' from `float'
simfab.cc:1433: warning: unused variable 'number_of_customers'
simfab.cc:1434: warning: unused variable 'number_of_suppliers'
simfab.cc:1435: warning: unused variable 'jobs'
simfab.cc: In member function `void fabrik_t::info(cbuffer_t&) const':
simfab.cc:1607: warning: converting to `uint32' from `float'
In file included from simhalt.cc:37:
bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
simhalt.cc: In member function `void haltestelle_t::step(sint16&)':
simhalt.cc:986: warning: comparison between signed and unsigned integer expressions
simhalt.cc:1064: warning: converting to `sint64' from `double'
simhalt.cc:1095: warning: converting to `uint16' from `double'
simhalt.cc: In member function `uint16 haltestelle_t::get_average_waiting_time(halthandle_t, uint8) const':
simhalt.cc:1292: warning: taking address of temporary
simhalt.cc: In member function `void haltestelle_t::add_connexion(uint8, convoihandle_t, linehandle_t, const minivec_tpl<halthandle_t>&, uint8)':
simhalt.cc:1390: warning: converting to `uint16' from `float'
simhalt.cc:1324: warning: unused variable 'i_am_public'
simhalt.cc: In member function `void haltestelle_t::rebuild_connexions(uint8)':
simhalt.cc:1543: warning: unused variable 'entry_count'
simhalt.cc: In member function `ware_t haltestelle_t::hole_ab(const ware_besch_t*, uint32, const schedule_t*, const spieler_t*, convoi_t*)':
simhalt.cc:2231: warning: converting to `uint32' from `float'
simhalt.cc:2247: warning: comparison between signed and unsigned integer expressions
simhalt.cc: In member function `uint16 haltestelle_t::get_waiting_minutes(uint32) const':
simhalt.cc:2355: warning: converting to `uint16' from `float'
simhalt.cc: In member function `void haltestelle_t::info(cbuffer_t&) const':
simhalt.cc:2667: warning: unused variable 'tmp'
simhalt.cc: In member function `void haltestelle_t::rdwr(loadsave_t*)':
simhalt.cc:3220: warning: comparison between signed and unsigned integer expressions
simhalt.cc:3288: warning: comparison between signed and unsigned integer expressions
simhalt.cc:3297: warning: comparison between signed and unsigned integer expressions
simline.cc: In member function `int simline_t::get_replacing_convoys_count() const':
simline.cc:259: warning: comparison between signed and unsigned integer expressions
In file included from simmenu.cc:22:
bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
simware.cc:179: warning: unused parameter 'sp'
simware.cc:197:2: warning: no newline at end of file
In file included from simwerkz.cc:81:
dataobj/replace_data.h:122:7: warning: no newline at end of file
In file included from simwerkz.cc:86:
bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
simwerkz.cc: In member function `virtual const char* wkz_fahrplan_add_t::work(karte_t*, spieler_t*, koord3d)':
simwerkz.cc:1608: warning: cast from `const char*' to `schedule_t*' discards qualifiers from pointer target type
simwerkz.cc: In member function `virtual const char* wkz_fahrplan_ins_t::work(karte_t*, spieler_t*, koord3d)':
simwerkz.cc:1613: warning: cast from `const char*' to `schedule_t*' discards qualifiers from pointer target type
simwerkz.cc: At global scope:
simwerkz.cc:2196: warning: unused parameter 'cur'
simwerkz.cc: In member function `virtual const char* wkz_roadsign_t::do_work(karte_t*, spieler_t*, const koord3d&, const koord3d&)':
simwerkz.cc:3727: warning: unused variable 'can_built'
simwerkz.cc: In member function `const char* wkz_depot_t::wkz_depot_aux(karte_t*, spieler_t*, koord3d, const haus_besch_t*, waytype_t, sint64)':
simwerkz.cc:3916: warning: enumeration value `invalid_wt' not handled in switch
simwerkz.cc:3916: warning: enumeration value `ignore_wt' not handled in switch
simwerkz.cc:3916: warning: enumeration value `overheadlines_wt' not handled in switch
simwerkz.cc:3916: warning: enumeration value `powerline_wt' not handled in switch
simwerkz.cc: In member function `virtual bool wkz_change_convoi_t::init(karte_t*, spieler_t*)':
simwerkz.cc:5170: warning: unused variable 'extra'
simwerkz.cc:5172: warning: unused variable 'additional_convoi_id'
simwin.cc: In function `int top_win(int)':
simwin.cc:589: warning: comparison between signed and unsigned integer expressions
simwin.cc: In function `void display_win(int)':
simwin.cc:638: warning: comparison between signed and unsigned integer expressions
In file included from simworld.cc:54:
tpl/ordered_vector_tpl.h:333:7: warning: no newline at end of file
In file included from simworld.cc:96:
bauer/hausbauer.h:102: warning: unused parameter 'allow_earlier'
simworld.cc: In member function `void karte_t::update_frame_sleep_time(long int)':
simworld.cc:2866: warning: comparison between signed and unsigned integer expressions
simworld.cc: In member function `void karte_t::neuer_monat()':
simworld.cc:2958: warning: converting to `uint32' from `float'
simworld.cc:3000: warning: comparison between signed and unsigned integer expressions
simworld.cc: In member function `void karte_t::recalc_average_speed()':
simworld.cc:3122: warning: converting to `int' from `float'
simworld.cc: In member function `void karte_t::step()':
simworld.cc:3368: warning: comparison between signed and unsigned integer expressions
simworld.cc:3373: warning: comparison between signed and unsigned integer expressions
simworld.cc: In member function `bool karte_t::interactive(uint32)':
simworld.cc:5556: warning: converting of negative value `-0x000000001' to `uint32'
simworld.cc:5684: warning: converting of negative value `-0x000000001' to `uint32'
simworld.cc:5734: warning: converting of negative value `-0x000000001' to `uint32'
simworld.cc: In member function `void karte_t::set_citycar_speed_average()':
simworld.cc:5827: warning: unused variable 'speed_sum'
simworld.cc: In member function `uint16 karte_t::calc_generic_road_speed(const weg_besch_t*)':
simworld.cc:5864: warning: converting to `uint16' from `float'
simworld.cc:5865: warning: converting to `uint16' from `float'
simworld.cc: In member function `void karte_t::calc_max_road_check_depth()':
simworld.cc:5898: warning: converting to `uint32' from `float'
utils/simstring.cc: In function `char* ntos(long int, const char*)':
utils/simstring.cc:27: warning: int format, long int arg (arg 3)
vehicle/simvehikel.cc: In member function `uint32 vehikel_t::calc_modified_speed_limit(const koord3d*, uint8, bool)':
vehicle/simvehikel.cc:1400: warning: unused variable 'current_tile'
vehicle/simvehikel.cc: In member function `virtual int automobil_t::get_kosten(const grund_t*, uint32) const':
vehicle/simvehikel.cc:2461: warning: converting to `int' from `double'
vehicle/simvehikel.cc: In member function `virtual int waggon_t::get_kosten(const grund_t*, uint32) const':
vehicle/simvehikel.cc:2974: warning: converting to `int' from `double'
vehicle/simverkehr.cc: In member function `virtual bool stadtauto_t::hop_check()':
vehicle/simverkehr.cc:789: warning: unused variable 'offset'
simgraph16.cc: In function `void rezoom_img(image_id)':
simgraph16.cc:1290: warning: comparison between signed and unsigned integer expressions
simsys_w16.cc:95: warning: unused parameter 'parameter'
simsys_w16.cc:169: warning: unused parameter 'bpp'
simsys_w16.cc:273: warning: unused parameter 'bpp'
simsys_w16.cc: In function `long unsigned int dr_time()':
simsys_w16.cc:758: warning: unused variable 'support_performance_counter'
simsys_w16.cc: At global scope:
simsys_w16.cc:797: warning: unused parameter 'hPrevInstance'
simsys_w16.cc:797: warning: unused parameter 'nShowCmd'

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18037
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: no asserts in simutrans-experimental
« Reply #3 on: August 01, 2010, 11:14:59 PM »
Prissi,

thank you for that information and analysis - that is most kind. I shall have a look into that when I get a little more time. Thank you again :-)

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18037
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: no asserts in simutrans-experimental
« Reply #4 on: December 23, 2010, 03:00:48 PM »
Rats - I've only just remembered about these and now all the line numberings are out. However, even looking at versions from Github as they were on the 1st of August this year, I cannot see how the line numbers match up. May I ask - which branch were you using when you compiled and got those warnings?

I have, however, now corrected the bzlib.h issue.

As to debugging symbols, I think that the Linux version is now automatically compiled both with and without debugging symbols to provide a choice between performance and diagnostics: we have Ansgar to thank for that innovation.

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Re: no asserts in simutrans-experimental
« Reply #5 on: December 23, 2010, 03:11:40 PM »
I think there is a misunderstanding here.

Debugging symbols (the ones that the compiler adds for the debugger), do (to my knowledge) not slow down the execution. They just make the binary bigger.

The debugger uses the added information to display method/function/variable names, source files/line numbers in stack traces and similar.

Asserts are something different. They are usually used to check preconditions (do parameters have the proper value range), invariants (groups of variables that always need to sum up to/calculate to a fixed value during the execution of a method), or postconditions (does a method return a value from the expected range, does the program state match an expected condition after execution) of methods and functions.

These do slow down the execution, but are valuable to find out mistakes quickly if you change something, and this change results in a method call with parameters in an unexpected range or in unexpected returned values. You should keep those in and active while developing. They are also good to document the expected ranges of parameters and conditions to other coders who are not as fluent with the code yet.

The debug statements that Simutrans has in addition to the asserts and debug symbols are a third layer of debug information.


Edit: I think trigraphs were a try to encode non-ascii characters in ascii C source files. They should be portable, I might think. They just never took off the ground and might have become obsolete quickly after their introduction - that part I don't really know about.
« Last Edit: December 23, 2010, 03:16:04 PM by Hajo »

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18037
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: no asserts in simutrans-experimental
« Reply #6 on: December 23, 2010, 03:18:51 PM »
Hajo,

thank you for the clarification. The view that I take is that release builds should not have asserts enabled, whereas debug builds should have asserts enabled. I don't have control over the binaries for Linux, but that is the way in which I set things up for Windows.

Edit: Checking the warnings on MSVC++ with the latest -devel branch, I only seem to get the following types of warning:

(1) C4005 - macro redefinition (appears mainly in Standard code);
(2) C4018 - signed/unsigned mismatch (appears both in Standard and Experimental code); and
(3) C4244 - conversion from [type] to [type], possible loss of data (appears both in Standard and Experimental code).

The more troubling warnings to which Prissi referred in the earlier post appear to be lacking.
« Last Edit: December 23, 2010, 06:08:49 PM by jamespetts »