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/04/21 23:35:13 UTC

git commit: TS-1820 Another round of NOWARN_UNUSED eliminations

Updated Branches:
  refs/heads/master bf5145895 -> 6f52a3c3e


TS-1820 Another round of NOWARN_UNUSED eliminations


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

Branch: refs/heads/master
Commit: 6f52a3c3e8544090df968cfb9312ba4bab8061b9
Parents: bf51458
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sun Apr 21 15:34:45 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sun Apr 21 15:34:45 2013 -0600

----------------------------------------------------------------------
 iocore/cache/CacheWrite.cc        |   47 +------------------------------
 iocore/eventsystem/test_Buffer.cc |    7 +---
 lib/records/P_RecCore.cc          |    4 +--
 lib/ts/HostLookup.cc              |    3 +-
 lib/ts/ink_assert.h               |    1 +
 lib/ts/ink_mutex.cc               |    9 ------
 lib/ts/ink_mutex.h                |    1 -
 lib/ts/ink_res_init.cc            |    3 +-
 lib/ts/ink_res_mkquery.cc         |    4 +--
 proxy/InkAPI.cc                   |   35 +++++++++---------------
 10 files changed, 22 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6f52a3c3/iocore/cache/CacheWrite.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index 9aba2d5..dee62bd 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -56,11 +56,8 @@ get_alternate_index(CacheHTTPInfoVector *cache_vector, CacheKey key)
 // of writing the vector even if the http state machine aborts.  This
 // makes it easier to handle situations where writers abort.
 int
