summarylogtreecommitdiffstats
path: root/0043-Fix-detecting-GCC-include-files-and-predefined-macro.patch
blob: ce7755e8cbc1ee91890688d3f9f6fa6b2218afde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From cd472e72487bc8b5ec4ef870079f0ab0c913bc32 Mon Sep 17 00:00:00 2001
From: Sergei Litvin <litvindev@gmail.com>
Date: Sun, 1 Feb 2026 18:26:04 +0100
Subject: [PATCH] Fix detecting GCC include files and predefined macros in
 Windows

---
 xref-any/src/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/main.c b/src/main.c
index f8c4aad..9570b68 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2200,7 +2200,11 @@ static void getAndProcessGccIncludeOptions() {
 	isActiveSect = 0;
 	ttt = crTmpFileName_st();
 	assert(strlen(ttt)+1 < MAX_FILE_NAME_SIZE);
+#if defined (__WIN32__)
+	sprintf(tmpBuff, "set LANG=C && cpp -v -x %s -o NUL - <NUL >%s 2>&1", lang, ttt);
+#else
 	sprintf(tmpBuff, "LANG=C cpp -v -x %s -o /dev/null /dev/null >%s 2>&1", lang, ttt);
+#endif
 	system(tmpBuff);
 	ff = fopen(ttt,"r");
 	if (ff==NULL) return;
@@ -2239,7 +2243,11 @@ static void getAndProcessGccDefineOptions() {
 	}
 	ttt = crTmpFileName_st();
 	assert(strlen(ttt)+1 < MAX_FILE_NAME_SIZE);
+#if defined (__WIN32__)
+	sprintf(tmpBuff, "set LANG=C && cpp -dM -x %s -o %s NUL 1>NUL 2>&1", lang, ttt);
+#else
 	sprintf(tmpBuff, "LANG=C cpp -dM -x %s -o %s /dev/null 1>/dev/null 2>&1", lang, ttt);
+#endif
 	system(tmpBuff);
 	ff = fopen(ttt,"r");
 	if (ff==NULL) return;
-- 
2.50.0.windows.1