CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
9.73k stars 4.05k forks source link

Fix GCC 9: initialize to `nullptr` #73473

Closed Brambor closed 2 weeks ago

Brambor commented 2 weeks ago

Summary

None

Purpose of change

73400 broke tests, I believe this is what ~Clang~ GCC, Curses, LTO 9 wants

Describe the solution

initialize to nullptr. So it is still undefined behaviour, but at least the value is initialized.

Describe alternatives you've considered

Ask if this is correct.

Testing

Let's see it compile

Broken tests in #73400 https://github.com/CleverRaven/Cataclysm-DDA/actions/runs/8927978126/job/24523240306 Fixed tests here https://github.com/CleverRaven/Cataclysm-DDA/actions/runs/8946092853/job/24576537951?pr=73473

Additional context

Mergers always surprise me with their sudden speed. I should have written "Do not merge yet!" before I went to sleep when I noticed it. Instead of relying on the merger to go through all the tests.

Brambor commented 2 weeks ago

Random test failure and I initialized only one of two vars. Shame that the test didn't run. Will fix when I get home.

Brambor commented 2 weeks ago

Omg, it is GCC 9, not Clang 9. Since the tests didn't start I renamed the commit to not live in eternal shame.

Brambor commented 2 weeks ago

It looks ok now. Ready to merge.

Maleclypse commented 2 weeks ago

Note: I think I did see that fail but confused it with an existing fail state. Thanks for the work you do!