Use Cppcheck to lint XHPAST source files.
Details
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Commits
- rPHU27d5889f56ef: Use `cppcheck` to lint XHPAST source
Ran arc lint --trace support/xhpast/xhpast.cpp and saw cppcheck invoked.
Diff Detail
Diff Detail
- Repository
- rPHU libphutil
- Branch
- master
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 5114 Build 5132: [Placeholder Plan] Wait for 30 Seconds
Event Timeline
Comment Actions
Here is the current output:
>>> Lint for support/xhpast/ast.hpp: Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::insert_token' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::last_token' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::heredoc_yyleng' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::heredoc_data' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::used_attributes' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::old_expecting_xhp_class_statements' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::first_lineno' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::used_attributes' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::insert_token' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::last_token' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::heredoc_yyleng' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::heredoc_data' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::old_expecting_xhp_class_statements' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; Warning (Cppcheck) uninitMemberVar Member variable 'yy_extra_type::first_lineno' is not initialized in the constructor. 9 10 class yy_extra_type { 11 public: >>> 12 yy_extra_type() { 13 lineno = 1; 14 terminated = false; 15 used = false; >>> Lint for support/xhpast/astnode.hpp: Warning (Cppcheck) uninitMemberVar Member variable 'Token::lineno' is not initialized in the constructor. 17 unsigned int lineno; 18 unsigned int n; 19 >>> 20 Token(unsigned int type, char *value, unsigned int n) : 21 type(type), 22 value(value), 23 n(n) { Warning (Cppcheck) uninitMemberVar Member variable 'Token::lineno' is not initialized in the constructor. 17 unsigned int lineno; 18 unsigned int n; 19 >>> 20 Token(unsigned int type, char *value, unsigned int n) : 21 type(type), 22 value(value), 23 n(n) { Warning (Cppcheck) uninitMemberVar Member variable 'Token::lineno' is not initialized in the constructor. 17 unsigned int lineno; 18 unsigned int n; 19 >>> 20 Token(unsigned int type, char *value, unsigned int n) : 21 type(type), 22 value(value), 23 n(n) { Warning (Cppcheck) uninitMemberVar Member variable 'Token::lineno' is not initialized in the constructor. 17 unsigned int lineno; 18 unsigned int n; 19 >>> 20 Token(unsigned int type, char *value, unsigned int n) : 21 type(type), 22 value(value), 23 n(n) { >>> Lint for support/xhpast/xhpast.cpp: Warning (Cppcheck) unusedVariable Unused variable: files 12 void print_node(xhpast::Node *node); 13 14 int main(int argc, char* argv[]) { >>> 15 vector<string> files; 16 17 if (argc != 1) { 18 //coupling: modify also libphutil/src/parser/xhpast/bin/PhutilXHPASTBinary.php Warning (Cppcheck) variableScope The scope of the variable 'r' can be reduced. 98 99 void print_node(xhpast::Node *node) { 100 int l = -1; >>> 101 int r = -1; 102 if (node->l_tok != -1) { 103 l = node->l_tok; 104 } Warning (Cppcheck) invalidPrintfArgType_sint %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. 104 } 105 106 if (l == -1) { >>> 107 printf("[%d]", node->type); 108 } else { 109 if (node->r_tok != -1) { 110 r = node->r_tok; Warning (Cppcheck) invalidPrintfArgType_sint %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. 110 r = node->r_tok; 111 } 112 >>> 113 printf("[%d, %d, %d", node->type, l, r); 114 if (!node->children.empty()) { 115 printf(", ["); 116 for (xhpast::node_list_t::iterator ii = node->children.begin();;) {