THURSDAY, JULY 30, 2026
cobol
cobol: New warning for REDEFINES placement, defaults to error
Introduces a new warning for REDEFINES not being the first item in a data definition, which defaults to an error.
A new warning, -Wredefines-first, is introduced for the COBOL compiler to flag instances where the REDEFINES clause is not the first item within a data item’s definition. By default, this condition is treated as an error, but the new warning flag allows developers to downgrade it to a warning or suppress it entirely. The ‘-dialect mf’ option automatically suppresses this warning.
In Details
Adds the MfRedefinesFirst diagnostic and associated option handling. This allows users to control the severity of 'REDEFINES' not being the first item in a group item. The option is integrated into lang-specs.h and kobol.opt, respecting dialect settings.
For Context
- REDEFINES
- A COBOL clause used to specify that two or more data items occupy the same memory space. It allows different data structures to be overlaid onto the same storage.
- data item definition
- In COBOL, the specification of a variable or data structure, including its name, level number, type, size, and any special clauses like REDEFINES.
- dialect
- A specific version or conforming standard of the COBOL language that the compiler supports, such as IBM VS COBOL II or Micro Focus COBOL.