You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/03/31 01:48:41 UTC

[1/2] git commit: Unify MAX/MIN definitions (in ink_defs.h). Also clean up the checks of gcc prior to v3.x (which we no long support).

Updated Branches:
  refs/heads/master 8a4f5837f -> 046107366


Unify MAX/MIN definitions (in ink_defs.h). Also clean up the checks of
gcc prior to v3.x (which we no long support).


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/965c40f2
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/965c40f2
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/965c40f2

Branch: refs/heads/master
Commit: 965c40f2d12f028d4cf027fe77a72847f6ebe1e2
Parents: 6309835
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sun Mar 24 18:28:28 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sun Mar 24 18:28:28 2013 -0600

----------------------------------------------------------------------
 CHANGES                                    |    3 ++
 example/remap/remap.cc                     |   16 +------------
 example/thread-pool/psi.c                  |    3 +-
 iocore/net/NetVCTest.cc                    |    7 -----
 iocore/net/P_InkBulkIO.h                   |    7 -----
 lib/ts/ink_defs.h                          |   18 ++++++++++++--
 lib/ts/ink_unused.h                        |   29 +---------------------
 mgmt/cli/cliAppInit.cc                     |    6 +----
 plugins/experimental/geoip_acl/lulu.h      |   14 +++--------
 plugins/experimental/header_rewrite/lulu.h |   11 +-------
 plugins/experimental/spdy/protocol.cc      |    6 +---
 plugins/header_filter/lulu.h               |   12 ++-------
 proxy/InkAPITestTool.cc                    |    3 --
 proxy/MuxVC.cc                             |    3 --
 proxy/PluginVC.cc                          |    5 ----
 proxy/api/ts/ts.h.in                       |    4 ---
 proxy/http/HttpTunnel.cc                   |    7 -----
 proxy/logstats.cc                          |    6 ----
 18 files changed, 34 insertions(+), 126 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 760d532..06974cf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1764] Unify MAX/MIN definitions (in ink_defs.h). Also clean
+   up the checks of gcc prior to v3.x (which we no long support).
+
   *) [TS-1724] Add tool to compare records.config files to contrib
    Author: Mark Harrison <ma...@mivok.net>
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/example/remap/remap.cc
----------------------------------------------------------------------
diff --git a/example/remap/remap.cc b/example/remap/remap.cc
index f316ca4..da5d5ed 100644
--- a/example/remap/remap.cc
+++ b/example/remap/remap.cc
@@ -47,21 +47,7 @@
 #include <ts/ts.h>
 #include <ts/remap.h>
 
-#if __GNUC__ >= 3
-#ifndef likely
-#define likely(x)   __builtin_expect (!!(x),1)
-#endif
-#ifndef unlikely
-#define unlikely(x) __builtin_expect (!!(x),0)
-#endif
-#else
-#ifndef likely
-#define likely(x)   (x)
-#endif
-#ifndef unlikely
-#define unlikely(x) (x)
-#endif
-#endif /* #if __GNUC__ >= 3 */
+#include "ink_unused.h"
 
 class remap_entry
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/example/thread-pool/psi.c
----------------------------------------------------------------------
diff --git a/example/thread-pool/psi.c b/example/thread-pool/psi.c
index 43e0a40..b10aeca 100644
--- a/example/thread-pool/psi.c
+++ b/example/thread-pool/psi.c
@@ -52,8 +52,7 @@
 #include <ts/ts.h>
 
 #include "thread.h"
-
-#define MIN(x,y) ((x < y) ? x :y)
+#include "ink_defs.h"
 
 #define DBG_TAG "xpsi"
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/iocore/net/NetVCTest.cc
----------------------------------------------------------------------
diff --git a/iocore/net/NetVCTest.cc b/iocore/net/NetVCTest.cc
index 0890533..8903e72 100644
--- a/iocore/net/NetVCTest.cc
+++ b/iocore/net/NetVCTest.cc
@@ -36,13 +36,6 @@
 
 #include "P_Net.h"
 
