gh-96821: Check for `-fstrict-overflow` only if `--with-strict-overflow` is passed by StanFromIreland · Pull Request #139595 · python/cpython
Comment on lines +2238 to +2246
| CFLAGS="-fstrict-overflow -fno-strict-overflow" | ||
| AC_CACHE_CHECK([if $CC supports -fstrict-overflow and -fno-strict-overflow], | ||
| [ac_cv_cc_supports_fstrict_overflow], | ||
| AC_COMPILE_IFELSE( | ||
| [AC_LANG_PROGRAM([[]], [[]])], | ||
| [ac_cv_cc_supports_fstrict_overflow=yes], | ||
| [ac_cv_cc_supports_fstrict_overflow=no] | ||
| ) | ||
| ) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be fine with using AX_CHECK_COMPILE_FLAG here. (I don't remember why I did not recommend that when we added this code.)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you suggesting we just check -fstrict-overflow? Currently it checks both -fstrict-overflow and -fno-strict-overflow.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using AX_CHECK_COMPILE_FLAG makes it more complicated to follow IMO, but I pushed the change.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I should've been more specific. Currently, we check for the compile flag first, then we check for the configure flag. Now, you've embedded the compile check into the configure flag check. I suggest keeping the original structure. We should be able to use AX_CHECK_COMPILE_FLAG to check for the compile flag(s), and then use those results when we check for the configure flag.