ACPICA: fix -Wfallthrough
authorNick Desaulniers <ndesaulniers@google.com>
Fri, 22 Jan 2021 00:23:51 +0000 (16:23 -0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 22 Jan 2021 14:51:30 +0000 (15:51 +0100)
ACPICA commit 4b9135f5774caa796ddf826448811e8e7f08ef2f

GCC 7.1 gained -Wimplicit-fallthrough to warn on implicit fallthrough,
as well as __attribute__((__fallthrough__)) and comments to explicitly
denote that cases of fallthrough were intentional. Clang also supports
this warning and statement attribute, but not the comment form.

Robert Moore provides additional context about the lint comments being
removed. They were for "an old version of PC-Lint, which we don't use
anymore." Drop those.

This will help us enable -Wimplicit-fallthrough throughout the Linux
kernel.

Suggested-by: Robert Moore <robert.moore@intel.com>
Reported-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://github.com/acpica/acpica/commit/4b9135f5
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/dscontrol.c
drivers/acpi/acpica/dswexec.c
drivers/acpi/acpica/dswload.c
drivers/acpi/acpica/dswload2.c
drivers/acpi/acpica/exfldio.c
drivers/acpi/acpica/exresop.c
drivers/acpi/acpica/exstore.c
drivers/acpi/acpica/hwgpe.c
drivers/acpi/acpica/utdelete.c
include/acpi/actypes.h
include/acpi/platform/acgcc.h

index 4b5b6e859f62f9f9abf07bb0904a099f4cfe039a..b58ffc7acdb988cc5d3187054419ac28a801a9b0 100644 (file)
@@ -62,7 +62,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
                        }
                }
 
-               /*lint -fallthrough */
+               ACPI_FALLTHROUGH;
 
        case AML_IF_OP:
                /*
index 1d4f8c81028c29120d2087f3d1e51ab4cb29214c..4a9799246faeb72945850f3ec2f2104ec0e4e9ed 100644 (file)
@@ -598,8 +598,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                                        break;
                                }
 
-                               /* Fall through */
-                               /*lint -fallthrough */
+                               ACPI_FALLTHROUGH;
 
                        case AML_INT_EVAL_SUBTREE_OP:
 
index 27069325b6de0efc0a68828fea12a9807a815c51..dd97c86f8e415954f3e405dc9f869434aa461840 100644 (file)
@@ -224,7 +224,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
                                break;
                        }
 
-                       /*lint -fallthrough */
+                       ACPI_FALLTHROUGH;
 
                default:
 
index edadbe1465069651221d81b6b1d2d1153481f7bd..d9a3dfca75552da3dd60b9c2b654e422a8567bc6 100644 (file)
@@ -214,7 +214,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
                                break;
                        }
 
-                       /*lint -fallthrough */
+                       ACPI_FALLTHROUGH;
 
                default:
 
index ade35ff1c7ba5626055866a2e01ba2ae578e3ed9..cde24e0fa6a8d2342aa7d01ac469e3a0f749765d 100644 (file)
@@ -434,7 +434,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
                 * region_field case and write the datum to the Operation Region
                 */
 
-               /*lint -fallthrough */
+               ACPI_FALLTHROUGH;
 
        case ACPI_TYPE_LOCAL_REGION_FIELD:
                /*
index 4d1b22971d58daf4150ac10a2249d741c00ab082..4a0f8b8bfe6253e5dec85fd77718bb742872f85f 100644 (file)
@@ -198,7 +198,7 @@ acpi_ex_resolve_operands(u16 opcode,
 
                                        target_op = AML_DEBUG_OP;
 
-                                       /*lint -fallthrough */
+                                       ACPI_FALLTHROUGH;
 
                                case ACPI_REFCLASS_ARG:
                                case ACPI_REFCLASS_LOCAL:
@@ -264,7 +264,7 @@ acpi_ex_resolve_operands(u16 opcode,
                         * Else not a string - fall through to the normal Reference
                         * case below
                         */
-                       /*lint -fallthrough */
+                       ACPI_FALLTHROUGH;
 
                case ARGI_REFERENCE:    /* References: */
                case ARGI_INTEGER_REF:
index 3adc0a29d890b259cb86043bc81bf6df5248815f..8fe33051275dad4f084856fff2ba9dda8403d363 100644 (file)
@@ -96,7 +96,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
                        return_ACPI_STATUS(AE_OK);
                }
 
-               /*lint -fallthrough */
+               ACPI_FALLTHROUGH;
 
        default:
 
@@ -422,7 +422,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
                                break;
                        }
 
-                       /* Fallthrough */
+                       ACPI_FALLTHROUGH;
 
                case ACPI_TYPE_DEVICE:
                case ACPI_TYPE_EVENT:
index b13a4ed5bc6385c7fd356d07932c34d4a2dd640e..0c84300e915c550a9659da079b6a5cec7cdeaea7 100644 (file)
@@ -167,7 +167,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
                        return (AE_BAD_PARAMETER);
                }
 
-               /*lint -fallthrough */
+               ACPI_FALLTHROUGH;
 
        case ACPI_GPE_ENABLE:
 
index 4c0d4e434196195b137af2ce1d34344851b5ea22..624a26794d5588206ddd5aaa60664e5821496b8c 100644 (file)
@@ -112,7 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
                                                       gpe_block);
                }
 
-               /*lint -fallthrough */
+               ACPI_FALLTHROUGH;
 
        case ACPI_TYPE_PROCESSOR:
        case ACPI_TYPE_THERMAL:
index 647cb11d0a0a3026321dddcc9a261a6b94c645ef..2a32593691bcd13a0f40812baf753ada2ccc44f0 100644 (file)
@@ -1286,4 +1286,10 @@ typedef enum {
 
 #define ACPI_OPT_END                    -1
 
+/* Definitions for explicit fallthrough */
+
+#ifndef ACPI_FALLTHROUGH
+#define ACPI_FALLTHROUGH do {} while(0)
+#endif
+
 #endif                         /* __ACTYPES_H__ */
index 7d63d03cf5077a0d92718cf062e38ad745dac45c..91f7a02c798a693af820c6c2799014f450f175f9 100644 (file)
@@ -54,4 +54,19 @@ typedef __builtin_va_list va_list;
 
 #define ACPI_USE_NATIVE_MATH64
 
+/* GCC did not support __has_attribute until 5.1. */
+
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
+/*
+ * Explictly mark intentional explicit fallthrough to silence
+ * -Wimplicit-fallthrough in GCC 7.1+.
+ */
+
+#if __has_attribute(__fallthrough__)
+#define ACPI_FALLTHROUGH __attribute__((__fallthrough__))
+#endif
+
 #endif                         /* __ACGCC_H__ */