Closed r-barnes closed 11 months ago
Aren't these flags only available on certain versions of clang? Do you need to guard against that in CMake?
Ah sorry, I have a backlog to attend to. Not sure about the flags, but they should only be set on compilers that support them, obviously, including a version check. In this case there is probably no reason to add it to anything but clang since clang runs checks in CI and the should do.
@mikkelfj : These flags work in both clang and gcc.
@r-barnes thansk for following up. I'm just superficially revisiting for now - I should have more time in a few weeks. It is not sufficient that flags work, they need to work with specific versions. FlatCC supports very old compilers too. You can see this in the root CMakeList.txt.
@mikkelfj - I'm afraid I don't have time to sort out which versions will work best for the flags, but I can say that you had undefined behaviour which this PR fixes. I can remove the flags if they're your only objection.
@r-barnes Lets keep this until I get more time to look at it. If there is UB this should be fixed or at least understood, flags or not. After that we can discuss if there should be changes to build, but maybe not.
@r-barnes Thanks for the contribution. I'm sorry I have not had time to follow up before now. The flags are indeed reasonable for clang debug and not really needed for other compilers.
I have made a separate commit 0e925e1 to address this and I am therefore closing this PR.
Some fixes to remove warnings were already done, and some fixes were done differently (adding 0 to null ptr. was handled via cast in macro instead of a runtime check in builder).
This fixes some instances of undefined behaviour. Specifically: