You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.9 KiB

  1. From 7f811d9c4ebc9444e613e251c31d6bf537a24dc1 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Mon, 13 Apr 2015 16:35:30 -0700
  4. Subject: [PATCH] remove glibc assumption
  5. glibc time.h header has an undocumented __isleap macro
  6. that we are using anf musl is missing it.
  7. Since it is undocumented & does not appear
  8. on any other libc, stop using it and just define the macro in
  9. locally instead.
  10. Upstream-Status: Pending
  11. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  12. [patch from: http://patchwork.openembedded.org/patch/91893/ ]
  13. Signed-off-by: Phil Eichinger <phil@zankapfel.net>
  14. ---
  15. parsetime.y | 11 +++++++----
  16. 1 file changed, 7 insertions(+), 4 deletions(-)
  17. --- a/parsetime.y
  18. +++ b/parsetime.y
  19. @@ -14,6 +14,9 @@
  20. ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
  21. #endif
  22. +#define is_leap_year(y) \
  23. + ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
  24. +
  25. struct tm exectm;
  26. static int isgmt;
  27. static char *tz = NULL;
  28. @@ -230,8 +233,8 @@ date : month_name day_number
  29. mnum == 12) && dnum > 31)
  30. || ((mnum == 4 || mnum == 6 || mnum == 9 ||
  31. mnum == 11) && dnum > 30)
  32. - || (mnum == 2 && dnum > 29 && __isleap(ynum+1900))
  33. - || (mnum == 2 && dnum > 28 && !__isleap(ynum+1900))
  34. + || (mnum == 2 && dnum > 29 && is_leap_year(ynum+1900))
  35. + || (mnum == 2 && dnum > 28 && !is_leap_year(ynum+1900))
  36. )
  37. {
  38. yyerror("Error in day of month");
  39. @@ -274,8 +277,8 @@ date : month_name day_number
  40. mnum == 12) && dnum > 31)
  41. || ((mnum == 4 || mnum == 6 || mnum == 9 ||
  42. mnum == 11) && dnum > 30)
  43. - || (mnum == 2 && dnum > 29 && __isleap(ynum+1900))
  44. - || (mnum == 2 && dnum > 28 && !__isleap(ynum+1900))
  45. + || (mnum == 2 && dnum > 29 && is_leap_year(ynum+1900))
  46. + || (mnum == 2 && dnum > 28 && !is_leap_year(ynum+1900))
  47. )
  48. {
  49. yyerror("Error in day of month");