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.
* added support for reading borland c++ builder 6 projects
* add: fetch sysdefines from project
add: start providing bcb6 predefines (WIP)
* configure all the internal defines for BCB6
* make sure define strings don't start with ';'
* improvements on bwoesters BCB6 project support
- improved `*.bpr` XML handling by reducing the number of loops
- added `const` where aplicable
- optimized compiler argument parser performance
- reformatted code with provided astyle config
* - undo looping (keep it the same as the other implementations)
- keep parsing of cflags simple and separate from the synonym cleanup (no need for micro optimization in this place)
- move input validation to FileSettings::setDefines
- re-run astyle
* use [] instead of at() when comparing characters