Source-Changes-HG archive

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

[src/trunk]: src the result of the construct



details:   https://anonhg.NetBSD.org/src/rev/3325065ffa05
branches:  trunk
changeset: 781562:3325065ffa05
user:      plunky <plunky%NetBSD.org@localhost>
date:      Sat Sep 15 16:56:05 2012 +0000

description:
the result of the construct

#define FOO     defined(BAR)

#if FOO
 [conditional code]
#endif

is "undefined", according to C99 6.10.1 note 4. So, change code like
that to use the following paradigm

#if defined(BAR)
#define FOO     1
#else
#define FOO     0
#endif

#if FOO
 [conditional code]
#endif

diffstat:

 external/bsd/ipf/dist/opts.h             |   8 ++-
 sys/external/bsd/ipf/netinet/ip_compat.h |  81 +++++++++++++++++++++----------
 sys/external/bsd/ipf/netinet/ip_fil.h    |   8 ++-
 sys/external/bsd/ipf/netinet/ip_log.c    |  12 +++-
 sys/external/bsd/ipf/netinet/ip_nat.h    |  10 ++-
 sys/external/bsd/ipf/netinet/ip_proxy.h  |   8 ++-
 6 files changed, 88 insertions(+), 39 deletions(-)

diffs (225 lines):

diff -r e316b3756b57 -r 3325065ffa05 external/bsd/ipf/dist/opts.h
--- a/external/bsd/ipf/dist/opts.h      Sat Sep 15 16:22:58 2012 +0000
+++ b/external/bsd/ipf/dist/opts.h      Sat Sep 15 16:56:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: opts.h,v 1.2 2012/07/22 14:27:35 darrenr Exp $ */
+/*     $NetBSD: opts.h,v 1.3 2012/09/15 16:56:05 plunky Exp $  */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -12,7 +12,11 @@
 #define        __OPTS_H__
 
 #ifndef        SOLARIS
-#define        SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+# if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#  define SOLARIS      1
+# else
+#  define SOLARIS      0
+# endif
 #endif
 #define        OPT_REMOVE      0x000001
 #define        OPT_DEBUG       0x000002
diff -r e316b3756b57 -r 3325065ffa05 sys/external/bsd/ipf/netinet/ip_compat.h
--- a/sys/external/bsd/ipf/netinet/ip_compat.h  Sat Sep 15 16:22:58 2012 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_compat.h  Sat Sep 15 16:56:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_compat.h,v 1.3 2012/07/22 14:27:51 darrenr Exp $    */
+/*     $NetBSD: ip_compat.h,v 1.4 2012/09/15 16:56:45 plunky Exp $     */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -27,7 +27,11 @@
 #endif
 
 #ifndef        SOLARIS
-#define        SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+# if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#  define SOLARIS      1
+# else
+#  define SOLARIS      0
+# endif
 #endif
 #if (defined(SOLARIS2) && (SOLARIS2 >= 8))
 # ifndef       USE_INET6
@@ -128,30 +132,55 @@
 # endif
 #endif
 
-#define        NETBSD_GE_REV(x)        (defined(__NetBSD_Version__) && \
-                                (__NetBSD_Version__ >= (x)))
-#define        NETBSD_GT_REV(x)        (defined(__NetBSD_Version__) && \
-                                (__NetBSD_Version__ > (x)))
-#define        NETBSD_LT_REV(x)        (defined(__NetBSD_Version__) && \
-                                (__NetBSD_Version__ < (x)))
-#define        FREEBSD_GE_REV(x)       (defined(__FreeBSD_version) && \
-                                (__FreeBSD_version >= (x)))
-#define        FREEBSD_GT_REV(x)       (defined(__FreeBSD_version) && \
-                                (__FreeBSD_version > (x)))
-#define        FREEBSD_LT_REV(x)       (defined(__FreeBSD_version) && \
-                                (__FreeBSD_version < (x)))
-#define        BSDOS_GE_REV(x)         (defined(_BSDI_VERSION) && \
-                                (_BSDI_VERSION >= (x)))
-#define        BSDOS_GT_REV(x)         (defined(_BSDI_VERSION) && \
-                                (_BSDI_VERSION > (x)))
-#define        BSDOS_LT_REV(x)         (defined(_BSDI_VERSION) && \
-                                (_BSDI_VERSION < (x)))
-#define        OPENBSD_GE_REV(x)       (defined(OpenBSD) && (OpenBSD >= (x)))
-#define        OPENBSD_GT_REV(x)       (defined(OpenBSD) && (OpenBSD > (x)))
-#define        OPENBSD_LT_REV(x)       (defined(OpenBSD) && (OpenBSD < (x)))
-#define        BSD_GE_YEAR(x)          (defined(BSD) && (BSD >= (x)))
-#define        BSD_GT_YEAR(x)          (defined(BSD) && (BSD > (x)))
-#define        BSD_LT_YEAR(x)          (defined(BSD) && (BSD < (x)))
+#if defined(__NetBSD_Version__)
+# define NETBSD_GE_REV(x)      (__NetBSD_Version__ >= (x))
+# define NETBSD_GT_REV(x)      (__NetBSD_Version__ > (x))
+# define NETBSD_LT_REV(x)      (__NetBSD_Version__ < (x))
+#else
+# define NETBSD_GE_REV(x)      0
+# define NETBSD_GT_REV(x)      0
+# define NETBSD_LT_REV(x)      0
+#endif
+
+#if defined(__FreeBSD_version)
+# define FREEBSD_GE_REV(x)     (__FreeBSD_version >= (x))
+# define FREEBSD_GT_REV(x)     (__FreeBSD_version > (x))
+# define FREEBSD_LT_REV(x)     (__FreeBSD_version < (x))
+#else
+# define FREEBSD_GE_REV(x)     0
+# define FREEBSD_GT_REV(x)     0
+# define FREEBSD_LT_REV(x)     0
+#endif
+
+#if defined(_BSDI_VERSION)
+# define BSDOS_GE_REV(x)       (_BSDI_VERSION >= (x))
+# define BSDOS_GT_REV(x)       (_BSDI_VERSION > (x))
+# define BSDOS_LT_REV(x)       (_BSDI_VERSION < (x))
+#else
+# define BSDOS_GE_REV(x)       0
+# define BSDOS_GT_REV(x)       0
+# define BSDOS_LT_REV(x)       0
+#endif
+
+#if defined(OpenBSD)
+# define OPENBSD_GE_REV(x)     (OpenBSD >= (x))
+# define OPENBSD_GT_REV(x)     (OpenBSD > (x))
+# define OPENBSD_LT_REV(x)     (OpenBSD < (x))
+#else
+# define OPENBSD_GE_REV(x)     0
+# define OPENBSD_GT_REV(x)     0
+# define OPENBSD_LT_REV(x)     0
+#endif
+
+#if defined(BSD)
+# define BSD_GE_YEAR(x)                (BSD >= (x))
+# define BSD_GT_YEAR(x)                (BSD > (x))
+# define BSD_LT_YEAR(x)                (BSD < (x))
+#else
+# define BSD_GE_YEAR(x)                0
+# define BSD_GT_YEAR(x)                0
+# define BSD_LT_YEAR(x)                0
+#endif
 
 
 /* ----------------------------------------------------------------------- */
