libbacktrace: use __has_attribute for fallthrough

Also convert some FALLTHROUGH comments to ATTRIBUTE_FALLTHROUGH.

	* internal.h: Use __has_attribute to check for fallthrough
	attribute.
	* elf.c (elf_zstd_decompress): Use ATTRIBUTE_FALLTHROUGH rather
	than a FALLTHROUGH comment.
This commit is contained in:
Ian Lance Taylor
2024-07-18 11:34:09 -07:00
parent f37b51de9b
commit 7e2b7da3d6
2 changed files with 12 additions and 7 deletions

View File

@@ -56,6 +56,11 @@ POSSIBILITY OF SUCH DAMAGE. */
# endif
#endif
#ifdef __has_attribute
# if __has_attribute(fallthrough)
# define ATTRIBUTE_FALLTHROUGH __attribute__ ((fallthrough))
# endif
#endif
#ifndef ATTRIBUTE_FALLTHROUGH
# if (GCC_VERSION >= 7000)
# define ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))