[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-dev] [patch] fix cparser/firm compiler warnings



Hi!

We're trying to compile Tor with cparser and got some warnings and an
error.

src/or/dirserv.c:803:1: error: declaration 'was_router_added_t
dirserv_add_extrainfo(extrainfo_t*, const char**)' is incompatible with
'int dirserv_add_extrainfo(extrainfo_t*, const char**)' (declared at
line 96:12)
src/or/dirserv.c:81:14: warning: unnecessary static forward declaration
for 'char* format_versions_list(config_line_t*)' [-Wredundant-decls]
src/or/dirserv.c:2186:8: warning: statement is empty [-Wempty-statement]
src/or/dirserv.c:2210:8: warning: statement is empty [-Wempty-statement]
src/or/dirserv.c:2752:51: warning: statement is empty
[-Wempty-statement]
src/or/dirserv.c:3009:51: warning: statement is empty
[-Wempty-statement]
src/or/dirserv.c:3280:112: warning: statement is empty
[-Wempty-statement]
src/or/dirserv.c:3483:54: warning: statement is empty
[-Wempty-statement]
src/or/dirserv.c:3603:129: warning: statement is empty
[-Wempty-statement]
1 error(s), 47 warning(s)

The attached patch fixes those the warnings that are unambiguously due
to inconsistent style ("if (cond) {body};" -- removing extra semicolon)
and fixes the warning due to inconsistently declared a return type (once
declared as 'enum', once as 'int').

Is there a better place for sending patches that do not really require
broad discussion?


Happy hacking!

Christian
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index ec4ecfa..3851043 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -93,7 +93,7 @@ static const signed_descriptor_t *get_signed_descriptor_by_fp(
                                                         const char *fp,
                                                         int extrainfo,
                                                         time_t publish_cutoff);
-static int dirserv_add_extrainfo(extrainfo_t *ei, const char **msg);
+static was_router_added_t dirserv_add_extrainfo(extrainfo_t *ei, const char **msg);
 
 /************** Measured Bandwidth parsing code ******/
 #define MAX_MEASUREMENT_AGE (3*24*60*60) /* 3 days */
@@ -2183,7 +2183,7 @@ routerstatus_format_entry(char *buf, size_t buf_len,
             "(wanted descriptor %s).",
             id, dd);
         return -1;
-      };
+      }
 
       /* This assert can fire for the control port, because
        * it can request NS documents before all descriptors
@@ -2207,7 +2207,7 @@ routerstatus_format_entry(char *buf, size_t buf_len,
         tor_assert(tor_memeq(desc->cache_info.signed_descriptor_digest,
               rs->descriptor_digest,
               DIGEST_LEN));
-      };
+      }
     }
 
     if (format == NS_CONTROL_PORT && rs->has_bandwidth) {
_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev