Skip to contentSkip to conversation

ACPICA: Use fallthrough pseudo-keyword

PATCH In review Gustavo A. R. Silva 5 participants 8 messages Jul 7, 2020 – Oct 14, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPICA: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

---
 drivers/acpi/acpica/dscontrol.c |    2 +-
 drivers/acpi/acpica/dswexec.c   |    3 +--
 drivers/acpi/acpica/dswload.c   |    2 +-
 drivers/acpi/acpica/dswload2.c  |    4 +---
 drivers/acpi/acpica/exfldio.c   |    2 +-
 drivers/acpi/acpica/exresop.c   |    4 ++--
 drivers/acpi/acpica/exstore.c   |    4 ++--
 drivers/acpi/acpica/hwgpe.c     |    3 +--
 drivers/acpi/acpica/utdelete.c  |    3 +--
 drivers/acpi/acpica/utprint.c   |    2 +-
 10 files changed, 12 insertions(+), 17 deletions(-)
drivers/acpi/acpica/dscontrol.c +1 -1
index 4b5b6e859f62..134d53380663 100644
@@ -62,7 +62,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
 			}
 		}
 
-		/*lint -fallthrough */
+		fallthrough;
 
 	case AML_IF_OP:
 		/*
drivers/acpi/acpica/dswexec.c +1 -2
index 1d4f8c81028c..41f6cb61778a 100644
@@ -598,8 +598,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
 					break;
 				}
 
-				/* Fall through */
-				/*lint -fallthrough */
+				fallthrough;
 
 			case AML_INT_EVAL_SUBTREE_OP:
 
drivers/acpi/acpica/dswload.c +1 -1
index 27069325b6de..1d8789869dda 100644
@@ -224,7 +224,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
 				break;
 			}
 
-			/*lint -fallthrough */
+			fallthrough;
 
 		default:
 
drivers/acpi/acpica/dswload2.c +1 -3
index edadbe146506..de367e8e4cf4 100644
@@ -213,9 +213,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
 			     parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
 				break;
 			}
-
-			/*lint -fallthrough */
-
+			fallthrough;
 		default:
 
 			/* All other types are an error */
drivers/acpi/acpica/exfldio.c +1 -1
index ade35ff1c7ba..677ba3ab1482 100644
@@ -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 */
+		fallthrough;
 
 	case ACPI_TYPE_LOCAL_REGION_FIELD:
 		/*
drivers/acpi/acpica/exresop.c +2 -2
index 4d1b22971d58..7c8676adcf43 100644
@@ -198,7 +198,7 @@ acpi_ex_resolve_operands(u16 opcode,
 
 					target_op = AML_DEBUG_OP;
 
-					/*lint -fallthrough */
+					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 */
+			fallthrough;
 
 		case ARGI_REFERENCE:	/* References: */
 		case ARGI_INTEGER_REF:
drivers/acpi/acpica/exstore.c +2 -2
index 3adc0a29d890..fcf8dff56c5b 100644
@@ -96,7 +96,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
 			return_ACPI_STATUS(AE_OK);
 		}
 
-		/*lint -fallthrough */
+		fallthrough;
 
 	default:
 
@@ -422,7 +422,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
 				break;
 			}
 
-			/* Fallthrough */
+			fallthrough;
 
 		case ACPI_TYPE_DEVICE:
 		case ACPI_TYPE_EVENT:
drivers/acpi/acpica/hwgpe.c +1 -2
index 49c46d4dd070..19d574f64c78 100644
@@ -95,8 +95,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
 		if (!(register_bit & gpe_register_info->enable_mask)) {
 			return (AE_BAD_PARAMETER);
 		}
-
-		/*lint -fallthrough */
+		fallthrough;
 
 	case ACPI_GPE_ENABLE:
 
drivers/acpi/acpica/utdelete.c +1 -2
index c365faf4e6cd..6db09eb9d257 100644
@@ -111,8 +111,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
 			(void)acpi_ev_delete_gpe_block(object->device.
 						       gpe_block);
 		}
-
-		/*lint -fallthrough */
+		fallthrough;
 
 	case ACPI_TYPE_PROCESSOR:
 	case ACPI_TYPE_THERMAL:
drivers/acpi/acpica/utprint.c +1 -1
index 681c11f4af4e..f7e43baf5ff2 100644
@@ -475,7 +475,7 @@ int vsnprintf(char *string, acpi_size size, const char *format, va_list args)
 		case 'X':
 
 			type |= ACPI_FORMAT_UPPER;
