Update flexible array member ABI note to use new behavior flag
Flexible array member ABI warnings now correctly defer to the new behavior flag, simplifying diagnostics.
The compiler’s handling of flexible array members in structs has been refactored to improve ABI diagnostics. Previously, a function-local static flag controlled a warning about the ABI change (introduced in GCC 4.4). This patch moves the flexible array member check into a helper function and uses the psabi_new_behavior_p flag, deferring the note to inform_psabi_change. This eliminates redundant static flags and consolidates diagnostic reporting.
In Details
The i386 port's ABI reporting for structs with flexible array members, particularly concerning the change in GCC 4.4, has been streamlined. The classify_argument function previously used a warned static flag. This commit introduces flexible_array_p and leverages psabi_new_behavior_p(PSABI_FLEXIBLE_ARRAY_STRUCT) to conditionally ignore flexible array members based on the target's ABI behavior. The diagnostic is now emitted through the unified inform_psabi_change mechanism, removing the local static flag and centralizing the logic.
- flexible array member
- A C99 feature where the last element of a struct can be an array with zero elements, allowing the struct to be allocated with a variable amount of extra storage for that array.
- psABI
- Procedure Call Standard Application Binary Interface. A set of rules that define how functions are called, how parameters are passed, and how return values are handled at the machine code level for a specific architecture and operating system.
- struct
- A composite data type in C and C++ that groups together variables of potentially different types under a single name.
- ABI change
- A modification to the Application Binary Interface that can break binary compatibility with previously compiled code or libraries.
- i386
- The architecture for Intel 80386 and compatible 32-bit microprocessors.
- LP64
- A data model where pointers and long integers are 64 bits wide, and traditional integers are 32 bits wide. Common on 64-bit Unix-like systems.