Use positional_argument in callback_only attribute handler
Unified attribute diagnostics by using positional_argument and downgrading errors to warnings.
The handler for the callback_only attribute in GCC’s C-family frontends has been updated to use the positional_argument utility for bounds checking. This change harmonizes diagnostic reporting by downgrading attribute errors to warnings, aligning them with the behavior of positional_argument and improving diagnostic consistency for attribute usage.
In Details
The handle_callback_only_attribute function previously performed manual error reporting. By integrating calls to positional_argument, it now leverages that utility's bounds-checking and warning/error reporting mechanisms. The explicit choice to downgrade errors to warnings aligns the attribute's diagnostics with a common standard within the compiler, improving user experience.
- callback_only attribute
- A function attribute that, when applied, can enforce specific constraints on how a function is called, often related to its arguments or execution context.
- positional_argument
- A GCC utility function used for parsing and validating function arguments based on their position, often issuing warnings or errors for incorrect usage.