-			/* FALLTHROUGH */
+			fallthrough;
 
 		case 'x':
 
#1 lore raw
Quoted 8 lines · Gustavo A. R. Silva

Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by Gustavo A. R. Silva <gustavoars(a)kernel.org>

I need to talk to Erik and Bob about this one.

Quoted 167 lines
---
 drivers/acpi/acpica/dscontrol.c |    2 +-
 drivers/acpi/acpica/dswexec.c   |    3 +--
 drivers/acpi/acpica/dswload.c   |    2 +-
 drivers/acpi/acpica/dswload2.c  |    4 +---
 drivers/acpi/acpica/exfldio.c   |    2 +-
 drivers/acpi/acpica/exresop.c   |    4 ++--
 drivers/acpi/acpica/exstore.c   |    4 ++--
 drivers/acpi/acpica/hwgpe.c     |    3 +--
 drivers/acpi/acpica/utdelete.c  |    3 +--
 drivers/acpi/acpica/utprint.c   |    2 +-
 10 files changed, 12 insertions(+), 17 deletions(-)
drivers/acpi/acpica/dscontrol.c +1 -1
index 4b5b6e859f62..134d53380663 100644
@@ -62,7 +62,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
                        }
                }
 
-               /*lint -fallthrough */
+               fallthrough;
 
        case AML_IF_OP:
                /*
drivers/acpi/acpica/dswexec.c +1 -2
index 1d4f8c81028c..41f6cb61778a 100644
@@ -598,8 +598,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                                        break;
                                }
 
-                               /* Fall through */
-                               /*lint -fallthrough */
+                               fallthrough;
 
                        case AML_INT_EVAL_SUBTREE_OP:
 
drivers/acpi/acpica/dswload.c +1 -1
index 27069325b6de..1d8789869dda 100644
@@ -224,7 +224,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
                                break;
                        }
 
-                       /*lint -fallthrough */
+                       fallthrough;
 
                default:
 
drivers/acpi/acpica/dswload2.c +1 -3
index edadbe146506..de367e8e4cf4 100644
@@ -213,9 +213,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
                             parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
                                break;
                        }
-
-                       /*lint -fallthrough */
-
+                       fallthrough;
                default:
 
                        /* All other types are an error */
drivers/acpi/acpica/exfldio.c +1 -1
index ade35ff1c7ba..677ba3ab1482 100644
@@ -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 */
+               fallthrough;
 
        case ACPI_TYPE_LOCAL_REGION_FIELD:
                /*
drivers/acpi/acpica/exresop.c +2 -2
index 4d1b22971d58..7c8676adcf43 100644
@@ -198,7 +198,7 @@ acpi_ex_resolve_operands(u16 opcode,
 
                                        target_op = AML_DEBUG_OP;
 
-                                       /*lint -fallthrough */
+                                       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 */
+                       fallthrough;
 
                case ARGI_REFERENCE:    /* References: */
                case ARGI_INTEGER_REF:
drivers/acpi/acpica/exstore.c +2 -2
index 3adc0a29d890..fcf8dff56c5b 100644
@@ -96,7 +96,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
                        return_ACPI_STATUS(AE_OK);
                }
 
-               /*lint -fallthrough */
+               fallthrough;
 
        default:
 
@@ -422,7 +422,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
                                break;
                        }
 
-                       /* Fallthrough */
+                       fallthrough;
 
                case ACPI_TYPE_DEVICE:
                case ACPI_TYPE_EVENT:
drivers/acpi/acpica/hwgpe.c +1 -2
index 49c46d4dd070..19d574f64c78 100644
@@ -95,8 +95,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
                if (!(register_bit & gpe_register_info->enable_mask)) {
                        return (AE_BAD_PARAMETER);
                }
-
-               /*lint -fallthrough */
+               fallthrough;
 
        case ACPI_GPE_ENABLE:
 
drivers/acpi/acpica/utdelete.c +1 -2
index c365faf4e6cd..6db09eb9d257 100644
@@ -111,8 +111,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
                        (void)acpi_ev_delete_gpe_block(object->device.
                                                       gpe_block);
                }
-
-               /*lint -fallthrough */
+               fallthrough;
 
        case ACPI_TYPE_PROCESSOR:
        case ACPI_TYPE_THERMAL:
