]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libbacktrace: use __has_attribute for fallthrough
authorIan Lance Taylor <iant@golang.org>
Thu, 18 Jul 2024 18:34:09 +0000 (11:34 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 18 Jul 2024 18:35:44 +0000 (11:35 -0700)
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.

libbacktrace/elf.c
libbacktrace/internal.h

index e8d67feab6d35d97e6365e45c354271497c03ea4..0040479143d6335d2c044e7cb53e8829dba9ccea 100644 (file)
@@ -4848,25 +4848,25 @@ elf_zstd_decompress (const unsigned char *pin, size_t sin,
                  {
                  case 8:
                    *pout++ = *plit++;
-                   /* FALLTHROUGH */
+                   ATTRIBUTE_FALLTHROUGH;
                  case 7:
                    *pout++ = *plit++;
-                   /* FALLTHROUGH */
+                   ATTRIBUTE_FALLTHROUGH;
                  case 6:
                    *pout++ = *plit++;
-                   /* FALLTHROUGH */
+                   ATTRIBUTE_FALLTHROUGH;
                  case 5:
                    *pout++ = *plit++;
-                   /* FALLTHROUGH */
+                   ATTRIBUTE_FALLTHROUGH;
                  case 4:
                    *pout++ = *plit++;
-                   /* FALLTHROUGH */
+                   ATTRIBUTE_FALLTHROUGH;
                  case 3:
                    *pout++ = *plit++;
-                   /* FALLTHROUGH */
+                   ATTRIBUTE_FALLTHROUGH;
                  case 2:
                    *pout++ = *plit++;
-                   /* FALLTHROUGH */
+                   ATTRIBUTE_FALLTHROUGH;
                  case 1:
                    *pout++ = *plit++;
                    break;
index a119cda692fd5394c1bc3ea21310727a8d464773..fe2abe50b0f3c02d4c2388717baca3219746e308 100644 (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__))