diff options
author | joerg <joerg@pkgsrc.org> | 2016-12-22 21:07:17 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2016-12-22 21:07:17 +0000 |
commit | 7e4eba72708cc2c85ac7e9c464013fa95200cef5 (patch) | |
tree | 967ae632f02140e7d22ef3d022e30a9aee9c4a7e /sysutils | |
parent | 6c5bc34607f7842a8141f6d09acb2780ce35b971 (diff) | |
download | pkgsrc-7e4eba72708cc2c85ac7e9c464013fa95200cef5.tar.gz |
It is UB whether defined() is evaluated in macro expansions, so avoid
it.
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/flashrom/distinfo | 3 | ||||
-rw-r--r-- | sysutils/flashrom/patches/patch-hwaccess.c | 72 |
2 files changed, 74 insertions, 1 deletions
diff --git a/sysutils/flashrom/distinfo b/sysutils/flashrom/distinfo index c178111bb0d..bc6fe24a0cf 100644 --- a/sysutils/flashrom/distinfo +++ b/sysutils/flashrom/distinfo @@ -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 --git a/sysutils/flashrom/patches/patch-hwaccess.c b/sysutils/flashrom/patches/patch-hwaccess.c new file mode 100644 index 00000000000..fe0c320186c --- /dev/null +++ b/sysutils/flashrom/patches/patch-hwaccess.c @@ -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; |