drivers/acpi/acpica/utprint.c +1 -1
index 681c11f4af4e..f7e43baf5ff2 100644
@@ -475,7 +475,7 @@ int vsnprintf(char *string, acpi_size size, const char *format, va_list args)
                case 'X':
 
                        type |= ACPI_FORMAT_UPPER;
-                       /* FALLTHROUGH */
+                       fallthrough;
 
                case 'x':
 
#2 lore raw

It looks like this attribute is not supported by msvc 2017 (and perhaps other compilers) -- it is apparently a GCC extension -- meaning that it cannot be used in the ACPICA compiler-independent code.

Bob

-----Original Message-----
From: Rafael J. Wysocki <rafael(a)kernel.org>
Sent: Wednesday, July 08, 2020 3:59 AM
To: Gustavo A. R. Silva <gustavoars(a)kernel.org>
Cc: Moore, Robert <robert.moore(a)intel.com>; Kaneda, Erik <erik.kaneda(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; Len Brown <lenb(a)kernel.org>; ACPI Devel Maling List <linux-acpi(a)vger.kernel.org>; open list:ACPI COMPONENT ARCHITECTURE (ACPICA) <devel(a)acpica.org>; Linux Kernel Mailing List <linux-kernel(a)vger.kernel.org>
Subject: Re: [PATCH][next] ACPICA: Use fallthrough pseudo-keyword

Quoted 10 lines · Gustavo A. R. Silva

Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case.

[1]
https://www.kernel.org/doc/html/latest/process/deprecated.html?highlig
ht=fallthrough#implicit-switch-case-fall-through

Signed-off-by Gustavo A. R. Silva <gustavoars(a)kernel.org>

I need to talk to Erik and Bob about this one.

Quoted 175 lines
---
 drivers/acpi/acpica/dscontrol.c |    2 +-
 drivers/acpi/acpica/dswexec.c   |    3 +--
 drivers/acpi/acpica/dswload.c   |    2 +-
 drivers/acpi/acpica/dswload2.c  |    4 +---
 drivers/acpi/acpica/exfldio.c   |    2 +-
 drivers/acpi/acpica/exresop.c   |    4 ++--
 drivers/acpi/acpica/exstore.c   |    4 ++--
 drivers/acpi/acpica/hwgpe.c     |    3 +--
 drivers/acpi/acpica/utdelete.c  |    3 +--
 drivers/acpi/acpica/utprint.c   |    2 +-
 10 files changed, 12 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/drivers/acpi/acpica/dscontrol.c index 4b5b6e859f62..134d53380663 100644

drivers/acpi/acpica/dscontrol.c +1 -1
@@ -62,7 +62,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
                        }
                }
 
-               /*lint -fallthrough */
+               fallthrough;
 
        case AML_IF_OP:
                /*
(quoted diff) +0 -0

b/drivers/acpi/acpica/dswexec.c index 1d4f8c81028c..41f6cb61778a 100644

drivers/acpi/acpica/dswexec.c +1 -2
@@ -598,8 +598,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                                        break;
                                }
 
-                               /* Fall through */
-                               /*lint -fallthrough */
+                               fallthrough;
 
                        case AML_INT_EVAL_SUBTREE_OP:
 
(quoted diff) +0 -0

b/drivers/acpi/acpica/dswload.c index 27069325b6de..1d8789869dda 100644

drivers/acpi/acpica/dswload.c +1 -1
@@ -224,7 +224,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
                                break;
                        }
 
-                       /*lint -fallthrough */
+                       fallthrough;
 
                default:
 
(quoted diff) +0 -0

b/drivers/acpi/acpica/dswload2.c index edadbe146506..de367e8e4cf4 100644

drivers/acpi/acpica/dswload2.c +1 -3
@@ -213,9 +213,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
                             parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
                                break;
                        }
-
-                       /*lint -fallthrough */
-
+                       fallthrough;
                default:
 
                        /* All other types are an error */ diff --git 

a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index ade35ff1c7ba..677ba3ab1482 100644

drivers/acpi/acpica/exfldio.c +1 -1
@@ -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 */
+               fallthrough;
 
        case ACPI_TYPE_LOCAL_REGION_FIELD:
                /*
(quoted diff) +0 -0

b/drivers/acpi/acpica/exresop.c index 4d1b22971d58..7c8676adcf43 100644

drivers/acpi/acpica/exresop.c +2 -2
@@ -198,7 +198,7 @@ acpi_ex_resolve_operands(u16 opcode,
 
                                        target_op = AML_DEBUG_OP;
 
-                                       /*lint -fallthrough */
+                                       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 */
+                       fallthrough;
 
                case ARGI_REFERENCE:    /* References: */
                case ARGI_INTEGER_REF:
