Skip to content

Commit

Permalink
Use define because the fallthrough attribute is only supported by gcc.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Apr 10, 2023
1 parent 18fd137 commit 312aaf9
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 91 deletions.
16 changes: 8 additions & 8 deletions MagickCore/blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -3801,7 +3801,7 @@ MagickExport ssize_t ReadBlob(Image *image,const size_t length,void *data)
break;
*q++=(unsigned char) c;
count++;
magick_attribute((fallthrough));
magick_fallthrough;
}
case 3:
{
Expand All @@ -3810,7 +3810,7 @@ MagickExport ssize_t ReadBlob(Image *image,const size_t length,void *data)
break;
*q++=(unsigned char) c;
count++;
magick_attribute((fallthrough));
magick_fallthrough;
}
case 2:
{
Expand All @@ -3819,7 +3819,7 @@ MagickExport ssize_t ReadBlob(Image *image,const size_t length,void *data)
break;
*q++=(unsigned char) c;
count++;
magick_attribute((fallthrough));
magick_fallthrough;
}
case 1:
{
Expand All @@ -3828,7 +3828,7 @@ MagickExport ssize_t ReadBlob(Image *image,const size_t length,void *data)
break;
*q++=(unsigned char) c;
count++;
magick_attribute((fallthrough));
magick_fallthrough;
}
case 0:
break;
Expand Down Expand Up @@ -5743,31 +5743,31 @@ MagickExport ssize_t WriteBlob(Image *image,const size_t length,
if (c == EOF)
break;
count++;
magick_attribute((fallthrough));
magick_fallthrough;
}
case 3:
{
c=putc((int) *p++,blob_info->file_info.file);
if (c == EOF)
break;
count++;
magick_attribute((fallthrough));
magick_fallthrough;
}
case 2:
{
c=putc((int) *p++,blob_info->file_info.file);
if (c == EOF)
break;
count++;
magick_attribute((fallthrough));
magick_fallthrough;
}
case 1:
{
c=putc((int) *p++,blob_info->file_info.file);
if (c == EOF)
break;
count++;
magick_attribute((fallthrough));
magick_fallthrough;
}
case 0:
break;
Expand Down
2 changes: 1 addition & 1 deletion MagickCore/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ static inline void RelinquishPixelCachePixels(CacheInfo *cache_info)
(void) RelinquishUniqueFileResource(cache_info->cache_filename);
*cache_info->cache_filename='\0';
RelinquishMagickResource(MapResource,cache_info->length);
magick_attribute((fallthrough));
magick_fallthrough;
}
case DiskCache:
{
Expand Down
2 changes: 1 addition & 1 deletion MagickCore/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -3225,7 +3225,7 @@ MagickExport MagickBooleanType SetImageMask(Image *image,const PixelMask type,
case WritePixelMask:
{
image->channels=(ChannelType) (image->channels & ~WriteMaskChannel);
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down
2 changes: 1 addition & 1 deletion MagickCore/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ MagickExport MatrixInfo *DestroyMatrixInfo(MatrixInfo *matrix_info)
(void) UnmapBlob(matrix_info->elements,(size_t) matrix_info->length);
matrix_info->elements=NULL;
RelinquishMagickResource(MapResource,matrix_info->length);
magick_attribute((fallthrough));
magick_fallthrough;
}
case DiskCache:
{
Expand Down
16 changes: 8 additions & 8 deletions MagickCore/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,14 +851,14 @@ MagickExport void *CopyMagickMemory(void *magick_restrict destination,
switch (size)
{
default: return(memcpy(destination,source,size));
case 8: *q++=(*p++); magick_attribute((fallthrough));
case 7: *q++=(*p++); magick_attribute((fallthrough));
case 6: *q++=(*p++); magick_attribute((fallthrough));
case 5: *q++=(*p++); magick_attribute((fallthrough));
case 4: *q++=(*p++); magick_attribute((fallthrough));
case 3: *q++=(*p++); magick_attribute((fallthrough));
case 2: *q++=(*p++); magick_attribute((fallthrough));
case 1: *q++=(*p++); magick_attribute((fallthrough));
case 8: *q++=(*p++); magick_fallthrough;
case 7: *q++=(*p++); magick_fallthrough;
case 6: *q++=(*p++); magick_fallthrough;
case 5: *q++=(*p++); magick_fallthrough;
case 4: *q++=(*p++); magick_fallthrough;
case 3: *q++=(*p++); magick_fallthrough;
case 2: *q++=(*p++); magick_fallthrough;
case 1: *q++=(*p++); magick_fallthrough;
case 0: return(destination);
}
return(memmove(destination,source,size));
Expand Down
2 changes: 2 additions & 0 deletions MagickCore/method-attribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ extern "C" {
#if !defined(__clang__) && (((__GNUC__) > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
# define magick_alloc_size(x) __attribute__((__alloc_size__(x)))
# define magick_alloc_sizes(x,y) __attribute__((__alloc_size__(x,y)))
# define magick_fallthrough __attribute__((fallthrough))
#else
# define magick_alloc_size(x) /* nothing */
# define magick_alloc_sizes(x,y) /* nothing */
# define magick_fallthrough
#endif

#if defined(__clang__) || (((__GNUC__) > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
Expand Down
2 changes: 1 addition & 1 deletion MagickCore/morphology.c
Original file line number Diff line number Diff line change
Expand Up @@ -3725,7 +3725,7 @@ MagickPrivate Image *MorphologyApply(const Image *image,
break;
case HitAndMissMorphology:
rslt_compose = LightenCompositeOp; /* Union of multi-kernel results */
magick_attribute((fallthrough));
magick_fallthrough;
case ThinningMorphology:
case ThickenMorphology:
method_limit = kernel_limit; /* iterate the whole method */
Expand Down
40 changes: 20 additions & 20 deletions MagickCore/quantum-export.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ static void ExportAlphaQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -619,7 +619,7 @@ static void ExportBGRQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -860,7 +860,7 @@ static void ExportBGRAQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -1103,7 +1103,7 @@ static void ExportBGROQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -1221,7 +1221,7 @@ static void ExportBlackQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -1325,7 +1325,7 @@ static void ExportBlueQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -1577,7 +1577,7 @@ static void ExportCMYKQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -1745,7 +1745,7 @@ static void ExportCMYKAQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -1913,7 +1913,7 @@ static void ExportCMYKOQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -2181,7 +2181,7 @@ static void ExportGrayQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -2384,7 +2384,7 @@ static void ExportGrayAlphaQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -2490,7 +2490,7 @@ static void ExportGreenQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -2660,7 +2660,7 @@ static void ExportIndexQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -2851,7 +2851,7 @@ static void ExportIndexAlphaQuantum(const Image *image,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -2978,7 +2978,7 @@ static void ExportMultispectralQuantum(const Image *image,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -3085,7 +3085,7 @@ static void ExportOpacityQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -3189,7 +3189,7 @@ static void ExportRedQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -3486,7 +3486,7 @@ static void ExportRGBQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -3727,7 +3727,7 @@ static void ExportRGBAQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down Expand Up @@ -3976,7 +3976,7 @@ static void ExportRGBOQuantum(const Image *image,QuantumInfo *quantum_info,
}
break;
}
magick_attribute((fallthrough));
magick_fallthrough;
}
default:
{
Expand Down
Loading

0 comments on commit 312aaf9

Please sign in to comment.