Skip to content

Commit 182a0e1

Browse files
committed
524 wip
1 parent 05fa3d7 commit 182a0e1

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

.github/workflows/CI-mingw.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ jobs:
4848
# TODO: install mingw-w64-x86_64-make and use mingw32.make instead - currently fails with "Windows Subsystem for Linux has no installed distributions."
4949
install: >-
5050
make
51-
python
52-
python-pytest
51+
${{ matrix.pkg-prefix }}python
52+
${{ matrix.pkg-prefix }}python-pytest
5353
5454
- name: install compiler
5555
run: |
5656
pacman -S --noconfirm ${{ matrix.pkg-prefix }}${{ matrix.compiler-pkg }}
5757
${CXX} -v
58+
which python3
5859
5960
- name: install libc++
6061
if: matrix.compiler == 'clang++' && matrix.pkg-prefix != ''

simplecpp.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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>
@@ -33,7 +33,7 @@
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
24192419
static 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

29462946
class NonExistingFilesCache {
29472947
public:
@@ -2973,14 +2973,14 @@ static NonExistingFilesCache nonExistingFilesCache;
29732973

29742974
static 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

30833083
bool 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

31093109
simplecpp::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

32443244
void 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

simplecpp.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
#ifndef simplecppH
77
#define simplecppH
88

9-
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
10-
# define SIMPLECPP_WINDOWS
11-
#endif
12-
139
#include <cctype>
1410
#include <cstring>
1511
#include <iosfwd>
@@ -43,7 +39,7 @@
4339
# define SIMPLECPP_LIB
4440
#endif
4541

46-
#ifdef SIMPLECPP_WINDOWS
42+
#ifdef _WIN32
4743
# include <cstdint>
4844
#else
4945
# include <sys/stat.h>
@@ -471,7 +467,7 @@ namespace simplecpp {
471467

472468
private:
473469
struct FileID {
474-
#ifdef SIMPLECPP_WINDOWS
470+
#ifdef _WIN32
475471
struct {
476472
std::uint64_t VolumeSerialNumber;
477473
struct {
@@ -495,7 +491,7 @@ namespace simplecpp {
495491
#endif
496492
struct Hasher {
497493
std::size_t operator()(const FileID &id) const {
498-
#ifdef SIMPLECPP_WINDOWS
494+
#ifdef _WIN32
499495
return static_cast<std::size_t>(id.fileIdInfo.FileId.IdentifierHi ^ id.fileIdInfo.FileId.IdentifierLo ^
500496
id.fileIdInfo.VolumeSerialNumber);
501497
#else

0 commit comments

Comments
 (0)