(quoted diff) +0 -0

b/drivers/acpi/acpica/exstore.c index 3adc0a29d890..fcf8dff56c5b 100644

drivers/acpi/acpica/exstore.c +2 -2
@@ -96,7 +96,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
                        return_ACPI_STATUS(AE_OK);
                }
 
-               /*lint -fallthrough */
+               fallthrough;
 
        default:
 
@@ -422,7 +422,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
                                break;
                        }
 
-                       /* Fallthrough */
+                       fallthrough;
 
                case ACPI_TYPE_DEVICE:
                case ACPI_TYPE_EVENT:
drivers/acpi/acpica/hwgpe.c +1 -2
index 49c46d4dd070..19d574f64c78 100644
@@ -95,8 +95,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
                if (!(register_bit & gpe_register_info->enable_mask)) {
                        return (AE_BAD_PARAMETER);
                }
-
-               /*lint -fallthrough */
+               fallthrough;
 
        case ACPI_GPE_ENABLE:
 
(quoted diff) +0 -0

b/drivers/acpi/acpica/utdelete.c index c365faf4e6cd..6db09eb9d257 100644

drivers/acpi/acpica/utdelete.c +1 -2
@@ -111,8 +111,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
                        (void)acpi_ev_delete_gpe_block(object->device.
                                                       gpe_block);
                }
-
-               /*lint -fallthrough */
+               fallthrough;
 
        case ACPI_TYPE_PROCESSOR:
        case ACPI_TYPE_THERMAL:
(quoted diff) +0 -0

b/drivers/acpi/acpica/utprint.c index 681c11f4af4e..f7e43baf5ff2 100644

drivers/acpi/acpica/utprint.c +1 -1
@@ -475,7 +475,7 @@ int vsnprintf(char *string, acpi_size size, const char *format, va_list args)
                case 'X':
 
                        type |= ACPI_FORMAT_UPPER;
-                       /* FALLTHROUGH */
+                       fallthrough;
 
                case 'x':
 
#3 lore raw

Hi,

This is a macro pseudo-keyword, which expands to /* fallthrough */ for compilers that don't support the attribute __fallthrough__. See:

include/linux/compiler_attributes.h:213:
213 #if __has_attribute(__fallthrough__)
214 # define fallthrough __attribute__((__fallthrough__))
215 #else
216 # define fallthrough do {} while (0) /* fallthrough */
217 #endif

So, any compiler (older or new) will be fine with it.

Thanks
--
Gustavo

Quoted 201 lines · Robert

It looks like this attribute is not supported by msvc 2017 (and perhaps other compilers) -- it is apparently a GCC extension -- meaning that it cannot be used in the ACPICA compiler-independent code.

Bob

-----Original Message-----
From: Rafael J. Wysocki <[email protected]>
Sent: Wednesday, July 08, 2020 3:59 AM
To: Gustavo A. R. Silva <[email protected]>
Cc: Moore, Robert <[email protected]>; Kaneda, Erik <[email protected]>; Wysocki, Rafael J <[email protected]>; Len Brown <[email protected]>; ACPI Devel Maling List <[email protected]>; open list:ACPI COMPONENT ARCHITECTURE (ACPICA) <[email protected]>; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH][next] ACPICA: Use fallthrough pseudo-keyword

Quoted 10 lines · Gustavo A. R. Silva

Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case.

[1]
https://www.kernel.org/doc/html/latest/process/deprecated.html?highlig
ht=fallthrough#implicit-switch-case-fall-through

I need to talk to Erik and Bob about this one.

Quoted 175 lines
---
 drivers/acpi/acpica/dscontrol.c |    2 +-
 drivers/acpi/acpica/dswexec.c   |    3 +--
 drivers/acpi/acpica/dswload.c   |    2 +-
 drivers/acpi/acpica/dswload2.c  |    4 +---
 drivers/acpi/acpica/exfldio.c   |    2 +-
 drivers/acpi/acpica/exresop.c   |    4 ++--
 drivers/acpi/acpica/exstore.c   |    4 ++--
 drivers/acpi/acpica/hwgpe.c     |    3 +--
 drivers/acpi/acpica/utdelete.c  |    3 +--
 drivers/acpi/acpica/utprint.c   |    2 +-
 10 files changed, 12 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/drivers/acpi/acpica/dscontrol.c index 4b5b6e859f62..134d53380663 100644

