Skip to content

Commit c19741a

Browse files
committed
[DO NOT MERGE] measurement for #693: which process exits, and the encoding build.ninja is written in
1 parent 82867ad commit c19741a

28 files changed

Lines changed: 420 additions & 6849 deletions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// A build program written the way most are: narrow getenv, a narrow path
2+
// into std::ofstream, the path printed back to mcpp as bytes.
3+
#include <cstdio>
4+
#include <cstdlib>
5+
#include <fstream>
6+
#include <string>
7+
8+
int main() {
9+
const char* out = std::getenv("MCPP_OUT_DIR");
10+
if (!out) { std::fputs("no MCPP_OUT_DIR\n", stderr); return 1; }
11+
std::string p = std::string(out) + "/gen.cpp";
12+
std::ofstream f(p);
13+
if (!f) { std::fprintf(stderr, "build.mcpp: cannot open %s\n", p.c_str()); return 2; }
14+
f << "int gen_value() { return 42; }\n";
15+
f.close();
16+
std::printf("mcpp:generated=%s\n", p.c_str());
17+
return 0;
18+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "probe"
3+
version = "0.1.0"
4+
5+
[toolchain]
6+
default = "llvm@20.1.7"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <cstdio>
2+
3+
int gen_value();
4+
5+
int main() {
6+
std::printf("gen_value=%d\n", gen_value());
7+
return 0;
8+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// A build program that speaks UTF-8 whatever the process code page is: the
2+
// wide environment, a wide path into std::ofstream, UTF-8 bytes back to mcpp.
3+
// It stands in for a build program that carries a UTF-8 activeCodePage.
4+
#include <cstdio>
5+
#include <cstdlib>
6+
#include <filesystem>
7+
#include <fstream>
8+
#include <string>
9+
10+
int main() {
11+
#ifdef _WIN32
12+
const wchar_t* w = _wgetenv(L"MCPP_OUT_DIR");
13+
if (!w) { std::fputs("no MCPP_OUT_DIR\n", stderr); return 1; }
14+
std::filesystem::path out(w);
15+
#else
16+
const char* n = std::getenv("MCPP_OUT_DIR");
17+
if (!n) { std::fputs("no MCPP_OUT_DIR\n", stderr); return 1; }
18+
std::filesystem::path out(n);
19+
#endif
20+
auto p = out / "gen.cpp";
21+
std::ofstream f(p);
22+
if (!f) { std::fputs("build.mcpp: cannot open the generated file\n", stderr); return 2; }
23+
f << "int gen_value() { return 42; }\n";
24+
f.close();
25+
auto u8 = p.generic_u8string();
26+
std::printf("mcpp:generated=%s\n", reinterpret_cast<const char*>(u8.c_str()));
27+
return 0;
28+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "probe"
3+
version = "0.1.0"
4+
5+
[toolchain]
6+
default = "llvm@20.1.7"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <cstdio>
2+
3+
int gen_value();
4+
5+
int main() {
6+
std::printf("gen_value=%d\n", gen_value());
7+
return 0;
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "probe"
3+
version = "0.1.0"
4+
5+
[toolchain]
6+
default = "llvm@20.1.7"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import std;
2+
3+
int main() {
4+
std::println("hello from a project whose path is not ASCII");
5+
return 0;
6+
}

‎.github/measure-693/measure.ps1‎

Lines changed: 312 additions & 0 deletions
Large diffs are not rendered by default.

‎.github/workflows/aur-publish.yml‎

Lines changed: 0 additions & 163 deletions
This file was deleted.

0 commit comments

Comments
 (0)