The International Simutrans Forum

 

Author Topic: Fixes for lots of warnings when compiling with Clang  (Read 88 times)

0 Members and 1 Guest are viewing this topic.

Offline ceeac

  • *
  • Posts: 123
Fixes for lots of warnings when compiling with Clang
« on: May 19, 2020, 03:21:59 PM »
I made a PR to fix a large number of warnings which are emitted when compiling with clang on Linux. Some of those warnings revealed actual errors in the code; these errors should now be fixed.
The PR also reduces the number of lines emitted during a full re-compilation from >16000 to ~750, making it much easier to spot compile errors among all the warnings. The full list of compiler warnings is now as follows:
Code: [Select]
     48 [-Wsign-compare]
     18 [-Wcast-align]
     14 [-Wdeprecated-copy]
      8 [-Waddress-of-packed-member]
      3 [-Wreturn-std-move]
      2 [-Wtautological-constant-out-of-range-compare]
      2 [-Winvalid-source-encoding]
      2 [-Wenum-compare]
      1 [-W#warnings]
      1 [-Wstring-compare]
      1 [-Wpointer-bool-conversion]
      1 [-Wmisleading-indentation]
      1 [-Wint-in-bool-context]
      1 [-Wconstant-conversion]
Some of those warnings cannot be fixed since these are emitted by the squirrel code.
The PR is here.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19684
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Fixes for lots of warnings when compiling with Clang
« Reply #1 on: May 19, 2020, 07:15:18 PM »
Thank you - now incorporated.