From 55784030e4e267387a0d3c33f7a1f9b663fbea0f Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Thu, 7 Oct 2021 14:26:08 +1100 Subject: [PATCH] Have fuzzers use WUFFS_CONFIG__STATIC_FUNCTIONS Compile time: $ time ./build-fuzz.sh Before: user 0m36.656s After: user 0m18.534s --- fuzz/c/std/bmp_fuzzer.c | 10 ++++++++++ fuzz/c/std/cbor_fuzzer.c | 10 ++++++++++ fuzz/c/std/gif_fuzzer.c | 10 ++++++++++ fuzz/c/std/json_fuzzer.cc | 10 ++++++++++ fuzz/c/std/pixel_swizzler_fuzzer.c | 10 ++++++++++ fuzz/c/std/png_fuzzer.c | 10 ++++++++++ fuzz/c/std/zlib_fuzzer.c | 10 ++++++++++ 7 files changed, 70 insertions(+) diff --git a/fuzz/c/std/bmp_fuzzer.c b/fuzz/c/std/bmp_fuzzer.c index 2f0f45d1..a0789399 100644 --- a/fuzz/c/std/bmp_fuzzer.c +++ b/fuzz/c/std/bmp_fuzzer.c @@ -42,6 +42,16 @@ It should print "PASS", amongst other information, and exit(0). // 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/fuzz/c/std/cbor_fuzzer.c b/fuzz/c/std/cbor_fuzzer.c index 661e676f..e2150444 100644 --- a/fuzz/c/std/cbor_fuzzer.c +++ b/fuzz/c/std/cbor_fuzzer.c @@ -42,6 +42,16 @@ It should print "PASS", amongst other information, and exit(0). // 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/fuzz/c/std/gif_fuzzer.c b/fuzz/c/std/gif_fuzzer.c index 1dcfb445..4eb19f9d 100644 --- a/fuzz/c/std/gif_fuzzer.c +++ b/fuzz/c/std/gif_fuzzer.c @@ -42,6 +42,16 @@ It should print "PASS", amongst other information, and exit(0). // 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/fuzz/c/std/json_fuzzer.cc b/fuzz/c/std/json_fuzzer.cc index e92c64f6..54a97add 100644 --- a/fuzz/c/std/json_fuzzer.cc +++ b/fuzz/c/std/json_fuzzer.cc @@ -42,6 +42,16 @@ It should print "PASS", amongst other information, and exit(0). // 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/fuzz/c/std/pixel_swizzler_fuzzer.c b/fuzz/c/std/pixel_swizzler_fuzzer.c index fb5fd02b..c5ef45a6 100644 --- a/fuzz/c/std/pixel_swizzler_fuzzer.c +++ b/fuzz/c/std/pixel_swizzler_fuzzer.c @@ -42,6 +42,16 @@ It should print "PASS", amongst other information, and exit(0). // 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/fuzz/c/std/png_fuzzer.c b/fuzz/c/std/png_fuzzer.c index d6cc049f..7e73d894 100644 --- a/fuzz/c/std/png_fuzzer.c +++ b/fuzz/c/std/png_fuzzer.c @@ -42,6 +42,16 @@ It should print "PASS", amongst other information, and exit(0). // 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/fuzz/c/std/zlib_fuzzer.c b/fuzz/c/std/zlib_fuzzer.c index 428c5e7e..2ddcf00a 100644 --- a/fuzz/c/std/zlib_fuzzer.c +++ b/fuzz/c/std/zlib_fuzzer.c @@ -42,6 +42,16 @@ It should print "PASS", amongst other information, and exit(0). // 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