drivers/acpi/acpica/dscontrol.c +1 -1
@@ -62,7 +62,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
                        }
                }
 
-               /*lint -fallthrough */
+               fallthrough;
 
        case AML_IF_OP:
                /*
(quoted diff) +0 -0

b/drivers/acpi/acpica/dswexec.c index 1d4f8c81028c..41f6cb61778a 100644

drivers/acpi/acpica/dswexec.c +1 -2
@@ -598,8 +598,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                                        break;
                                }
 
-                               /* Fall through */
-                               /*lint -fallthrough */
+                               fallthrough;
 
                        case AML_INT_EVAL_SUBTREE_OP:
 
(quoted diff) +0 -0

b/drivers/acpi/acpica/dswload.c index 27069325b6de..1d8789869dda 100644

drivers/acpi/acpica/dswload.c +1 -1
@@ -224,7 +224,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
                                break;
                        }
 
-                       /*lint -fallthrough */
+                       fallthrough;
 
                default:
 
(quoted diff) +0 -0

b/drivers/acpi/acpica/dswload2.c index edadbe146506..de367e8e4cf4 100644

drivers/acpi/acpica/dswload2.c +1 -3
@@ -213,9 +213,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
                             parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
                                break;
                        }
-
-                       /*lint -fallthrough */
-
+                       fallthrough;
                default:
 
                        /* All other types are an error */ diff --git 

a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index ade35ff1c7ba..677ba3ab1482 100644

drivers/acpi/acpica/exfldio.c +1 -1
@@ -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 */
+               fallthrough;
 
        case ACPI_TYPE_LOCAL_REGION_FIELD:
                /*
(quoted diff) +0 -0

b/drivers/acpi/acpica/exresop.c index 4d1b22971d58..7c8676adcf43 100644

drivers/acpi/acpica/exresop.c +2 -2
@@ -198,7 +198,7 @@ acpi_ex_resolve_operands(u16 opcode,
 
                                        target_op = AML_DEBUG_OP;
 
-                                       /*lint -fallthrough */
+                                       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 */
+                       fallthrough;
 
                case ARGI_REFERENCE:    /* References: */
                case ARGI_INTEGER_REF:
(quoted diff) +0 -0

b/drivers/acpi/acpica/exstore.c index 3adc0a29d890..fcf8dff56c5b 100644

drivers/acpi/acpica/exstore.c +2 -2
@@ -96,7 +96,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
                        return_ACPI_STATUS(AE_OK);
                }
 
-               /*lint -fallthrough */
+               fallthrough;
 
        default:
 
@@ -422,7 +422,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
                                break;
                        }
 
-                       /* Fallthrough */
+                       fallthrough;
 
                case ACPI_TYPE_DEVICE:
                case ACPI_TYPE_EVENT:
drivers/acpi/acpica/hwgpe.c +1 -2
index 49c46d4dd070..19d574f64c78 100644
@@ -95,8 +95,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
                if (!(register_bit & gpe_register_info->enable_mask)) {
                        return (AE_BAD_PARAMETER);
                }
-
-               /*lint -fallthrough */
+               fallthrough;
 
        case ACPI_GPE_ENABLE:
 
(quoted diff) +0 -0

b/drivers/acpi/acpica/utdelete.c index c365faf4e6cd..6db09eb9d257 100644

drivers/acpi/acpica/utdelete.c +1 -2
@@ -111,8 +111,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
                        (void)acpi_ev_delete_gpe_block(object->device.
                                                       gpe_block);
                }
-
-               /*lint -fallthrough */
+               fallthrough;
 
        case ACPI_TYPE_PROCESSOR:
        case ACPI_TYPE_THERMAL:
(quoted diff) +0 -0

b/drivers/acpi/acpica/utprint.c index 681c11f4af4e..f7e43baf5ff2 100644

drivers/acpi/acpica/utprint.c +1 -1
@@ -475,7 +475,7 @@ int vsnprintf(char *string, acpi_size size, const char *format, va_list args)
                case 'X':
 
                        type |= ACPI_FORMAT_UPPER;
-                       /* FALLTHROUGH */
+                       fallthrough;
 
                case 'x':
 
#4 lore raw
Quoted 5 lines · Gustavo A. R. Silva

Hi,

