summaryrefslogtreecommitdiffstats
path: root/ossfuzz
diff options
context:
space:
mode:
authorMax Dymond <cmeister2@gmail.com>2019-06-28 22:48:33 (GMT)
committerMax Dymond <cmeister2@gmail.com>2019-06-28 22:48:33 (GMT)
commit02b5b3c242fd4131983152f0dd422429e6702923 (patch)
treed070741a691775869a155706389e7bf1b38c9e1c /ossfuzz
parent60d71dc20c5f9bb95e0b963ab6fb19212eb441a9 (diff)
downloadlz4-02b5b3c242fd4131983152f0dd422429e6702923.zip
lz4-02b5b3c242fd4131983152f0dd422429e6702923.tar.gz
lz4-02b5b3c242fd4131983152f0dd422429e6702923.tar.bz2
Move to using C rather than C++ for compilation
Diffstat (limited to 'ossfuzz')
-rw-r--r--ossfuzz/Makefile12
-rw-r--r--ossfuzz/compress_fuzzer.c (renamed from ossfuzz/compress_fuzzer.cc)2
-rw-r--r--ossfuzz/decompress_fuzzer.c (renamed from ossfuzz/decompress_fuzzer.cc)2
-rw-r--r--ossfuzz/standaloneengine.c (renamed from ossfuzz/standaloneengine.cc)0
-rw-r--r--ossfuzz/testinput.h2
5 files changed, 12 insertions, 6 deletions
diff --git a/ossfuzz/Makefile b/ossfuzz/Makefile
index 1e7679b..1480ccb 100644
--- a/ossfuzz/Makefile
+++ b/ossfuzz/Makefile
@@ -42,14 +42,20 @@ include ../Makefile.inc
$(LZ4DIR)/liblz4.a:
$(MAKE) -C $(LZ4DIR) CFLAGS="$(CFLAGS)" liblz4.a
-%.o: %.cc
- $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
+%.o: %.c
+ $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
# Generic rule for generating fuzzers
%_fuzzer: %_fuzzer.o $(LZ4DIR)/liblz4.a
# Compile the standalone code just in case. The OSS-Fuzz code might
# override the LIB_FUZZING_ENGINE value to "-fsanitize=fuzzer"
- $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) standaloneengine.cc -o standaloneengine.o
+ $(CC) -c $(CFLAGS) $(CPPFLAGS) standaloneengine.c -o standaloneengine.o
# Now compile the actual fuzzer.
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIB_FUZZING_ENGINE) $^ -o $@$(EXT)
+
+%_fuzzer_clean:
+ $(RM) $*_fuzzer $*_fuzzer.o standaloneengine.o
+
+.PHONY: clean
+clean: compress_fuzzer_clean decompress_fuzzer_clean
diff --git a/ossfuzz/compress_fuzzer.cc b/ossfuzz/compress_fuzzer.c
index 4a720e2..28610ad 100644
--- a/ossfuzz/compress_fuzzer.cc
+++ b/ossfuzz/compress_fuzzer.c
@@ -5,7 +5,7 @@
#define CHECK(COND) if (!(COND)) { abort(); }
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
size_t const compressed_dest_size = LZ4_compressBound(size);
char *const dest_buffer = (char *)malloc(compressed_dest_size);
diff --git a/ossfuzz/decompress_fuzzer.cc b/ossfuzz/decompress_fuzzer.c
index 594a5af..1fa2b1a 100644
--- a/ossfuzz/decompress_fuzzer.cc
+++ b/ossfuzz/decompress_fuzzer.c
@@ -5,7 +5,7 @@
#define CHECK(COND) if (!(COND)) { abort(); }
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
size_t const buffer_size = 10 * 1024 * 1024;
char *const dest_buffer = (char *)malloc(buffer_size);
diff --git a/ossfuzz/standaloneengine.cc b/ossfuzz/standaloneengine.c
index 175360e..175360e 100644
--- a/ossfuzz/standaloneengine.cc
+++ b/ossfuzz/standaloneengine.c
diff --git a/ossfuzz/testinput.h b/ossfuzz/testinput.h
index 6ab9b51..8da6215 100644
--- a/ossfuzz/testinput.h
+++ b/ossfuzz/testinput.h
@@ -1,3 +1,3 @@
#include <inttypes.h>
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);