-// Get rid of any previous MIN declaration, since we have our own
-// funky MIN here. /leif
-#if defined(MIN)
-#undef MIN
-#endif
-#define MIN(x,y) (x <= y) ? x : y;
-
 // Each test requires two definition entries.  One for the passive
 //   side of the connection and one for the active side
 //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/iocore/net/P_InkBulkIO.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_InkBulkIO.h b/iocore/net/P_InkBulkIO.h
index 96937f9..19c15c5 100644
--- a/iocore/net/P_InkBulkIO.h
+++ b/iocore/net/P_InkBulkIO.h
@@ -146,13 +146,6 @@ struct InkBulkIORequest
 #define INKBIO_SPLIT_REQUEST  0xf1
 
 /*
- * These 2 better be the same in user/kernel land
- */
-#ifndef MAX
-#define MAX(x, y) (x > y ? x : y)
-#endif
-
-/*
  * Purposely, under specify the size; we need to leave space for the "terminating" packet.
  * Every block contains at least 1 request.
  */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/lib/ts/ink_defs.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_defs.h b/lib/ts/ink_defs.h
index 2970e2b..e39aa7e 100644
--- a/lib/ts/ink_defs.h
+++ b/lib/ts/ink_defs.h
@@ -24,16 +24,26 @@
 #ifndef _ink_defs_h
 #define	_ink_defs_h
 
-/* Defines
+/* Some popular defines
 */
 #define SIZE(x) (sizeof(x)/sizeof((x)[0]))
 #define SOCKOPT_ON ((char*)&on)
 #define SOCKOPT_OFF ((char*)&off)
+
 #ifndef ABS
-#define ABS(_x_) (((_x_) < 0) ? ( - (_x_)) : (_x_))
+#define ABS(x) (((x) < 0) ? ( - (x)) : (x))
+#endif
+
+#ifndef MAX
+#define MAX(x,y) (((x) >= (y)) ? (x) : (y))
 #endif
+
+#ifndef MIN
+#define MIN(x,y) (((x) <= (y)) ? (x) : (y))
+#endif
+
 #if TS_USE_HWLOC
-#include <hwloc.h>
+#  include <hwloc.h>
 #endif
 
 /* Debugging
@@ -82,8 +92,10 @@ const hwloc_topology_t* ink_get_topology();
 
 /** Constants.
  */
+#ifdef __cplusplus
 namespace ts {
   static const int NO_FD = -1; ///< No or invalid file descriptor.
 }
+#endif
 
 #endif /*__ink_defs_h*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/lib/ts/ink_unused.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_unused.h b/lib/ts/ink_unused.h
index 0ca5190..3aba5f3 100644
--- a/lib/ts/ink_unused.h
+++ b/lib/ts/ink_unused.h
@@ -24,21 +24,15 @@
 #ifndef _ink_unused_h
 #define _ink_unused_h
 
-#if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
 #ifdef DEBUG
 #define RELEASE_UNUSED
 #else
 #define RELEASE_UNUSED __attribute__ ((unused))
 #endif /* #ifdef DEBUG */
+
 #define UNUSED __attribute__ ((unused))
 #define INK_UNUSED __attribute__ ((unused))
-#else
-#define UNUSED
-#define INK_UNUSED
-#define RELEASE_UNUSED
-#endif /* #if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) */
 
-#if __GNUC__ >= 3
 #if 0 /* NOT USED */
 # define inline               inline __attribute__ ((always_inline))
 # define __pure               __attribute__ ((pure))
@@ -50,31 +44,12 @@
 # define __unused     __attribute__ ((unused))
 # define __packed     __attribute__ ((packed))
 #endif
+
 #ifndef likely
 #define likely(x)	__builtin_expect (!!(x), 1)
 #endif
 #ifndef unlikely
 #define unlikely(x)	__builtin_expect (!!(x), 0)
 #endif
