Commit Graph

18245 Commits

Author SHA1 Message Date
Olivier Croquette b05ae44edb Fix link error when building with MinGW about __imp_PathFileExistsA (#1310)
Following error occurs when building with MinGW 7.2.0 and Ninja on Windows:

  cli/CMakeFiles/cli_objs.dir/filelister.cpp.obj: In function `MyIsDirectory':
  cppcheck-1.84\build/../cli/filelister.cpp:49: undefined reference to `__imp_PathIsDirectoryA'
  cli/CMakeFiles/cli_objs.dir/filelister.cpp.obj: In function `MyFileExists':
  cppcheck-1.84\build/../cli/filelister.cpp:67: undefined reference to `__imp_PathFileExistsA'
  collect2.exe: error: ld returned 1 exit status

This is the corresponding code in filelister.cpp:

  #ifdef _WIN32

  // snip

  static BOOL MyIsDirectory(const std::string& path)
  {
  #ifdef __BORLANDC__
      return (GetFileAttributes(path.c_str()) & FILE_ATTRIBUTE_DIRECTORY);
  #else
  // See http://msdn.microsoft.com/en-us/library/bb773621(VS.85).aspx
      return PathIsDirectoryA(path.c_str());
  #endif
  }

  static BOOL MyFileExists(const std::string& path)
  {
  #ifdef __BORLANDC__
      DWORD fa = GetFileAttributes(path.c_str());
      BOOL result = FALSE;
      if (fa != INVALID_FILE_ATTRIBUTES && !(fa & FILE_ATTRIBUTE_DIRECTORY))
	  result = TRUE;
  #else
      const BOOL result = PathFileExistsA(path.c_str());
  #endif
      return result;
  }

The else blocks assume that Shlwapi.lib is available on Windows except with Borland,
so the patch set ensures that the library is linked on the same condition.
2018-07-15 22:26:02 +02:00
rikardfalkeborn 0e639ea7c9 runtest.sh: Bugfix cfg dir when run in test/cfg (#1311)
Commit 5cc8da2db4 introduced syntax checking of xml-files. This broke
running the file directly in the test/cfg folder since it assumed the
config files to check were located in cfg in the current working
directory. Fix this by adding a variable that holds the correct path.
2018-07-15 22:24:31 +02:00
Daniel Marjamäki 39857220ce Refactoring: Use range for loops 2018-07-15 15:08:35 +02:00
Daniel Marjamäki cc5f00c252 Refactoring; use range for loops 2018-07-15 15:03:08 +02:00
Daniel Marjamäki 518dd8bfa3 Refactoring: Use range for loops 2018-07-15 14:51:33 +02:00
Daniel Marjamäki 1c4fb47582 astyle formatting
[ci skip]
2018-07-15 14:45:33 +02:00
Daniel Marjamäki faea8e1c02 Refactoring: Use range for loops 2018-07-15 14:45:15 +02:00
Paul Fultz II 5d1fdf7958 Fix issue 7904: Handle double nots in isSameExpression (#1305)
* Fix issue 7904: Handle double nots in isSameExpression

* Skip checking double nots in assignments

* Use ast to check for double not
2018-07-15 11:30:02 +02:00
Daniel Marjamäki 60485df762 Refactoring; Use range for loops 2018-07-14 22:49:31 +02:00
Daniel Marjamäki 991300ac54 Clarify code with Token::isUnaryOp() 2018-07-14 22:36:08 +02:00
Daniel Marjamäki 1e824330c0 Refactoring: Use range for loops 2018-07-14 22:26:22 +02:00
Daniel Marjamäki 0f3cc56c59 Refactoring: Use range for loops 2018-07-14 13:19:41 +02:00
Daniel Marjamäki d603a811bb Clarify code with Token::hasKnownValue() 2018-07-14 13:09:53 +02:00
Daniel Marjamäki d00e522856 Clarify the code with Token::isUnaryOp and Token::isBinaryOp 2018-07-14 13:01:24 +02:00
Daniel Marjamäki c9a2071420 Refactoring: Use range for loop 2018-07-14 12:28:57 +02:00
Daniel Marjamäki 0c84475aac Clarify code with Token::isUnaryOp() 2018-07-14 10:26:22 +02:00
Daniel Marjamäki 449c48f6a7 Refactoring: Use range for loops 2018-07-14 10:23:41 +02:00
Daniel Marjamäki c7b787888a Refactoring: Use range for loops 2018-07-14 10:09:12 +02:00
Daniel Marjamäki 7dda8e2a2d Refactoring: Use range for loops 2018-07-14 10:02:32 +02:00
Daniel Marjamäki eeda082a2f Refactoring: use range for loops 2018-07-14 09:54:52 +02:00
Daniel Marjamäki bb36adb432 Refactoring; Use range for loops 2018-07-14 09:49:03 +02:00
Daniel Marjamäki c60763bc14 Refactoring; Use range for loop 2018-07-14 08:18:10 +02:00
Daniel Marjamäki 5b1d96b346 Clarify code with Token::isUnaryOp() 2018-07-14 08:04:08 +02:00
Daniel Marjamäki 4429ee55c3 Refactoring; Use range for loop 2018-07-14 07:55:18 +02:00
Daniel Marjamäki 1dd647ae84 Refactoring; Use range for loop 2018-07-14 07:49:04 +02:00
Daniel Marjamäki d759015d99 Refactoring; Use range for loops 2018-07-13 23:51:22 +02:00
Daniel Marjamäki 594e07acaa Refactoring; Use range for loop 2018-07-13 23:45:34 +02:00
Daniel Marjamäki 58ac8a9982 Refactoring; Use range for loops 2018-07-13 23:43:03 +02:00
Daniel Marjamäki ed76f06ca7 Refactoring; use range for loop 2018-07-13 23:32:49 +02:00
Daniel Marjamäki b2403c36cd Refactoring; Use Token::isUnaryOp() to clarify code 2018-07-13 23:17:24 +02:00
Daniel Marjamäki 54cfdb731e Refactoring; Use Token::isUnaryOp() to clarify code 2018-07-13 23:12:20 +02:00
Daniel Marjamäki 2c90a83695 Refactoring; Use Token::isBinaryOp() to clarify code, use early continue in loop 2018-07-13 23:06:45 +02:00
Daniel Marjamäki a4fdef8d9e Refactoring; Use Token::isUnaryOp() to clarify code 2018-07-13 23:02:52 +02:00
Daniel Marjamäki 5712366a8f refactoring; use range for loops 2018-07-13 22:56:20 +02:00
fu7mu4 41d4a6bde6 update cppcheck_ja.ts for 1.84 (#1306) 2018-07-13 22:49:30 +02:00
Daniel Marjamäki 93903d96c4 Refactoring, use Token::isUnaryOp and Token::isBinaryOp 2018-07-13 18:52:03 +02:00
Daniel Marjamäki 435888f82e Refactoring; use range for loop 2018-07-13 16:57:17 +02:00
Daniel Marjamäki 4d52949be6 Refactoring: Use ranged for loop 2018-07-13 16:50:12 +02:00
Daniel Marjamäki e552737028 Refactoring: Use range for loop 2018-07-13 16:46:29 +02:00
Daniel Marjamäki 2c49732eb8 Added Token::isUnaryOp() 2018-07-13 16:40:32 +02:00
Daniel Marjamäki 2963522d5f Refactoring: Use ranged for loops 2018-07-13 16:40:15 +02:00
Daniel Marjamäki 2b125e013a Code refactoring, no functional change intended 2018-07-13 09:20:53 +02:00
Paul Fultz II 42f075c3fa Skip literals for always true/false (#1304) 2018-07-12 23:06:47 +02:00
Sebastian 5cc8da2db4
cfg/runtests.sh: Check syntax of defines in configuration files. (#1303)
travis: Add xmlstarlet package used by cfg/runtests.sh
2018-07-12 08:40:26 +02:00
versat 086a005a9f microsoft_sal.cfg: Remove redundant define. 2018-07-11 14:03:00 +02:00
Daniel Marjamäki b398398dec Fixed #8360 (false positive "Ineffective call of function 'empty()'") 2018-07-10 22:58:02 +02:00
Daniel Marjamäki 7e2858f158 astyle formatting
[ci skip]
2018-07-10 22:56:18 +02:00
Mischa Aster Alff 5f2dc0a036 Fix Microsoft SAL cfg macro definitions that used - instead of _ for variable names (#1301) 2018-07-09 16:19:29 +02:00
umanamente 44416862c0 Fixed Visual Studio Natvis file after recent refactoring (#1299) 2018-07-09 08:27:26 +02:00
Daniel Marjamäki 03faa25d12 Conditions: Better handling of function calls 2018-07-08 15:58:04 +02:00