From 07a1903390252f7d7e6a07ede01291109a48cb9c Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 24 Jan 2016 13:21:53 +0000 Subject: [PATCH] use g_assert_not_reached() we were using g_assert(0) ... g_assert_not_reached() makes the intention clearer --- ChangeLog | 1 + libvips/arithmetic/abs.c | 2 +- libvips/arithmetic/add.c | 2 +- libvips/arithmetic/avg.c | 2 +- libvips/arithmetic/boolean.c | 6 ++--- libvips/arithmetic/complex.c | 14 +++++------ libvips/arithmetic/deviate.c | 2 +- libvips/arithmetic/divide.c | 2 +- libvips/arithmetic/hist_find_indexed.c | 4 ++-- libvips/arithmetic/hist_find_ndim.c | 2 +- libvips/arithmetic/invert.c | 2 +- libvips/arithmetic/linear.c | 4 ++-- libvips/arithmetic/math.c | 4 ++-- libvips/arithmetic/math2.c | 6 ++--- libvips/arithmetic/max.c | 2 +- libvips/arithmetic/min.c | 2 +- libvips/arithmetic/multiply.c | 2 +- libvips/arithmetic/profile.c | 2 +- libvips/arithmetic/project.c | 4 ++-- libvips/arithmetic/relational.c | 6 ++--- libvips/arithmetic/remainder.c | 4 ++-- libvips/arithmetic/round.c | 4 ++-- libvips/arithmetic/sign.c | 2 +- libvips/arithmetic/stats.c | 2 +- libvips/arithmetic/subtract.c | 2 +- libvips/arithmetic/sum.c | 2 +- libvips/arithmetic/unaryconst.c | 2 +- libvips/conversion/arrayjoin.c | 4 ++-- libvips/conversion/bandbool.c | 4 ++-- libvips/conversion/bandmean.c | 2 +- libvips/conversion/bandrank.c | 2 +- libvips/conversion/cast.c | 4 ++-- libvips/conversion/embed.c | 4 ++-- libvips/conversion/flatten.c | 4 ++-- libvips/conversion/ifthenelse.c | 4 ++-- libvips/conversion/join.c | 27 +++++++++++----------- libvips/conversion/premultiply.c | 2 +- libvips/conversion/recomb.c | 2 +- libvips/conversion/rot.c | 6 ++--- libvips/conversion/rot45.c | 6 +---- libvips/conversion/tilecache.c | 2 +- libvips/conversion/unpremultiply.c | 2 +- libvips/convolution/compass.c | 5 ++-- libvips/convolution/conv.c | 2 +- libvips/convolution/fastcor.c | 2 +- libvips/convolution/im_aconv.c | 4 ++-- libvips/convolution/im_aconvsep.c | 4 ++-- libvips/convolution/im_conv.c | 4 ++-- libvips/convolution/im_conv_f.c | 2 +- libvips/convolution/spcor.c | 8 +++++-- libvips/draw/draw_image.c | 6 ++--- libvips/draw/draw_line.c | 2 +- libvips/draw/draw_mask.c | 4 ++-- libvips/draw/draw_smudge.c | 2 +- libvips/foreign/analyze2vips.c | 6 ++--- libvips/foreign/csv.c | 2 +- libvips/foreign/dzsave.c | 21 +++++++++-------- libvips/foreign/magick2vips.c | 10 ++++---- libvips/foreign/ppm.c | 14 +++++------ libvips/foreign/tiff2vips.c | 12 +++++----- libvips/foreign/vips2tiff.c | 6 ++--- libvips/histogram/hist_cum.c | 2 +- libvips/histogram/hist_plot.c | 4 ++-- libvips/histogram/maplut.c | 6 ++--- libvips/iofuncs/header.c | 4 +--- libvips/iofuncs/image.c | 32 +++++++++++++------------- libvips/iofuncs/memory.c | 4 ++-- libvips/iofuncs/object.c | 2 +- libvips/iofuncs/region.c | 5 ++-- libvips/iofuncs/threadpool.c | 2 +- libvips/morphology/countlines.c | 6 +---- libvips/morphology/hitmiss.c | 4 ++-- libvips/morphology/morph.c | 2 +- libvips/morphology/rank.c | 2 +- libvips/mosaicing/merge.c | 2 +- libvips/mosaicing/mosaic.c | 11 +-------- libvips/resample/mapim.c | 11 +++++++-- libvips/resample/quadratic.c | 3 +-- libvips/resample/shrink2.c | 2 +- libvips/resample/shrinkh.c | 2 +- libvips/resample/shrinkv.c | 4 ++-- 81 files changed, 191 insertions(+), 199 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb62cfbd..0888781d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ - remove SEQ hint from vips_subsample(), fixes cli performance [erdmann] - fix double free on attach ICC profile from file in tiff write [erdmann] - add VIPS_FLOOR()/VIPS_CEIL(), much faster [Lovell Fuller] +- use g_assert_not_reached(); 1/1/16 started 8.2.1 - add a compat stub [Benjamin Gilbert] diff --git a/libvips/arithmetic/abs.c b/libvips/arithmetic/abs.c index 8b750f9d..0d414dd3 100644 --- a/libvips/arithmetic/abs.c +++ b/libvips/arithmetic/abs.c @@ -193,7 +193,7 @@ vips_abs_buffer( VipsArithmetic *arithmetic, case VIPS_FORMAT_DPCOMPLEX: ABS_COMPLEX( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } } diff --git a/libvips/arithmetic/add.c b/libvips/arithmetic/add.c index 16a1a45a..40839a63 100644 --- a/libvips/arithmetic/add.c +++ b/libvips/arithmetic/add.c @@ -137,7 +137,7 @@ add_buffer( VipsArithmetic *arithmetic, VipsPel *out, VipsPel **in, int width ) LOOP( double, double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/avg.c b/libvips/arithmetic/avg.c index f2bdcf8b..8946f72e 100644 --- a/libvips/arithmetic/avg.c +++ b/libvips/arithmetic/avg.c @@ -184,7 +184,7 @@ vips_avg_scan( VipsStatistic *statistic, void *seq, case VIPS_FORMAT_DPCOMPLEX: CLOOP( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } *sum = m; diff --git a/libvips/arithmetic/boolean.c b/libvips/arithmetic/boolean.c index 12abca55..2ed8594e 100644 --- a/libvips/arithmetic/boolean.c +++ b/libvips/arithmetic/boolean.c @@ -137,7 +137,7 @@ vips_boolean_build( VipsObject *object ) case VIPS_FORMAT_DOUBLE: F( double, OP ); break;\ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } static void @@ -172,7 +172,7 @@ vips_boolean_buffer( VipsArithmetic *arithmetic, break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -494,7 +494,7 @@ vips_boolean_const_buffer( VipsArithmetic *arithmetic, break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/complex.c b/libvips/arithmetic/complex.c index df13aabe..a486355c 100644 --- a/libvips/arithmetic/complex.c +++ b/libvips/arithmetic/complex.c @@ -128,7 +128,7 @@ G_DEFINE_TYPE( VipsComplex, vips_complex, VIPS_TYPE_UNARY ); CLOOP( double, double, OP ); break;\ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } static double @@ -211,7 +211,7 @@ vips_complex_buffer( VipsArithmetic *arithmetic, case VIPS_OPERATION_COMPLEX_CONJ: SWITCH( CONJ ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -428,7 +428,7 @@ G_DEFINE_TYPE( VipsComplex2, vips_complex2, VIPS_TYPE_BINARY ); CLOOP2( double, double, OP ); break;\ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } /* There doesn't seem to be much difference in speed between these two methods @@ -504,7 +504,7 @@ vips_complex2_buffer( VipsArithmetic *arithmetic, break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -692,7 +692,7 @@ vips_complexget_build( VipsObject *object ) CGETLOOP( double, OP ); break;\ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } #define REAL( Q, X, Y ) { \ @@ -718,7 +718,7 @@ vips_complexget_buffer( VipsArithmetic *arithmetic, case VIPS_OPERATION_COMPLEXGET_IMAG: GETSWITCH( IMAG ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -926,7 +926,7 @@ vips_complexform_buffer( VipsArithmetic *arithmetic, CFORM( double, double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/deviate.c b/libvips/arithmetic/deviate.c index 2bf3e6ac..1b4b9019 100644 --- a/libvips/arithmetic/deviate.c +++ b/libvips/arithmetic/deviate.c @@ -190,7 +190,7 @@ vips_deviate_scan( VipsStatistic *statistic, void *seq, case VIPS_FORMAT_DOUBLE: LOOP( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } ss2[0] = sum; diff --git a/libvips/arithmetic/divide.c b/libvips/arithmetic/divide.c index 90367c25..60b59e56 100644 --- a/libvips/arithmetic/divide.c +++ b/libvips/arithmetic/divide.c @@ -190,7 +190,7 @@ vips_divide_buffer( VipsArithmetic *arithmetic, case VIPS_FORMAT_DPCOMPLEX: CLOOP( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/hist_find_indexed.c b/libvips/arithmetic/hist_find_indexed.c index 3322e550..c89a28f6 100644 --- a/libvips/arithmetic/hist_find_indexed.c +++ b/libvips/arithmetic/hist_find_indexed.c @@ -266,7 +266,7 @@ vips_hist_find_indexed_uchar_scan( VipsHistFindIndexed *indexed, ACCUMULATE_UCHAR( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } /* Max is always 255. @@ -327,7 +327,7 @@ vips_hist_find_indexed_ushort_scan( VipsHistFindIndexed *indexed, ACCUMULATE_USHORT( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } /* Note the maximum. diff --git a/libvips/arithmetic/hist_find_ndim.c b/libvips/arithmetic/hist_find_ndim.c index c18a0b54..e0d930d8 100644 --- a/libvips/arithmetic/hist_find_ndim.c +++ b/libvips/arithmetic/hist_find_ndim.c @@ -256,7 +256,7 @@ vips_hist_find_ndim_scan( VipsStatistic *statistic, void *seq, break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/arithmetic/invert.c b/libvips/arithmetic/invert.c index 61ccf9f5..53e2b5d0 100644 --- a/libvips/arithmetic/invert.c +++ b/libvips/arithmetic/invert.c @@ -131,7 +131,7 @@ vips_invert_buffer( VipsArithmetic *arithmetic, LOOPC( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/linear.c b/libvips/arithmetic/linear.c index 321f7dc5..d113c97f 100644 --- a/libvips/arithmetic/linear.c +++ b/libvips/arithmetic/linear.c @@ -321,7 +321,7 @@ vips_linear_buffer( VipsArithmetic *arithmetic, LOOPCMPLXNuc( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } else switch( vips_image_get_format( im ) ) { @@ -347,7 +347,7 @@ vips_linear_buffer( VipsArithmetic *arithmetic, LOOPCMPLXN( double, double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/math.c b/libvips/arithmetic/math.c index 73453f6d..9e696464 100644 --- a/libvips/arithmetic/math.c +++ b/libvips/arithmetic/math.c @@ -126,7 +126,7 @@ vips_math_build( VipsObject *object ) LOOP( double, double, OP ); break;\ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } /* sin/cos/tan in degrees. @@ -170,7 +170,7 @@ vips_math_buffer( VipsArithmetic *arithmetic, case VIPS_OPERATION_MATH_EXP10: SWITCH( EXP10 ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/math2.c b/libvips/arithmetic/math2.c index 6bc36093..a7aef448 100644 --- a/libvips/arithmetic/math2.c +++ b/libvips/arithmetic/math2.c @@ -130,7 +130,7 @@ vips_math2_build( VipsObject *object ) L( double, double, OP ); break;\ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } #define POW( Y, X, E ) { \ @@ -159,7 +159,7 @@ vips_math2_buffer( VipsArithmetic *arithmetic, case VIPS_OPERATION_MATH2_WOP: SWITCH( LOOP, WOP ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -377,7 +377,7 @@ vips_math2_const_buffer( VipsArithmetic *arithmetic, case VIPS_OPERATION_MATH2_WOP: SWITCH( LOOPC, WOP ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/max.c b/libvips/arithmetic/max.c index c6130274..f5fefc1b 100644 --- a/libvips/arithmetic/max.c +++ b/libvips/arithmetic/max.c @@ -398,7 +398,7 @@ vips_max_scan( VipsStatistic *statistic, void *seq, LOOPC( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/arithmetic/min.c b/libvips/arithmetic/min.c index 0ee62c08..0c58145e 100644 --- a/libvips/arithmetic/min.c +++ b/libvips/arithmetic/min.c @@ -401,7 +401,7 @@ vips_min_scan( VipsStatistic *statistic, void *seq, LOOPC( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/arithmetic/multiply.c b/libvips/arithmetic/multiply.c index 3388ba61..b7acfe8a 100644 --- a/libvips/arithmetic/multiply.c +++ b/libvips/arithmetic/multiply.c @@ -138,7 +138,7 @@ vips_multiply_buffer( VipsArithmetic *arithmetic, case VIPS_FORMAT_DPCOMPLEX: CLOOP( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/profile.c b/libvips/arithmetic/profile.c index 7777b60c..4cdddbad 100644 --- a/libvips/arithmetic/profile.c +++ b/libvips/arithmetic/profile.c @@ -246,7 +246,7 @@ vips_profile_scan( VipsStatistic *statistic, void *seq, break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/arithmetic/project.c b/libvips/arithmetic/project.c index 69cb28e9..c5180c3f 100644 --- a/libvips/arithmetic/project.c +++ b/libvips/arithmetic/project.c @@ -246,7 +246,7 @@ vips_project_scan( VipsStatistic *statistic, void *seq, break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); @@ -297,7 +297,7 @@ vips_project_stop( VipsStatistic *statistic, void *seq ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } /* Blank out sub-project to make sure we can't add it again. diff --git a/libvips/arithmetic/relational.c b/libvips/arithmetic/relational.c index d2e73bad..96dda30d 100644 --- a/libvips/arithmetic/relational.c +++ b/libvips/arithmetic/relational.c @@ -125,7 +125,7 @@ G_DEFINE_TYPE( VipsRelational, vips_relational, VIPS_TYPE_BINARY ); case VIPS_FORMAT_DPCOMPLEX: C( double, COP ); break;\ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } #define CEQUAL( x1, y1, x2, y2 ) (x1 == x2 && y1 == y2) @@ -180,7 +180,7 @@ vips_relational_buffer( VipsArithmetic *arithmetic, break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -534,7 +534,7 @@ vips_relational_const_buffer( VipsArithmetic *arithmetic, break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/remainder.c b/libvips/arithmetic/remainder.c index 3d3c6d41..71a6bb72 100644 --- a/libvips/arithmetic/remainder.c +++ b/libvips/arithmetic/remainder.c @@ -135,7 +135,7 @@ vips_remainder_buffer( VipsArithmetic *arithmetic, case VIPS_FORMAT_DOUBLE:FREMAINDER( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -305,7 +305,7 @@ vips_remainder_const_buffer( VipsArithmetic *arithmetic, case VIPS_FORMAT_DOUBLE:FREMAINDERCONST( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/round.c b/libvips/arithmetic/round.c index 2aac000d..e066db49 100644 --- a/libvips/arithmetic/round.c +++ b/libvips/arithmetic/round.c @@ -101,7 +101,7 @@ vips_round_build( VipsObject *object ) case VIPS_FORMAT_DOUBLE:LOOP( double, OP ); break;\ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } \ } @@ -125,7 +125,7 @@ vips_round_buffer( VipsArithmetic *arithmetic, case VIPS_OPERATION_ROUND_FLOOR: SWITCH( VIPS_FLOOR ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/sign.c b/libvips/arithmetic/sign.c index a953710b..ba5ca359 100644 --- a/libvips/arithmetic/sign.c +++ b/libvips/arithmetic/sign.c @@ -120,7 +120,7 @@ vips_sign_buffer( VipsArithmetic *arithmetic, case VIPS_FORMAT_DPCOMPLEX: CSIGN( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/stats.c b/libvips/arithmetic/stats.c index 16e50bea..345275ca 100644 --- a/libvips/arithmetic/stats.c +++ b/libvips/arithmetic/stats.c @@ -392,7 +392,7 @@ vips_stats_scan( VipsStatistic *statistic, void *seq, case VIPS_FORMAT_DOUBLE: LOOP( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/arithmetic/subtract.c b/libvips/arithmetic/subtract.c index bf881baf..656acd11 100644 --- a/libvips/arithmetic/subtract.c +++ b/libvips/arithmetic/subtract.c @@ -127,7 +127,7 @@ vips_subtract_buffer( VipsArithmetic *arithmetic, break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/sum.c b/libvips/arithmetic/sum.c index 234185c4..79e9155f 100644 --- a/libvips/arithmetic/sum.c +++ b/libvips/arithmetic/sum.c @@ -108,7 +108,7 @@ sum_buffer( VipsArithmetic *arithmetic, VipsPel *out, VipsPel **in, int width ) LOOP( double, double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/arithmetic/unaryconst.c b/libvips/arithmetic/unaryconst.c index a0fe5063..679987e1 100644 --- a/libvips/arithmetic/unaryconst.c +++ b/libvips/arithmetic/unaryconst.c @@ -137,7 +137,7 @@ make_pixel( VipsObject *obj, break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( q ); diff --git a/libvips/conversion/arrayjoin.c b/libvips/conversion/arrayjoin.c index 62dee967..98708736 100644 --- a/libvips/conversion/arrayjoin.c +++ b/libvips/conversion/arrayjoin.c @@ -241,7 +241,7 @@ vips_arrayjoin_build( VipsObject *object ) break; default: - g_assert( 0 ); + g_assert_not_reached(); break; } @@ -259,7 +259,7 @@ vips_arrayjoin_build( VipsObject *object ) break; default: - g_assert( 0 ); + g_assert_not_reached(); break; } diff --git a/libvips/conversion/bandbool.c b/libvips/conversion/bandbool.c index faea1e32..86385048 100644 --- a/libvips/conversion/bandbool.c +++ b/libvips/conversion/bandbool.c @@ -110,7 +110,7 @@ vips_bandbool_build( VipsObject *object ) case VIPS_FORMAT_DOUBLE: F( double, OP ); break;\ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } #define LOOPB( TYPE, OP ) { \ @@ -169,7 +169,7 @@ vips_bandbool_buffer( VipsBandary *bandary, break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/conversion/bandmean.c b/libvips/conversion/bandmean.c index ad547f05..2dd7d01a 100644 --- a/libvips/conversion/bandmean.c +++ b/libvips/conversion/bandmean.c @@ -153,7 +153,7 @@ vips_bandmean_buffer( VipsBandary *bandary, FLOOP( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/conversion/bandrank.c b/libvips/conversion/bandrank.c index 115150f5..8f25f501 100644 --- a/libvips/conversion/bandrank.c +++ b/libvips/conversion/bandrank.c @@ -141,7 +141,7 @@ G_DEFINE_TYPE( VipsBandrank, vips_bandrank, VIPS_TYPE_BANDARY ); case VIPS_FORMAT_DOUBLE: OPERATION( double ); break; \ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } /* Sort input band elements in the stack. Needs to be big enough for diff --git a/libvips/conversion/cast.c b/libvips/conversion/cast.c index d724bfb8..f4f61b0f 100644 --- a/libvips/conversion/cast.c +++ b/libvips/conversion/cast.c @@ -362,7 +362,7 @@ vips_cast_start( VipsImage *out, void *a, void *b ) break; \ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } \ } @@ -462,7 +462,7 @@ vips_cast_gen( VipsRegion *or, void *vseq, void *a, void *b, break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/conversion/embed.c b/libvips/conversion/embed.c index 358528b6..9e77dc85 100644 --- a/libvips/conversion/embed.c +++ b/libvips/conversion/embed.c @@ -330,7 +330,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); @@ -535,7 +535,7 @@ vips_embed_build( VipsObject *object ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/conversion/flatten.c b/libvips/conversion/flatten.c index f05949e9..b95e0237 100644 --- a/libvips/conversion/flatten.c +++ b/libvips/conversion/flatten.c @@ -212,7 +212,7 @@ vips_flatten_black_gen( VipsRegion *or, void *vseq, void *a, void *b, case VIPS_FORMAT_COMPLEX: case VIPS_FORMAT_DPCOMPLEX: default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -277,7 +277,7 @@ vips_flatten_gen( VipsRegion *or, void *vseq, void *a, void *b, case VIPS_FORMAT_COMPLEX: case VIPS_FORMAT_DPCOMPLEX: default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/conversion/ifthenelse.c b/libvips/conversion/ifthenelse.c index 1170cca6..4b056b2c 100644 --- a/libvips/conversion/ifthenelse.c +++ b/libvips/conversion/ifthenelse.c @@ -197,7 +197,7 @@ vips_blend1_buffer( VipsPel *qp, case VIPS_FORMAT_DPCOMPLEX: CBLEND1( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -225,7 +225,7 @@ vips_blendn_buffer( VipsPel *qp, case VIPS_FORMAT_DPCOMPLEX: CBLENDN( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/conversion/join.c b/libvips/conversion/join.c index c74f851c..31988947 100644 --- a/libvips/conversion/join.c +++ b/libvips/conversion/join.c @@ -117,11 +117,11 @@ vips_join_build( VipsObject *object ) break; default: - g_assert( 0 ); + g_assert_not_reached(); - /* Keep -Wall happy. + /* Stop compiler warnings. */ - return( 0 ); + y = 0; } break; @@ -143,21 +143,17 @@ vips_join_build( VipsObject *object ) break; default: - g_assert( 0 ); + g_assert_not_reached(); - /* Keep -Wall happy. + /* Stop compiler warnings. */ - return( 0 ); + x = 0; } break; default: - g_assert( 0 ); - - /* Keep -Wall happy. - */ - return( 0 ); + g_assert_not_reached(); } if( vips_insert( join->in1, join->in2, &t, x, y, @@ -186,11 +182,14 @@ vips_join_build( VipsObject *object ) break; default: - g_assert( 0 ); + g_assert_not_reached(); - /* Keep -Wall happy. + /* Stop compiler warnings. */ - return( 0 ); + left = 0; + top = 0; + width = 0; + height = 0; } if( left != 0 || diff --git a/libvips/conversion/premultiply.c b/libvips/conversion/premultiply.c index e1e5ebe6..0560237e 100644 --- a/libvips/conversion/premultiply.c +++ b/libvips/conversion/premultiply.c @@ -172,7 +172,7 @@ vips_premultiply_gen( VipsRegion *or, void *vseq, void *a, void *b, case VIPS_FORMAT_COMPLEX: case VIPS_FORMAT_DPCOMPLEX: default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/conversion/recomb.c b/libvips/conversion/recomb.c index 58396467..e8d332c1 100644 --- a/libvips/conversion/recomb.c +++ b/libvips/conversion/recomb.c @@ -128,7 +128,7 @@ vips_recomb_gen( VipsRegion *or, case VIPS_FORMAT_DOUBLE:LOOP( double, double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/conversion/rot.c b/libvips/conversion/rot.c index bb81897f..2d07e78f 100644 --- a/libvips/conversion/rot.c +++ b/libvips/conversion/rot.c @@ -325,11 +325,11 @@ vips_rot_build( VipsObject *object ) break; default: - g_assert( 0 ); + g_assert_not_reached(); - /* Keep -Wall happy. + /* Stop compiler warnings. */ - return( 0 ); + generate_fn = NULL; } if( vips_image_generate( conversion->out, diff --git a/libvips/conversion/rot45.c b/libvips/conversion/rot45.c index 90451048..c049a5aa 100644 --- a/libvips/conversion/rot45.c +++ b/libvips/conversion/rot45.c @@ -239,11 +239,7 @@ vips_rot45_build( VipsObject *object ) break; default: - g_assert( 0 ); - - /* Keep -Wall happy. - */ - return( 0 ); + g_assert_not_reached(); } if( vips_image_write( in, conversion->out ) ) diff --git a/libvips/conversion/tilecache.c b/libvips/conversion/tilecache.c index f0f803bb..c6c6702d 100644 --- a/libvips/conversion/tilecache.c +++ b/libvips/conversion/tilecache.c @@ -286,7 +286,7 @@ vips_tile_search_recycle( gpointer key, gpointer value, gpointer user_data ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } } diff --git a/libvips/conversion/unpremultiply.c b/libvips/conversion/unpremultiply.c index 47e6f840..28e998a3 100644 --- a/libvips/conversion/unpremultiply.c +++ b/libvips/conversion/unpremultiply.c @@ -183,7 +183,7 @@ vips_unpremultiply_gen( VipsRegion *or, void *vseq, void *a, void *b, case VIPS_FORMAT_COMPLEX: case VIPS_FORMAT_DPCOMPLEX: default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/convolution/compass.c b/libvips/convolution/compass.c index 3a26a701..f7f01870 100644 --- a/libvips/convolution/compass.c +++ b/libvips/convolution/compass.c @@ -120,10 +120,11 @@ vips_compass_build( VipsObject *object ) break; default: - /* Silence compiler warning. + g_assert_not_reached(); + + /* Stop compiler warnings. */ x = NULL; - g_assert( 0 ); } if( vips_image_write( x, convolution->out ) ) diff --git a/libvips/convolution/conv.c b/libvips/convolution/conv.c index 31307657..234e275c 100644 --- a/libvips/convolution/conv.c +++ b/libvips/convolution/conv.c @@ -116,7 +116,7 @@ vips_conv_build( VipsObject *object ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/convolution/fastcor.c b/libvips/convolution/fastcor.c index 454d5b02..c9b8dc52 100644 --- a/libvips/convolution/fastcor.c +++ b/libvips/convolution/fastcor.c @@ -180,7 +180,7 @@ vips_fastcor_correlation( VipsCorrelation *correlation, break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/convolution/im_aconv.c b/libvips/convolution/im_aconv.c index b35463d4..901f846a 100644 --- a/libvips/convolution/im_aconv.c +++ b/libvips/convolution/im_aconv.c @@ -961,7 +961,7 @@ aconv_hgenerate( REGION *or, void *vseq, void *a, void *b ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -1183,7 +1183,7 @@ aconv_vgenerate( REGION *or, void *vseq, void *a, void *b ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/convolution/im_aconvsep.c b/libvips/convolution/im_aconvsep.c index 9abae71b..4bc0a810 100644 --- a/libvips/convolution/im_aconvsep.c +++ b/libvips/convolution/im_aconvsep.c @@ -590,7 +590,7 @@ aconvsep_generate_horizontal( REGION *or, void *vseq, void *a, void *b ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -768,7 +768,7 @@ aconvsep_generate_vertical( REGION *or, void *vseq, void *a, void *b ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/convolution/im_conv.c b/libvips/convolution/im_conv.c index a148eef7..222388c7 100644 --- a/libvips/convolution/im_conv.c +++ b/libvips/convolution/im_conv.c @@ -772,7 +772,7 @@ conv_gen( REGION *or, void *vseq, void *a, void *b ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -929,7 +929,7 @@ conv3x3_gen( REGION *or, void *vseq, void *a, void *b ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/convolution/im_conv_f.c b/libvips/convolution/im_conv_f.c index d23872b6..f2d6acd3 100644 --- a/libvips/convolution/im_conv_f.c +++ b/libvips/convolution/im_conv_f.c @@ -303,7 +303,7 @@ conv_gen( REGION *or, void *vseq, void *a, void *b ) CONV_FLOAT( double, double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/convolution/spcor.c b/libvips/convolution/spcor.c index c95b304a..a5134b7f 100644 --- a/libvips/convolution/spcor.c +++ b/libvips/convolution/spcor.c @@ -263,8 +263,12 @@ vips_spcor_correlation( VipsCorrelation *correlation, break; default: - g_assert( 0 ); - return; + g_assert_not_reached(); + + /* Stop compiler warnings. + */ + sum2 = 0; + sum3 = 0; } c2 = spcor->c1[b] * sqrt( sum2 ); diff --git a/libvips/draw/draw_image.c b/libvips/draw/draw_image.c index d6a534c9..c56bd486 100644 --- a/libvips/draw/draw_image.c +++ b/libvips/draw/draw_image.c @@ -146,7 +146,7 @@ vips_draw_image_mode_add( VipsDrawImage *draw_image, VipsImage *im, LOOPF( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -231,9 +231,7 @@ vips_draw_image_build( VipsObject *object ) break; default: - g_assert( 0 ); - break; - + g_assert_not_reached(); } p += VIPS_IMAGE_SIZEOF_LINE( im ); diff --git a/libvips/draw/draw_line.c b/libvips/draw/draw_line.c index 771cf0c6..9c00d807 100644 --- a/libvips/draw/draw_line.c +++ b/libvips/draw/draw_line.c @@ -208,7 +208,7 @@ vips__draw_line_direct( VipsImage *image, int x1, int y1, int x2, int y2, } } else - g_assert( 0 ); + g_assert_not_reached(); } static void diff --git a/libvips/draw/draw_mask.c b/libvips/draw/draw_mask.c index 48a04616..5f54685a 100644 --- a/libvips/draw/draw_mask.c +++ b/libvips/draw/draw_mask.c @@ -220,7 +220,7 @@ vips_draw_mask_draw( VipsImage *image, VipsImage *mask, VipsPel *ink, break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -283,7 +283,7 @@ vips__draw_mask_direct( VipsImage *image, VipsImage *mask, break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/draw/draw_smudge.c b/libvips/draw/draw_smudge.c index 8eaeb818..17f4951e 100644 --- a/libvips/draw/draw_smudge.c +++ b/libvips/draw/draw_smudge.c @@ -174,7 +174,7 @@ vips_draw_smudge_build( VipsObject *object ) case VIPS_FORMAT_DPCOMPLEX: SMUDGE( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/foreign/analyze2vips.c b/libvips/foreign/analyze2vips.c index 9489f639..e7ec87b3 100644 --- a/libvips/foreign/analyze2vips.c +++ b/libvips/foreign/analyze2vips.c @@ -289,7 +289,7 @@ print_dsr( struct dsr *d ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } } @@ -344,7 +344,7 @@ read_header( const char *header ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } } @@ -478,7 +478,7 @@ attach_meta( VipsImage *out, struct dsr *d ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } } diff --git a/libvips/foreign/csv.c b/libvips/foreign/csv.c index 6236e71e..2e35cf16 100644 --- a/libvips/foreign/csv.c +++ b/libvips/foreign/csv.c @@ -417,7 +417,7 @@ vips2csv( VipsImage *in, FILE *fp, const char *sep ) PRINT_COMPLEX( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } p += es; diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index 2c19e3be..44b321e3 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -723,9 +723,11 @@ pyramid_build( VipsForeignSaveDz *dz, Layer *above, break; default: - g_assert( 0 ); - limit = dz->tile_size; - break; + g_assert_not_reached(); + + /* Stop compiler warnings. + */ + limit = 1; } if( width > limit || @@ -1080,8 +1082,11 @@ tile_name( Layer *layer, int x, int y ) break; default: - g_assert( 0 ); - return( NULL ); + g_assert_not_reached(); + + /* Stop compiler warnings. + */ + out = NULL; } #ifdef DEBUG_VERBOSE @@ -1804,8 +1809,7 @@ vips_foreign_save_dz_build( VipsObject *object ) break; default: - g_assert( 0 ); - return( -1 ); + g_assert_not_reached(); } if( vips_sink_disc( save->ready, pyramid_strip, dz ) ) @@ -1828,8 +1832,7 @@ vips_foreign_save_dz_build( VipsObject *object ) break; default: - g_assert( 0 ); - return( -1 ); + g_assert_not_reached(); } if( dz->properties && diff --git a/libvips/foreign/magick2vips.c b/libvips/foreign/magick2vips.c index 7f767a94..a8a22f6c 100644 --- a/libvips/foreign/magick2vips.c +++ b/libvips/foreign/magick2vips.c @@ -533,7 +533,7 @@ unpack_pixels( VipsImage *im, VipsPel *q8, PixelPacket *pixels, int n ) GRAY_LOOP( double, QuantumRange ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } break; @@ -551,7 +551,7 @@ unpack_pixels( VipsImage *im, VipsPel *q8, PixelPacket *pixels, int n ) GRAYA_LOOP( double, QuantumRange ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } break; @@ -569,7 +569,7 @@ unpack_pixels( VipsImage *im, VipsPel *q8, PixelPacket *pixels, int n ) RGB_LOOP( double, QuantumRange ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } break; @@ -587,12 +587,12 @@ unpack_pixels( VipsImage *im, VipsPel *q8, PixelPacket *pixels, int n ) RGBA_LOOP( double, QuantumRange ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/foreign/ppm.c b/libvips/foreign/ppm.c index cb916e29..8b70cb16 100644 --- a/libvips/foreign/ppm.c +++ b/libvips/foreign/ppm.c @@ -249,11 +249,11 @@ read_header( FILE *fp, VipsImage *out, int *bits, int *ascii, int *msb_first ) break; default: - g_assert( 0 ); + g_assert_not_reached(); - /* Keep -Wall happy. + /* Stop compiler warnings. */ - return( 0 ); + format = VIPS_FORMAT_UCHAR; } if( bands == 1 ) { @@ -341,7 +341,7 @@ read_ascii( FILE *fp, VipsImage *out ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -607,7 +607,7 @@ write_ppm_line_ascii( Write *write, VipsPel *p ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -731,7 +731,7 @@ write_ppm( Write *write, gboolean ascii, gboolean squash ) else if( in->Bands == 3 && !ascii ) magic = "P6"; else - g_assert( 0 ); + g_assert_not_reached(); fprintf( write->fp, "%s\n", magic ); time( &timebuf ); @@ -765,7 +765,7 @@ write_ppm( Write *write, gboolean ascii, gboolean squash ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } if( squash ) diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 74a1ab5a..1fe38472 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -674,7 +674,7 @@ greyscale_line( ReadTiff *rtiff, VipsPel *q, VipsPel *p, int n, void *client ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -934,7 +934,7 @@ parse_palette( ReadTiff *rtiff, VipsImage *out ) else if( rtiff->bits_per_sample == 16 ) rtiff->sfn = palette_line16; else - g_assert( 0 ); + g_assert_not_reached(); return( 0 ); } @@ -1835,7 +1835,7 @@ my_tiff_read( thandle_t st, tdata_t buffer, tsize_t size ) static tsize_t my_tiff_write( thandle_t st, tdata_t buffer, tsize_t size ) { - g_assert( 0 ); + g_assert_not_reached(); return( 0 ); } @@ -1858,7 +1858,7 @@ my_tiff_seek( thandle_t st, toff_t pos, int whence ) else if( whence == SEEK_END ) rtiff->pos = rtiff->len + pos; else - g_assert( 0 ); + g_assert_not_reached(); return( rtiff->pos ); } @@ -1874,7 +1874,7 @@ my_tiff_size( thandle_t st ) static int my_tiff_map( thandle_t st, tdata_t *start, toff_t *len ) { - g_assert( 0 ); + g_assert_not_reached(); return 0; } @@ -1882,7 +1882,7 @@ my_tiff_map( thandle_t st, tdata_t *start, toff_t *len ) static void my_tiff_unmap( thandle_t st, tdata_t start, toff_t len ) { - g_assert( 0 ); + g_assert_not_reached(); return; } diff --git a/libvips/foreign/vips2tiff.c b/libvips/foreign/vips2tiff.c index 24fc8f14..cb6c3bbd 100644 --- a/libvips/foreign/vips2tiff.c +++ b/libvips/foreign/vips2tiff.c @@ -829,7 +829,7 @@ get_compression( VipsForeignTiffCompression compression ) return( COMPRESSION_LZW ); default: - g_assert( 0 ); + g_assert_not_reached(); } /* Keep -Wall happy. @@ -847,7 +847,7 @@ get_resunit( VipsForeignTiffResunit resunit ) return( RESUNIT_INCH ); default: - g_assert( 0 ); + g_assert_not_reached(); } /* Keep -Wall happy. @@ -1103,7 +1103,7 @@ invert_band0( Write *write, VipsPel *q, VipsPel *p, int n ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/histogram/hist_cum.c b/libvips/histogram/hist_cum.c index a81907ab..57a6cfd2 100644 --- a/libvips/histogram/hist_cum.c +++ b/libvips/histogram/hist_cum.c @@ -116,7 +116,7 @@ vips_hist_cum_process( VipsHistogram *histogram, ACCUMULATE( double, double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/histogram/hist_plot.c b/libvips/histogram/hist_plot.c index 2d3c00f1..41af74bb 100644 --- a/libvips/histogram/hist_plot.c +++ b/libvips/histogram/hist_plot.c @@ -158,7 +158,7 @@ make_vert_gen( REGION *or, void *seq, void *a, void *b ) case IM_BANDFMT_DOUBLE: VERT( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -208,7 +208,7 @@ make_horz_gen( REGION *or, void *seq, void *a, void *b ) case IM_BANDFMT_DOUBLE: HORZ( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/histogram/maplut.c b/libvips/histogram/maplut.c index b40e75e8..14154c35 100644 --- a/libvips/histogram/maplut.c +++ b/libvips/histogram/maplut.c @@ -404,7 +404,7 @@ vips_maplut_start( VipsImage *out, void *a, void *b ) case VIPS_FORMAT_USHORT: GEN( unsigned short, OUT ); break; \ case VIPS_FORMAT_UINT: GEN( unsigned int, OUT ); break; \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } /* Switch for LUT types. One function for non-complex images, a @@ -434,7 +434,7 @@ vips_maplut_start( VipsImage *out, void *a, void *b ) case VIPS_FORMAT_DPCOMPLEX: \ inner_switch( UCHAR_FC, GEN_FC, double ); break; \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } /* Do a map. @@ -666,7 +666,7 @@ vips_maplut_build( VipsObject *object ) case VIPS_FORMAT_DPCOMPLEX: PACK_TABLEC( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } if( vips_image_generate( maplut->out, diff --git a/libvips/iofuncs/header.c b/libvips/iofuncs/header.c index db76dfd8..155b9606 100644 --- a/libvips/iofuncs/header.c +++ b/libvips/iofuncs/header.c @@ -536,9 +536,7 @@ vips_image_guess_interpretation( const VipsImage *image ) break; default: - g_assert( 0 ); - sane = FALSE; - break; + g_assert_not_reached(); } if( sane ) diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index d9608f6f..3c739e35 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -3384,8 +3384,8 @@ vips_band_format_isint( VipsBandFormat format ) return( FALSE ); default: - g_assert( 0 ); - return( -1 ); + g_assert_not_reached(); + return( FALSE ); } } @@ -3402,7 +3402,7 @@ vips_band_format_isuint( VipsBandFormat format ) case VIPS_FORMAT_UCHAR: case VIPS_FORMAT_USHORT: case VIPS_FORMAT_UINT: - return( 1 ); + return( TRUE ); case VIPS_FORMAT_INT: case VIPS_FORMAT_SHORT: @@ -3411,11 +3411,11 @@ vips_band_format_isuint( VipsBandFormat format ) case VIPS_FORMAT_DOUBLE: case VIPS_FORMAT_COMPLEX: case VIPS_FORMAT_DPCOMPLEX: - return( 0 ); + return( FALSE ); default: - g_assert( 0 ); - return( -1 ); + g_assert_not_reached(); + return( FALSE ); } } @@ -3444,8 +3444,8 @@ vips_band_format_is8bit( VipsBandFormat format ) return( FALSE ); default: - g_assert( 0 ); - return( -1 ); + g_assert_not_reached(); + return( FALSE ); } } @@ -3461,7 +3461,7 @@ vips_band_format_isfloat( VipsBandFormat format ) switch( format ) { case VIPS_FORMAT_FLOAT: case VIPS_FORMAT_DOUBLE: - return( 1 ); + return( TRUE ); case VIPS_FORMAT_UCHAR: case VIPS_FORMAT_CHAR: @@ -3471,11 +3471,11 @@ vips_band_format_isfloat( VipsBandFormat format ) case VIPS_FORMAT_INT: case VIPS_FORMAT_COMPLEX: case VIPS_FORMAT_DPCOMPLEX: - return( 0 ); + return( FALSE ); default: - g_assert( 0 ); - return( -1 ); + g_assert_not_reached(); + return( FALSE ); } } @@ -3491,7 +3491,7 @@ vips_band_format_iscomplex( VipsBandFormat format ) switch( format ) { case VIPS_FORMAT_COMPLEX: case VIPS_FORMAT_DPCOMPLEX: - return( 1 ); + return( TRUE ); case VIPS_FORMAT_UCHAR: case VIPS_FORMAT_CHAR: @@ -3501,10 +3501,10 @@ vips_band_format_iscomplex( VipsBandFormat format ) case VIPS_FORMAT_INT: case VIPS_FORMAT_FLOAT: case VIPS_FORMAT_DOUBLE: - return( 0 ); + return( FALSE ); default: - g_assert( 0 ); - return( -1 ); + g_assert_not_reached(); + return( FALSE ); } } diff --git a/libvips/iofuncs/memory.c b/libvips/iofuncs/memory.c index f3a17714..21a11741 100644 --- a/libvips/iofuncs/memory.c +++ b/libvips/iofuncs/memory.c @@ -90,7 +90,7 @@ * uses this information to decide when to trim caches. */ -/* g_assert( 0 ) on memory errors. +/* g_assert_not_reached() on memory errors. #define DEBUG */ @@ -288,7 +288,7 @@ vips_tracked_malloc( size_t size ) if( !(buf = g_try_malloc( size )) ) { #ifdef DEBUG - g_assert( 0 ); + g_assert_not_reached(); #endif /*DEBUG*/ vips_error( "vips_tracked", diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index 23288fbb..c7412e2a 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -1774,7 +1774,7 @@ vips_object_no_value( VipsObject *object, const char *name ) if( vips_object_get_argument( object, name, &pspec, &argument_class, &argument_instance ) ) - g_assert( 0 ); + g_assert_not_reached(); if( strcmp( name, g_param_spec_get_name( pspec ) ) == 0 ) vips_error( class->nickname, diff --git a/libvips/iofuncs/region.c b/libvips/iofuncs/region.c index aad8f3bf..c1514831 100644 --- a/libvips/iofuncs/region.c +++ b/libvips/iofuncs/region.c @@ -967,8 +967,7 @@ vips_region_paint( VipsRegion *reg, VipsRect *r, int value ) break; default: - g_assert( 0 ); - break; + g_assert_not_reached(); } q1 = q + ls; @@ -1221,7 +1220,7 @@ vips_region_shrink_uncoded( VipsRegion *from, VipsRegion *to, VipsRect *target ) SHRINK_TYPE_FLOAT( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } } diff --git a/libvips/iofuncs/threadpool.c b/libvips/iofuncs/threadpool.c index cc999200..db51c0c8 100644 --- a/libvips/iofuncs/threadpool.c +++ b/libvips/iofuncs/threadpool.c @@ -965,7 +965,7 @@ vips_get_tile_size( VipsImage *im, break; default: - g_assert( 0 ); + g_assert_not_reached(); } /* We can't set n_lines for the current demand style: a later bit of diff --git a/libvips/morphology/countlines.c b/libvips/morphology/countlines.c index 5aa3dd9d..0a48ce96 100644 --- a/libvips/morphology/countlines.c +++ b/libvips/morphology/countlines.c @@ -104,11 +104,7 @@ vips_countlines_build( VipsObject *object ) break; default: - g_assert( 0 ); - - /* Keep -Wall happy. - */ - return( 0 ); + g_assert_not_reached(); } g_object_set( object, "nolines", nolines / 255.0, NULL ); diff --git a/libvips/morphology/hitmiss.c b/libvips/morphology/hitmiss.c index fdbe4584..9a78772f 100644 --- a/libvips/morphology/hitmiss.c +++ b/libvips/morphology/hitmiss.c @@ -495,7 +495,7 @@ dilate_gen( REGION *or, void *vseq, void *a, void *b ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -607,7 +607,7 @@ erode_gen( REGION *or, void *vseq, void *a, void *b ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/morphology/morph.c b/libvips/morphology/morph.c index c1e93a37..47333e18 100644 --- a/libvips/morphology/morph.c +++ b/libvips/morphology/morph.c @@ -117,7 +117,7 @@ vips_morph_build( VipsObject *object ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/morphology/rank.c b/libvips/morphology/rank.c index a6388918..67f2f5f1 100644 --- a/libvips/morphology/rank.c +++ b/libvips/morphology/rank.c @@ -282,7 +282,7 @@ vips_rank_start( IMAGE *out, void *a, void *b ) case VIPS_FORMAT_DOUBLE: OPERATION( double ); break; \ \ default: \ - g_assert( 0 ); \ + g_assert_not_reached(); \ } static int diff --git a/libvips/mosaicing/merge.c b/libvips/mosaicing/merge.c index 401f98b3..bf7b1e9c 100644 --- a/libvips/mosaicing/merge.c +++ b/libvips/mosaicing/merge.c @@ -86,7 +86,7 @@ vips_merge_build( VipsObject *object ) break; default: - g_assert( 0 ); + g_assert_not_reached(); } return( 0 ); diff --git a/libvips/mosaicing/mosaic.c b/libvips/mosaicing/mosaic.c index b5cf3a5e..eee86884 100644 --- a/libvips/mosaicing/mosaic.c +++ b/libvips/mosaicing/mosaic.c @@ -128,16 +128,7 @@ vips_mosaic_build( VipsObject *object ) break; default: - /* Silence compiler warnings. - */ - dx0 = 0; - dy0 = 0; - scale1 = 0.0; - angle1 = 0.0; - dx1 = 0.0; - dy1 = 0.0; - - g_assert( 0 ); + g_assert_not_reached(); } g_object_set( mosaic, diff --git a/libvips/resample/mapim.c b/libvips/resample/mapim.c index c90e08bc..6fe140b5 100644 --- a/libvips/resample/mapim.c +++ b/libvips/resample/mapim.c @@ -140,7 +140,14 @@ vips_mapim_region_minmax( VipsRegion *region, VipsRect *r, VipsRect *bounds ) MINMAX( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); + + /* Stop compiler warnings. + */ + min_x = 0; + max_x = 0; + min_y = 0; + max_y = 0; } } @@ -280,7 +287,7 @@ vips_mapim_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) LOOKUP( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/resample/quadratic.c b/libvips/resample/quadratic.c index 1720c2f0..e4741af8 100644 --- a/libvips/resample/quadratic.c +++ b/libvips/resample/quadratic.c @@ -193,8 +193,7 @@ vips_quadratic_gen( VipsRegion *or, void *vseq, break; default: - g_assert( 0 ); - return( -7 ); + g_assert_not_reached(); } printf( "dx = %g, dy = %g\n", dx, dy ); diff --git a/libvips/resample/shrink2.c b/libvips/resample/shrink2.c index c6e70c40..02fbd14c 100644 --- a/libvips/resample/shrink2.c +++ b/libvips/resample/shrink2.c @@ -234,7 +234,7 @@ vips_shrink2_gen2( VipsShrink2 *shrink, VipsShrink2Sequence *seq, FSHRINK( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } out += sizeof_pixel; diff --git a/libvips/resample/shrinkh.c b/libvips/resample/shrinkh.c index 08c4e215..e64c257f 100644 --- a/libvips/resample/shrinkh.c +++ b/libvips/resample/shrinkh.c @@ -165,7 +165,7 @@ vips_shrinkh_gen2( VipsShrinkh *shrink, VipsRegion *or, VipsRegion *ir, FSHRINK( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } diff --git a/libvips/resample/shrinkv.c b/libvips/resample/shrinkv.c index 034d61d6..fc781efd 100644 --- a/libvips/resample/shrinkv.c +++ b/libvips/resample/shrinkv.c @@ -189,7 +189,7 @@ vips_shrinkv_add_line( VipsShrinkv *shrink, VipsShrinkvSequence *seq, ADD( double, double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } } @@ -251,7 +251,7 @@ vips_shrinkv_write_line( VipsShrinkv *shrink, VipsShrinkvSequence *seq, FAVG( double ); break; default: - g_assert( 0 ); + g_assert_not_reached(); } }