# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 2019-12-06 20:05:34
# Node ID 51a99e09c54b38a37f306469a108839368ab43f0
# Parent  54a6846ba96f45a8c9d5bd59f665ca3de04b3795

fuzz: always define LLVMFuzzerInitialize() even if we don't need it

This will make it easier to test our fuzzers outside oss-fuzz.

Differential Revision: https://phab.mercurial-scm.org/D7560

diff --git a/contrib/fuzz/bdiff.cc b/contrib/fuzz/bdiff.cc
--- a/contrib/fuzz/bdiff.cc
+++ b/contrib/fuzz/bdiff.cc
@@ -14,6 +14,11 @@
 extern "C" {
 #include "bdiff.h"
 
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
+{
+	return 0;
+}
+
 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
 {
 	FuzzedDataProvider provider(Data, Size);
diff --git a/contrib/fuzz/mpatch.cc b/contrib/fuzz/mpatch.cc
--- a/contrib/fuzz/mpatch.cc
+++ b/contrib/fuzz/mpatch.cc
@@ -14,6 +14,11 @@
 
 #include "fuzzutil.h"
 
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
+{
+	return 0;
+}
+
 // To avoid having too many OOMs from the fuzzer infrastructure, we'll
 // skip patch application if the resulting fulltext would be bigger
 // than 10MiB.
diff --git a/contrib/fuzz/xdiff.cc b/contrib/fuzz/xdiff.cc
--- a/contrib/fuzz/xdiff.cc
+++ b/contrib/fuzz/xdiff.cc
@@ -14,6 +14,11 @@
 
 extern "C" {
 
+int LLVMFuzzerInitialize(int *argc, char ***argv)
+{
+	return 0;
+}
+
 int hunk_consumer(long a1, long a2, long b1, long b2, void *priv)
 {
 	// TODO: probably also test returning -1 from this when things break?