@@ -292,56 +292,55 @@ static void
build_prepend_package_length(GArray *package, unsigned length, bool incl_self)
{
uint8_t byte;
unsigned length_bytes;
if (length + 1 < (1 << PACKAGE_LENGTH_1BYTE_SHIFT)) {
length_bytes = 1;
} else if (length + 2 < (1 << PACKAGE_LENGTH_3BYTE_SHIFT)) {
length_bytes = 2;
} else if (length + 3 < (1 << PACKAGE_LENGTH_4BYTE_SHIFT)) {
length_bytes = 3;
} else {
length_bytes = 4;
}
/*
* NamedField uses PkgLength encoding but it doesn't include length
* of PkgLength itself.
*/
if (incl_self) {
/*
* PkgLength is the length of the inclusive length of the data
* and PkgLength's length itself when used for terms with
* explicit length.
*/
length += length_bytes;
}
switch (length_bytes) {
case 1:
byte = length;
build_prepend_byte(package, byte);
return;
case 4:
byte = length >> PACKAGE_LENGTH_4BYTE_SHIFT;
build_prepend_byte(package, byte);
length &= (1 << PACKAGE_LENGTH_4BYTE_SHIFT) - 1;
- /* fall through */
+ fallthrough;
case 3:
byte = length >> PACKAGE_LENGTH_3BYTE_SHIFT;
build_prepend_byte(package, byte);
length &= (1 << PACKAGE_LENGTH_3BYTE_SHIFT) - 1;
- /* fall through */
+ fallthrough;
case 2:
byte = length >> PACKAGE_LENGTH_2BYTE_SHIFT;
build_prepend_byte(package, byte);
length &= (1 << PACKAGE_LENGTH_2BYTE_SHIFT) - 1;
- /* fall through */
}
/*
* Most significant two bits of byte zero indicate how many following bytes
* are in PkgLength encoding.
*/
byte = ((length_bytes - 1) << PACKAGE_LENGTH_1BYTE_SHIFT) | length;
build_prepend_byte(package, byte);
}
@@ -508,37 +507,38 @@ static void build_buffer(GArray *array, uint8_t op)
void aml_append(Aml *parent_ctx, Aml *child)
{
GArray *buf = build_alloc_array();
build_append_array(buf, child->buf);
switch (child->block_flags) {
case AML_OPCODE:
build_append_byte(parent_ctx->buf, child->op);
break;
case AML_EXT_PACKAGE:
build_extop_package(buf, child->op);
break;
case AML_PACKAGE:
build_package(buf, child->op);
break;
case AML_RES_TEMPLATE:
build_append_byte(buf, 0x79); /* EndTag */
/*
* checksum operations are treated as succeeded if checksum
* field is zero. [ACPI Spec 1.0b, 6.4.2.8 End Tag]
*/
build_append_byte(buf, 0);
/* fall through, to pack resources in buffer */
+ fallthrough;
case AML_BUFFER:
build_buffer(buf, child->op);
break;
case AML_NO_OPCODE:
break;
default:
assert(0);
break;
}
build_append_array(parent_ctx->buf, buf);
build_free_array(buf);
}
/* ACPI 1.0b: 16.2.5.1 Namespace Modifier Objects Encoding: DefScope */
In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword. Signed-off-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org> --- hw/acpi/aml-build.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)