Makefile : added -Wstrict-prototype, as suggested by Larry Doolittle
authorYann Collet <yann.collet.73@gmail.com>
Mon, 14 Jul 2014 22:29:40 +0000 (23:29 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Mon, 14 Jul 2014 22:29:40 +0000 (23:29 +0100)
Makefile
lz4.c
programs/Makefile
programs/bench.c
programs/bench.h
programs/datagen.c
programs/fullbench.c
programs/fuzzer.c
programs/lz4cli.c

index d82c124..28a0bfc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -40,7 +40,7 @@ LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
 DESTDIR=
 PREFIX = /usr
 CC    := $(CC)
-CFLAGS+= -I. -std=c99 -O3 -Wall -Wextra -Wundef -Wshadow -DLZ4_VERSION=\"$(RELEASE)\"
+CFLAGS+= -I. -std=c99 -O3 -Wall -Wextra -Wundef -Wshadow -Wstrict-prototypes -DLZ4_VERSION=\"$(RELEASE)\"
 
 LIBDIR?= $(PREFIX)/lib
 INCLUDEDIR=$(PREFIX)/include
diff --git a/lz4.c b/lz4.c
index e24cf5c..2484fc6 100644 (file)
--- a/lz4.c
+++ b/lz4.c
@@ -300,7 +300,7 @@ typedef enum { full = 0, partial = 1 } earlyEnd_directive;
 ****************************/
 #if LZ4_ARCH64
 
-int LZ4_NbCommonBytes (register U64 val)
+static int LZ4_NbCommonBytes (register U64 val)
 {
 # if defined(LZ4_BIG_ENDIAN)
 #   if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT)
@@ -332,7 +332,7 @@ int LZ4_NbCommonBytes (register U64 val)
 
 #else
 
-int LZ4_NbCommonBytes (register U32 val)
+static int LZ4_NbCommonBytes (register U32 val)
 {
 # if defined(LZ4_BIG_ENDIAN)
 #   if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT)
@@ -742,7 +742,7 @@ int LZ4_loadDict (LZ4_stream_t* LZ4_dict, const char* dictionary, int dictSize)
 }
 
 
-void LZ4_renormDictT(LZ4_stream_t_internal* LZ4_dict, const BYTE* src)
+static void LZ4_renormDictT(LZ4_stream_t_internal* LZ4_dict, const BYTE* src)
 {
     if ((LZ4_dict->currentOffset > 0x80000000) ||
         ((size_t)LZ4_dict->currentOffset > (size_t)src))   /* address space overflow */
@@ -1180,7 +1180,7 @@ int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize,
 
 int LZ4_sizeofStreamState() { return LZ4_STREAMSIZE; }
 
-void LZ4_init(LZ4_stream_t_internal* lz4ds, const BYTE* base)
+static void LZ4_init(LZ4_stream_t_internal* lz4ds, const BYTE* base)
 {
     MEM_INIT(lz4ds, 0, LZ4_STREAMSIZE);
     lz4ds->bufferStart = base;
index c62366c..5127c5d 100644 (file)
@@ -34,7 +34,7 @@ RELEASE=rc120
 DESTDIR=
 PREFIX=/usr
 CC:=$(CC)
-CFLAGS+= -std=c99 -O3 -Wall -Wextra -Wundef -Wshadow -DLZ4_VERSION=\"$(RELEASE)\"
+CFLAGS+= -std=c99 -O3 -Wall -Wextra -Wundef -Wshadow -Wstrict-prototypes -DLZ4_VERSION=\"$(RELEASE)\"
 FLAGS= -I.. $(CFLAGS)
 
 BINDIR=$(PREFIX)/bin
index 8d68098..6af86ac 100644 (file)
@@ -32,7 +32,7 @@
 // Unix Large Files support (>4GB)
 #define _FILE_OFFSET_BITS 64
 #if (defined(__sun__) && (!defined(__LP64__)))   // Sun Solaris 32-bits requires specific definitions
-#  define _LARGEFILE_SOURCE 
+#  define _LARGEFILE_SOURCE
 #elif ! defined(__LP64__)                        // No point defining Large file for 64 bit
 #  define _LARGEFILE64_SOURCE
 #endif
@@ -155,7 +155,7 @@ void BMK_SetNbIterations(int nbLoops)
     DISPLAY("- %i iterations -\n", nbIterations);
 }
 
-void BMK_SetPause() { BMK_pause = 1; }
+void BMK_SetPause(void) { BMK_pause = 1; }
 
 
 //*********************************************************
@@ -178,7 +178,7 @@ static int BMK_GetMilliStart()
 
 #else
 
-static int BMK_GetMilliStart()
+static int BMK_GetMilliStart(void)
 {
   // Based on newer gettimeofday()
   // Use GetMilliSpan to correct for rollover
index a0b7ed2..7e59e52 100644 (file)
@@ -32,7 +32,7 @@ int BMK_benchFile(char** fileNamesTable, int nbFiles, int cLevel);
 // Parameters
 void BMK_SetBlocksize(int bsize);
 void BMK_SetNbIterations(int nbLoops);
-void BMK_SetPause();
+void BMK_SetPause(void);
 
 
 
index 0109d54..706c30f 100644 (file)
@@ -184,7 +184,7 @@ static void CDG_generate(U64 size, U32* seed, double proba)
 }
 
 
-int CDG_usage()
+int CDG_usage(void)
 {
     DISPLAY( "Compressible data generator\n");
     DISPLAY( "Usage :\n");
index 0ed8488..dd02357 100644 (file)
@@ -167,7 +167,7 @@ void BMK_SetNbIterations(int nbLoops)
     DISPLAY("- %i iterations -\n", nbIterations);
 }
 
-void BMK_SetPause()
+void BMK_SetPause(void)
 {
     BMK_pause = 1;
 }
@@ -192,7 +192,7 @@ static int BMK_GetMilliStart()
 
 #else
 
-static int BMK_GetMilliStart()
+static int BMK_GetMilliStart(void)
 {
   // Based on newer gettimeofday()
   // Use GetMilliSpan to correct for rollover
@@ -631,7 +631,7 @@ int usage(char* exename)
     return 0;
 }
 
-int usage_advanced()
+int usage_advanced(void)
 {
     DISPLAY( "\nAdvanced options :\n");
     DISPLAY( " -c#    : test only compression function # [1-%i]\n", NB_COMPRESSION_ALGORITHMS);
index 0f74f40..b302078 100644 (file)
@@ -103,7 +103,7 @@ static int displayLevel = 2;
 /*********************************************************
   Fuzzer functions
 *********************************************************/
-static int FUZ_GetMilliStart()
+static int FUZ_GetMilliStart(void)
 {
    struct timeb tb;
    int nCount;
@@ -174,7 +174,7 @@ void FUZ_fillCompressibleNoiseBuffer(void* buffer, int bufferSize, double proba,
 
 
 // No longer useful; included into issue 134
-int FUZ_Issue52()
+int FUZ_Issue52(void)
 {
   char* output;
   char* input;
@@ -199,7 +199,7 @@ int FUZ_Issue52()
 
 #define MAX_NB_BUFF_I134 150
 #define BLOCKSIZE_I134   (32 MB)
-int FUZ_Issue134()
+int FUZ_Issue134(void)
 {
   char* buffers[MAX_NB_BUFF_I134+1] = {0};
   int i, nbBuff=0;
@@ -648,7 +648,7 @@ _output_error:
 }
 
 
-int FUZ_usage()
+int FUZ_usage(void)
 {
     DISPLAY( "Usage :\n");
     DISPLAY( "      %s [args]\n", programName);
index e6e6740..e9b7506 100644 (file)
@@ -175,7 +175,7 @@ int LZ4IO_compressFilename_Legacy(char* input_filename, char* output_filename, i
 //****************************
 // Functions
 //****************************
-int usage()
+int usage(void)
 {
     DISPLAY( "Usage :\n");
     DISPLAY( "      %s [arg] [input] [output]\n", programName);
@@ -192,7 +192,7 @@ int usage()
     return 0;
 }
 
-int usage_advanced()
+int usage_advanced(void)
 {
     DISPLAY(WELCOME_MESSAGE);
     usage();
@@ -223,7 +223,7 @@ int usage_advanced()
     return 0;
 }
 
-int usage_longhelp()
+int usage_longhelp(void)
 {
     DISPLAY( "\n");
     DISPLAY( "Which values can get [output] ? \n");
@@ -273,7 +273,7 @@ int usage_longhelp()
     return 0;
 }
 
-int badusage()
+int badusage(void)
 {
     DISPLAYLEVEL(1, "Incorrect parameters\n");
     if (displayLevel >= 1) usage();
@@ -281,7 +281,7 @@ int badusage()
 }
 
 
-void waitEnter()
+void waitEnter(void)
 {
     DISPLAY("Press enter to continue...\n");
     getchar();