Commit 73eb1803 by Ian Lance Taylor

libbacktrace: use __attribute__((__fallthrough__))

Use an attribute rather than a comment when falling through a switch case. * internal.h (ATTRIBUTE_FALLTHROUGH): Define. * elf.c (elf_zlib_inflate): Use ATTRIBUTE_FALLTHROUGH.
parent 5009c113
...@@ -2081,10 +2081,10 @@ elf_zlib_inflate (const unsigned char *pin, size_t sin, uint16_t *zdebug_table, ...@@ -2081,10 +2081,10 @@ elf_zlib_inflate (const unsigned char *pin, size_t sin, uint16_t *zdebug_table,
{ {
case 6: case 6:
*plen++ = prev; *plen++ = prev;
/* fallthrough */ ATTRIBUTE_FALLTHROUGH;
case 5: case 5:
*plen++ = prev; *plen++ = prev;
/* fallthrough */ ATTRIBUTE_FALLTHROUGH;
case 4: case 4:
*plen++ = prev; *plen++ = prev;
} }
...@@ -2115,22 +2115,22 @@ elf_zlib_inflate (const unsigned char *pin, size_t sin, uint16_t *zdebug_table, ...@@ -2115,22 +2115,22 @@ elf_zlib_inflate (const unsigned char *pin, size_t sin, uint16_t *zdebug_table,
{ {
case 10: case 10:
*plen++ = 0; *plen++ = 0;
/* fallthrough */ ATTRIBUTE_FALLTHROUGH;
case 9: case 9:
*plen++ = 0; *plen++ = 0;
/* fallthrough */ ATTRIBUTE_FALLTHROUGH;
case 8: case 8:
*plen++ = 0; *plen++ = 0;
/* fallthrough */ ATTRIBUTE_FALLTHROUGH;
case 7: case 7:
*plen++ = 0; *plen++ = 0;
/* fallthrough */ ATTRIBUTE_FALLTHROUGH;
case 6: case 6:
*plen++ = 0; *plen++ = 0;
/* fallthrough */ ATTRIBUTE_FALLTHROUGH;
case 5: case 5:
*plen++ = 0; *plen++ = 0;
/* fallthrough */ ATTRIBUTE_FALLTHROUGH;
case 4: case 4:
*plen++ = 0; *plen++ = 0;
} }
......
...@@ -56,6 +56,14 @@ POSSIBILITY OF SUCH DAMAGE. */ ...@@ -56,6 +56,14 @@ POSSIBILITY OF SUCH DAMAGE. */
# endif # endif
#endif #endif
#ifndef ATTRIBUTE_FALLTHROUGH
# if (GCC_VERSION >= 7000)
# define ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
# else
# define ATTRIBUTE_FALLTHROUGH
# endif
#endif
#ifndef HAVE_SYNC_FUNCTIONS #ifndef HAVE_SYNC_FUNCTIONS
/* Define out the sync functions. These should never be called if /* Define out the sync functions. These should never be called if
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment