- From: Richard A. O'Keefe <ok@cs.otago.ac.nz>
- Date: Wed, 18 Nov 2015 17:37:36 +1300
- To: Geoff McLane <ubuntu@geoffair.info>
- CC: <html-tidy@w3.org>
(1) Download from https://github.com/htacg/tidy-html5 (2) Unpack. (3) Read README. (4) WHOOPS! README is not a plain text file, as its name suggests, it's a directory! (5) Read the stuff in README/ (6) cd build/cmake cmake ../.. -DMAKE_INSTALL_PREFIX=$HOME/local CMake Warning (dev): Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake --help-policy CMP0042" for policy details. Use the cmake_policy command to set the policy and suppress this warning. MACOSX_RPATH is not specified for the following targets: tidy-share This warning is for project developers. Use -Wno-dev to suppress it. m% cmake --help-policy CMP0042 CMP0042 ------- ``MACOSX_RPATH`` is enabled by default. CMake 2.8.12 and newer has support for using ``@rpath`` in a target's install name. This was enabled by setting the target property ``MACOSX_RPATH``. The ``@rpath`` in an install name is a more flexible and powerful mechanism than ``@executable_path`` or ``@loader_path`` for locating shared libraries. CMake 3.0 and later prefer this property to be ON by default. Projects wanting ``@rpath`` in a target's install name may remove any setting of the ``INSTALL_NAME_DIR`` and ``CMAKE_INSTALL_NAME_DIR`` variables. This policy was introduced in CMake version 3.0. CMake version 3.0.1 warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly. (7) make [ 15%] Building C object CMakeFiles/tidy-static.dir/src/pprint.c.o /tmp/tidy/src/pprint.c:1030:52: warning: '&&' within '||' [-Wlogical-op-parentheses] ...1) == end) || ((ix + 1) < end) && (isspace(doc->lexer->lexbuf[ix+1]))) ) ~~ ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /tmp/tidy/src/pprint.c:1030:52: note: place parentheses around the '&&' expression to silence this warning ...1) == end) || ((ix + 1) < end) && (isspace(doc->lexer->lexbuf[ix+1]))) ) ^ ( ) 1 warning generated. I personally regard this advice as expressing contempt for programmers. However, given that the line in question already has no fewer than SEVEN pairs of parentheses more than the compiler or human readers need, adding an eighth pair wouldn't make it significantly more horrible than it already is. [ 37%] Building C object CMakeFiles/tidy-static.dir/src/streamio.c.o /tmp/tidy/src/streamio.c:955:19: warning: unused variable 'Symbol2Unicode' [-Wunused-const-variable] static const uint Symbol2Unicode[] = ^ This is a table to convert characters in the "Symbol" font to Unicode. The function DecodeSymbolFont() that would have used it is #if 0-ed out. These are the only issues reported by /usr/bin/cc which is Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.4.0 Thread model: posix on this Mac OS X 10.9.5 box (Darwin Kernel 13.4.0). In particular, there doesn't appear to be any problem with 'uint' on this system. (8) Going to src/ and doing cc --analyze -I../include *.c produces these reports. Clang isn't always right, but the last time I was certain clang was wrong about a warning it turned out I had misunderstood what I was being warned about and clang had been trying to tell me about a real bug, so it's always worth investigating when clang complains. access.c:1605:29: warning: Value stored to 'flag' is never read flag = 1; ^ ~ access.c:2150:13: warning: Access to field 'content' results in a dereference of a null pointer (loaded from variable 'node') if (node->content != NULL && node->content->tag == NULL) ^~~~~~~~~~~~~ access.c:2756:30: warning: Access to field 'content' results in a dereference of a null pointer (loaded from variable 'node') TY_(nodeIsText)(node->content) ) ^~~~~~~~~~~~~ access.c:2771:22: warning: Access to field 'content' results in a dereference of a null pointer (loaded from variable 'node') for ( node = node->content; node; node = node->next ) ^~~~~~~~~~~~~ access.c:3237:21: warning: Access to field 'content' results in a dereference of a null pointer (loaded from variable 'node') for ( content = node->content; content != NULL; content = content->next ) ^~~~~~~~~~~~~ 5 warnings generated. attrs.c:1341:24: warning: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'first') temp = first->next; ^~~~~~~~~~~ attrs.c:1838:13: warning: Access to field 'value' results in a dereference of a null pointer (loaded from variable 'attval') if (attval->value == NULL) ^~~~~~~~~~~~~ 2 warnings generated. config.c:811:9: warning: Value stored to 'c' is never read c = FirstChar( cfg ); ^ ~~~~~~~~~~~~~~~~ config.c:831:17: warning: Value stored to 'c' is never read c = AdvanceChar( cfg ); ^ ~~~~~~~~~~~~~~~~~~ 2 warnings generated. fileio.c:81:5: warning: Dereference of null pointer TidyFree( fin->unget.allocator, fin ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./forward.h:58:37: note: expanded from macro 'TidyFree' #define TidyFree(allocator, block) ((allocator)->vtbl->free((allocator)... ^~~~~~~~~~~ 1 warning generated. lexer.c:2113:43: warning: Access to field 'element' results in a dereference of a null pointer (loaded from variable 'container') matches = TY_(tmbstrncasecmp)(container->element, lexer->lex... ^~~~~~~~~~~~~~~~~~ 1 warning generated. localize.c:1763:65: warning: Access to field 'element' results in a dereference of a null pointer (loaded from variable 'element') ...TidyWarning, node, fmt, node->element, element->element); ^~~~~~~~~~~~~~~~ localize.c:1785:49: warning: Access to field 'element' results in a dereference of a null pointer (loaded from variable 'element') messageNode(doc, TidyWarning, rpt, fmt, element->element); ^~~~~~~~~~~~~~~~ localize.c:1789:49: warning: Access to field 'element' results in a dereference of a null pointer (loaded from variable 'element') messageNode(doc, TidyWarning, rpt, fmt, element->element, nodedesc); ^~~~~~~~~~~~~~~~ localize.c:1800:60: warning: Access to field 'element' results in a dereference of a null pointer (loaded from variable 'element') messageNode(doc, TidyWarning, node, fmt, nodedesc, element->element); ^~~~~~~~~~~~~~~~ localize.c:1835:63: warning: Access to field 'element' results in a dereference of a null pointer (loaded from variable 'element') messageNode(doc, TidyError, node, fmt, node->element, element->element); ^~~~~~~~~~~~~~~~ 5 warnings generated. parser.c:213:14: warning: Access to field 'parent' results in a dereference of a null pointer (loaded from variable 'element') parent = element->parent; ^~~~~~~~~~~~~~~ parser.c:222:9: warning: Access to field 'content' results in a dereference of a null pointer (loaded from variable 'parent') if (parent->content == element) ^~~~~~~~~~~~~~~ parser.c:426:27: warning: Access to field 'model' results in a dereference of a null pointer (loaded from field 'tag') if ( (element->tag->model & CM_INLINE) && ^~~~~~~~~~~~~~~~~~~ parser.c:500:15: warning: Access to field 'model' results in a dereference of a null pointer (loaded from field 'tag') if ( (element->tag->model & CM_INLINE) && ^~~~~~~~~~~~~~~~~~~ parser.c:737:11: warning: Access to field 'versions' results in a dereference of a null pointer (loaded from field 'tag') (node->tag->versions & VERS_PROPRIETARY) != 0 ) ^~~~~~~~~~~~~~~~~~~ parser.c:794:23: warning: Access to field 'parent' results in a dereference of a null pointer (loaded from variable 'element') element = element->parent; ^~~~~~~~~~~~~~~ parser.c:1424:5: warning: Access to field 'element' results in a dereference of a null pointer (loaded from variable 'node') (node->element != NULL && ^~~~~~~~~~~~~ parser.c:2105:15: warning: Access to field 'model' results in a dereference of a null pointer (loaded from field 'tag') if (!(node->tag->model & CM_INLINE) && ^~~~~~~~~~~~~~~~ parser.c:2180:11: warning: Access to field 'model' results in a dereference of a null pointer (loaded from field 'tag') if (!(element->tag->model & CM_OPT)) ^~~~~~~~~~~~~~~~~~~ parser.c:2322:17: warning: Access to field 'last' results in a dereference of a null pointer (loaded from variable 'parent') if (parent->last == node) ^~~~~~~~~~~~ parser.c:2809:13: warning: Access to field 'model' results in a dereference of a null pointer (loaded from field 'tag') if (node->tag->model & CM_ROWGRP) ^~~~~~~~~~~~~~~~ parser.c:3398:26: warning: Access to field 'tag' results in a dereference of a null pointer (loaded from variable 'field') if (node->tag == field->tag && node->type == EndTag) ^~~~~~~~~~ parser.c:3447:11: warning: Access to field 'model' results in a dereference of a null pointer (loaded from field 'tag') if (!(field->tag->model & CM_OPT)) ^~~~~~~~~~~~~~~~~ parser.c:3447:11: warning: Access to field 'tag' results in a dereference of a null pointer (loaded from variable 'field') if (!(field->tag->model & CM_OPT)) ^~~~~~~~~~ parser.c:4215:40: warning: Access to field 'model' results in a dereference of a null pointer (loaded from field 'tag') if (node->type == StartTag && (node->tag->model & CM_FRAMES)) ^~~~~~~~~~~~~~~~ parser.c:4222:48: warning: Access to field 'model' results in a dereference of a null pointer (loaded from field 'tag') else if (node->type == StartEndTag && (node->tag->model & CM_FRAMES)) ^~~~~~~~~~~~~~~~ 16 warnings generated. pprint.c:1214:11: warning: Value stored to 'indAttrs' is never read indAttrs = no; ^ ~~ pprint.c:1845:8: warning: Access to field 'parent' results in a dereference of a null pointer (loaded from variable 'node') if ( node->parent != NULL ) ^~~~~~~~~~~~ pprint.c:1998:9: warning: Value stored to 'contentIndent' is never read contentIndent = 0; ^ ~ 3 warnings generated. streamio.c:689:13: warning: Value stored to 'c' is never read c = 0; ^ ~ streamio.c:699:17: warning: Value stored to 'c' is never read c = 0; ^ ~ 2 warnings generated. tmbstr.c:154:22: warning: Dereference of null pointer (loaded from variable 's1') while (c = (uint)(*s1), TY_(ToLower)(c) == TY_(ToLower)((uint)(*s2))) ^~~~~ 1 warning generated. utf8.c:306:33: warning: Assigned value is garbage or undefined theByte = buf[tempCount - 1]; ^ ~~~~~~~~~~~~~~~~~~ 1 warning generated. "Value stored ... is never read" warnings appear to be correct. "Dereference of null pointer" warnings don't mean that the pointer in question is certain to be NULL, only that clang cannot see anything that ensures that it *isn't* NULL. You can shut clang up about these warnings by adding assert(ptr != NULL), with the benefit that if the pointer *is* NULL you will get an assertion failure which is somewhat more helpful than a crash (Darwin not producing core dumps). The wornings in streamio.c appear to be correct. I *think* the warning in utf8.c is mistaken, but I've been wrong about that kind of thing before.
Received on Wednesday, 18 November 2015 04:38:17 UTC