Cobol group attributes inheritance repaired.
Cobol group attributes now correctly inherit from FldGroup.
This commit corrects an issue in the Cobol compiler where group attributes were not being inherited properly. Specifically, the numeric_group_attrs function in symbols.cc was modified to ensure that group attributes correctly inherit only from FldGroup, resolving an inheritance bug and improving the accuracy of Cobol data type handling.
In Details
In GCC's Cobol frontend, handling of group items and their attributes involves inheritance mechanisms. The genapi.cc file gained an ease-of-debugging feature. More significantly, symbols.cc's numeric_group_attrs function was adjusted to refine its inheritance logic. Previously, it might have incorrectly inherited attributes from unintended parent types. The change restricts inheritance solely to FldGroup, ensuring that numeric attributes of group items are correctly determined based on their declared structure and avoiding potential misinterpretations of group properties.
- Group attributes
- In COBOL, a group item is a data structure that logically contains other elementary or group items. Group attributes refer to properties associated with these composite data structures, such as whether they are considered numeric.
- FldGroup
- Likely a type or structure within the GCC Cobol compiler's symbol table or abstract syntax tree representation, used to denote a group field or data structure.
- Inheritance
- In programming, the mechanism by which a new class (subclass or derived class) acquires the properties (methods and attributes) of an existing class (superclass or base class). In this context, it refers to how data type properties are passed down in the Cobol type hierarchy.
- Cobol
- A high-level programming language that is especially well-suited for business applications. It is known for its verbose syntax and strong data structuring capabilities.