I have an open PR which retains TARGET_* labels when computed gotos aren’t used but Py_DEBUG is defined. I got things to compile on Mac and Linux (gcc and clang) without warnings, as desired. The Windows CI still reports warnings though. Here’s an example of the warning:
I’ve never used Windows for software development and all the XML project files are just line noise to me. Can someone suggest how to suppress unused labels when Py_DEBUG is defined? For comparison, here’s the relevant chunk of configure.ac:
case $ac_cv_prog_cc_g in
yes)
if test "$Py_DEBUG" = 'true' ; then
OPT="-g $PYDEBUG_CFLAGS -Wall -Wno-unused-label"
else
OPT="-g $WRAP -O3 -Wall"
fi
;;
*)
OPT="-O3 -Wall"
;;
esac
I wasn’t suggesting that a solution on Windows would use configure, just giving that as an example of how I accomplished that for Unix-like compilation environments. I assume Python on Windows is built using Windows-specific tools, but I have no experience with them. I was asking for help with that.
Thanks. Where do I find mappings from those magic numbers to useful names? For example, you referenced
#pragma warning(disable:4996)
Based on the comment, I imagine 4996 is something to do with deprecations. How do I find what the magic number is for unused labels?
I’d be happy to always suppress the unused label warnings for the TARGET_* labels. If that is agreeable to other folks, I’d propose also modifying the relevant macros to always insert them, no matter the state of Py_DEBUG or USE_COMPUTED_GOTOS.
I worried the #ifdef __GNUC__ might be too restrictive, hence the TBD comment, but it seems clang (at least) is happy with the construct. Now to push these changes and see if the MS compiler is happy…