Skip to content

Commit

Permalink
ACPICA: fix -Wfallthrough
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reported-by: Jon Hunter <[email protected]>

Link: acpica/acpica@4b9135f5
Signed-off-by: Nick Desaulniers <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Erik Kaneda <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
nickdesaulniers authored and rafaeljw committed Jan 22, 2021
1 parent 25d866c commit c1a7c2c
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/dscontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
}
}

/*lint -fallthrough */
ACPI_FALLTHROUGH;

case AML_IF_OP:
/*
Expand Down
3 changes: 1 addition & 2 deletions drivers/acpi/acpica/dswexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/dswload.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
break;
}

/*lint -fallthrough */
ACPI_FALLTHROUGH;

default:

Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/dswload2.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
break;
}

/*lint -fallthrough */
ACPI_FALLTHROUGH;

default:

Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/exfldio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
/*
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/exresop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/exstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
return_ACPI_STATUS(AE_OK);
}

/*lint -fallthrough */
ACPI_FALLTHROUGH;

default:

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/hwgpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/utdelete.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions include/acpi/actypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
15 changes: 15 additions & 0 deletions include/acpi/platform/acgcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */

0 comments on commit c1a7c2c

Please sign in to comment.