Skip to content

Commit

Permalink
Added support for latest g++ compiler versions that warn on implicit
Browse files Browse the repository at this point in the history
fall-through. Added comments throughout the code to disable warnings,
added autoconfig checks to make g++ aware of these comments.

Bumped to 1.57.
  • Loading branch information
Thomas Richter committed Apr 8, 2020
1 parent 87636f3 commit cf4cc9c
Show file tree
Hide file tree
Showing 21 changed files with 260 additions and 70 deletions.
4 changes: 2 additions & 2 deletions Makefile_Settings.gcc
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
##
## Specific GCC project settings.
##
## $Id: Makefile_Settings.gcc,v 1.4 2017/08/17 13:23:54 thor Exp $
## $Id: Makefile_Settings.gcc,v 1.5 2020/04/08 10:05:29 thor Exp $
##

CXX = $(COMPILER_CMD)
DEFINES =
CC = $(CXX)
MAKEOBJS = -x c++ -c
CFLAGS = $(BITSIZE) -Wall -W -Wunused -Wpointer-arith -pedantic -Wcast-qual -Wwrite-strings -Wno-long-long -Wredundant-decls -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -fno-exceptions -Wno-char-subscripts -Wno-shift-negative-value $(INCLUDEOPTS) $(DEFINES) $(ADDOPTS) $(CPU) $(TUNE)
CFLAGS = $(BITSIZE) -Wall -W -Wunused -Wpointer-arith -pedantic -Wcast-qual -Wwrite-strings -Wno-long-long -Wredundant-decls -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -fno-exceptions -Wno-char-subscripts -Wno-shift-negative-value $(INCLUDEOPTS) $(DEFINES) $(ADDOPTS) $(WARNOPTS) $(CPU) $(TUNE)
OPTIMIZER = -O3 -DDEBUG_LEVEL=0 -DCHECK_LEVEL=0 -funroll-loops -fstrict-aliasing -Wno-redundant-decls -ffast-math #-mfpmath=387 #-maccumulate-outgoing-args -minline-all-stringops -fno-rtti
#-fschedule-insns # These give "register spill" errors.
#-fschedule-insns2 #-fomit-frame-pointer breaks exception handling for 3.2
Expand Down
13 changes: 11 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,21 @@ hopefully work ok.

--------------------------------------------------------------------------

Release 1.57:

Newer g++ compiler versions warned about implicit fall-throughs in switch/
case constructs that are actually harmless. This release adds an autoconf
detection of such compiler versions, adds consistent comments throughout
the code.

--------------------------------------------------------------------------

For license conditions, please check the file README.license in this
directory.

Finally, I want to thank Accusoft and the Computing Center of the University of
Stuttgart for sponsoring this project.
Stuttgart and Fraunhofer IIS for sponsoring this project.

Thomas Richter, August 2019
Thomas Richter, April 2020

-------------------------------------------------------------------------------------
9 changes: 9 additions & 0 deletions README.history
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,12 @@ supported, as it was considered a rather exotic use-case. Now that a
request was made, support for 2-components was added and should
hopefully work ok.

--------------------------------------------------------------------------

Release 1.57:

Newer g++ compiler versions warned about implicit fall-throughs in switch/
case constructs that are actually harmless. This release adds an autoconf
detection of such compiler versions, adds consistent comments throughout
the code, and disables the compiler warning were necessary.

52 changes: 26 additions & 26 deletions autoconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define HAS_CONST_CAST 1

/* Define to 1 if the variable HZ is available */
#define HAS_HZ 1
/* #undef HAS_HZ */

/* Define to 1 if the C99 type int16_t is available */
#define HAS_INT16_T 1
Expand Down Expand Up @@ -58,28 +58,28 @@
#define HAS_PRIVATE_ACCESS 1

/* Define to 1 if ptrdiff_t type is available */
#define HAS_PTRDIFF_T 1
/* #undef HAS_PTRDIFF_T */

/* Define to 1 if reinterpret_cast<> works */
#define HAS_REINTERPRET_CAST 1

/* Define to 1 if _SC_CLK_TCK is available for sysconf */
#define HAS_SC_CLK_TCK 1
/* #undef HAS_SC_CLK_TCK */

/* Define to 1 if the STDERR_FILENO define is available */
#define HAS_STDERR_FILENO 1
/* #undef HAS_STDERR_FILENO */

/* Define to 1 if the STDIN_FILENO define is available */
#define HAS_STDIN_FILENO 1
/* #undef HAS_STDIN_FILENO */

/* Define to 1 if the STDOUT_FILENO define is available */
#define HAS_STDOUT_FILENO 1
/* #undef HAS_STDOUT_FILENO */