-#else
-#if 0 /* NOT USED */
-# define inline               /* no inline */
-# define __pure               /* no pure */
-# define __const      /* no const */
-# define __noreturn   /* no noreturn */
-# define __malloc     /* no malloc */
-# define __must_check /* no warn_unused_result */
-# define __deprecated /* no deprecated */
-# define __used               /* no used */
-# define __unused     /* no unused */
-# define __packed     /* no packed */
-#endif
-#ifndef likely
-#define likely(x)	(x)
-#endif
-#ifndef unlikely
-#define unlikely(x)	(x)
-#endif
-#endif /* #if __GNUC__ >= 3 */
 
 #endif /* #ifndef _ink_unused_h */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/mgmt/cli/cliAppInit.cc
----------------------------------------------------------------------
diff --git a/mgmt/cli/cliAppInit.cc b/mgmt/cli/cliAppInit.cc
index 93163e9..52c6f22 100644
--- a/mgmt/cli/cliAppInit.cc
+++ b/mgmt/cli/cliAppInit.cc
@@ -35,12 +35,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-// Not sure if we need to worry about old gcc compilers any more, but ... /leif
-#if (__GNUC__ >= 3)
 #include <iostream>
-#else
-#include <iostream.h>
-#endif
+
 //#include "tclExtend.h"
 #include "tcl.h"
 #include <unistd.h>

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/plugins/experimental/geoip_acl/lulu.h
----------------------------------------------------------------------
diff --git a/plugins/experimental/geoip_acl/lulu.h b/plugins/experimental/geoip_acl/lulu.h
index a4f5653..0e44509 100644
--- a/plugins/experimental/geoip_acl/lulu.h
+++ b/plugins/experimental/geoip_acl/lulu.h
@@ -24,18 +24,12 @@
 #ifndef __LULU_H__
 #define __LULU_H__ 1
 
-// Pick the Geo implementation to use
-#define MAXMIND_GEOIP 1
-
+#include <sys/types.h>
 
-// Define UNUSED properly.
-#if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
-#define UNUSED __attribute__ ((unused))
-#else
-#define UNUSED
-#endif /* #if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) */
+#include "ink_defs.h"
 
-#include <sys/types.h>
+// Pick the Geo implementation to use
+#define MAXMIND_GEOIP 1
 
 // Memory barriers on i386 / linux / gcc
 #if defined(__i386__)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/plugins/experimental/header_rewrite/lulu.h
----------------------------------------------------------------------
diff --git a/plugins/experimental/header_rewrite/lulu.h b/plugins/experimental/header_rewrite/lulu.h
index 02dfefb..d517cf7 100644
--- a/plugins/experimental/header_rewrite/lulu.h
+++ b/plugins/experimental/header_rewrite/lulu.h
@@ -22,17 +22,10 @@
 #ifndef __LULU_H__
 #define __LULU_H__ 1
 
-// Define UNUSED properly.
-#if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
-#define UNUSED __attribute__ ((unused))
-#else
-#define UNUSED
-#endif /* #if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) */
-
-static char UNUSED rcsId__lulu_h[] = "@(#) $Id$ built on " __DATE__ " " __TIME__;
-
 #include <sys/types.h>
 
+#include "ink_defs.h"
+
 // Memory barriers on i386 / linux / gcc
 #if defined(__i386__)
 #define mb()  __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/plugins/experimental/spdy/protocol.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/spdy/protocol.cc b/plugins/experimental/spdy/protocol.cc
index ab06ea5..0dc5c33 100644
--- a/plugins/experimental/spdy/protocol.cc
+++ b/plugins/experimental/spdy/protocol.cc
@@ -26,10 +26,8 @@
 
 #include <algorithm>
 #include <vector>
