The International Simutrans Forum

 

Author Topic: a couple more gcc 4.4.3 compilation warnings  (Read 3620 times)

0 Members and 1 Guest are viewing this topic.

Offline yobbobandana

  • *
  • Posts: 42
a couple more gcc 4.4.3 compilation warnings
« on: June 23, 2010, 01:50:13 AM »
A couple unsigned vs signed integer comparison warnings popped back in so I made a quick patch.
This assumes that a negative value for factory_worker_minimum_towns, factory_worker_maximum_towns, factory_worker_radius should mean no limit.

I also addressed the two "unused parameter" warnings.

All that is left after this is two warnings about "casting away constness", but in these cases that is exactly why the cast was used, so fixing them is a little less straightforward.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #1 on: June 23, 2010, 11:25:34 AM »
Well MSVC gives still 50+ legit warnings, GCC 2.95 still another 15 on haiku, and even MinGW GCC is not silent yet. I think silent is very much system and architecture dependent. But as long as it fixes errors ...

Offline yobbobandana

  • *
  • Posts: 42
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #2 on: June 23, 2010, 08:56:13 PM »
Sadly I don't have any test setup other than gcc 4.4.3 on ubuntu 64-bit.

These warnings are certainly very minor. But it is so close to warning-free on this setup that I feel addressing them is worthwhile.

I would actually be happy to try to fix the warnings for other setups given a list of them, but of course couldn't test the fixes :).

Offline neroden

  • Devotees (Inactive)
  • *
  • Posts: 831
  • Nathanael Nerode
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #3 on: June 29, 2010, 04:57:01 AM »
Sadly I don't have any test setup other than gcc 4.4.3 on ubuntu 64-bit.

These warnings are certainly very minor. But it is so close to warning-free on this setup that I feel addressing them is worthwhile.

If you want a good project, turn on -Wconversion with gcc 4.4.3 and fix all of THOSE warnings.  :-)  Those all warn of serious potential computation errors....  I was starting in on it, but it's a huge job.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #4 on: June 29, 2010, 11:43:10 AM »
gcc does also emit meaningless warnings, and is generally are rather silent compiler. MSVC also emits valid warnings, about still 176 for a full translate, even when GCC was silent at a point. Also -Wconversion seems to report warnings for things not compiled due to preprocessor commands. So I would no define good from the number of warnings in GCC.

Offline Václav

  • Devotee
  • *
  • Posts: 3324
  • formerly VaclavMacurek
  • Languages: CZ, EN
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #5 on: November 02, 2010, 09:56:31 PM »
I found some warnings in compile.log of Windows versions - like I wrote it in else topic ([R3862 and up] Crash instead intro dialogue). I know only PHP but they seem be quite serious. For example, function cannot have two or more input parameters with the same name. Some principles are same in all languages. And also one missing file is called: WinSock2.h.

Last edit of my last post in that topic may be divorced from previous texts - due to this topic.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #6 on: November 03, 2010, 12:07:42 AM »
Well, I do not get those. Aparently you did not install all needed files for the distribution (winsock2.h comes from the system. If this is missing, things got wrong in your compiler installation).

Offline Václav

  • Devotee
  • *
  • Posts: 3324
  • formerly VaclavMacurek
  • Languages: CZ, EN
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #7 on: November 03, 2010, 07:06:56 AM »
WinSock2.h may come from system - but I don't do own compilation. I only use files downloaded on nightlies page. So this cannot be fully on my side.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #8 on: November 03, 2010, 07:23:03 AM »
This looks like MingW on the nightly site is out of order.

But since MinGW does not use IPv6 support, winsock2.h missing does not cause harm. I will have a look at the defines.

Offline wernieman

  • Devotees (Inactive)
  • *
  • Posts: 713
    • Werniemans-Webside (only German)
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #9 on: November 03, 2010, 07:45:36 AM »
On the nightly-Server I look that the Compiler Work. I don´t look if there could be some "warnings". Only Errors are important.

It is an cross-compiler. Every cross-compiler create some warnings about System-files. It is not easy that the compiler-System an the target-system is not the same, so it is a  fundamental problem of  cross-compiler.

With some work I could reduce some of the warnings, but ... sorry .... my private time is reduced and so .....

(and with every update I must do the same ..... :o( )

Offline Václav

  • Devotee
  • *
  • Posts: 3324
  • formerly VaclavMacurek
  • Languages: CZ, EN
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #10 on: November 03, 2010, 07:52:52 AM »
In attachments is that missing file winsock2.h. So download it and I hope that next windows compilation would be running right again.

Offline wernieman

  • Devotees (Inactive)
  • *
  • Posts: 713
    • Werniemans-Webside (only German)
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #11 on: November 03, 2010, 07:55:07 AM »
Sorry .. witch (c) is on the file??

Offline VS

  • Senior Plumber (Devotee)
  • Devotees (Inactive)
  • *
  • Posts: 4856
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #12 on: November 03, 2010, 08:26:21 AM »
answer: Microsoft :D

Offline wernieman

  • Devotees (Inactive)
  • *
  • Posts: 713
    • Werniemans-Webside (only German)
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #13 on: November 03, 2010, 08:34:08 AM »
*lol*

But .. could I use it ore not ... that is the quesion ;o)

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4869
  • Languages: EN, DE, AT
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #14 on: November 03, 2010, 09:55:30 AM »
This header file is obviously not necessary to compile the executable. Otherwise the compiler would have failed with an error.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10636
  • Languages: De,EN,JP
Re: a couple more gcc 4.4.3 compilation warnings
« Reply #15 on: November 03, 2010, 11:01:30 AM »
Since MinGW uses IPv4 only (to run also on Win2k) I just submitted a change using old winsock in such cases.