33 * Copyright (C) 2016-2023 simplecpp team
44 */
55
6- #if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
6+ #if defined(_WIN32)
77# define _WIN32_WINNT 0x0602
88# define NOMINMAX
99# include < windows.h>
3333#include < stack>
3434#include < stdexcept>
3535#include < string>
36- #ifdef SIMPLECPP_WINDOWS
36+ #ifdef _WIN32
3737# include < mutex>
3838#endif
3939#include < unordered_map>
@@ -2415,7 +2415,7 @@ namespace simplecpp {
24152415#endif
24162416}
24172417
2418- #ifdef SIMPLECPP_WINDOWS
2418+ #ifdef _WIN32
24192419static bool isAbsolutePath (const std::string &path)
24202420{
24212421 if (path.length () >= 3 && path[0 ] > 0 && std::isalpha (path[0 ]) && path[1 ] == ' :' && (path[2 ] == ' \\ ' || path[2 ] == ' /' ))
@@ -2941,7 +2941,7 @@ static const simplecpp::Token *gotoNextLine(const simplecpp::Token *tok)
29412941 return tok;
29422942}
29432943
2944- #ifdef SIMPLECPP_WINDOWS
2944+ #ifdef _WIN32
29452945
29462946class NonExistingFilesCache {
29472947public:
@@ -2973,14 +2973,14 @@ static NonExistingFilesCache nonExistingFilesCache;
29732973
29742974static std::string openHeaderDirect (std::ifstream &f, const std::string &path)
29752975{
2976- #ifdef SIMPLECPP_WINDOWS
2976+ #ifdef _WIN32
29772977 if (nonExistingFilesCache.contains (path))
29782978 return " " ; // file is known not to exist, skip expensive file open call
29792979#endif
29802980 f.open (path.c_str ());
29812981 if (f.is_open ())
29822982 return path;
2983- #ifdef SIMPLECPP_WINDOWS
2983+ #ifdef _WIN32
29842984 nonExistingFilesCache.add (path);
29852985#endif
29862986 return " " ;
@@ -3082,7 +3082,7 @@ std::pair<simplecpp::FileData *, bool> simplecpp::FileDataCache::get(const std::
30823082
30833083bool simplecpp::FileDataCache::getFileId (const std::string &path, FileID &id)
30843084{
3085- #ifdef SIMPLECPP_WINDOWS
3085+ #ifdef _WIN32
30863086 HANDLE hFile = CreateFileA (path.c_str (), 0 , FILE_SHARE_READ | FILE_SHARE_WRITE, NULL , OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
30873087
30883088 if (hFile == INVALID_HANDLE_VALUE)
@@ -3108,7 +3108,7 @@ bool simplecpp::FileDataCache::getFileId(const std::string &path, FileID &id)
31083108
31093109simplecpp::FileDataCache simplecpp::load (const simplecpp::TokenList &rawtokens, std::vector<std::string> &filenames, const simplecpp::DUI &dui, simplecpp::OutputList *outputList, FileDataCache cache)
31103110{
3111- #ifdef SIMPLECPP_WINDOWS
3111+ #ifdef _WIN32
31123112 if (dui.clearIncludeCache )
31133113 nonExistingFilesCache.clear ();
31143114#endif
@@ -3243,7 +3243,7 @@ static std::string getTimeDefine(const struct tm *timep)
32433243
32443244void simplecpp::preprocess (simplecpp::TokenList &output, const simplecpp::TokenList &rawtokens, std::vector<std::string> &files, simplecpp::FileDataCache &cache, const simplecpp::DUI &dui, simplecpp::OutputList *outputList, std::list<simplecpp::MacroUsage> *macroUsage, std::list<simplecpp::IfCond> *ifCond)
32453245{
3246- #ifdef SIMPLECPP_WINDOWS
3246+ #ifdef _WIN32
32473247 if (dui.clearIncludeCache )
32483248 nonExistingFilesCache.clear ();
32493249#endif
0 commit comments