Browse Source

Add clang's -Wstring-conversion, and fix the one place it hits

Nick Mathewson 8 years ago
parent
commit
e80a032b61
2 changed files with 2 additions and 1 deletions
  1. 1 0
      configure.ac
  2. 1 1
      src/test/test_relaycell.c

+ 1 - 0
configure.ac

@@ -1851,6 +1851,7 @@ if test "x$enable_gcc_warnings_advisory" != "xno"; then
      -Wstatic-local-in-inline
      -Wstrict-overflow=2
      -Wstring-compare
+     -Wstring-conversion
      -Wstrlcpy-strlcat-size
      -Wstrncat-size
      -Wsuggest-attribute=format

+ 1 - 1
src/test/test_relaycell.c

@@ -95,7 +95,7 @@ test_relaycell_resolved(void *arg)
     tt_int_op(srm_ncalls, OP_EQ, 1);                                 \
     tt_ptr_op(srm_conn, OP_EQ, entryconn);                           \
     tt_int_op(srm_atype, OP_EQ, (atype));                            \
-    if (answer) {                                                 \
+    if ((answer) != NULL) {                                          \
       tt_int_op(srm_alen, OP_EQ, sizeof(answer)-1);                  \
       tt_int_op(srm_alen, OP_LT, 512);                                \
       tt_int_op(srm_answer_is_set, OP_EQ, 1);                        \