/* Define to 1 if struct timeval is available */
#define HAS_STRUCT_TIMEVAL 1
/* #undef HAS_STRUCT_TIMEVAL */

/* Define to 1 if struct tms is available */
#define HAS_STRUCT_TMS 1
/* #undef HAS_STRUCT_TMS */

/* Define to 1 if casting in template arguments work */
#define HAS_TEMPLATE_CASTS 1
Expand Down Expand Up @@ -154,16 +154,16 @@
/* #undef HAVE_DOPRNT */

/* Define to 1 if you have the `dup' function. */
#define HAVE_DUP 1
/* #undef HAVE_DUP */

/* Define to 1 if you have the `dup2' function. */
#define HAVE_DUP2 1
/* #undef HAVE_DUP2 */

/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1

/* Define to 1 if you have the `execve' function. */
#define HAVE_EXECVE 1
/* #undef HAVE_EXECVE */

/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
Expand All @@ -178,22 +178,22 @@
#define HAVE_FOPEN64 1

/* Define to 1 if you have the `fork' function. */
#define HAVE_FORK 1
/* #undef HAVE_FORK */

/* Define to 1 if you have the `free' function. */
#define HAVE_FREE 1

/* Define to 1 if you have the `fstat' function. */
#define HAVE_FSTAT 1
/* #undef HAVE_FSTAT */

/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1

/* Define to 1 if you have the `htonl' function. */
#define HAVE_HTONL 1
/* #undef HAVE_HTONL */

/* Define to 1 if you have the `htons' function. */
#define HAVE_HTONS 1
/* #undef HAVE_HTONS */

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
Expand All @@ -202,7 +202,7 @@
#define HAVE_ISSPACE 1

/* Define to 1 if you have the `kill' function. */
#define HAVE_KILL 1
/* #undef HAVE_KILL */

/* Define to 1 if llseek is available */
/* #undef HAVE_LLSEEK */
Expand Down Expand Up @@ -244,16 +244,16 @@
#define HAVE_NORETURN 1

/* Define to 1 if you have the `ntohl' function. */
#define HAVE_NTOHL 1
/* #undef HAVE_NTOHL */

/* Define to 1 if you have the `ntohs' function. */
#define HAVE_NTOHS 1
/* #undef HAVE_NTOHS */

/* Define to 1 if you have the `open' function. */
#define HAVE_OPEN 1

/* Define to 1 if you have the `pipe' function. */
#define HAVE_PIPE 1
/* #undef HAVE_PIPE */

/* Define if you have POSIX threads libraries and header files. */
/* #undef HAVE_PTHREAD */
Expand Down Expand Up @@ -301,10 +301,10 @@
#define HAVE_SETJMP_H 1

/* Define to 1 if you have the `sigaction' function. */
#define HAVE_SIGACTION 1
/* #undef HAVE_SIGACTION */

/* Define to 1 if you have the `sigemptyset' function. */
#define HAVE_SIGEMPTYSET 1
/* #undef HAVE_SIGEMPTYSET */

/* Define to 1 if you have the `signal' function. */
#define HAVE_SIGNAL 1
Expand Down Expand Up @@ -358,10 +358,10 @@
#define HAVE_STRTOL 1

/* Define to 1 if you have the `sysconf' function. */
#define HAVE_SYSCONF 1
/* #undef HAVE_SYSCONF */

/* Define to 1 if you have the `system' function. */
#define HAVE_SYSTEM 1
/* #undef HAVE_SYSTEM */

/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
Expand All @@ -382,7 +382,7 @@
#define HAVE_TIME 1

/* Define to 1 if you have the `times' function. */
#define HAVE_TIMES 1
/* #undef HAVE_TIMES */

/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
Expand Down Expand Up @@ -422,7 +422,7 @@
#define PACKAGE_NAME "jpeg"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "jpeg thor@math.tu-berlin.de"
#define PACKAGE_STRING "jpeg thomas.richter@iis.fraunhofer.de"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "jpeg"
Expand All @@ -431,7 +431,7 @@
#define PACKAGE_URL ""

/* Define to the version of this package. */
#define PACKAGE_VERSION "thor@math.tu-berlin.de"
#define PACKAGE_VERSION "thomas.richter@iis.fraunhofer.de"

