dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

Fix dangling reference warning in buildingplan plugin

Open cvuchener opened this issue 1 year ago • 7 comments

fix #4534

cvuchener avatar May 01 '24 06:05 cvuchener

A version check is needed in the macro definition. :(

cvuchener avatar May 01 '24 06:05 cvuchener

updated

I don't like this compiler/version check, it's too complex. Can it be better? Maybe you want to wait for your tool chain to update to gcc 14 before fixing this issue.

cvuchener avatar May 01 '24 07:05 cvuchener

"All attributes unknown to an implementation are ignored without causing an error" so if an undefined attribute is causing a compilation error this itself is a compiler bug.

ab9rf avatar May 01 '24 08:05 ab9rf

We are not likely to move to gcc 14 any time soon due to basically nonexistent support for gcc 14's runtime in widely available distributions. Building DFHack with a version of gcc other than the one DF is built with (currently gcc 11) is unsupported.

ab9rf avatar May 01 '24 09:05 ab9rf

"All attributes unknown to an implementation are ignored without causing an error" so if an undefined attribute is causing a compilation error this itself is a compiler bug.

It causes a warning and with -Werror it causes an error. See on compiler explorer

We are not likely to move to gcc 14 any time soon due to basically nonexistent support for gcc 14's runtime in widely available distributions. Building DFHack with a version of gcc other than the one DF is built with (currently gcc 11) is unsupported.

Yes, forget about this. I'll keep my workaround in my cmake configuration.

cvuchener avatar May 01 '24 13:05 cvuchener

Yes, forget about this. I'll keep my workaround in my cmake configuration.

I think this can still be a useful addition. we don't distribute DFHack built with newer compilers, but we do build with newer compilers. We build with gcc-12 in CI, for example, to catch warnings that gcc-10 misses.

myk002 avatar May 01 '24 18:05 myk002

I would use the "pragma" approach to disable the warnings instead of using an attribute, since (I sincerely hope) that no compiler author is doofus enough to issue even so much as a warning for an unrecognized pragma. 🤦‍♀️

ab9rf avatar May 02 '24 01:05 ab9rf