Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Push/Pop pragma magic to avoid gcc warning aber a l...
details: https://anonhg.NetBSD.org/src/rev/f39ecb2d2068
branches: trunk
changeset: 789997:f39ecb2d2068
user: martin <martin%NetBSD.org@localhost>
date: Sat Sep 14 20:46:27 2013 +0000
description:
Push/Pop pragma magic to avoid gcc warning aber a less-than NULL comparision
diffstat:
sys/kern/kern_ras.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diffs (46 lines):
diff -r bf327d96d7b1 -r f39ecb2d2068 sys/kern/kern_ras.c
--- a/sys/kern/kern_ras.c Sat Sep 14 20:29:54 2013 +0000
+++ b/sys/kern/kern_ras.c Sat Sep 14 20:46:27 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ras.c,v 1.35 2012/02/19 21:06:53 rmind Exp $ */
+/* $NetBSD: kern_ras.c,v 1.36 2013/09/14 20:46:27 martin Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ras.c,v 1.35 2012/02/19 21:06:53 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ras.c,v 1.36 2013/09/14 20:46:27 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -176,6 +176,14 @@
#if defined(__HAVE_RAS)
+#if __GNUC_PREREQ__(4, 8)
+#define __WARNING_PUSH_LESS_NULL_PTR _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wextra\"")
+#define __WARNING_POP_LESS_NULL_PTR _Pragma("GCC diagnostic pop")
+#else
+#define __WARNING_PUSH_LESS_NULL_PTR
+#define __WARNING_POP_LESS_NULL_PTR
+#endif
+
/*
* Install the new sequence. If it already exists, return
* an error.
@@ -191,9 +199,12 @@
endaddr = (char *)addr + len;
+ /* do not warn about < NULL pointer comparision */
+ __WARNING_PUSH_LESS_NULL_PTR
if (addr < (void *)VM_MIN_ADDRESS ||
endaddr > (void *)VM_MAXUSER_ADDRESS)
return (EINVAL);
+ __WARNING_POP_LESS_NULL_PTR
if (len <= 0)
return (EINVAL);
Home |
Main Index |
Thread Index |
Old Index