/* Define to the necessary symbol if this constant uses a non-standard name on
your system. */
Expand Down
13 changes: 7 additions & 6 deletions automakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
## $Id: automakefile.in,v 1.2 2012/05/20 16:17:27 thor Exp $
## $Id: automakefile.in,v 1.3 2020/04/08 10:05:29 thor Exp $
##
#######################################################################
## Makefile for the jpeg project,
Expand All @@ -10,8 +10,8 @@
## The following variable defines the compiler we use
## for running the code.
##
COMPILER_CMD = g++-4.9
CC_ONLY = gcc-4.9 -std=gnu99
COMPILER_CMD = g++
CC_ONLY = gcc
SETTINGS = gcc
PREFIX = /home/thor/bin/wavelet
PTHREADCFLAGS =
Expand All @@ -22,9 +22,10 @@ HAVE_ADDONS =
BITSIZE =
##
## Additional options
ADDOPTS = -DUSE_AUTOCONF -mfpmath=387
LIB_OPTS = -fPIC -DBUILD_LIB
EXTRA_LIBS = -lgcc_s
ADDOPTS = -DUSE_AUTOCONF
LIB_OPTS = -DBUILD_LIB
EXTRA_LIBS =
WARNOPTS =
##
## Miscellaneous compiler options
CPU =
Expand Down
3 changes: 2 additions & 1 deletion automakefile.in
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
## $Id: automakefile.in,v 1.2 2012/05/20 16:17:27 thor Exp $
## $Id: automakefile.in,v 1.3 2020/04/08 10:05:29 thor Exp $
##
#######################################################################
## Makefile for the jpeg project,
Expand All @@ -25,6 +25,7 @@ BITSIZE = @BITSIZE@
ADDOPTS = -DUSE_AUTOCONF @FPU_OPTS@ @HW_DEFINE@ @ASSEMBLY_FLAG@
LIB_OPTS = @LIB_OPTS@ @LIB_PICOPTS@ -DBUILD_LIB
EXTRA_LIBS = @LGCCS_OPTS@ @MALLOC_LIB@
WARNOPTS = @WARN_OPTS@
##
## Miscellaneous compiler options
CPU = @CPU@
Expand Down
5 changes: 4 additions & 1 deletion cmd/filehook.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
** This module implements the IO-Hook function that reads and writes
** the encoded data.
**
** $Id: filehook.cpp,v 1.2 2014/09/30 08:33:15 thor Exp $
** $Id: filehook.cpp,v 1.3 2020/04/08 10:05:38 thor Exp $
**
*/

Expand All @@ -68,13 +68,15 @@ JPG_LONG FileHook(struct JPG_Hook *hook, struct JPG_TagItem *tags)

return fread(buffer,1,size,in);
}
break;
case JPGFLAG_ACTION_WRITE:
{
UBYTE *buffer = (UBYTE *)tags->GetTagPtr(JPGTAG_FIO_BUFFER);
ULONG size = (ULONG )tags->GetTagData(JPGTAG_FIO_SIZE);

return fwrite(buffer,1,size,in);
}
break;
case JPGFLAG_ACTION_SEEK:
{
LONG mode = tags->GetTagData(JPGTAG_FIO_SEEKMODE);
Expand All @@ -89,6 +91,7 @@ JPG_LONG FileHook(struct JPG_Hook *hook, struct JPG_TagItem *tags)
return fseek(in,offset,SEEK_END);
}
}
break;
case JPGFLAG_ACTION_QUERY:
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions codestream/encoder.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
/*
** This class parses the markers and holds the decoder together.
**
** $Id: encoder.cpp,v 1.53 2015/03/24 09:45:31 thor Exp $
** $Id: encoder.cpp,v 1.54 2020/04/08 10:05:41 thor Exp $
**
*/

Expand Down Expand Up @@ -288,7 +288,7 @@ void Encoder::FindScanTypes(const struct JPG_TagItem *tags,LONG defaultscan,UBYT
if (hdrprecision != 8 && (hdrprecision != 12 || restype == Baseline))
JPG_THROW(INVALID_PARAMETER,"Encoder::FindScanTypes",
"The residual image precision must be either 8 or 12 bits per component");
// Runs into the following...
// fall through
default:
if (riddenbits > 4)
JPG_THROW(OVERFLOW_PARAMETER,"Encoder::FindScanTypes",
Expand Down
4 changes: 2 additions & 2 deletions codestream/tables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
** This class keeps all the coding tables, huffman, AC table, quantization
** and other side information.
**
** $Id: tables.cpp,v 1.203 2019/08/21 10:09:56 thor Exp $
** $Id: tables.cpp,v 1.204 2020/04/08 10:05:41 thor Exp $
**
*/

Expand Down Expand Up @@ -523,7 +523,7 @@ void Tables::CreateProfileCSettings(const struct JPG_TagItem *tags,class FileTyp
case JPGFLAG_RESIDUAL:
case JPGFLAG_RESIDUALPROGRESSIVE:
dodct = false;
// run into the following.
// fall through
case JPGFLAG_RESIDUALDCT:
dopart8 = true;
clipping = false;
Expand Down
Loading

0 comments on commit cf4cc9c

Please sign in to comment.