mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
gh-123681: Check NORMALIZE_CENTURY behavior at runtime; require C99 (GH-136022)
A runtime check is needed to support cross-compiling. Remove the _Py_NORMALIZE_CENTURY macro. Remove _pydatetime.py's _can_support_c99. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
b07a267953
commit
719e5c3f71
8 changed files with 48 additions and 191 deletions
104
configure
generated
vendored
104
configure
generated
vendored
|
|
@ -28190,110 +28190,6 @@ printf "%s\n" "#define HAVE_STAT_TV_NSEC2 1" >>confdefs.h
|
|||
|
||||
fi
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether year with century should be normalized for strftime" >&5
|
||||
printf %s "checking whether year with century should be normalized for strftime... " >&6; }
|
||||
if test ${ac_cv_normalize_century+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else case e in #(
|
||||
e)
|
||||
if test "$cross_compiling" = yes
|
||||
then :
|
||||
ac_cv_normalize_century=yes
|
||||
else case e in #(
|
||||
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char year[5];
|
||||
struct tm date = {
|
||||
.tm_year = -1801,
|
||||
.tm_mon = 0,
|
||||
.tm_mday = 1
|
||||
};
|
||||
if (strftime(year, sizeof(year), "%Y", &date) && !strcmp(year, "0099")) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"
|
||||
then :
|
||||
ac_cv_normalize_century=yes
|
||||
else case e in #(
|
||||
e) ac_cv_normalize_century=no ;;
|
||||
esac
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_normalize_century" >&5
|
||||
printf "%s\n" "$ac_cv_normalize_century" >&6; }
|
||||
if test "$ac_cv_normalize_century" = yes
|
||||
then
|
||||
|
||||
printf "%s\n" "#define _Py_NORMALIZE_CENTURY 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C99-compatible strftime specifiers are supported" >&5
|
||||
printf %s "checking whether C99-compatible strftime specifiers are supported... " >&6; }
|
||||
if test ${ac_cv_strftime_c99_support+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else case e in #(
|
||||
e)
|
||||
if test "$cross_compiling" = yes
|
||||
then :
|
||||
ac_cv_strftime_c99_support=
|
||||
else case e in #(
|
||||
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char full_date[11];
|
||||
struct tm date = {
|
||||
.tm_year = 0,
|
||||
.tm_mon = 0,
|
||||
.tm_mday = 1
|
||||
};
|
||||
if (strftime(full_date, sizeof(full_date), "%F", &date) && !strcmp(full_date, "1900-01-01")) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"
|
||||
then :
|
||||
ac_cv_strftime_c99_support=yes
|
||||
else case e in #(
|
||||
e) as_fn_error $? "Python requires C99-compatible strftime specifiers" "$LINENO" 5 ;;
|
||||
esac
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_strftime_c99_support" >&5
|
||||
printf "%s\n" "$ac_cv_strftime_c99_support" >&6; }
|
||||
|
||||
have_curses=no
|
||||
have_panel=no
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue