pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/sysutils/flashrom It is UB whether defined() is evalua...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/985b529ff80c
branches:  trunk
changeset: 356227:985b529ff80c
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Thu Dec 22 21:07:17 2016 +0000

description:
It is UB whether defined() is evaluated in macro expansions, so avoid
it.

diffstat:

 sysutils/flashrom/distinfo                 |   3 +-
 sysutils/flashrom/patches/patch-hwaccess.c |  72 ++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+), 1 deletions(-)

diffs (89 lines):

diff -r d0a0e9a1c894 -r 985b529ff80c sysutils/flashrom/distinfo
--- a/sysutils/flashrom/distinfo        Thu Dec 22 21:05:01 2016 +0000
+++ b/sysutils/flashrom/distinfo        Thu Dec 22 21:07:17 2016 +0000
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.9 2015/11/04 01:32:14 agc Exp $
+$NetBSD: distinfo,v 1.10 2016/12/22 21:07:17 joerg Exp $
 
 SHA1 (flashrom-0.9.7.tar.bz2) = d08b4073ea3ebf63f03c3e502f4291f50ef348ee
 RMD160 (flashrom-0.9.7.tar.bz2) = e160e0ac1e0e138702f3f467707175df96b7e6b1
 SHA512 (flashrom-0.9.7.tar.bz2) = a226c1ac3f9c7822b74ca14b7f9b53013110b2cdb66b1f936593c693ee54f19d643cc3a97a9635c05f2c959aca817668006f609ddb503a84d0bf5d510065674e
 Size (flashrom-0.9.7.tar.bz2) = 408883 bytes
 SHA1 (patch-flashrom.c) = 9867fa7ff7d0a55bff5fc0e6c8c6c901af6211f8
+SHA1 (patch-hwaccess.c) = a76c1def47b8b3a79c8d024c43c510f3989bd6d9
diff -r d0a0e9a1c894 -r 985b529ff80c sysutils/flashrom/patches/patch-hwaccess.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/flashrom/patches/patch-hwaccess.c        Thu Dec 22 21:07:17 2016 +0000
@@ -0,0 +1,72 @@
+$NetBSD: patch-hwaccess.c,v 1.1 2016/12/22 21:07:17 joerg Exp $
+
+It is UB whether define() is not handled inside macro expansions.
+
+--- hwaccess.c.orig    2016-12-22 15:40:41.401773946 +0000
++++ hwaccess.c
+@@ -18,16 +18,40 @@
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+  */
+ 
+-#define IS_X86        (defined(__i386__) || defined(__x86_64__) || defined(__amd64__))
+-#define IS_MIPS       (defined (__mips) || defined (__mips__) || defined (__MIPS__) || defined (mips))
+-#define IS_PPC        (defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__))
+-#define IS_ARM        (defined (__arm__) || defined (_ARM))
++#if defined(__i386__) || defined(__x86_64__) || defined(__amd64__)
++#define IS_X86        1
++#else
++#define IS_X86        0
++#endif
++#if defined (__mips) || defined (__mips__) || defined (__MIPS__) || defined (mips)
++#define IS_MIPS       1
++#else
++#define IS_MIPS       0
++#endif
++#if defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__)
++#define IS_PPC        1
++#else
++#define IS_PPC        0
++#endif
++#if defined (__arm__) || defined (_ARM)
++#define IS_ARM        1
++#else
++#define IS_ARM        0
++#endif
+ #if !(IS_X86 || IS_MIPS || IS_PPC || IS_ARM)
+ #error Unknown architecture
+ #endif
+ 
+-#define IS_LINUX      (defined(__gnu_linux__) || defined(__linux__))
+-#define IS_MACOSX     (defined(__APPLE__) && defined(__MACH__))
++#if defined(__gnu_linux__) || defined(__linux__)
++#define IS_LINUX      1
++#else
++#define IS_LINUX      0
++#endif
++#if defined(__APPLE__) && defined(__MACH__)
++#define IS_MACOSX     1
++#else
++#define IS_MACOSX     0
++#endif
+ #if !(IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__DJGPP__) || 
defined(__LIBPAYLOAD__) || defined(__sun))
+ #error "Unknown operating system"
+ #endif
+@@ -45,8 +69,16 @@
+ #include "flash.h"
+ #include "hwaccess.h"
+ 
+-#define USE_IOPL      (IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__))
+-#define USE_DEV_IO    (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__))
++#if IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__)
++#define USE_IOPL      1
++#else
++#define USE_IOPL      0
++#endif
++#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__))
++#define USE_DEV_IO    1
++#else
++#define USE_DEV_IO    0
++#endif
+ 
+ #if IS_X86 && USE_DEV_IO
+ int io_fd;



Home | Main Index | Thread Index | Old Index