[or-cvs] r10195: Make --enable-gcc-warnings happy on the upcoming gcc 4.2 (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Tue May 15 21:17:45 UTC 2007


Author: nickm
Date: 2007-05-15 17:17:42 -0400 (Tue, 15 May 2007)
New Revision: 10195

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/circuitlist.c
   tor/trunk/src/or/config.c
   tor/trunk/src/or/router.c
Log:
 r12763 at catbus:  nickm | 2007-05-15 05:29:33 -0400
 Make --enable-gcc-warnings happy on the upcoming gcc 4.2



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r12763] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-05-15 10:09:44 UTC (rev 10194)
+++ tor/trunk/ChangeLog	2007-05-15 21:17:42 UTC (rev 10195)
@@ -144,6 +144,7 @@
     - Add even more asserts to hunt down bug 417.
     - On Windows, we were preventing other processes from reading
       cached-routers while Tor was running.  (Reported by janbar)
+    - Build without verbose warnings even on (not-yet-released) gcc 4.2
 
   o Minor bugfixes (controller):
     - Make 'getinfo fingerprint' return a 551 error if we're not a

Modified: tor/trunk/src/or/circuitlist.c
===================================================================
--- tor/trunk/src/or/circuitlist.c	2007-05-15 10:09:44 UTC (rev 10194)
+++ tor/trunk/src/or/circuitlist.c	2007-05-15 21:17:42 UTC (rev 10195)
@@ -1116,16 +1116,20 @@
   edge_connection_t *conn;
   const or_circuit_t *or_circ = NULL;
   const origin_circuit_t *origin_circ = NULL;
+  circuit_t *nonconst_circ;
 
   tor_assert(c);
   tor_assert(c->magic == ORIGIN_CIRCUIT_MAGIC || c->magic == OR_CIRCUIT_MAGIC);
   tor_assert(c->purpose >= _CIRCUIT_PURPOSE_MIN &&
              c->purpose <= _CIRCUIT_PURPOSE_MAX);
 
+  /* Having a separate variable for this pleases GCC 4.2 in ways I hop I never
+   * understand. -NM. */
+  nonconst_circ = (circuit_t*) c;
   if (CIRCUIT_IS_ORIGIN(c))
-    origin_circ = TO_ORIGIN_CIRCUIT((circuit_t*)c);
+    origin_circ = TO_ORIGIN_CIRCUIT(nonconst_circ);
   else
-    or_circ = TO_OR_CIRCUIT((circuit_t*)c);
+    or_circ = TO_OR_CIRCUIT(nonconst_circ);
 
   if (c->n_conn) {
     tor_assert(!memcmp(c->n_conn->identity_digest, c->n_conn_id_digest,

Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2007-05-15 10:09:44 UTC (rev 10194)
+++ tor/trunk/src/or/config.c	2007-05-15 21:17:42 UTC (rev 10195)
@@ -3113,7 +3113,7 @@
 
   if (argc > 1 && (!strcmp(argv[1],"--version"))) {
     char vbuf[128];
-    if (tor_svn_revision && strlen(tor_svn_revision)) {
+    if (tor_svn_revision != NULL && strlen(tor_svn_revision)) {
       tor_snprintf(vbuf, sizeof(vbuf), " (r%s)", tor_svn_revision);
     } else {
       vbuf[0] = 0;

Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2007-05-15 10:09:44 UTC (rev 10194)
+++ tor/trunk/src/or/router.c	2007-05-15 21:17:42 UTC (rev 10195)
@@ -1244,7 +1244,7 @@
 {
   char svn_version_buf[128];
   if (!strcmpend(VERSION, "-dev") &&
-      tor_svn_revision && strlen(tor_svn_revision)) {
+      tor_svn_revision != NULL && strlen(tor_svn_revision)) {
     tor_snprintf(svn_version_buf, sizeof(svn_version_buf), " (r%s)",
                  tor_svn_revision);
   } else {



More information about the tor-commits mailing list