Ticket #43868

fc_strrep_resize(): 'success' set, but never used in FREECIV_NDEBUG build

Eröffnet am: 2022-02-15 14:01 Letztes Update: 2022-05-05 08:15

Auswertung:
Verantwortlicher:
Typ:
Status:
Geschlossen
Komponente:
Meilenstein:
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
3

Details

Building with both FREECIV_NDEBUG (to disable asserts) and --enable-debug (to have all the compiler warnings). S3_0 compile ends to:

../../../src/utility/support.c: In function ‘fc_strrep_resize’:
../../../src/utility/support.c:674:8: error: variable ‘success’ set but not used (-Werror=unused-but-set-variable)

674 | bool success;

Ticket-Verlauf (3/10 Historien)

2022-02-15 14:01 Aktualisiert von: cazfi
  • New Ticket "fc_strrep_resize(): 'success' set, but never used in FREECIV_NDEBUG build" created
2022-04-09 05:42 Aktualisiert von: cazfi
Kommentar

I've been treating this as a generic ticket for all similar errors with degug+ndebug build that are not handled separately for having more serious consequences. My local patch file is growing as I get further and further in the build...

2022-04-14 14:27 Aktualisiert von: cazfi
Kommentar

The original reason I started to look at this was that I were trying to set up some static analysis tool runs. There's quite a conceptual clash with asserts(). We assert that something is true, and remains so when the code changes. The tools determine the very same thing; that the thing is certainly true, but then conclude that code within our assert() is thus redundant. So need to disable asserts for such builds, at which point some compiler warnings not usually enabled in our FREECIV_NDEBUG became an issue. So need to get NDEBUG build to build without errors with our full set of --enable-debug warnings.

2022-04-19 15:27 Aktualisiert von: cazfi
Kommentar

Reply To cazfi

The original reason I started to look at this was that I were trying to set up some static analysis tool runs.

Getting there. But OTOH it's going to be the beginning. We're going to get a lot of new issues detected by this.

2022-04-23 06:29 Aktualisiert von: cazfi
  • Verantwortlicher Update from (Keine) to cazfi
  • Lösung Update from Keine to Accepted
2022-04-23 16:12 Aktualisiert von: cazfi
Kommentar

Reply To cazfi

Reply To cazfi

The original reason I started to look at this was that I were trying to set up some static analysis tool runs.

Getting there. But OTOH it's going to be the beginning. We're going to get a lot of new issues detected by this.

Summary from initial scan run on S3_0 attached - 289 issues to look at.

2022-05-05 08:15 Aktualisiert von: cazfi
  • Status Update from Offen to Geschlossen
  • Lösung Update from Accepted to Gefixt

Bearbeiten

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Anmelden