-#include <sys/param.h> // MAX
-#if !defined(MAX)
-# define MAX(a,b) (((a)>(b))?(a):(b))
-#endif
+
+#include "ink_defs.h" // MAX
 
 void
 spdy_send_reset_stream(

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/plugins/header_filter/lulu.h
----------------------------------------------------------------------
diff --git a/plugins/header_filter/lulu.h b/plugins/header_filter/lulu.h
index a16f943..bff1a2e 100644
--- a/plugins/header_filter/lulu.h
+++ b/plugins/header_filter/lulu.h
@@ -24,17 +24,11 @@
 #ifndef __LULU_H__
 #define __LULU_H__ 1
 
-#include "ink_atomic.h"
-
-// Define UNUSED properly.
-#if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
-#define UNUSED __attribute__ ((unused))
-#else
-#define UNUSED
-#endif /* #if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) */
-
 #include <sys/types.h>
 
+#include "ink_atomic.h"
+#include "ink_unused.h"
+
 // Memory barriers on i386 / linux / gcc
 #if defined(__i386__)
 #define mb()  __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/proxy/InkAPITestTool.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITestTool.cc b/proxy/InkAPITestTool.cc
index 91e3093..7e2c988 100644
--- a/proxy/InkAPITestTool.cc
+++ b/proxy/InkAPITestTool.cc
@@ -31,9 +31,6 @@
 #define SDBG_TAG "SockServer"
 #define CDBG_TAG "SockClient"
 
-#ifndef MIN
-#define MIN(_x, _y) ((_x < _y) ? _x : _y)
-#endif
 #define IP(a,b,c,d) htonl((a) << 24 | (b) << 16 | (c) << 8 | (d))
 
 #define SET_TEST_HANDLER(_d, _s) {_d = _s;}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/proxy/MuxVC.cc
----------------------------------------------------------------------
diff --git a/proxy/MuxVC.cc b/proxy/MuxVC.cc
index 799d8d2..2f08a85 100644
--- a/proxy/MuxVC.cc
+++ b/proxy/MuxVC.cc
@@ -42,9 +42,6 @@
 const int MUX_LOCK_RETRY = HRTIME_MSECONDS(10);
 const int MUX_MAX_DATA_SIZE = USHRT_MAX - sizeof(MuxMessage);
 
-#define MIN(x,y) (x <= y) ? x : y;
-#define MAX(x,y) (x >= y) ? x : y;
-
 #define MUX_MAX_BYTES_SLOT 32768
 #define MUX_MAX_BYTES_BANK 32768
 #define MUX_SMALL_BLOCK_SIZE 256

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/proxy/PluginVC.cc
----------------------------------------------------------------------
diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc
index 52dfa26..47a285a 100644
--- a/proxy/PluginVC.cc
+++ b/proxy/PluginVC.cc
@@ -77,11 +77,6 @@
 #include "Regression.h"
 
 #define PVC_LOCK_RETRY_TIME HRTIME_MSECONDS(10)
-#undef MIN
-#define MIN(x,y) (((x) <= (y)) ? (x) : (y))
-#undef MAX
-#define MAX(x,y) (((x) >= (y)) ? (x) : (y))
-
 #define PVC_DEFAULT_MAX_BYTES 32768
 #define MIN_BLOCK_TRANSFER_BYTES 128
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/proxy/api/ts/ts.h.in
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
index cabef07..b8fd4a1 100644
--- a/proxy/api/ts/ts.h.in
+++ b/proxy/api/ts/ts.h.in
@@ -83,13 +83,9 @@ extern "C"
 #define TS_RES_MEM_PATH    TS_RES_PATH ("memory/")
 #define TS_MAX_USER_NAME_LEN 256
 
-#if __GNUC__ >= 3
 #ifndef TS_DEPRECATED
 #define TS_DEPRECATED __attribute__ ((deprecated))
 #endif
-#else
-#define TS_DEPRECATED
-#endif
 
   /**
       The following struct is used by TSPluginRegister(). It stores

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/proxy/http/HttpTunnel.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc
index 9db3df2..721ad20 100644
--- a/proxy/http/HttpTunnel.cc
+++ b/proxy/http/HttpTunnel.cc
@@ -230,11 +230,6 @@ ChunkedHandler::read_size()
 //   Use block reference method when there is a sufficient
 //   size to move.  Otherwise, uses memcpy method
 //
-
-// We redefine MIN here, with our own funky implementation.  TODO: Do we need this ?
-#undef MIN
-#define MIN(x,y) ((x) <= (y)) ? (x) : (y);
-
 int64_t
 ChunkedHandler::transfer_bytes()
 {
@@ -445,8 +440,6 @@ bool ChunkedHandler::generate_chunked_content()
   return false;
 }
 
-#undef MIN
-
 HttpTunnelProducer::HttpTunnelProducer()
   : consumer_list(), self_consumer(NULL),
     vc(NULL), vc_handler(NULL), read_vio(NULL), read_buffer(NULL),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/965c40f2/proxy/logstats.cc
----------------------------------------------------------------------
diff --git a/proxy/logstats.cc b/proxy/logstats.cc
index 2553a38..d4eb377 100644
--- a/proxy/logstats.cc
+++ b/proxy/logstats.cc
@@ -53,16 +53,10 @@
 #include <functional>
 #include <fcntl.h>
 
-#if (__GNUC__ >= 3)
 #define _BACKWARD_BACKWARD_WARNING_H    // needed for gcc 4.3
 #include <ext/hash_map>
 #include <ext/hash_set>
 #undef _BACKWARD_BACKWARD_WARNING_H
-#else
-#include <hash_map>
-#include <hash_set>
-#include <map>
-#endif
 
 #ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE 600


[2/2] git commit: TS-1764 Unify MAX/MIN definitions (in ink_defs.h). Also clean up the checks of gcc prior to v3.x (which we no longer support.

Posted by zw...@apache.org.
TS-1764 Unify MAX/MIN definitions (in ink_defs.h). Also clean up the checks of gcc prior to v3.x (which we no longer support.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/04610736
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/04610736
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/04610736

Branch: refs/heads/master
Commit: 046107366aba453b5fc05142110140a0621ac714
Parents: 8a4f583 965c40f
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sat Mar 30 18:48:26 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sat Mar 30 18:48:26 2013 -0600

----------------------------------------------------------------------
 CHANGES                                    |    3 ++
 example/remap/remap.cc                     |   16 +------------
 example/thread-pool/psi.c                  |    3 +-
 iocore/net/NetVCTest.cc                    |    7 -----
 iocore/net/P_InkBulkIO.h                   |    7 -----
 lib/ts/ink_defs.h                          |   18 ++++++++++++--
 lib/ts/ink_unused.h                        |   29 +---------------------
 mgmt/cli/cliAppInit.cc                     |    6 +----
 plugins/experimental/geoip_acl/lulu.h      |   14 +++--------
 plugins/experimental/header_rewrite/lulu.h |   11 +-------
 plugins/experimental/spdy/protocol.cc      |    6 +---
 plugins/header_filter/lulu.h               |   12 ++-------
 proxy/InkAPITestTool.cc                    |    3 --
 proxy/MuxVC.cc                             |    3 --
 proxy/PluginVC.cc                          |    5 ----
 proxy/api/ts/ts.h.in                       |    4 ---
 proxy/http/HttpTunnel.cc                   |    7 -----
 proxy/logstats.cc                          |    6 ----
 18 files changed, 34 insertions(+), 126 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/04610736/CHANGES
----------------------------------------------------------------------
diff --cc CHANGES
index 024f515,06974cf..7a4eea4
--- a/CHANGES
+++ b/CHANGES
@@@ -2,18 -2,9 +2,21 @@@
    Changes with Apache Traffic Server 3.3.2
  
  
 +  *) [TS-1790] authproxy should accept 2xx as authorization success
 +
 +  *) [TS-1780] Fix Debuntu build with hardening flags
 +
 +  *) [TS-1623, TS-1625] Fixes for logging where the host name was not handled
 +    correctly because it was not in the URL.
 +
 +  *) [TS-1754] Remove unecessary wWarnings from stats evaluation.
 +   Author: Yunkai Zhang.
 +
 +  *) [TS-1169] Eliminate bogus asserts. Credits to Conan Wang.
 +
+   *) [TS-1764] Unify MAX/MIN definitions (in ink_defs.h). Also clean
 -   up the checks of gcc prior to v3.x (which we no long support).
++   up the checks of gcc prior to v3.x (which we no longer support).
+ 
    *) [TS-1724] Add tool to compare records.config files to contrib
     Author: Mark Harrison <ma...@mivok.net>