From 6fb7697b4adcfc59cae1bcc4341e1531f91d19f3 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Thu, 7 Oct 2021 14:36:35 +1100 Subject: [PATCH] Have scripts use WUFFS_CONFIG__STATIC_FUNCTIONS --- script/bench-c-deflate-fragmentation.c | 10 ++++++++++ script/manual-test-parse-number-f64.cc | 10 ++++++++++ script/print-json-token-debug-format.c | 10 ++++++++++ script/process-json-numbers.c | 10 ++++++++++ 4 files changed, 40 insertions(+) diff --git a/script/bench-c-deflate-fragmentation.c b/script/bench-c-deflate-fragmentation.c index 37b7c1e5..ba7e2733 100644 --- a/script/bench-c-deflate-fragmentation.c +++ b/script/bench-c-deflate-fragmentation.c @@ -68,6 +68,16 @@ // compiling it. #define WUFFS_IMPLEMENTATION +// Defining the WUFFS_CONFIG__STATIC_FUNCTIONS macro is optional, but when +// combined with WUFFS_IMPLEMENTATION, it demonstrates making all of Wuffs' +// functions have static storage. +// +// This can help the compiler ignore or discard unused code, which can produce +// faster compiles and smaller binaries. Other motivations are discussed in the +// "ALLOW STATIC IMPLEMENTATION" section of +// https://raw.githubusercontent.com/nothings/stb/master/docs/stb_howto.txt +#define WUFFS_CONFIG__STATIC_FUNCTIONS + // If building this program in an environment that doesn't easily accommodate // relative includes, you can use the script/inline-c-relative-includes.go // program to generate a stand-alone C file. diff --git a/script/manual-test-parse-number-f64.cc b/script/manual-test-parse-number-f64.cc index a36cdd75..d4ac7f3d 100644 --- a/script/manual-test-parse-number-f64.cc +++ b/script/manual-test-parse-number-f64.cc @@ -37,6 +37,16 @@ // compiling it. #define WUFFS_IMPLEMENTATION +// Defining the WUFFS_CONFIG__STATIC_FUNCTIONS macro is optional, but when +// combined with WUFFS_IMPLEMENTATION, it demonstrates making all of Wuffs' +// functions have static storage. +// +// This can help the compiler ignore or discard unused code, which can produce +// faster compiles and smaller binaries. Other motivations are discussed in the +// "ALLOW STATIC IMPLEMENTATION" section of +// https://raw.githubusercontent.com/nothings/stb/master/docs/stb_howto.txt +#define WUFFS_CONFIG__STATIC_FUNCTIONS + // Defining the WUFFS_CONFIG__MODULE* macros are optional, but it lets users of // release/c/etc.c choose which parts of Wuffs to build. That file contains the // entire Wuffs standard library, implementing a variety of codecs and file diff --git a/script/print-json-token-debug-format.c b/script/print-json-token-debug-format.c index ea3d330f..866723b6 100644 --- a/script/print-json-token-debug-format.c +++ b/script/print-json-token-debug-format.c @@ -73,6 +73,16 @@ // compiling it. #define WUFFS_IMPLEMENTATION +// Defining the WUFFS_CONFIG__STATIC_FUNCTIONS macro is optional, but when +// combined with WUFFS_IMPLEMENTATION, it demonstrates making all of Wuffs' +// functions have static storage. +// +// This can help the compiler ignore or discard unused code, which can produce +// faster compiles and smaller binaries. Other motivations are discussed in the +// "ALLOW STATIC IMPLEMENTATION" section of +// https://raw.githubusercontent.com/nothings/stb/master/docs/stb_howto.txt +#define WUFFS_CONFIG__STATIC_FUNCTIONS + // Defining the WUFFS_CONFIG__MODULE* macros are optional, but it lets users of // release/c/etc.c choose which parts of Wuffs to build. That file contains the // entire Wuffs standard library, implementing a variety of codecs and file diff --git a/script/process-json-numbers.c b/script/process-json-numbers.c index 26f699c0..282a692a 100644 --- a/script/process-json-numbers.c +++ b/script/process-json-numbers.c @@ -52,6 +52,16 @@ // compiling it. #define WUFFS_IMPLEMENTATION +// Defining the WUFFS_CONFIG__STATIC_FUNCTIONS macro is optional, but when +// combined with WUFFS_IMPLEMENTATION, it demonstrates making all of Wuffs' +// functions have static storage. +// +// This can help the compiler ignore or discard unused code, which can produce +// faster compiles and smaller binaries. Other motivations are discussed in the +// "ALLOW STATIC IMPLEMENTATION" section of +// https://raw.githubusercontent.com/nothings/stb/master/docs/stb_howto.txt +#define WUFFS_CONFIG__STATIC_FUNCTIONS + // Defining the WUFFS_CONFIG__MODULE* macros are optional, but it lets users of // release/c/etc.c choose which parts of Wuffs to build. That file contains the // entire Wuffs standard library, implementing a variety of codecs and file