pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/python39 lang/python39: Move pragma outside funct...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/121dc00ce4a0
branches:  trunk
changeset: 442065:121dc00ce4a0
user:      sjmulder <sjmulder%pkgsrc.org@localhost>
date:      Wed Nov 18 12:18:29 2020 +0000

description:
lang/python39: Move pragma outside function for GCC 4.4

diffstat:

 lang/python39/distinfo                           |   3 +-
 lang/python39/patches/patch-Modules___zoneinfo.c |  50 ++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletions(-)

diffs (71 lines):

diff -r 9066f3970f6d -r 121dc00ce4a0 lang/python39/distinfo
--- a/lang/python39/distinfo    Wed Nov 18 11:43:30 2020 +0000
+++ b/lang/python39/distinfo    Wed Nov 18 12:18:29 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.2 2020/11/12 10:58:20 sjmulder Exp $
+$NetBSD: distinfo,v 1.3 2020/11/18 12:18:29 sjmulder Exp $
 
 SHA1 (Python-3.9.0.tar.xz) = ff1fc8c37d5d4b09ec3bf0d84f3e5b97745c6704
 RMD160 (Python-3.9.0.tar.xz) = 822fd1ea11f3ca303a08317f6db61f2a1e03e5ef
@@ -25,6 +25,7 @@
 SHA1 (patch-Modules___ctypes_ctypes.h) = 641c0af4d550c9140549ce2f2df6239c2c954a06
 SHA1 (patch-Modules___ctypes_malloc__closure.c) = 7e8f491ce66acb6d07e8830ee881edbf0aaac538
 SHA1 (patch-Modules___decimal_libmpdec_mpdecimal.h) = 8d302abacc5737fe7620d4738fff6c5c3ed387c7
+SHA1 (patch-Modules___zoneinfo.c) = b1df24fe935cd357670a6d9f41245ab04f2015e8
 SHA1 (patch-Modules_getpath.c) = d7114d21d7d9c7167fad259b115cb02e4153c531
 SHA1 (patch-Modules_makesetup) = a06786eebffadecedba5e3a50a9785fb47613567
 SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d
diff -r 9066f3970f6d -r 121dc00ce4a0 lang/python39/patches/patch-Modules___zoneinfo.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Modules___zoneinfo.c  Wed Nov 18 12:18:29 2020 +0000
@@ -0,0 +1,50 @@
+$NetBSD: patch-Modules___zoneinfo.c,v 1.1 2020/11/18 12:18:29 sjmulder Exp $
+
+Move `#pragma GCC diagnostics` outside function for GCC 4.4.
+
+--- Modules/_zoneinfo.c.orig   2020-10-05 15:07:58.000000000 +0000
++++ Modules/_zoneinfo.c
+@@ -1197,6 +1197,19 @@ calendarrule_year_to_timestamp(Transitio
+             (int64_t)(self->minute * 60) + (int64_t)(self->second));
+ }
+ 
++// Re. `if (day < 0 || day > 6)`:
++//
++// day is an unsigned integer, so day < 0 should always return false, but
++// if day's type changes to a signed integer *without* changing this value,
++// it may create a bug. Considering that the compiler should be able to
++// optimize out the first comparison if day is an unsigned integer anyway,
++// we will leave this comparison in place and disable the compiler warning.
++//
++// Old GCC versions like 4.4 don't allow `#pragma GCC diagnostic` inside
++// functions.
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wtype-limits"
++
+ /* Constructor for CalendarRule. */
+ int
+ calendarrule_new(uint8_t month, uint8_t week, uint8_t day, int8_t hour,
+@@ -1219,15 +1232,7 @@ calendarrule_new(uint8_t month, uint8_t 
+         return -1;
+     }
+ 
+-    // day is an unsigned integer, so day < 0 should always return false, but
+-    // if day's type changes to a signed integer *without* changing this value,
+-    // it may create a bug. Considering that the compiler should be able to
+-    // optimize out the first comparison if day is an unsigned integer anyway,
+-    // we will leave this comparison in place and disable the compiler warning.
+-#pragma GCC diagnostic push
+-#pragma GCC diagnostic ignored "-Wtype-limits"
+     if (day < 0 || day > 6) {
+-#pragma GCC diagnostic pop
+         PyErr_Format(PyExc_ValueError, "Day must be in [0, 6]");
+         return -1;
+     }
+@@ -1247,6 +1252,7 @@ calendarrule_new(uint8_t month, uint8_t 
+     *out = new_offset;
+     return 0;
+ }
++#pragma GCC diagnostic pop
+ 
+ /* Function to calculate the local timestamp of a transition from the year.
+  *



Home | Main Index | Thread Index | Old Index