Don't run the base package through the C-formatter

----
$ # Before.
$ time wuffs gen > /dev/null
real	0m1.427s
user	0m1.272s
sys	0m0.245s

$ # After.
$ time wuffs gen > /dev/null
real	0m0.953s
user	0m0.864s
sys	0m0.188s
----
This commit is contained in:
Nigel Tao committed 2020-06-03 23:31:54 +10:00
1 parent 4402c1c7c0
commit 58a48d5a54
2 files changed
+279 -227

No files matched your search

+6 -5
View File
@@ -142,10 +142,7 @@ func Do(args []string) error {
"// !! INSERT base/pixconv-submodule.c.\n": insertBasePixConvSubmoduleC,
"// !! INSERT base/strconv-impl.c.\n": insertBaseStrConvImplC,
"// !! INSERT vtable names.\n": func(b *buffer) error {
for i, n := range builtin.Interfaces {
if i > 0 {
buf.writeb('\n')
}
for _, n := range builtin.Interfaces {
buf.printf("const char* wuffs_base__%s__vtable_name = "+
"\"{vtable}wuffs_base__%s\";\n", n, n)
@@ -197,7 +194,11 @@ func Do(args []string) error {
now = time.Now()
}
if *cformatterFlag == "" {
// The base package is largely hand-written C, not transpiled from
// Wuffs, and that part is presumably already formatted. The rest is
// generated by this package. We take care here to print well indented
// C code, so further C formatting is unnecessary (and not costless).
if (*cformatterFlag == "") || (pkgName == "base") {
return unformatted, nil
}