Compiler Unused Symbol Extraction via Attribute Warnings
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for identifying unused symbols in source code are inefficient, as they require separate functions to search for symbol definitions and references, making it difficult to implement an extraction function for unused symbols effectively.
Innovation Solution
A compiler is enhanced with a function that adds attribute information to symbols in the source code to output warnings about non-recommended usage, allowing for the identification of unused symbols by determining whether a warning is output during compilation, thereby facilitating the extraction of unused symbols without a separate routine.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If separate functions are used to search for symbol definitions and references, then comprehensive symbol analysis can be achieved, but the complexity of the system increases and efficiency decreases
Solution Approach 1:
The patent combines multiple separate functions (symbol definition search, reference search, and unused symbol extraction) into a single integrated compiler function. The compiler simultaneously performs all these operations during the normal compilation process, eliminating the need for separate analysis routines and reducing system complexity while maintaining comprehensive symbol analysis capability.
Solution Approach 2:
The compiler is enhanced with multi-functionality to perform not only its traditional compilation tasks but also symbol definition searching, reference searching, and unused symbol extraction. This universal approach allows a single system to handle multiple functions that were previously required separate dedicated tools.
2Measurement precision
If separate routines are implemented for extracting unused symbols, then thorough code analysis can be performed, but the time and effort required increases
Solution Approach 1:
The patent merges the unused symbol extraction process with the normal compilation process. The compiler performs symbol definition and reference tracking as part of its standard operation, and identifies unused symbols simultaneously without requiring a separate analysis pass, thereby eliminating additional time consumption.
Solution Approach 2:
The compiler performs preliminary tracking of symbol definitions and references during the compilation process itself, before the compilation is complete. This preliminary action allows unused symbols to be identified without requiring post-compilation analysis, saving time by doing the work in advance as part of the normal flow.
3Ease of operation
If attribute information is added to all symbols, then unused symbols can be identified through warning absence, but the amount of information to be processed increases
Solution Approach 1:
The patent extracts only the essential attribute information needed for unused symbol identification (definition status and reference status) from the full set of possible symbol attributes. By selecting and processing only these specific attributes, the system reduces the information quantity to be processed while maintaining the ease of identifying unused symbols through warning absence.
Data Source
AI summary
An apparatus adds attribute information that is used for outputting a warning that use of a symbol is non-recommended to the symbol that is included in a source code. The apparatus determines whether or not the warning corresponding to the attribute information is output for the symbol in compilation of the source code, determines that the symbol is an unused symbol which is not used in a process which is described in the source code in a case where the warning is not output, and outputs information of the unused symbol.


