OpenROAD icon indicating copy to clipboard operation
OpenROAD copied to clipboard

Fix some compile warnings and errors on an up-to-date system

Open gatecat opened this issue 4 years ago • 8 comments

This enables OpenROAD to build with a recent compiler; without hitting warnings that become errors due to -Werror (the first commit, the free on a class member, is a particularly concerning issue...)

Not sure if all of these will be of interest as-is but hopefully at least some of this is useful!

gatecat avatar Jan 11 '22 20:01 gatecat

What compiler reports these problems?

maliberty avatar Jan 11 '22 21:01 maliberty

GCC 11.1.0

gatecat avatar Jan 11 '22 21:01 gatecat

I still believe -Werror should only be enabled for CI builds for this reason.

rovinski avatar Jan 11 '22 23:01 rovinski

I still believe -Werror should only be enabled for CI builds for this reason.

Yeah, that's how I have nextpnr set up too because of similar concerns.

Note that 4edea48 is fixing a genuine error for me, not a warning-turned-error, so would still be needed and some of the other free-related ones might be worth looking at as it seems like the compiler has found genuine concerns.

gatecat avatar Jan 12 '22 07:01 gatecat

Note that there is ALLOW_WARNINGS cmake option if needed.

maliberty avatar Jan 12 '22 16:01 maliberty

What version of spdlog are you using? I don't see any such assertion in the current version.

maliberty avatar Jan 12 '22 16:01 maliberty

Note that 4edea48 is fixing a genuine error for me, not a warning-turned-error, so would still be needed and some of the other free-related ones might be worth looking at as it seems like the compiler has found genuine concerns.

Realistically it would be more helpful if these enums had a toString() function so that they can be printed.

rovinski avatar Jan 12 '22 22:01 rovinski

I fixed the issue addressed in 4edea486af07f8ea7f9c0d6d00bf5eeb9d1c3761 in https://github.com/The-OpenROAD-Project/OpenROAD/pull/1542/files in a fashion I prefer (operator<< not int cast). Please revert that commit from this PR and re-merge master to this PR.

maliberty avatar Jan 13 '22 16:01 maliberty

Sorry, this unfortunately ended up forgotten all too long as life got in the way in various forms - I've finally rebased it and addressed some comments although a new issue appeared with a recent fmt version - I've fixed it in afb3313 but I can see there are other approaches that could be taken there.

gatecat avatar Nov 04 '22 09:11 gatecat

Seems like my fix in afb3313 was no good because it breaks older fmt versions... not sure what you think is the best approach to supporting everything here.

gatecat avatar Nov 04 '22 11:11 gatecat

The fmt change has been discussed in various PRs. I think FMT_DEPRECATED_OSTREAM is the best solution until fmt fixes https://github.com/fmtlib/fmt/issues/3088

maliberty avatar Nov 04 '22 17:11 maliberty