-CacheVC::updateVector(int event, Event *e)
+CacheVC::updateVector(int /* event ATS_UNUSED */, Event */* e ATS_UNUSED */)
 {
-  NOWARN_UNUSED(e);
-  NOWARN_UNUSED(event);
-
   cancel_trigger();
   if (od->reading_vec || od->writing_vec)
     VC_SCHED_LOCK_RETRY();
@@ -179,11 +176,8 @@ CacheVC::updateVector(int event, Event *e)
    */
 
 int
-CacheVC::handleWrite(int event, Event *e)
+CacheVC::handleWrite(int event, Event */* e ATS_UNUSED */)
 {
-  NOWARN_UNUSED(e);
-  NOWARN_UNUSED(event);
-
   // plain write case
   ink_assert(!trigger);
   frag_len = 0;
@@ -311,9 +305,6 @@ Vol::scan_for_pinned_documents()
 int
 Vol::aggWriteDone(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-  NOWARN_UNUSED(event);
-
   cancel_trigger();
 
   // ensure we have the cacheDirSync lock if we intend to call it later
@@ -390,9 +381,6 @@ new_DocEvacuator(int nbytes, Vol *vol)
 int
 CacheVC::evacuateReadHead(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-  NOWARN_UNUSED(event);
-
   // The evacuator vc shares the lock with the volition mutex
   ink_debug_assert(vol->mutex->thread_holding == this_ethread());
   cancel_trigger();
@@ -458,9 +446,6 @@ Ldone:
 int
 CacheVC::evacuateDocDone(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-  NOWARN_UNUSED(event);
-
   ink_debug_assert(vol->mutex->thread_holding == this_ethread());
   Doc *doc = (Doc *) buf->data();
   DDebug("cache_evac", "evacuateDocDone %X o %d p %d new_o %d new_p %d",
@@ -591,9 +576,6 @@ evacuate_fragments(CacheKey *key, CacheKey *earliest_key, int force, Vol *vol)
 int
 Vol::evacuateWrite(CacheVC *evacuator, int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-  NOWARN_UNUSED(event);
-
   // push to front of aggregation write list, so it is written first
 
   evacuator->agg_len = round_to_approx_size(((Doc *)evacuator->buf->data())->len);
@@ -611,8 +593,6 @@ Vol::evacuateWrite(CacheVC *evacuator, int event, Event *e)
 int
 Vol::evacuateDocReadDone(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-
   cancel_trigger();
   if (event != AIO_EVENT_DONE)
     return EVENT_DONE;
@@ -971,8 +951,6 @@ Vol::agg_wrap()
 int
 Vol::aggWrite(int event, void *e)
 {
-  NOWARN_UNUSED(e);
-  NOWARN_UNUSED(event);
   ink_assert(!is_io_in_progress());
 
   Que(CacheVC, link) tocall;
@@ -1093,9 +1071,6 @@ Lwait:
 int
 CacheVC::openWriteCloseDir(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-  NOWARN_UNUSED(event);
-
   cancel_trigger();
   {
     CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
@@ -1152,7 +1127,6 @@ CacheVC::openWriteCloseDir(int event, Event *e)
 int
 CacheVC::openWriteCloseHeadDone(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
   if (event == AIO_EVENT_DONE)
     set_io_not_in_progress();
   else if (is_io_in_progress())
@@ -1197,8 +1171,6 @@ Lclose:
 int
 CacheVC::openWriteCloseHead(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-
   cancel_trigger();
   f.use_first_key = 1;
   if (io.ok())
@@ -1226,7 +1198,6 @@ CacheVC::openWriteCloseHead(int event, Event *e)
 int
 CacheVC::openWriteCloseDataDone(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
   int ret = 0;
 
   if (event == AIO_EVENT_DONE)
@@ -1271,7 +1242,6 @@ Lcallreturn:
 int
 CacheVC::openWriteClose(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
   cancel_trigger();
   if (is_io_in_progress()) {
     if (event != AIO_EVENT_DONE)
@@ -1314,8 +1284,6 @@ CacheVC::openWriteClose(int event, Event *e)
 int
 CacheVC::openWriteWriteDone(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-
   cancel_trigger();
   if (event == AIO_EVENT_DONE)
     set_io_not_in_progress();
@@ -1366,8 +1334,6 @@ static inline int target_fragment_size() {
 int
 CacheVC::openWriteMain(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-  NOWARN_UNUSED(event);
   cancel_trigger();
   int called_user = 0;
   ink_debug_assert(!is_io_in_progress());
@@ -1438,8 +1404,6 @@ Lagain:
 int
 CacheVC::openWriteOverwrite(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-
   cancel_trigger();
   if (event != AIO_EVENT_DONE) {
     if (event == EVENT_IMMEDIATE)
@@ -1483,8 +1447,6 @@ Lcallreturn:
 int
 CacheVC::openWriteStartDone(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-
   intptr_t err = ECACHE_NO_DOC;
   cancel_trigger();
   if (is_io_in_progress()) {
@@ -1599,9 +1561,6 @@ Lcallreturn:
 int
 CacheVC::openWriteStartBegin(int event, Event *e)
 {
-  NOWARN_UNUSED(e);
-  NOWARN_UNUSED(event);
-
   intptr_t err;
   cancel_trigger();
   if (_action.cancelled)
@@ -1698,8 +1657,6 @@ Action *
 Cache::open_write(Continuation *cont, CacheKey *key, CacheHTTPInfo *info, time_t apin_in_cache,
                   CacheKey *key1, CacheFragType type, char *hostname, int host_len)
 {
-  NOWARN_UNUSED(key1);
-
   if (!CACHE_READY(type)) {
     cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6f52a3c3/iocore/eventsystem/test_Buffer.cc
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/test_Buffer.cc b/iocore/eventsystem/test_Buffer.cc
index 3331b8d..c11211c 100644
--- a/iocore/eventsystem/test_Buffer.cc
+++ b/iocore/eventsystem/test_Buffer.cc
@@ -135,20 +135,17 @@ main(int /* argc ATS_UNUSED */, const char */* argv ATS_UNUSED */[])
 
   for (unsigned i = 0; i < 100; ++i) {
     MIOBuffer *b1 = new_MIOBuffer(default_large_iobuffer_size);
-    IOBufferReader *b1reader = b1->alloc_reader();
+    IOBufferReader *b1reader ATS_UNUSED = b1->alloc_reader();
     b1->fill(b1->write_avail());
 
     MIOBuffer *b2 = new_MIOBuffer(default_large_iobuffer_size);
-    IOBufferReader *b2reader = b2->alloc_reader();
+    IOBufferReader *b2reader ATS_UNUSED = b2->alloc_reader();
     b2->fill(b2->write_avail());
 
     //b1->write(b2reader, 2*1024);
 
     free_MIOBuffer(b2);
     free_MIOBuffer(b1);
-
-    NOWARN_UNUSED(b1reader);
-    NOWARN_UNUSED(b2reader);
   }
 
   exit(0);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6f52a3c3/lib/records/P_RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/P_RecCore.cc b/lib/records/P_RecCore.cc
index 043c9f7..59a18fc 100644
--- a/lib/records/P_RecCore.cc
+++ b/lib/records/P_RecCore.cc
@@ -183,10 +183,8 @@ send_pull_message(RecMessageT msg_type)
 // recv_message_cb
 //-------------------------------------------------------------------------
 int
-recv_message_cb(RecMessage * msg, RecMessageT msg_type, void *cookie)
+recv_message_cb(RecMessage * msg, RecMessageT msg_type, void */* cookie */)
 {
-  REC_NOWARN_UNUSED(cookie);
-
   RecRecord *r;
   RecMessageItr itr;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6f52a3c3/lib/ts/HostLookup.cc
----------------------------------------------------------------------
diff --git a/lib/ts/HostLookup.cc b/lib/ts/HostLookup.cc
index dde727d..af8bfdb 100644
--- a/lib/ts/HostLookup.cc
+++ b/lib/ts/HostLookup.cc
@@ -798,9 +798,8 @@ HostLookup::~HostLookup()
 }
 
 static void
-empty_print_fn(void *opaque_data)
+empty_print_fn(void */* opaque_data ATS_UNUSED */)
 {
-  NOWARN_UNUSED(opaque_data);
 }
 
 void

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6f52a3c3/lib/ts/ink_assert.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_assert.h b/lib/ts/ink_assert.h
index a661abf..fb1cb90 100644
--- a/lib/ts/ink_assert.h
+++ b/lib/ts/ink_assert.h
@@ -29,6 +29,7 @@ Assertions
 #define _INK_ASSERT_H
 
 #include "ink_apidefs.h"
+#include "ink_error.h"
 
 #ifdef __cplusplus
 extern "C"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6f52a3c3/lib/ts/ink_mutex.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_mutex.cc b/lib/ts/ink_mutex.cc
index 50ec35b..e9ba5b0 100644
--- a/lib/ts/ink_mutex.cc
+++ b/lib/ts/ink_mutex.cc
@@ -33,15 +33,6 @@ ProcessMutex __global_death = PTHREAD_MUTEX_INITIALIZER;
 ProcessMutex *gobal_death_mutex = &__global_death;
 
 void
-ink_ProcessMutex_init(ProcessMutex * m, const char *name)
-{
-  NOWARN_UNUSED(name);
-  if (pthread_mutex_init(m, &_g_mattr.attr) != 0) {
-    abort();
-  }
-}
-
-void
 ink_ProcessMutex_destroy(ProcessMutex * m)
 {
   pthread_mutex_destroy(m);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6f52a3c3/lib/ts/ink_mutex.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_mutex.h b/lib/ts/ink_mutex.h
index 4c9fdb4..3e3c810 100644
--- a/lib/ts/ink_mutex.h
+++ b/lib/ts/ink_mutex.h
@@ -118,7 +118,6 @@ ink_mutex_try_acquire(ink_mutex * m)
 
 /* process mutex */
 
-void ink_ProcessMutex_init(ProcessMutex *, const char *name);
 void ink_ProcessMutex_destroy(ProcessMutex *);
 void ink_ProcessMutex_acquire(ProcessMutex *);
 void ink_ProcessMutex_release(ProcessMutex *);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6f52a3c3/lib/ts/ink_res_init.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_res_init.cc b/lib/ts/ink_res_init.cc
index 8864259..81a25b1 100644
--- a/lib/ts/ink_res_init.cc
+++ b/lib/ts/ink_res_init.cc
@@ -167,9 +167,8 @@ ink_res_getservers(ink_res_state statp, sockaddr *set, int cnt) {
 }
 
 static void
-ink_res_setoptions(ink_res_state statp, const char *options, const char *source)
+ink_res_setoptions(ink_res_state statp, const char *options, const char *source ATS_UNUSED)
 {
-  NOWARN_UNUSED(source);
   const char *cp = options;
   int i;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6f52a3c3/lib/ts/ink_res_mkquery.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_res_mkquery.cc b/lib/ts/ink_res_mkquery.cc
index a272c4a..3e01a94 100644
--- a/lib/ts/ink_res_mkquery.cc
+++ b/lib/ts/ink_res_mkquery.cc
@@ -97,7 +97,7 @@ ink_res_mkquery(ink_res_state statp,
 	     int _class, int type,	/*!< _class and type of query  */
 	     const u_char *data,	/*!< resource record data  */
 	     int datalen,		/*!< length of data  */
-	     const u_char *newrr_in,	/*!< new rr for modify or append  */
+             const u_char */* newrr_in  ATS_UNUSED */,	/*!< new rr for modify or append  */
 	     u_char *buf,		/*!< buffer to put query  */
 	     int buflen)		/*!< size of buffer  */
 {
@@ -106,8 +106,6 @@ ink_res_mkquery(ink_res_state statp,
 	int n;
 	u_char *dnptrs[20], **dpp, **lastdnptr;
 
-	NOWARN_UNUSED(newrr_in);
-
 	/*
 	 * Initialize header fields.
 	 */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6f52a3c3/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index cf374af..814b07c 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -411,17 +411,15 @@ _TSReleaseAssert(const char *text, const char *file, int line)
 
 // Assert only in debug
 int
+#ifdef DEBUG
 _TSAssert(const char *text, const char *file, int line)
 {
-#ifdef DEBUG
   _ink_assert(text, file, line);
 #else
-  NOWARN_UNUSED(text);
-  NOWARN_UNUSED(file);
-  NOWARN_UNUSED(line);
+_TSAssert(const char *, const char *, int)
+{
 #endif
-
-  return 0;
+ return 0;
 }
 
 // This assert is for internal API use only.
@@ -1141,9 +1139,8 @@ INKVConnInternal::do_io_shutdown(ShutdownHowTo_t howto)
 }
 
 void
-INKVConnInternal::reenable(VIO *vio)
+INKVConnInternal::reenable(VIO */* vio ATS_UNUSED */)
 {
-  NOWARN_UNUSED(vio);
   if (ink_atomic_increment((int *) &m_event_count, 1) < 0) {
     ink_assert(!"not reached");
   }
@@ -1652,16 +1649,14 @@ api_init()
 ////////////////////////////////////////////////////////////////////
 
 void *
-_TSmalloc(size_t size, const char *path)
+_TSmalloc(size_t size, const char */* path ATS_UNUSED */)
 {
-  NOWARN_UNUSED(path);
   return ats_malloc(size);
 }
 
 void *
-_TSrealloc(void *ptr, size_t size, const char *path)
+_TSrealloc(void *ptr, size_t size, const char */* path ATS_UNUSED */)
 {
-  NOWARN_UNUSED(path);
   return ats_realloc(ptr, size);
 }
 
@@ -2611,9 +2606,8 @@ TSMimeHdrFieldsCount(TSMBuffer bufp, TSMLoc obj)
 // The following three helper functions should not be used in plugins! Since they are not used
 // by plugins, there's no need to validate the input.
 const char *
-TSMimeFieldValueGet(TSMBuffer bufp, TSMLoc field_obj, int idx, int *value_len_ptr)
+TSMimeFieldValueGet(TSMBuffer /* bufp ATS_UNUSED */, TSMLoc field_obj, int idx, int *value_len_ptr)
 {
-  NOWARN_UNUSED(bufp);
   MIMEFieldSDKHandle *handle = (MIMEFieldSDKHandle *) field_obj;
 
   if (idx >= 0) {
@@ -6517,10 +6511,9 @@ extern bool ssl_register_protocol(const char *, Continuation *);
 extern bool ssl_unregister_protocol(const char *, Continuation *);
 
 TSReturnCode
+#if TS_USE_TLS_NPN
 TSNetAcceptNamedProtocol(TSCont contp, const char * protocol)
 {
-#if TS_USE_TLS_NPN
-
   sdk_assert(protocol != NULL);
   sdk_assert(contp != NULL);
   sdk_assert(sdk_sanity_check_continuation(contp) == TS_SUCCESS);
@@ -6531,15 +6524,13 @@ TSNetAcceptNamedProtocol(TSCont contp, const char * protocol)
   }
 
   return TS_SUCCESS;
-
+}
 #else /* TS_USE_TLS_NPN */
-
-  NOWARN_UNUSED(contp);
-  NOWARN_UNUSED(protocol);
+TSNetAcceptNamedProtocol(TSCont, const char *)
+{
   return TS_ERROR;
-
-#endif /* TS_USE_TLS_NPN */
 }
+#endif /* TS_USE_TLS_NPN */
 
 /* DNS Lookups */
 TSAction