This is a macro pseudo-keyword, which expands to /* fallthrough */ for compilers that don't support the attribute __fallthrough__. See:

Not really.

It expands to

	do {} while (0)

for compilers that do not support the __fallthrough__ attribute.

The /* fallthrough */ after that is for the human reader and is stripped before compilation.

Quoted 8 lines

include/linux/compiler_attributes.h:213:
213 #if __has_attribute(__fallthrough__)
214 # define fallthrough __attribute__((__fallthrough__))
215 #else
216 # define fallthrough do {} while (0) /* fallthrough */
217 #endif

So, any compiler (older or new) will be fine with it.

But old compilers should not emit warnings for these uses.

#5 lore raw

Yes, but:

include/linux/compiler_attributes.h

This file is linux-specific and cannot be used with ACPICA. Bob

-----Original Message-----
From: Joe Perches <joe(a)perches.com>
Sent: Monday, July 27, 2020 7:22 PM
To: Gustavo A. R. Silva <gustavo(a)embeddedor.com>; Moore, Robert <robert.moore(a)intel.com>; Rafael J. Wysocki <rafael(a)kernel.org>; Gustavo A. R. Silva <gustavoars(a)kernel.org>
Cc: Kaneda, Erik <erik.kaneda(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; Len Brown <lenb(a)kernel.org>; ACPI Devel Maling List <linux-acpi(a)vger.kernel.org>; open list:ACPI COMPONENT ARCHITECTURE (ACPICA) <devel(a)acpica.org>; Linux Kernel Mailing List <linux-kernel(a)vger.kernel.org>
Subject: Re: [PATCH][next] ACPICA: Use fallthrough pseudo-keyword

Quoted 5 lines · Gustavo A. R. Silva

Hi,

This is a macro pseudo-keyword, which expands to /* fallthrough */ for compilers that don't support the attribute __fallthrough__. See:

Not really.

It expands to

	do {} while (0)

for compilers that do not support the __fallthrough__ attribute.

The /* fallthrough */ after that is for the human reader and is stripped before compilation.

Quoted 8 lines

include/linux/compiler_attributes.h:213:
213 #if __has_attribute(__fallthrough__)
214 # define fallthrough __attribute__((__fallthrough__))
215 #else
216 # define fallthrough do {} while (0) /* fallthrough */
217 #endif

So, any compiler (older or new) will be fine with it.

But old compilers should not emit warnings for these uses.

#6 lore raw
In reply to Joe Perches

I'm afraid that the macro does not compile under MSVC:

warning C4067: unexpected tokens following preprocessor directive - expected a newline (compiling source file ..\..\source\tools\acpiexec\aetests.c)

It looks like "__has_attribute" is not supported.

-----Original Message-----
From: Joe Perches <[email protected]>
Sent: Monday, July 27, 2020 7:22 PM
To: Gustavo A. R. Silva <[email protected]>; Moore, Robert <[email protected]>; Rafael J. Wysocki <[email protected]>; Gustavo A. R. Silva <[email protected]>
Cc: Kaneda, Erik <[email protected]>; Wysocki, Rafael J <[email protected]>; Len Brown <[email protected]>; ACPI Devel Maling List <[email protected]>; open list:ACPI COMPONENT ARCHITECTURE (ACPICA) <[email protected]>; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH][next] ACPICA: Use fallthrough pseudo-keyword

Quoted 5 lines · Gustavo A. R. Silva

Hi,

This is a macro pseudo-keyword, which expands to /* fallthrough */ for compilers that don't support the attribute __fallthrough__. See:

Not really.

It expands to

	do {} while (0)

for compilers that do not support the __fallthrough__ attribute.

The /* fallthrough */ after that is for the human reader and is stripped before compilation.

Quoted 8 lines

include/linux/compiler_attributes.h:213:
213 #if __has_attribute(__fallthrough__)
214 # define fallthrough __attribute__((__fallthrough__))
215 #else
216 # define fallthrough do {} while (0) /* fallthrough */
217 #endif

So, any compiler (older or new) will be fine with it.

But old compilers should not emit warnings for these uses.

#7 lore raw
Quoted 5 lines · Robert

I'm afraid that the macro does not compile under MSVC:

warning C4067: unexpected tokens following preprocessor directive - expected a newline (compiling source file ..\..\source\tools\acpiexec\aetests.c)

It looks like "__has_attribute" is not supported.

It looks more like compiler.h/compiler_types.h/compiler_attributes.h doesn't support msvc.