diff -r e316b3756b57 -r 3325065ffa05 sys/external/bsd/ipf/netinet/ip_fil.h
--- a/sys/external/bsd/ipf/netinet/ip_fil.h     Sat Sep 15 16:22:58 2012 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_fil.h     Sat Sep 15 16:56:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_fil.h,v 1.3 2012/07/22 14:27:51 darrenr Exp $       */
+/*     $NetBSD: ip_fil.h,v 1.4 2012/09/15 16:56:45 plunky Exp $        */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -30,7 +30,11 @@
 #endif
 
 #ifndef        SOLARIS
-# define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+# if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#  define SOLARIS      1
+# else
+#  define SOLARIS      0
+# endif
 #endif
 
 #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)
diff -r e316b3756b57 -r 3325065ffa05 sys/external/bsd/ipf/netinet/ip_log.c
--- a/sys/external/bsd/ipf/netinet/ip_log.c     Sat Sep 15 16:22:58 2012 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_log.c     Sat Sep 15 16:56:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_log.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $       */
+/*     $NetBSD: ip_log.c,v 1.4 2012/09/15 16:56:45 plunky Exp $        */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -9,7 +9,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_log.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_log.c,v 1.4 2012/09/15 16:56:45 plunky Exp $");
 
 #include <sys/param.h>
 #if defined(KERNEL) || defined(_KERNEL)
@@ -21,8 +21,12 @@
 #if defined(__FreeBSD__) && !defined(_KERNEL)
 # include <osreldate.h>
 #endif
-#ifndef SOLARIS
-# define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#ifndef        SOLARIS
+# if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#  define SOLARIS      1
+# else
+#  define SOLARIS      0
+# endif
 #endif
 #include <sys/errno.h>
 #include <sys/types.h>
diff -r e316b3756b57 -r 3325065ffa05 sys/external/bsd/ipf/netinet/ip_nat.h
--- a/sys/external/bsd/ipf/netinet/ip_nat.h     Sat Sep 15 16:22:58 2012 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_nat.h     Sat Sep 15 16:56:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_nat.h,v 1.3 2012/07/22 14:27:51 darrenr Exp $       */
+/*     $NetBSD: ip_nat.h,v 1.4 2012/09/15 16:56:45 plunky Exp $        */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -12,8 +12,12 @@
 #ifndef        __IP_NAT_H__
 #define        __IP_NAT_H__
 
-#ifndef SOLARIS
-#define        SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#ifndef        SOLARIS
+# if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#  define SOLARIS      1
+# else
+#  define SOLARIS      0
+# endif
 #endif
 
 #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)
diff -r e316b3756b57 -r 3325065ffa05 sys/external/bsd/ipf/netinet/ip_proxy.h
--- a/sys/external/bsd/ipf/netinet/ip_proxy.h   Sat Sep 15 16:22:58 2012 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_proxy.h   Sat Sep 15 16:56:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_proxy.h,v 1.3 2012/07/22 14:27:51 darrenr Exp $     */
+/*     $NetBSD: ip_proxy.h,v 1.4 2012/09/15 16:56:45 plunky Exp $      */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -12,7 +12,11 @@
 #define _NETINET_IP_PROXY_H_
 
 #ifndef SOLARIS
-#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+# if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#  define SOLARIS      1
+# else
+#  define SOLARIS      0
+# endif
 #endif
 
 #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)



Home | Main Index | Thread Index | Old Index