diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-10-28 18:41:24 +0100 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-10-28 18:41:24 +0100 |
commit | bf6dad60c338a42a7fb85f7b2a5870c0fb2e20f8 (patch) | |
tree | e513781ef717465e7db0358e987a5a6cbef5665c /libbacktrace | |
parent | 0c261d5b5c931d9e9214d06531bdc7e9e16aeaab (diff) | |
parent | 47d13acbda9a5d8eb57ff169ba74857cd54108e4 (diff) | |
download | gcc-bf6dad60c338a42a7fb85f7b2a5870c0fb2e20f8.zip gcc-bf6dad60c338a42a7fb85f7b2a5870c0fb2e20f8.tar.gz gcc-bf6dad60c338a42a7fb85f7b2a5870c0fb2e20f8.tar.bz2 |
Merge branch 'master' into devel/coarray_native.
Merge into devel/coarray_native to prepare for later merging of
coarray_native with master.
Diffstat (limited to 'libbacktrace')
-rw-r--r-- | libbacktrace/ChangeLog | 25 | ||||
-rw-r--r-- | libbacktrace/Makefile.am | 52 | ||||
-rw-r--r-- | libbacktrace/Makefile.in | 40 | ||||
-rwxr-xr-x | libbacktrace/configure | 18 | ||||
-rw-r--r-- | libbacktrace/configure.ac | 2 | ||||
-rw-r--r-- | libbacktrace/dwarf.c | 38 | ||||
-rw-r--r-- | libbacktrace/elf.c | 16 | ||||
-rw-r--r-- | libbacktrace/internal.h | 8 |
8 files changed, 128 insertions, 71 deletions
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index b6fbe28..528b2b0 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,28 @@ +2020-10-20 Ian Lance Taylor <iant@golang.org> + + * internal.h (ATTRIBUTE_FALLTHROUGH): Define. + * elf.c (elf_zlib_inflate): Use ATTRIBUTE_FALLTHROUGH. + +2020-09-28 Ian Lance Taylor <iant@golang.org> + + PR libbacktrace/97082 + * Makefile.am (check_DATA): Add mtest.dSYM if USE_DSYMUTIL. + * Makefile.in: Regenerate. + +2020-09-28 Ian Lance Taylor <iant@golang.org> + + PR libbacktrace/97227 + * configure.ac (USE_DSYMUTIL): Define instead of HAVE_DSYMUTIL. + * Makefile.am: Change all uses of HAVE_DSYMUTIL to USE_DSYMUTIL. + * configure: Regenerate. + * Makefile.in: Regenerate. + +2020-09-23 Ian Lance Taylor <iant@golang.org> + + * dwarf.c (report_inlined_functions): Handle PC == -1 and PC == + p->low. + (dwarf_lookup_pc): Likewise. + 2020-09-17 Ian Lance Taylor <iant@golang.org> PR libbacktrace/97080 diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am index 4d34938..5899a21 100644 --- a/libbacktrace/Makefile.am +++ b/libbacktrace/Makefile.am @@ -100,12 +100,12 @@ check_DATA = # Flags to use when compiling test programs. libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g -if HAVE_DSYMUTIL +if USE_DSYMUTIL %.dSYM: % $(DSYMUTIL) $< -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL if NATIVE check_LTLIBRARIES = libbacktrace_alloc.la @@ -237,9 +237,9 @@ allocfail.sh: allocfail TESTS += allocfail.sh -if HAVE_DSYMUTIL +if USE_DSYMUTIL check_DATA += allocfail.dSYM -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL if HAVE_ELF if HAVE_OBJCOPY_DEBUGLINK @@ -273,9 +273,9 @@ btest_LDADD = libbacktrace.la BUILDTESTS += btest -if HAVE_DSYMUTIL +if USE_DSYMUTIL check_DATA += btest.dSYM -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL if HAVE_ELF @@ -293,9 +293,9 @@ btest_alloc_LDADD = libbacktrace_alloc.la BUILDTESTS += btest_alloc -if HAVE_DSYMUTIL +if USE_DSYMUTIL check_DATA += btest_alloc.dSYM -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL if HAVE_DWZ @@ -323,9 +323,9 @@ stest_LDADD = libbacktrace.la BUILDTESTS += stest -if HAVE_DSYMUTIL +if USE_DSYMUTIL check_DATA += stest.dSYM -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL stest_alloc_SOURCES = $(stest_SOURCES) stest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS) @@ -333,9 +333,9 @@ stest_alloc_LDADD = libbacktrace_alloc.la BUILDTESTS += stest_alloc -if HAVE_DSYMUTIL +if USE_DSYMUTIL check_DATA += stest_alloc.dSYM -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL if HAVE_ELF @@ -366,17 +366,17 @@ edtest_LDADD = libbacktrace.la BUILDTESTS += edtest -if HAVE_DSYMUTIL +if USE_DSYMUTIL check_DATA += edtest.dSYM -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL edtest_alloc_SOURCES = $(edtest_SOURCES) edtest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS) edtest_alloc_LDADD = libbacktrace_alloc.la -if HAVE_DSYMUTIL +if USE_DSYMUTIL check_DATA += edtest_alloc.dSYM -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL BUILDTESTS += edtest_alloc @@ -394,9 +394,9 @@ ttest_SOURCES = ttest.c testlib.c ttest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -pthread ttest_LDADD = libbacktrace.la -if HAVE_DSYMUTIL +if USE_DSYMUTIL check_DATA += ttest.dSYM -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL BUILDTESTS += ttest_alloc @@ -404,9 +404,9 @@ ttest_alloc_SOURCES = $(ttest_SOURCES) ttest_alloc_CFLAGS = $(ttest_CFLAGS) ttest_alloc_LDADD = libbacktrace_alloc.la -if HAVE_DSYMUTIL +if USE_DSYMUTIL check_DATA += ttest_alloc.dSYM -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL endif HAVE_PTHREAD @@ -462,9 +462,9 @@ dwarf5_LDADD = libbacktrace.la BUILDTESTS += dwarf5 -if HAVE_DSYMUTIL +if USE_DSYMUTIL check_DATA += dwarf5.dSYM -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL dwarf5_alloc_SOURCES = $(dwarf5_SOURCES) dwarf5_alloc_CFLAGS = $(dwarf5_CFLAGS) @@ -472,9 +472,9 @@ dwarf5_alloc_LDADD = libbacktrace_alloc.la BUILDTESTS += dwarf5_alloc -if HAVE_DSYMUTIL +if USE_DSYMUTIL check_DATA += dwarf5_alloc.dSYM -endif HAVE_DSYMUTIL +endif USE_DSYMUTIL endif @@ -484,6 +484,10 @@ mtest_LDADD = libbacktrace.la BUILDTESTS += mtest +if USE_DSYMUTIL +check_DATA += mtest.dSYM +endif USE_DSYMUTIL + if HAVE_MINIDEBUG TESTS += mtest_minidebug diff --git a/libbacktrace/Makefile.in b/libbacktrace/Makefile.in index 201cee3..2f5fdb1 100644 --- a/libbacktrace/Makefile.in +++ b/libbacktrace/Makefile.in @@ -124,17 +124,17 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ $(am__EXEEXT_14) TESTS = $(am__append_4) $(am__append_7) $(am__append_9) \ $(am__append_12) $(am__append_13) $(am__append_20) \ - $(am__append_25) $(am__EXEEXT_14) + $(am__append_26) $(am__EXEEXT_14) @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_1 = libbacktrace_elf_for_test.la @NATIVE_TRUE@am__append_2 = test_elf_32 test_elf_64 test_macho \ @NATIVE_TRUE@ test_xcoff_32 test_xcoff_64 test_pecoff \ @NATIVE_TRUE@ test_unknown unittest unittest_alloc btest @NATIVE_TRUE@am__append_3 = allocfail @NATIVE_TRUE@am__append_4 = allocfail.sh -@HAVE_DSYMUTIL_TRUE@@NATIVE_TRUE@am__append_5 = allocfail.dSYM \ -@HAVE_DSYMUTIL_TRUE@@NATIVE_TRUE@ btest.dSYM btest_alloc.dSYM \ -@HAVE_DSYMUTIL_TRUE@@NATIVE_TRUE@ stest.dSYM stest_alloc.dSYM \ -@HAVE_DSYMUTIL_TRUE@@NATIVE_TRUE@ edtest.dSYM edtest_alloc.dSYM +@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_5 = allocfail.dSYM \ +@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ btest.dSYM btest_alloc.dSYM \ +@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ stest.dSYM stest_alloc.dSYM \ +@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ edtest.dSYM edtest_alloc.dSYM @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_6 = b2test @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_7 = b2test_buildid @HAVE_DWZ_TRUE@@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_8 = b3test @@ -148,20 +148,23 @@ TESTS = $(am__append_4) $(am__append_7) $(am__append_9) \ @HAVE_ELF_TRUE@@NATIVE_TRUE@am__append_16 = ztest ztest_alloc @NATIVE_TRUE@am__append_17 = edtest edtest_alloc @HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_18 = ttest ttest_alloc -@HAVE_DSYMUTIL_TRUE@@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_19 = ttest.dSYM \ -@HAVE_DSYMUTIL_TRUE@@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ ttest_alloc.dSYM +@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_19 = \ +@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ ttest.dSYM \ +@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ ttest_alloc.dSYM @HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_20 = btest_gnudebuglink @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__append_21 = ctestg ctesta \ @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ ctestg_alloc \ @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ ctesta_alloc @HAVE_DWARF5_TRUE@@NATIVE_TRUE@am__append_22 = dwarf5 dwarf5_alloc -@HAVE_DSYMUTIL_TRUE@@HAVE_DWARF5_TRUE@@NATIVE_TRUE@am__append_23 = dwarf5.dSYM \ -@HAVE_DSYMUTIL_TRUE@@HAVE_DWARF5_TRUE@@NATIVE_TRUE@ dwarf5_alloc.dSYM +@HAVE_DWARF5_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_23 = \ +@HAVE_DWARF5_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ dwarf5.dSYM \ +@HAVE_DWARF5_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ dwarf5_alloc.dSYM @NATIVE_TRUE@am__append_24 = mtest -@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@am__append_25 = mtest_minidebug -@HAVE_ELF_TRUE@@HAVE_LIBLZMA_TRUE@am__append_26 = -llzma +@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_25 = mtest.dSYM +@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@am__append_26 = mtest_minidebug @HAVE_ELF_TRUE@@HAVE_LIBLZMA_TRUE@am__append_27 = -llzma -@HAVE_ELF_TRUE@am__append_28 = xztest xztest_alloc +@HAVE_ELF_TRUE@@HAVE_LIBLZMA_TRUE@am__append_28 = -llzma +@HAVE_ELF_TRUE@am__append_29 = xztest xztest_alloc subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/cet.m4 \ @@ -989,10 +992,11 @@ libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD) BUILDTESTS = $(am__append_2) $(am__append_10) $(am__append_11) \ $(am__append_16) $(am__append_17) $(am__append_18) \ $(am__append_21) $(am__append_22) $(am__append_24) \ - $(am__append_28) + $(am__append_29) # Add a file to this variable if you want it to be built for testing. -check_DATA = $(am__append_5) $(am__append_19) $(am__append_23) +check_DATA = $(am__append_5) $(am__append_19) $(am__append_23) \ + $(am__append_25) # Flags to use when compiling test programs. libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g @@ -1119,12 +1123,12 @@ libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g @NATIVE_TRUE@mtest_LDADD = libbacktrace.la @HAVE_ELF_TRUE@xztest_SOURCES = xztest.c testlib.c @HAVE_ELF_TRUE@xztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\" -@HAVE_ELF_TRUE@xztest_LDADD = libbacktrace.la $(am__append_26) \ +@HAVE_ELF_TRUE@xztest_LDADD = libbacktrace.la $(am__append_27) \ @HAVE_ELF_TRUE@ $(CLOCK_GETTIME_LINK) @HAVE_ELF_TRUE@xztest_alloc_SOURCES = $(xztest_SOURCES) @HAVE_ELF_TRUE@xztest_alloc_CFLAGS = $(xztest_CFLAGS) @HAVE_ELF_TRUE@xztest_alloc_LDADD = libbacktrace_alloc.la \ -@HAVE_ELF_TRUE@ $(am__append_27) $(CLOCK_GETTIME_LINK) +@HAVE_ELF_TRUE@ $(am__append_28) $(CLOCK_GETTIME_LINK) CLEANFILES = \ $(TESTS) *.debug elf_for_test.c edtest2_build.c gen_edtest2_build \ *.dsyms *.fsyms *.keepsyms *.dbg *.mdbg *.mdbg.xz *.strip @@ -2392,8 +2396,8 @@ uninstall-am: .PRECIOUS: Makefile -@HAVE_DSYMUTIL_TRUE@%.dSYM: % -@HAVE_DSYMUTIL_TRUE@ $(DSYMUTIL) $< +@USE_DSYMUTIL_TRUE@%.dSYM: % +@USE_DSYMUTIL_TRUE@ $(DSYMUTIL) $< @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@elf_for_test.c: elf.c @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ SEARCH='^#define SYSTEM_BUILD_ID_DIR.*$$'; \ diff --git a/libbacktrace/configure b/libbacktrace/configure index 031a156..8c8c34d 100755 --- a/libbacktrace/configure +++ b/libbacktrace/configure @@ -645,8 +645,8 @@ COMM HAVE_XZ_FALSE HAVE_XZ_TRUE XZ -HAVE_DSYMUTIL_FALSE -HAVE_DSYMUTIL_TRUE +USE_DSYMUTIL_FALSE +USE_DSYMUTIL_TRUE HAVE_OBJCOPY_DEBUGLINK_FALSE HAVE_OBJCOPY_DEBUGLINK_TRUE READELF @@ -13860,12 +13860,12 @@ $as_echo "no" >&6; } fi - if test -n "${DSYMUTIL}"; then - HAVE_DSYMUTIL_TRUE= - HAVE_DSYMUTIL_FALSE='#' + if test -n "${DSYMUTIL}" -a "$FORMAT_FILE" = "macho.lo"; then + USE_DSYMUTIL_TRUE= + USE_DSYMUTIL_FALSE='#' else - HAVE_DSYMUTIL_TRUE='#' - HAVE_DSYMUTIL_FALSE= + USE_DSYMUTIL_TRUE='#' + USE_DSYMUTIL_FALSE= fi @@ -14271,8 +14271,8 @@ if test -z "${HAVE_OBJCOPY_DEBUGLINK_TRUE}" && test -z "${HAVE_OBJCOPY_DEBUGLINK as_fn_error $? "conditional \"HAVE_OBJCOPY_DEBUGLINK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_DSYMUTIL_TRUE}" && test -z "${HAVE_DSYMUTIL_FALSE}"; then - as_fn_error $? "conditional \"HAVE_DSYMUTIL\" was never defined. +if test -z "${USE_DSYMUTIL_TRUE}" && test -z "${USE_DSYMUTIL_FALSE}"; then + as_fn_error $? "conditional \"USE_DSYMUTIL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_XZ_TRUE}" && test -z "${HAVE_XZ_FALSE}"; then diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac index 0659ea6..ec456bf 100644 --- a/libbacktrace/configure.ac +++ b/libbacktrace/configure.ac @@ -510,7 +510,7 @@ AM_CONDITIONAL(HAVE_OBJCOPY_DEBUGLINK, test "$libbacktrace_cv_objcopy_debuglink" AC_ARG_VAR(DSYMUTIL, [location of dsymutil]) AC_CHECK_PROG(DSYMUTIL, dsymutil, dsymutil) -AM_CONDITIONAL(HAVE_DSYMUTIL, test -n "${DSYMUTIL}") +AM_CONDITIONAL(USE_DSYMUTIL, test -n "${DSYMUTIL}" -a "$FORMAT_FILE" = "macho.lo") AC_ARG_VAR(NM, [location of nm]) AC_CHECK_PROG(NM, nm, nm) diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c index 386701b..582f34b 100644 --- a/libbacktrace/dwarf.c +++ b/libbacktrace/dwarf.c @@ -3558,6 +3558,11 @@ report_inlined_functions (uintptr_t pc, struct function *function, if (function->function_addrs_count == 0) return 0; + /* Our search isn't safe if pc == -1, as that is the sentinel + value. */ + if (pc + 1 == 0) + return 0; + p = ((struct function_addrs *) bsearch (&pc, function->function_addrs, function->function_addrs_count, @@ -3567,9 +3572,12 @@ report_inlined_functions (uintptr_t pc, struct function *function, return 0; /* Here pc >= p->low && pc < (p + 1)->low. The function_addrs are - sorted by low, so we are at the end of a range of function_addrs - with the same low alue. Walk backward and use the first range - that includes pc. */ + sorted by low, so if pc > p->low we are at the end of a range of + function_addrs with the same low value. If pc == p->low walk + forward to the end of the range with that low value. Then walk + backward and use the first range that includes pc. */ + while (pc == (p + 1)->low) + ++p; match = NULL; while (1) { @@ -3636,8 +3644,10 @@ dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata, *found = 1; - /* Find an address range that includes PC. */ - entry = (ddata->addrs_count == 0 + /* Find an address range that includes PC. Our search isn't safe if + PC == -1, as we use that as a sentinel value, so skip the search + in that case. */ + entry = (ddata->addrs_count == 0 || pc + 1 == 0 ? NULL : bsearch (&pc, ddata->addrs, ddata->addrs_count, sizeof (struct unit_addrs), unit_addrs_search)); @@ -3649,9 +3659,12 @@ dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata, } /* Here pc >= entry->low && pc < (entry + 1)->low. The unit_addrs - are sorted by low, so we are at the end of a range of unit_addrs - with the same low value. Walk backward and use the first range - that includes pc. */ + are sorted by low, so if pc > p->low we are at the end of a range + of unit_addrs with the same low value. If pc == p->low walk + forward to the end of the range with that low value. Then walk + backward and use the first range that includes pc. */ + while (pc == (entry + 1)->low) + ++entry; found_entry = 0; while (1) { @@ -3832,9 +3845,12 @@ dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata, return callback (data, pc, ln->filename, ln->lineno, NULL); /* Here pc >= p->low && pc < (p + 1)->low. The function_addrs are - sorted by low, so we are at the end of a range of function_addrs - with the same low alue. Walk backward and use the first range - that includes pc. */ + sorted by low, so if pc > p->low we are at the end of a range of + function_addrs with the same low value. If pc == p->low walk + forward to the end of the range with that low value. Then walk + backward and use the first range that includes pc. */ + while (pc == (p + 1)->low) + ++p; fmatch = NULL; while (1) { diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c index 941f820d..d52b86c 100644 --- a/libbacktrace/elf.c +++ b/libbacktrace/elf.c @@ -2081,10 +2081,10 @@ elf_zlib_inflate (const unsigned char *pin, size_t sin, uint16_t *zdebug_table, { case 6: *plen++ = prev; - /* fallthrough */ + ATTRIBUTE_FALLTHROUGH; case 5: *plen++ = prev; - /* fallthrough */ + ATTRIBUTE_FALLTHROUGH; case 4: *plen++ = prev; } @@ -2115,22 +2115,22 @@ elf_zlib_inflate (const unsigned char *pin, size_t sin, uint16_t *zdebug_table, { case 10: *plen++ = 0; - /* fallthrough */ + ATTRIBUTE_FALLTHROUGH; case 9: *plen++ = 0; - /* fallthrough */ + ATTRIBUTE_FALLTHROUGH; case 8: *plen++ = 0; - /* fallthrough */ + ATTRIBUTE_FALLTHROUGH; case 7: *plen++ = 0; - /* fallthrough */ + ATTRIBUTE_FALLTHROUGH; case 6: *plen++ = 0; - /* fallthrough */ + ATTRIBUTE_FALLTHROUGH; case 5: *plen++ = 0; - /* fallthrough */ + ATTRIBUTE_FALLTHROUGH; case 4: *plen++ = 0; } diff --git a/libbacktrace/internal.h b/libbacktrace/internal.h index 047a700..659db9e 100644 --- a/libbacktrace/internal.h +++ b/libbacktrace/internal.h @@ -56,6 +56,14 @@ POSSIBILITY OF SUCH DAMAGE. */ # endif #endif +#ifndef ATTRIBUTE_FALLTHROUGH +# if (GCC_VERSION >= 7000) +# define ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) +# else +# define ATTRIBUTE_FALLTHROUGH +# endif +#endif + #ifndef HAVE_SYNC_FUNCTIONS /* Define out the sync functions. These should never be called if |