Macro Information Record for Compiler Conflict Detection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Porting computer programs that use macros across different platforms is challenging due to complexities in macro expansion, debugging, and the unpredictability of macro definitions, leading to difficulties in maintaining a robust ecosystem for execution on various computing platforms.

Innovation Solution

A method for preprocessing macros in a computer program that involves identifying compile-time conditions, determining current and previous values, and storing macro information records to facilitate accurate analysis and debugging, enabling detection of macro conflicts and redefinition paths across source code files.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If macros are used in computer programs to enable platform portability, then the program can be used across multiple platforms, but the complexity of macro expansion and definition tracking increases significantly

Engineering Contradiction:
Improveplatform portabilityVSAvoidmacro expansion complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent introduces an intermediary data structure (macro information record) that mediates between the macro definitions and the compilation process. This record stores macro names, file locations, line numbers, and expansion states, serving as a intermediary layer that tracks macro usage without requiring complex analysis of the entire macro expansion process

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent performs preliminary actions by pre-processing the source code to identify and record all macro definitions, their locations, and their usage contexts before the actual compilation occurs. This preliminary macro information gathering enables the compiler to handle macro expansion more systematically

Inventive Principle:
Principle #10Preliminary action

2Productivity

If traditional macro preprocessing is used, then compilation can proceed, but debugging macro-related issues becomes unpredictable and difficult

Engineering Contradiction:
Improvecompilation speedVSAvoidmacro debugging difficulty
Core Design Contradiction:
ProductivityVSDifficulty of detecting and measuring

Solution Approach 1:

The patent applies a metaphorical 'coloring' approach by marking and annotating the macro information record with specific identifiers and states that indicate the expansion status, definition locations, and usage contexts of macros. This visual/metadata tagging system makes macro-related information detectable and measurable during debugging

Inventive Principle:
Principle #32Color changes

Solution Approach 2:

The patent implements feedback mechanisms by recording the actual expansion results of macros and making this information available for verification. The macro information record includes data about which macros were expanded, where they were defined, and what they expanded to, providing feedback that enables systematic debugging

Inventive Principle:
Principle #23Feedback

3Device complexity

If macro information is not tracked systematically, then compilation is simpler, but identification of enclosed instructions and conflict detection becomes impossible

Engineering Contradiction:
Improvepreprocessing complexityVSAvoidmacro analysis accuracy
Core Design Contradiction:
Device complexityVSMeasurement precision

Solution Approach 1:

The patent segments the macro information into distinct, organized components within the macro information record, including macro name, definition file, definition line, expansion file, expansion line, and expansion state. This segmentation allows systematic tracking of each aspect of macro usage independently

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS11947966B2Identifying computer instructions enclosed by macros and conflicting macros at build time
Publication Date: 2024.04.02 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11947966B2 patent drawing
  • US11947966B2 patent drawing
  • US11947966B2 patent drawing

AI summary

A computer-implemented method includes preprocessing, by a compiler, a plurality of macros in a computer program. Preprocessing a macro includes identifying a compile time condition associated with the macro. Preprocessing the macro further includes determining a current value of the compile time condition at the time of compiling a computer instruction and a previous value of the compile time condition. Preprocessing the macro further includes determining a set of computer instructions enclosed by the macro. The method further includes storing a macro information record that includes the compile time condition, the current value and the previous value of the compile time condition, and an identification of the set of computer instructions enclosed by the macro.