Checking source code validity when updating code
The method preprocesses source code for a target platform to identify and manage macros, addressing inefficient debugging in large projects by accurately determining which macros are included in the executable, thus improving debugging efficiency and reducing development efforts.
Patent Information
- Application Number
- JP2024519110
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-10-11
- Filing Date
- 2022-10-07
- Publication Date
- 2025-11-26
- Estimated Expiration
- 2042-10-07
AI Technical Summary
Existing solutions for porting computer programs, particularly large enterprise-level projects, fail to accurately identify and manage macros, leading to inefficient debugging and development efforts due to unpredictable macro expansion and complex debugging environments.
A method and system that preprocess source code changes for a target computing platform, identifying compile-time conditions and generating macro information records to determine which macros are included in the executable file, reducing unnecessary analysis and improving debugging efficiency.
Facilitates efficient analysis and isolation of unnecessary code, reduces development efforts, and provides a user-friendly view of large-scale projects by marking sections based on macro validity, enhancing project delivery efficiency.
Smart Images

Figure 0007776247000001 
Figure 0007776247000002 
Figure 0007776247000003
Abstract
Description
[Technical Field]
[0001] The present invention relates generally to computer technology, and more particularly to checking the validity of computer instructions when updating computer program products, and more particularly to checking the validity of computer instructions that include or are encompassed by macros.
[0002] Porting a computer program from one platform or source to another is important to enable the computer program to be used on several platforms. For example, in the case of cloud computing platforms, some computer programs, such as open source programs, are available for use with specific features, such as container support. Porting such computer programs from one platform (e.g., cloud computing platform, mobile computing platform, operating system, etc.) to another platform facilitates the uninterrupted use of software that uses such computer programs.
[0003] Existing technical solutions for analyzing computer programs and debugging computer instructions do not anticipate the specific technical challenges that arise when updating large enterprise-level projects with source code changes that may not be used by a particular target computing platform. Although there are several existing solutions for porting source code from one platform to a target computing platform, there is a need to improve the ported code, and in particular to filter ported code that is specific to the target computing platform. Summary of the Invention
[0004] According to one or more embodiments of the present invention, a computer-implemented method includes receiving, by a processor, an updated version of a computer program including a plurality of source code changes. The method further includes preprocessing the source code changes with a compiler for a target computing platform, wherein preprocessing the source code changes with the compiler includes identifying compile-time conditions associated with one or more computer instructions encapsulated by a macro. Preprocessing the source code changes with the compiler further includes determining a current value of the compile-time condition at the time of compiling the updated version of the computer program for the target computing platform. Preprocessing the source code changes with the compiler further includes determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition. Preprocessing the source code changes with the compiler further includes storing a macro information record for the macro, the macro information record including the compile-time condition, the current value of the compile-time condition, and an identification of the one or more computer instructions. The method further includes preprocessing the source code changes with a linker for the target computing platform. Preprocessing the source code modifications with the linker includes determining that the object code corresponding to the one or more computer instructions is not included in an executable file, and updating the macro information record to indicate that the macro is not included in the executable file.
[0005] According to one or more embodiments of the present invention, a system includes a memory device and one or more processing units coupled to the memory device. The one or more processing units are configured to execute a method for analyzing an updated version of a computer program for a target computing platform. The method includes receiving, by a processor, an updated version of the computer program including a plurality of source code changes. The method further includes preprocessing, by a compiler for the target computing platform, the source code changes, wherein preprocessing, by the compiler, the source code changes includes identifying compile-time conditions associated with one or more computer instructions encapsulated by a macro. Preprocessing, by the compiler, the source code changes further includes determining current values of the compile-time conditions at the time of compiling the updated version of the computer program for the target computing platform. Preprocessing, by the compiler, the source code changes further includes determining object code corresponding to the one or more computer instructions based on the current values of the compile-time conditions. Preprocessing the source code changes with the compiler further includes storing a macro information record for the macro, the macro information record including the compile-time condition, the current value of the compile-time condition, and an identification of the one or more computer instructions. The method further includes preprocessing the source code changes with a linker for the target computing platform. Preprocessing the source code changes with the linker includes determining that the object code corresponding to the one or more computer instructions is not included in an executable file and updating the macro information record to indicate that the macro is not included in the executable file.
[0006] According to one or more embodiments of the present invention, a computer program product includes a computer-readable memory having computer-executable instructions stored thereon that, when executed by a processor, cause the processor to perform a method for analyzing an updated version of a computer program. The method includes receiving, by a processor, an updated version of a computer program including a plurality of source code changes. The method further includes preprocessing, by a compiler for a target computing platform, the source code changes including identifying compile-time conditions associated with one or more computer instructions encapsulated by a macro. Preprocessing, by a compiler, the source code changes further includes determining current values of the compile-time conditions at the time of compiling the updated version of the computer program for the target computing platform. Preprocessing, by a compiler, the source code changes further includes determining object code corresponding to the one or more computer instructions based on the current values of the compile-time conditions. Preprocessing the source code changes with the compiler further includes storing a macro information record for the macro, the macro information record including the compile-time condition, the current value of the compile-time condition, and an identification of the one or more computer instructions. The method further includes preprocessing the source code changes with a linker for the target computing platform. Preprocessing the source code changes with the linker includes determining that the object code corresponding to the one or more computer instructions is not included in an executable file and updating the macro information record to indicate that the macro is not included in the executable file.
[0007] According to one or more embodiments of the present invention, a method includes receiving, by a processor, a computer program including a plurality of source code files, each including one or more computer instructions. The method further includes generating macro information by preprocessing the computer program for a specific target computing platform with a compiler. Generating the macro information includes identifying compile-time conditions associated with one or more computer instructions encapsulated by a macro. Generating the macro information further includes determining current values of the compile-time conditions at the time of compiling the updated version of the computer program for the target computing platform. Generating the macro information further includes determining object code corresponding to the one or more computer instructions based on the current values of the compile-time conditions. Generating the macro information further includes storing a macro information record for the macro in the macro information, the macro information record including the compile-time condition, the current value of the compile-time condition, an identification of a location where the macro is defined, and an identification of a location where the macro is used. The method further includes processing the computer program together with the macro information with a linker. The linker processing step includes determining that the object code corresponding to the one or more computer instructions is not contained within an executable file, and updating the macro information record to indicate that the macro is not contained within the executable file.
[0008] A computer program product includes a computer-readable memory having computer-executable instructions stored thereon, the computer-executable instructions, when executed by a processor, causing the processor to perform a method for analyzing a computer program. The method includes receiving, by a processor, a computer program including a plurality of source code files, each including one or more computer instructions. The method further includes generating macro information by preprocessing, with a compiler, the computer program for a specific target computing platform. Generating the macro information includes identifying compile-time conditions associated with one or more computer instructions encapsulated by a macro. Generating the macro information further includes determining current values of the compile-time conditions at the time of compiling the updated version of the computer program for the target computing platform. Generating the macro information further includes determining object code corresponding to the one or more computer instructions based on the current values of the compile-time conditions. Generating the macro information further includes storing a macro information record for the macro in the macro information, the macro information record including the compile-time condition, the current value of the compile-time condition, an identification of a location where the macro is defined, and an identification of a location where the macro is used. The method further includes processing the computer program together with the macro information with a linker, the processing including determining that the object code corresponding to the one or more computer instructions is not contained within an executable file, and updating the macro information record to indicate that the macro is not contained within the executable file.
[0009] At least the above features may also be provided by a system, a computer program product, and a machine, among other types of implementations.
[0010] Embodiments of the present invention provide a technical solution for analyzing and isolating unnecessary files / functions / code in an efficient and improved manner compared to existing solutions when porting large-scale projects. Accordingly, embodiments of the present invention increase the efficiency of keeping large-scale projects up-to-date with upstream changes and branches, which may include code changes made in the open source community. One or more embodiments of the present invention facilitate finding whether code updates in upstream branches need to be included in the ported version. If not required for the target computing platform 130, the updates do not need to be analyzed and debugged. Furthermore, one or more embodiments of the present invention facilitate software development tool editors / user interfaces to provide a highly readable and more user-friendly view of large-scale enterprise projects by marking sections of computer programs based on the techniques described herein.
[0011] Additional technical features and advantages are realized through the techniques of the present invention. Embodiments and aspects of the present invention are described in detail herein and are considered a part of the claimed subject matter. For a better understanding, please refer to the detailed description and drawings. [Brief explanation of the drawings]
[0012] The particulars of the exclusive rights set forth herein are particularly pointed out and distinctly claimed in the claims at the conclusion of this specification. The foregoing and other features and advantages of embodiments of the present invention will become apparent from the following detailed description when read in conjunction with the accompanying drawings. [Figure 1] 1 illustrates a system 100 for verifying computer instructions encapsulated by a macro, in accordance with one or more embodiments of the present invention. [Figure 2A] (collectively, FIG. 2) illustrates an exemplary computer program 106 in accordance with one or more embodiments of the present invention. [Figure 2B] (collectively, FIG. 2) illustrates an exemplary computer program 106 in accordance with one or more embodiments of the present invention. [Figure 3A] (Collectively, FIG. 3) illustrates two versions of an exemplary source code file according to one or more embodiments of the present invention. [Figure 3B] (Collectively, FIG. 3) illustrates two versions of an exemplary source code file according to one or more embodiments of the present invention. [Figure 4] 1 illustrates an exemplary source code file in accordance with one or more embodiments of the present invention. [Figure 5A] (collectively, FIGS. 5A and 5B) illustrate an exemplary scenario of expanding a macro during debugging, in accordance with one or more embodiments of the present invention. [Figure 5B] (collectively, FIGS. 5A and 5B) illustrate an exemplary scenario of expanding a macro during debugging, in accordance with one or more embodiments of the present invention. [Figure 5C] (collectively, FIGS. 5A and 5B) illustrate an exemplary scenario of expanding a macro during debugging, in accordance with one or more embodiments of the present invention. [Figure 6] 1 illustrates an exemplary structure of a development tool in accordance with one or more embodiments of the present invention. [Figure 7] 1 illustrates a flowchart of a method for detecting macros in a computer program and identifying compile-time condition paths that may cause compilation and / or execution errors, according to one or more embodiments of the present invention. [Figure 8] 1 illustrates exemplary macro information in accordance with one or more embodiments of the present invention. [Figure 9] 1 illustrates a flowchart of a method for generating computer instructions for a macro 104 in accordance with one or more embodiments of the present invention. [Figure 10] 1 illustrates a flowchart of a method for operations performed to check for macro conflicts in accordance with one or more embodiments of the present invention. [Figure 11]1 illustrates a flowchart of a method for macro redefinition path support in accordance with one or more embodiments of the present invention. [Figure 12] 10 illustrates an exemplary output of a mapping of computer instructions and macro information in accordance with one or more embodiments of the present invention. [Figure 13] 1 illustrates exemplary macro information in accordance with one or more embodiments of the present invention. [Figure 14] 1 illustrates a flowchart of a method for generating computer instructions for a macro in accordance with one or more embodiments of the present invention. [Figure 15] 1 illustrates a flowchart of a method for updating macro inclusion data with information about the removal of unused functions from source code files or object files in accordance with one or more embodiments of the present invention. [Figure 16] 16 illustrates an example implementation of the method of FIG. 15 in an example scenario in accordance with one or more embodiments of the present invention. [Figure 17] 1 illustrates a flowchart of a method for isolating source code portions in accordance with one or more embodiments of the present invention. [Figure 18A] (Collectively, FIG. 18) illustrates an example of code isolation being performed using the method of FIG. 17, in accordance with one or more embodiments of the present invention. [Figure 18B] (Collectively, FIG. 18) illustrates an example of code isolation being performed using the method of FIG. 17, in accordance with one or more embodiments of the present invention. [Figure 18C] (Collectively, FIG. 18) illustrates an example of code isolation being performed using the method of FIG. 17, in accordance with one or more embodiments of the present invention. [Figure 18D] (Collectively, FIG. 18) illustrates an example of code isolation being performed using the method of FIG. 17, in accordance with one or more embodiments of the present invention. [Figure 19] 10 illustrates an exemplary output according to one or more embodiments of the present invention. [Figure 20] 10 illustrates another output according to one or more embodiments of the present invention. [Figure 21] 1 illustrates a cloud computing environment in accordance with one or more embodiments of the present invention. [Figure 22] 1 illustrates abstraction model layers in accordance with one or more embodiments of the present invention. [Figure 23] 1 illustrates a computing system in accordance with one or more embodiments of the present invention.
[0013] The drawings shown herein are exemplary. Many changes may be made to the drawings or the operations described therein without departing from the spirit of the invention. For example, operations may be performed in a different order, or operations may be added, deleted, or modified. Also, the term "coupled" and variations thereof describe having a communication path between two elements, and do not imply a direct connection between those elements with no intervening elements / connections. All of these variations are considered part of this specification.
[0014] In the accompanying drawings and the following detailed description of the disclosed embodiments, various elements shown in the figures are provided with two or three digit reference numerals. With few exceptions, the left-most digit(s) of each reference numeral corresponds to the figure in which the element is first shown. DETAILED DESCRIPTION OF THE INVENTION
[0015] Described herein are technical solutions for verifying computer instructions encapsulated by macros within a computer program when the computer program is updated (i.e., computer instructions are added / modified). In the case of computing platforms, a technical challenge is to maintain a robust ecosystem that enables the execution of computer programs that are available on other computing platforms, e.g., competitor platforms, open source platforms, etc. For example, a computer program may include libraries, tools, etc. that a computer software / hardware developer (“developer”) wants to execute as part of or support the computer program. To facilitate the execution of such computer programs, the computer program instructions (i.e., source code, code, executable instructions, etc.) of such computer programs need to be compiled for a particular computing platform.
[0016] Typically, a computer program contains one or more macros. In computer programs, a macro is a tool that allows developers to reuse instructions. A macro is generally a rule or pattern that specifies how a particular input should be mapped to an output. The input and output may be a series of lexical tokens or characters, or a syntax tree. In programming languages such as C / C++, macros are often used to contain computer program instructions that are compiled only if certain conditions are met. Using macros can make the source code of a computer program compact and avoid duplication efforts. However, using macros makes analyzing the source code technically difficult. Furthermore, using macros also makes debugging the source code technically difficult.
[0017] Checking whether computer instructions encapsulated by a macro are included in an object file (the result of compilation) (i.e., the macro is expanded) is a technical challenge. This is because, for example, a macro definition may be included in a file separate from the file that actually contains (or uses) the macro. Alternatively, or additionally, macro expansion may be overridden if the source code is compiled with specific runtime options (i.e., when a compiler is run to compile the source code). Furthermore, in enterprise-level projects, the source code may be complex and may include several (hundreds) of directories and (thousands) of files in different hierarchies. Determining a macro defined in one of these files and then used in another file may be an analysis challenge. Furthermore, there may be multiple different macros that have the same macro name but contain different instructions. This situation may be exacerbated due to hierarchy. For example, multiple files may contain respective macros with the same name, and a file, e.g., file F1, may contain two or more such macro definition files. Therefore, it may be difficult to predict which macro was expanded when file F1 was compiled.
[0018] As a result, the technical challenge of unpredictability of macro expansion makes debugging computer programs that contain macros technically difficult. Therefore, porting computer programs, such as open-source computer programs, to target computing platforms is technically difficult. Additionally, several tools, such as aclocal, autoconfig, automake, libtool (all libraries as part of the GNU PROJECT), the MESON build system, and the NINJA build system, can make macro configuration and root cause analysis / identification (i.e., debugging) more complicated.
[0019] For example, consider a computer program developed using the C programming language. It should be understood that the technical challenges described herein may not be limited to a particular programming language. In the case of C, making a software program portable can be difficult because C compilers vary from system to system. Alternatively, or additionally, certain library functions may be missing in some systems. Alternatively, or additionally, header files may have different names. To address such challenges with portability, programmers typically use conditional code, where code blocks are selected with preprocessor directives (#ifdef). For example, these preprocessor directives instruct a compiler to compile only certain portions of a computer program if the target system meets certain conditions, such as the availability of a library function. However, due to the wide variety of systems and build environments, this approach can become unmanageable and, therefore, technically challenging.
[0020] Certain existing tools, such as AUTOTOOLS®, are designed to address this problem in a more manageable way. For example, AUTOTOOLS® includes configuration tools such as autoheader, autoconf, and automake that are used to assume or generate intermediate files (e.g., configure.ac, Makefile.in, Makefile.am, aclocal.m4, etc.). Such tools (e.g., AUTOTOOLS®, LIBTOOLS®, etc.) analyze operating systems, compiler options, etc., and automatically collect and generate macro definitions or macro-conditional code. However, existing tools add several macros and preprocessor directories (i.e., compile-time conditions) for the various platforms / compilers they support, making code debugging more complicated. In addition, such tools handle some cross-platform support without the user's explicit knowledge, making it difficult for users to debug computer programs in the event of failure.
[0021] Additionally, current existing solutions may facilitate preprocessing, such as compiling with specific options (e.g., gcc with option "-E") to generate one intermediate file that expands all macros and incorporates all content from included files. However, generating such an intermediate file can take a long time (hours), especially for large projects (thousands of lines of code). Furthermore, such intermediate files are not easy to read. For example, one source code file with 303 lines may expand into an intermediate file with 7148 lines.
[0022] There are also tools available (such as VSCODE) that can analyze source code and identify whether a particular macro is defined in a file. Some existing tools may also change the visual representation of the computer instructions encapsulated by a macro, for example, by changing the font to a different color (e.g., gray), if the definition of the macro is not located in the same file as the file that uses it.
[0023] However, these methods are based on static analysis of the source code (i.e., they cannot resolve macro definitions in other files), and therefore the results are not accurate, especially in many scenarios. For example, macros that are defined in included files or overridden in compilation options are generally misidentified by such tools.
[0024] Furthermore, several open source software (i.e., computer programs) are currently available to support or enhance enterprise-level projects and / or platform functionality. For example, several open source tools exist that can help developers support cloud platform development, particularly for container support. Porting such open source tools from one platform to another is essential for platform development organizations to build robust ecosystems for their platforms. Such porting of open source tools that may be available on some platforms ("first platforms") to other platforms ("second platforms") (e.g., POWER®, AIX®, IBM Z®, etc.) can be a technical challenge. Without such porting, providing the functionality of the first platform on the second platform can be a technical challenge. For example, without such porting, a computer program executable on the first platform cannot be executable on the second platform. Alternatively, a developer may need to overcome a steep learning curve to enable a computer program executable on the first platform to be executable on the second platform.
[0025] Technical challenges faced (and particularly with open source computer programs) while making a computer program from a first platform compatible (i.e., executable) on a second platform include the removal of files / computer instructions that are not applicable with the second platform (i.e., the target platform). For example, some files that are part of the computer program may be specific to a particular platform or hardware and may not be applicable to the target platform. Additionally, the computer program may include one or more functions that are not required in a ported version of the computer program for the target platform.
[0026] Technical challenges further include keeping the ported version of the computer program up to date with upstream versions of the computer program from the open source community. For example, if there is a code change in a new version of the computer program, i.e., in the upstream branch of the computer program, the updated computer instructions need to be checked and therefore the ported version of the computer program for the target platform needs to be modified.
[0027] Embodiments of the present invention address such technical challenges: Instead of expending extensive corporate effort to code and test ported versions of an open source computer program for a target platform each time the computer program is updated, embodiments of the present invention determine whether updated code needs to be ported (e.g., whether such functionality already exists in the target platform) and, if porting is required, facilitate checking the validity of the source code for the target platform.
[0028] Accordingly, embodiments of the present invention are rooted in computing technology and provide improvements to computing technology, particularly computer software development. Embodiments of the present invention provide a practical application for checking the validity of updated computer instructions (i.e., source code) in a computer program being ported to a target platform. Accordingly, embodiments of the present invention reduce development efforts and improve project delivery efficiency. Embodiments of the present invention address the technical problem described herein by recording preprocessing information about code paragraphs (e.g., included macros) according to compile-time conditional definitions or compilation options. These records facilitate analyzing / debugging computer instructions to check whether the code paragraphs have been compiled into an object file. Linkers also add information to the records to check whether the compiled code has been linked into an executable or library file. Because these records are generated based on compilation / linking options instead of static source code analysis of the computer program, embodiments of the present invention provide dynamic results for checking the validity of computer programs, particularly updates to computer programs.
[0029] Embodiments of the present invention provide technical solutions to address such technical challenges with improvements over existing tools. Embodiments of the present invention are rooted in computing technology, particularly in identifying computer program instructions within computer programs (i.e., source code). Furthermore, embodiments of the present invention are rooted in computing technology because computing technology improves debugging of computer programs (i.e., source code) that contain macros. Embodiments of the present invention provide practical applications for identifying macros and debugging computer programs that contain macros. Without embodiments of the present invention, such analysis, especially for large enterprise projects, may be impractical or may cause significant delays in development, debugging, testing, and release.
[0030] Embodiments of the present invention facilitate the processing of computer programs during compilation and linking of the computer programs. Preprocessing information about computer instructions encapsulated by macros is recorded according to macro definitions or compilation options. These records further facilitate analyzing / debugging computer programs to check whether the computer instructions were compiled into an object file (the result of compilation). Because embodiments of the present invention generate records based on compilation options instead of static source code analysis, dynamic compilation or linking results are provided.
[0031] FIG. 1 illustrates a system 100 for verifying computer instructions encapsulated by a macro, according to one or more embodiments. The illustrated system 100 includes a computer program 106 that is compiled by a compiler 110 to generate a corresponding object file 120. The computer program 106 may be written for a different computing platform and may be ported for execution on a target computing platform 130. The compiler 110 may be part of a development tool 112, such as an integrated development environment (IDE). The development tool 112 may also include a linker 115 that generates an executable file 125 based on the object file 120. The executable file 125 executes on the target computing platform 130. It will be appreciated that in one or more examples, the executable file 125 may include multiple files. In one or more embodiments of the invention, the compiler 110 generates the object file 120 specific to the target computing platform 130. Alternatively, or additionally, in one or more embodiments of the invention, the linker 115 generates the executable file 125 specific to the target computing platform 130. It should be noted that while a compiler and linker may be separate tools, separate runtime instructions, "compiling" or "building" a computer program 106, as used herein, may include compiling, linking, and any other operations that may be necessary to convert the computer instructions in the computer program 106 into machine instructions executable by the target computing platform 130. Generating such machine-executable instructions in an executable file 125 from a computer program 106 is not practically human-readable, e.g., as a mental process.
[0032] The target computing platform 130 may be a cloud computing platform architecture, an operating system, a processor architecture, or any other type of computing platform to which the computer program 106 is ported. In other words, the computer program 106 may not have been developed (written) specifically for the target computing platform 130. Compiling and linking by the development tools 112 facilitates execution of the computer program 106 on the target computing platform 130. Alternatively, or additionally, the development tools 112 improve the execution efficiency of the computer program 106 when running on the target computing platform 130.
[0033] Computer program 106 may include multiple source code files, including, but not limited to, source code file 102 ("file" 102) and source code file 103 (file 103). In some embodiments of the invention, computer program 106 may be open source. It is understood that computer program 106 may include several (hundreds, thousands) of source code files, only two of which are shown here. Each of the source code files (102, 103) may include several, e.g., hundreds, thousands, etc., of computer instructions (lines of code). In one or more embodiments of the invention, the source code files of computer program 106 are organized in a hierarchical manner, for example, using a directory structure (not shown).
[0034] One or more of the source code files in the computer program 106 use macros 104. For example, source code file 102 includes several macros 104. Each of the illustrated macros 104 may be an instance of a different macro. Alternatively, or additionally, a macro 104 may be associated with a conditional expansion. The conditional expansion may depend on one or more configurations of the compiler 110 that a user (e.g., a developer) may adjust before running the compiler 110. Alternatively, or additionally, the conditional expansion may depend on one or more environmental settings of the computing platform 130 (e.g., operating system-level variables, hardware type, etc.). Alternatively, or additionally, the conditional expansion may depend on runtime options that a user provides when running the development tool 112 (i.e., compiler and linker). In other embodiments of the present invention, other dependencies of conditional expansion may be used. In one or more embodiments of the present invention, the macros 104 used in file 102 may be defined in file 102 itself or in any other file (e.g., file 103) in the computer program 106.
[0035] The development tool 112 includes a user interface used to interact with the source code files 102, 103. A user can navigate the directory structure and perform operations with the source code files of the computer program 106, such as add, delete, copy, paste, move, edit, etc. The user interface displays the computer instructions of the computer program using one or more contextual visual attributes. For example, different types of computer instruction content (e.g., conditional statements, function calls, variables, keywords, macros, etc.) may be displayed using different colors, different fonts, or other such visual attributes. The visual representation of the computer instructions may be adjusted by the development tool 112 based on the results of various features of one or more embodiments of the present invention.
[0036] 2A and 2B illustrate an exemplary computer program 106 according to one or more embodiments. Two versions of the computer program 106 are shown: a first version 242 and a second version 244. In some examples, the first version 242 may be a current version, and the second version 244 may be a previous version. The computer program 106 includes several files (102, 103) organized within a directory structure 212.
[0037] The comparison result 220 of the two versions 242, 244 indicates the number of identical files, the number of different files, the number of similar files, and the number of orphan files in each version. Here, "same files" include files in the two versions 242, 244 where no changes have been detected. "Similar files" include files in which changes from the first version 242 to the second version 244 are less than a predetermined amount. For example, the number of lines with changes is less than a predetermined number of lines (e.g., 10 lines) or less than a predetermined percentage (e.g., 2% changes). While "changed lines" is used as the metric in the above example, it is understood that other metrics, such as "changed characters" or "changed functions," can be used in other examples. If the changes exceed such a predetermined threshold, the file is considered to be in the "different files" category. An "orphan file" is a file that exists in one version but not the other. An orphan file may exist in the first version 242 (if that file does not exist in the second version 244); similarly, the second version 244 may have an orphan file (second file) (if that (second) file may not exist in the first version 242).
[0038] 3A and 3B illustrate two versions of an exemplary source code file 104 in accordance with one or more embodiments of the present invention. A first version 242 of the source code file 104 includes updated computer instructions 245 (highlighted). The updated computer instructions 245 may not be directed to the target computing platform 130. For example, the updated computer instructions 245 may not be compiled by the compiler 110, depending on compile-time conditions (specific to the computing platform 130) that may be associated with the updated computer instructions 245. Alternatively, or additionally, in some examples, the object code (120) corresponding to the updated computer instructions 245 may not be linked by the linker 115 if a determination is made that the object code will not be executable by the computing platform 130.
[0039] FIG. 4 illustrates an exemplary source code file according to one or more embodiments of the present invention. Portions of source code file 102 are shown in two columns in FIG. 4; however, in some development tools, source code file 102 may be rendered as a single column (i.e., boxes shown on the right side of FIG. 4 may be in the same column as boxes shown on the left side of FIG. 4). The illustrated file 102 includes several macros 104. Note that not all macros in file 102 are marked in FIG. 4, and in other examples, file 102 may include a different number of macros than shown. Additionally, the lines of code shown in FIG. 4 may vary in other examples.
[0040] One or more of the macros 104 are conditional. A dynamic compile-time condition 202 is associated with such a conditional macro such that the computer instructions in the conditional macro 104 are compiled (i.e., converted into object 120 code) only if the associated compile-time condition 202 is satisfied. If the compile-time condition 202 is not satisfied, the computer instructions in the conditional macro 104 are not included in the object 120. The compile-time condition 202 may indicate the combined type of hardware and software of the target computing platform 130. For example, the compile-time condition 202 may indicate that the macro 104 should be expanded only if the platform uses a particular operating system, such as LINUX®, AIX®, INTERIX®, Z / OS®, etc. Alternatively, or additionally, the compile-time condition 202 may indicate that the macro 104 should be expanded only if one or more other source code files (e.g., header files) are included. In some examples, the expanded macro 104 may itself be the inclusion of additional source code files, such as libraries, application program interfaces, etc. Alternatively, or additionally, the expanded macro 104 may "implement" a particular type of hardware or software component, where "implementing" includes gaining access to the component before registering it for use, e.g., recognizing, reading, and processing file system structures, storage media, etc. In one or more embodiments of the present invention, several additional or alternative operations may be performed by the computer instructions encapsulated within the macro 104.
[0041] 5A, 5B, and 5C illustrate an exemplary macro expansion scenario during debugging, according to one or more embodiments of the present invention. In the illustrated scenario, macros TARG 104A, PRO 104B, and MYDEF 104C are used. Consider that the computer instructions in "ac" lines 9-11 of file 302 should be compiled because compile-time condition 202A of macro MYDEF 104C is defined in runtime command 320 to initiate compiler 110 to compile files 302, 304, 306, 308, and 310 into preprocessed file 312. Here, the desired result is that compile-time condition 202A is satisfied and all corresponding macros are expanded. In the example of FIGS. 5A, 5B, and 5C, command 320 causes compiler 110 to execute IDE 112 to export the expanded macros and included file (e.g., a.h 306) information to preprocessed file a.p 312. Preprocessed file 312 is later used to generate object code 120. However, the result of compilation is not as expected due to section 314. The reason is that macro MYDEF104C is not defined in "bh" line 2 of file 308. Compile-time conditions 202B and 202C cause subsequent expansion of computer instructions in object code 120 (rather than the desired compile-time condition 202A). The exemplary scenario here illustrates a scenario with very few lines of code; however, in larger projects involving thousands of lines of code, it can be appreciated that determining such root causes of failures when porting computer programs is a technical challenge.
[0042] Embodiments of the present invention provide a technical solution that facilitates detection of computer instructions contained within macros 104 and further identification of the root cause of conflicts between contained and uncontained macros. Alternatively, or additionally, embodiments of the present invention can identify macro redefinition paths across several source code files 102, 103 in a computer program 106 at the time of compilation. Alternatively, or additionally, one or more embodiments of the present invention facilitate representing (e.g., by highlighting, marking, etc.) portions (e.g., lines of code) of the computer program 106 compiled into an object file 120, the conflicting macros 104, and the macro redefinition paths in a development tool 112. In one or more embodiments of the present invention, one or more portions of the computer program 106, such as macros 104, are annotated with predetermined annotations, such as, for example, MacroEnclosed, CurrentMacroValue, Preprocesstype, EarlierAssignedMacroValue, etc. In one or more embodiments of the invention, a predetermined set of variables, such as MacroEnclosed, CurrentMacroValue, Preprocesstype, EarlierAssignedMacroValue, etc., are assigned values. The assigned values are used to facilitate representing the computer program 106 in a more readable manner. Additionally, these values are used to facilitate a user performing root cause analysis in the event of an error.
[0043] Additionally, in one or more embodiments of the present invention, a preprocessor collects, identifies, and generates records of computer instructions that are (and are not) contained within macros 104. Additionally, the compiler 110 supports macro definition conflicts by comparing compile-time conditions 202, MacroEnclosed and CurrentMacroValue, to identify the impact on the corresponding macro 104. The compiler (and / or linker) 110 supports macro redefinition passes across source code files 102, 103 by locating macro inclusion records with MacroEnclosed "ON" and runtime options (e.g., Preprocesstype "D") to compare AssignedMacroValue and EarlierAssignedMacroValue across different files. Thus, one or more embodiments of the present invention facilitate analyzing and identifying the root causes of macro conflicts that may (or may not) cause computer instructions to be compiled into object 120 files, as well as providing macro redefinition warnings across several source code files.
[0044] An embodiment of the present invention can achieve such a technical solution by generating intermediate files 312 at compile time of the computer program 106. However, this information is not sufficient to guide the developer and to identify which parts of the computer program 106 should be debugged (or analyzed) and which parts can be ignored in the updated version (242). For large enterprise-scale computer programs (millions of lines of code), such information can improve (reduce) development time and effort by an order of magnitude.
[0045] For example, in the illustrated scenario of FIG. 5A , lines 19-20 in file ac (302) are compiled, but the corresponding information is not covered in intermediate file ap (312). Therefore, based only on intermediate file 312, a developer may choose not to debug file ac (302), which may be an error. In addition, in the illustrated scenario, function “func_cc” in file “cc” (310) is not linked or used, but a corresponding macro inclusion record exists in intermediate file ap (312). Here, additional resources were consumed in capturing information about computer instructions that are not in executable file 125. The embodiments of the present invention address such technical solutions and, therefore, can save time and resources, providing practical applications for improving technical challenges underlying computer program development and porting.
[0046] 6 illustrates an exemplary structure of a development tool according to one or more embodiments of the present invention. The development tool 112 facilitates identifying macros 104, compile-time conditions 202, values of compile-time conditions 202, updating a user interface, debugging a computer program 106, and various other features of the technical solutions described herein. The architecture of the system 400 includes a debugger 402 that receives a command to initiate the identification of macros within the computer program 106. The command may be provided via a command line, a setting configuration, or any other user interaction by a user.
[0047] The development tool 112 also includes a macro preprocessor 410 that generates macro information 412 by analyzing the source code files of the computer program 106. The macro information 412 may include compile-time conditions 202, current values of the compile-time conditions, assigned compile-time condition values, macro names, preprocessor types, referenced macro names, etc. The preprocessor type "S" indicates the source code range encompassed by the macro; while "D" indicates the definition of the macro. In other embodiments of the invention, other preprocessor types may be specified. The ReferredMacroName specifies the macro name used in the macro condition during preprocessing. It is understood that the format of the command 320 may be changed in other embodiments of the invention.
[0048] The development tools 112 also include an editor 404, e.g., a graphical user interface (GUI), that facilitates viewing and / or editing file names, computer instructions within a file, line numbers of computer instructions, macro names, compile-time conditions 202, attributes of compile-time conditions 202 (e.g., type of value (e.g., integer, character, time, binary, etc.), condition to check, threshold to check, etc.), visual attributes (e.g., color, highlight, font size, font type, etc.), etc.
[0049] Additionally, development tool 112 includes compiler 110 and linker 115 that convert computer program 106 into object code 120 and machine-executable instructions for target computing platform 130. In one or more embodiments of the invention, development tool 112 is a computing system separate from computing platform 130. Alternatively, development tool 112 is part of computing platform 130, e.g., software that executes on computing platform 130. In other cases, computing platform 130 may be considered development tool 112.
[0050] 7 illustrates a flowchart of a method for detecting macros in a computer program and identifying paths for compile-time conditions that may cause compilation and / or execution errors, according to one or more embodiments of the present invention. The method 500 may be performed by the development tool 112. The method 500 includes, at block 502, receiving a command for detecting macros and compile-time conditions at the time of compiling the computer program 106. For example, the option "-p" in the compilation command 320 "gcc-DTARG-c ac-p" triggers the compiler 110 to begin detection and generate macro information 412 for the computer program 106. Alternatively, or additionally, the trigger may be based on an environment variable associated with the development tool 112 or the operating system of the computing platform 130.
[0051] In block 504, in response to receiving the command, the macro preprocessor 410 parses the computer program 106 to generate macro information 412. The macro information 412 can identify FileName, MacroEnclosed, LineNoStart / LineNoEnd, Preprocesstype, MacroName, AssignedMacroValue, EarlierAssignedMacroValue, SpecificMacroType, ReferredMacroName, CurrentMacroValue, etc. FileName indicates the name of the file 102, 103 that uses the macro 104. MacroEnclosed indicates whether the macro 104 has a compile-time condition 202 associated with it. LineNoStart indicates the starting line number in the file 102, 103 where the computer instructions for the macro 104 begin. LineNoEnd indicates the ending line number for the macro 104. Preprocesstype indicates the action associated with the compile-time condition 202. MacroName indicates a name associated with the macro 104 and is typically provided by the developer. AssignedMacroValue indicates the value assigned to the compile-time condition 202. SpecificMacroType indicates the type of the compile-time condition 202 and / or macro 104. ReferredMacroName indicates another macro 104 that may be referenced by the macro 104 being parsed. CurrentMacroValue indicates the current value of the compile-time condition 202, which may be different from the previously assigned value.
[0052] Such information may be identified through syntactic and semantic analysis of the computer instructions in the source code files 102, 103 of the computer program 106. In some examples, the command may specify a particular subset of the source code files 102, 103 to be analyzed to generate the macro information 412.
[0053] FIG. 5B illustrates an exemplary scenario for detecting macro information 412 in accordance with one or more embodiments of the present invention. In FIG. 5B, macro information 412 is generated for exemplary files 302, 304, and 306 based on a received command 320. It is understood that macro information 412 may be stored in a format different from that shown in FIG. 5B. As shown, macro information 412 is parsed to indicate the location of compile-time conditions 202 in source code files 302, 306, and 308. Furthermore, values assigned to compile-time conditions 202 based on the received command or based on the source code are identified. Additionally, if applicable, previous compile-time conditions 202 (in the hierarchy) are also identified, and values assigned to the previous compile-time conditions 202 are also indicated. For example, for file “ah” 302, compile-time condition 202 PRO is defined when previous compile-time condition 202 TARG is set to 1 (in the command line).
[0054] In some embodiments of the present invention, the generated macro information 412 is stored in memory. Alternatively, or additionally, the macro information 412 is stored in a file. For example, a file for storing the macro information 412<program name> In some embodiments of the present invention, the file name for storing the macro information 412 may be specified in the command for triggering preprocessing.
[0055] FIG. 8 illustrates exemplary macro information 412 in accordance with one or more embodiments of the present invention. The illustrated macro information 412 is the result of the macro processor 412 analyzing the computer program 106 illustrated in FIGS. 5A-5C. As illustrated elsewhere, FileName indicates the name of the file that uses the macro 104, e.g., "ac." MacroEnclosed "ON" indicates that the computer instructions expanded / extracted after preprocessing are encompassed by the compile-time condition 202. MacroEnclosed "OFF" indicates that the computer instructions are not encompassed by the compile-time condition 202. LineNoStart and LineNoEnd indicate the start and end line numbers, respectively, of the computer instructions encompassed by the macro 104. Preprocesstype "S" indicates the source code range encompassed by the macro, while "D" indicates the definition of the macro. MacroName is the name of the defined macro 104. AssignedMacroValue is the value assigned to the compile-time condition 202 when the compiler 110 is triggered. EarlierAssignedMacroValue is the value assigned to a compile-time condition 202 triggered by a previous compile-time condition 202 definition. SpecificMacroType "T" indicates whether the compile-time condition 202 is associated with the target computing platform 130, e.g., _MVS_ for ZOS®, AIX for AIX®. SpecificMacroType "P" indicates whether the macro 104 is associated with the target computing platform 130. ReferredMacroName provides the reference name of the compile-time condition 202 used in computing the compile-time condition 202 during preprocessing. CurrentMacroValue is the current value of the compile-time condition 202 at the corresponding condition check during preprocessing.
[0056] It should be noted that the above provided examples of various parameters in macro information 412 are not exhaustive and that these parameters may have other values assigned in one or more embodiments of the present invention.
[0057] Referring to the flowchart of method 500, at block 506, compiler 110 compiles computer instructions, which includes generating source code for macro 104 according to compile-time conditions encompassing the macro. Figure 9 shows a flowchart of a method 800 for generating computer instructions for macro 104, according to one or more embodiments of the present invention. For purposes of illustration, the description herein includes a walkthrough of example macro MYDEF 104 from Figure 5A (lines 8-18 in file "ac" 302).
[0058] Referring to the flowchart of method 800, at 802, the compiler 110 checks whether macro detection is enabled (block 502). If macro detection is triggered at block 804, the compiler 110 scans the computer program 106 with the macro preprocessor 410 (block 806); otherwise, the compiler proceeds (block 808) with typical macro processing according to existing solutions.
[0059] For each computer instruction, the compiler 110 checks in block 810 whether the current computer instruction is a definition of a compile-time condition 202. If the current computer instruction is a definition of a compile-time condition 202 (e.g., "#undef MYDEF"), the compiler 110 assigns flag "D" to Preprocesstype in block 812. If instead the computer instruction is a condition of a compile-time condition 202 (e.g., "ac" lines 14-17), the compiler 110 assigns flag "S" to Preprocesstype in block 814. Further, in this case (flag S), in block 816, the macro name, current value, and type are displayed from the computer instruction. Further, in block 810, if there is a computer instruction enclosed within the compile-time condition 202, MacroEnclosed is set to "ON" (e.g., "ac" lines 14-19), otherwise it is set to "OFF" (e.g., "ac" lines 9-12). In one or more embodiments of the invention, macro information parameters including SpecificMacroType, ReferredMacroName, and CurrentMacroValue are also recorded at this time.
[0060] If a definition of a compile-time condition 202 is encountered (flag D), the compiler 110 checks in block 818 whether the compile-time condition 202 (e.g., "MYDEF") has been previously defined. The check is performed by looking up the macro name through existing information in macro information 412. If the compile-time condition 202 has been previously defined, the compiler 110 in block 820 looks up and retrieves the last value assigned to the compile-time condition 202 (e.g., "1" in the illustrative example of MYDEF; 1 is passed by compiling the command option "-DMYDEF"). The retrieved value is recorded in EarlierAssignedMacroValue.
[0061] The compiler 110 also collects metadata associated with the macro 104, such as file name, line number (start, end), etc., at block 822. At block 824, the captured information is stored in a macro information 412 structure (e.g., a separate file, a database, memory, etc.).
[0062] The compiler 110 repeats this process for each computer instruction in the computer program 106, and for at least each macro 104 in the computer program. Once all of the macros 104 have been processed in this manner and the macro information 412 has been captured, the compiler 110 continues, in block 830, expanding the macros 104 and compiling the computer instructions in the computer program 106 as it normally would.
[0063] Continuing with the flowchart of method 500, at block 508, macro conflicts are checked in the expanded source code by compiler 110. FIG. 10 shows a flowchart of a method 900 for operations performed to check for macro conflicts in accordance with one or more embodiments of the present invention. For illustrative purposes, the description herein includes a walkthrough of the example macro MYDEF 104 from FIG. 5A (lines 8-18 in file "ac" 302). In this example, the definition of macro "MYDEF" is passed as part of the compilation command. Consider that all computer instructions that meet the conditions containing "MYDEF" being defined are expanded in object file 120, but the computer instructions at lines 9-10 of file "ac" 302 are not expanded and therefore not compiled.
[0064] Conflict checking facilitates identification of the root cause of conflicts between included macros 104, which, as in this case, are not due to conflicting compile-time conditions 202. In blocks 902, 904, the compiler 110 selects a macro to be checked and checks it for a particular macro type (i.e., the macro type is "T" (target) or set by the user). In this example, "MYDEF" is the selected macro to check. In block 906, if the type of the macro 104 is not a predetermined type (e.g., "T"), then conflict checking need not be performed.
[0065] If the macro 104 is of a predetermined type, the compiler 110 searches the macro information 412 for the ReferredMacroName (e.g., MYDEF) in block 908. In the example file "ac" 302, two records are identified (lines 8-12 and lines 12-16, both of which use MYDEF in a compile-time condition 202).
[0066] In blocks 910 and 912, the next macro information 412 is read and the current value of the compile-time condition 202 associated with the macro 104 is checked against the current value. If the compile-time condition 202 is satisfied, the next record is checked for a conflict in the same manner (repeat block 910). Alternatively, if the compile-time condition 202 has an ambiguous evaluation (e.g., a value that toggles between 1 and 0), the compiler 110 indicates the record in the macro information 412 as a potential conflict in block 914.
[0067] Further, at block 916, development tool 112 notifies the user of the potential conflict. The notification may be a pop-up window, a message, or any other type of electronic notification. Further, at block 918, within development tool 112, the computer instructions associated with macro 104 are marked. Marking may be performed by highlighting the computer instructions, for example, by changing one or more of a foreground color, a background color, a font, etc. Alternatively, or additionally, marking may include changing borders, annotations, etc. associated with the computer instructions of macro 104. Method 900 is repeated for any additional records of macro 104 (block 910).
[0068] Additionally, the development tool also marks computer instructions associated with other compile-time conditions 202 that trigger conflicts (e.g., the compile-time condition "PRO=0" affects "MYDEF"). Other compile-time conditions 202 that interact with the macro 104 being checked can be identified from the macro information 412 record of the macro 104. For example, the macro information 412 can be searched to obtain the definition of the other compile-time condition 202 (e.g., "PRO").
[0069] In one or more examples, a user can specify, for example via a start command, one or more target macros 104 to be checked for conflicts. Alternatively, or additionally, all distinct macros 104 are checked for conflicts in this manner.
[0070] Referring to the flowchart of method 500, once the conflicting macros are highlighted, in block 510, the development tool provides support for macro redefinition paths. Figure 11 shows a flowchart of a method 1000 for macro redefinition path support in accordance with one or more embodiments of the present invention. For illustrative purposes, the description herein includes a walkthrough of the example macro MYDEF 104 from Figure 5A (lines 8-18 in file "ac" 302).
[0071] At block 1002, the method 1000 includes initiating path change detection for a macro 104, where the macro is defined in one file and used in one or more other files in the computer program 106. Further, at block 1004, a macro path check option of the linker 115 is checked. If the macro path check option is not turned on, for example, via the start command (block 502), an environment variable, or any other setting that the linker 115 can check, path change detection is terminated at block 1006. Alternatively, if the setting is turned on, at block 1008, a record from the macro information 412 is read for further analysis.
[0072] This analysis involves checking at least four conditions: whether MacroEnclosed is ON (1010); whether Preprocesstype=D (1012); whether EarlierAssignedMacroValue exists (1014); and whether the new compile-time condition value is equal to the previous compile-time condition value (1016). Based on the outcome of each of these condition checks, in block 1018 the record may be deemed to require a redefinition pass (i.e., where a compile-time condition is set and used). This process is repeated for all records in macro information 412.
[0073] In the example scenario underway, the value "1" of the macro "MYDEF" is passed from the option "-DMYDEF" in the compile command. Considering that a path check is performed, records from the file "ap" / "bp" are read. If the value of MacroEnclosed is "ON" (1010), then "bh" line 2 is read; otherwise, "bh" lines 5-6 are read. Furthermore, if the value of Preprocesstype is "D" (1012), then one set of computer instructions is used (i.e., "bh" line 2); otherwise, a second set of computer instructions is used (i.e., "bh" lines 2-3). Next, if an EarlierAssignedMacroValue exists (i.e., PRO exists for every "bh" line 2), then (1012); otherwise, the other option needs to be executed (i.e., "bh" line 5). Additionally, if the new value of the compile-time condition 202 is equal to the earlier macro value (1016), then the compile-time condition 202 value (i.e., "bc" line 3) is used; otherwise, if the values do not match, the record is marked for a macro redefinition pass.
[0074] In addition to detecting and using the macro information 412 described above, one or more embodiments of the present invention facilitate updating source code (including identifying compiled and linked source code) in large-scale (enterprise) projects with support for multi-level and cross-compilation-unit isolation. To this end, in addition to the information described above, the compiler 110 detects and provides the StatementCompiledValid state of each macro 104 (see FIG. 6). The macro preprocessor 410 provides the information to the linker 115, which may further add information about ObjectLinkedValid and FuncSectionLinkedValid to the macro information 412 based on checking whether the object file 120 and function are linked into the executable file 125. The flags added to the macro information 412 along with the macro's identity (e.g., name) are used to isolate compiled portions of the computer program 106 and link them hierarchically to the executable file 125.
[0075] Thus, in combination with the linker 115, the macro preprocessor 410 can generate macro information 412 at build time that can facilitate detection of portions of source code in the computing program 102 that are neither compiled nor linked into an executable file 125 or library file (or that are compiled and linked into an executable file 125 or library file). The detection can further be used to update the user interface to guide the user to focus (i.e., analyze, edit, debug, etc.) on portions of the computer program 106 that are compiled and validly linked. Thus, embodiments of the present invention reduce development effort and improve project delivery efficiency.
[0076] The improvement is based on generating macro information 412 using a macro preprocessor, and further enhancing the macro information 412 using a linker 115 to preprocess the source code file 106 to determine, for each macro 104, status values representing ObjectLinkedValid, FuncSectionLinkedValid, and StatementCompiledValid. ObjectLinkedValid represents link invalidity when an object file is not linked into the executable file 125. FuncSectionLinkedValid represents whether the linking of a function in the computer program 106 is invalid when an (unused) function section is removed from the computer program 106. Using such information, the development tool 112 analyzes and removes computer instructions, such as objects and function sections, that are not part of the executable file 125, and then updates the macro information 412, in particular the status of ObjectLinkedValid and FuncSectionLinkedValid. If a computer instruction not encompassed by a compile-time condition 202 is compiled into the object file 120, the compiler 110 marks the flag StatementCompiledValid with compilation validity.
[0077] In some embodiments of the present invention, development tool 112 includes a source code isolation module 420 that determines link validity of portions of object file 120 based on the value of flag “ObjectLinkedValid” from macro information 412. If the value is invalid (e.g., “OFF”), source code isolation module 420 skips all macro information records for the object file. Otherwise, source code isolation module 420 continues to determine validity of linked function sections and indicates validity based on the value of flag “FuncSectionLinkedValid.” For example, if the value is invalid (e.g., “OFF”), source code isolation module 420 skips macro inclusion records for function sections. Otherwise, source code isolation module 420 continues to determine validity of source code segment compilation and indicates validity using flag “StatementCompiledValid.” If the value is valid (e.g., “ON”), source code isolation module 420 inserts the record into a valid source section. Otherwise, source code isolation module 420 continues to determine validity of macros and indicates validity using flag “MacroEnclosed.” If the value is valid (e.g., "ON"), the source code isolation module 420 inserts the record into a valid source section. In one or more embodiments of the invention, the editor and user interface 404 can highlight the record in a valid source code section.
[0078] 12 illustrates a mapping of computer instructions and macro information 412 in accordance with one or more embodiments of the present invention. It is understood that a particular example scenario using files from FIGS. 5A, 5B, and 5C is shown, and that the macro information 412 may differ in other embodiments of the present invention. In some embodiments of this information, the macro information 412 with additional flag values based on the linker 115 is generated in response to a command 320 specifying that such information be generated. For example, the command 320 includes a parameter "p" and the name of the source code file 106 to be processed in this manner to generate the macro information 412.
[0079] 13 illustrates exemplary macro information 412 according to one or more embodiments of the present invention. The macro information 412 in FIG. 13 includes three macro inclusion fields: ObjectLinkedValid, FuncSectionLinkedValid, and StatementCompiledValid, which are generated when the development tool 112 uses the macro preprocessor 410 and linker 115 to generate an intermediate file 312 (e.g., "ap") that includes macro information 412 associated with the source code file 106. In addition to the macro information 412 shown in the other example (where linker information was not included), the macro information 412 in this case includes ObjectLinkedValid, which has a value of "ON" if the object (in object file 120) corresponding to the macro 104 is to be linked into the executable file 125; otherwise, it has a value of "OFF." The value of FuncSectionLinkedValid is set to "ON" if the function contained by the macro 104 is to be linked into the executable file 125; otherwise, it is set to "OFF." Furthermore, The value of StatementCompiledValid is set to "ON" if the computer instructions contained in macro 104 are compiled into object file 120; otherwise, it is set to "OFF." Still further, in one or more embodiments of the present invention, the MacroEnclosed flag is set to "ON" for macro 104 if the computer instructions of macro 104 are contained by compile-time conditions 202 that become active after preprocessing; otherwise, it is set to "OFF." It is understood that in other embodiments, "ON" and "OFF" may be substituted with other values.
[0080] Figure 14 shows a flowchart of a method 1400 for generating computer instructions for a macro 104 in accordance with one or more embodiments of the present invention. For illustrative purposes, the description herein includes a walkthrough of the example macro MYDEF 104 from Figures 5A, 5B, and 5C (lines 8-18 in file "ac" 302). The compiler 110 checks 1402 whether macro detection is enabled (block 502). If macro detection is triggered in block 1404, the compiler 110 (block 1406) scans the computer program 106 with the macro preprocessor 410; otherwise, the compiler 110 (block 1408) proceeds with typical macro processing according to existing solutions.
[0081] At each computer instruction, the compiler 110 checks in block 1410 whether the current computer instruction is a definition of a compile-time condition 202. If the current computer instruction is a definition of a compile-time condition 202 (e.g., "#undef MYDEF"), the compiler 110 assigns a flag "D" to Preprocesstype in block 1412. If the computer instruction is instead a condition of a compile-time condition 202 (e.g., "ac" lines 14-17), the development tool 112 checks in block 1413 whether the value of the compile-time condition 202 is ON. In other words, it is checked whether the value of the compile-time condition 202 facilitates compilation of the enclosed macro 104.
[0082] If the compile-time condition 202 exists and is ON, the compiler 110 assigns a flag "S" to Preprocesstype in block 1414. Further, in this case (flag S), the macro name, current value, and type are indicated from the computer instruction in block 1416. If the compile-time condition 202 exists and is OFF, the StatementCompiledValid flag is set to "ON" in block 1415.
[0083] Further, in block 1410, if there are computer instructions contained within the compile-time condition 202, MacroEnclosed is set to "ON" (e.g., "ac" lines 14-19), otherwise it is set to "OFF" (e.g., "ac" lines 9-12). In one or more embodiments of the invention, macro information parameters including SpecificMacroType, ReferredMacroName, and CurrentMacroValue are also recorded at this time.
[0084] If a definition of a compile-time condition 202 is encountered (flag D), the compiler 110 checks in block 1418 whether the compile-time condition 202 (e.g., "MYDEF") has been previously defined. The check is performed by looking up the macro name through existing information in macro information 412. If the compile-time condition 202 has been previously defined, the development tool 112 in block 1420 looks up and retrieves the last value assigned to the compile-time condition 202 (e.g., "1" in the illustrative example of MYDEF; 1 is passed by compiling the command option "-DMYDEF"). The retrieved value is recorded in EarlierAssignedMacroValue.
[0085] The development tool 112 also collects metadata associated with the macro 104, such as file name, line number (start, end), etc., at block 1422. At block 1424, the captured information is stored in a macro information 412 structure (e.g., a separate file, a database, memory, etc.).
[0086] The development tool 112 repeats this process for each computer instruction in the computer program 106, and for at least each macro 104 in the computer program. Once all of the macros 104 have been processed in this manner and the macro information 412 has been captured, the development tool 112 continues, in block 1430, expanding the macros 104 and compiling and linking the computer instructions in the computer program 106 as it normally would.
[0087] Figure 15 shows a flowchart of a method for updating macro inclusion data with information about the removal of unused functions (i.e., sections) from source code files or object files in accordance with one or more embodiments of the present invention. Figure 16 shows an example implementation of method 1500 from Figure 15 in an example scenario. Linker 115 is triggered to determine part of macro information 412 by parameters specified in input command 320.
[0088] The development tool 112 determines whether the MacroEnclosed flag is ON at 1502 and 1504. If the flag is OFF, then linker information is not added to the macro information 412. Otherwise, if MacroEnclosed is ON, then at block 1506, an object from the object file 120 is parsed. The object corresponds to computer instructions contained within a macro 104 based on compile-time conditions 202. The compile-time conditions 202 that contain the macro may be specified / defined in the command 320 (e.g., MYDEF).
[0089] In block 1508, the linker 115 determines whether the identified object was included in the executable file 125 or whether it was removed before generating the executable file 125. Here, the "object" may be the source code file 106, for example, "cc." If the object was removed, in block 1510, the development tool iterates through all records (in the macro information 412) of that object (which have the same condition, i.e., MacroEnclosed=ON) and removes the object. For each of these records, the development tool 112 sets ObjectLinkedValid=OFF in block 1512. For example, in the scenario of FIG. 16, the file "cc" is not linked and is therefore an object that is unused and removed by the linker 115. Therefore, ObjectLinkedValid of all records in the macro information 412 corresponding to that file is marked as "OFF" (marked as "1" in FIG. 16).
[0090] Alternatively, if the object was not removed (1508), the development tool 112 parses and reads the function section in block 1514. Here, a function section is a set of computer instructions specified as a “function” in a computing programming language. The development tool 112 determines in block 1516 whether the function section is unused and whether it is to be removed before generating the executable file 125. For example, a function section may be unused and removed if the function is never used in the rest of the computer program 106. Alternatively, or additionally, a function section may be unused and removed if the entire function is contained within a compile-time condition 202 that is not ON at compile time. Alternatively, or additionally, the function may be removed because computer instructions within the function are contained within a compile-time condition 202 that is not ON, and therefore, during optimization, the linker removes the function. In the example of FIG. 16, the function func_ee() is removed due to such optimization. There may be some other reason why a function is unused and therefore removed before the generation of the executable file 125.
[0091] If the function is unused and will be removed, the development tool 112 traverses the macro information 412 in block 1518 to identify other records / entries with MacroEnclosed=ON that correspond to that function. For each of these entries, FuncSectionLinkedValid is set to OFF in block 1520. In the example of FIG. 16, func_ee() is removed by the linker 115 during optimization, so next all MacroEnclosed records for the function section are identified, and for each of them, the field "FuncSectionLinkedValid" is assigned "OFF" as shown (see "2" indicating processing computer instructions from source code file "dc" 1602).
[0092] As described, method 1500 is complete when all objects and functions in object file 120 have been analyzed and macro information 412 has been updated. In this manner, the development tool can add / update entries / records to macro information 412 and further use the records / entries in macro information 412 to identify portions of computer program 106 that are not included in executable file 125.
[0093] 17 illustrates a flowchart of a method 1700 for isolating a source code portion in accordance with one or more embodiments of the present invention. The development tool 112 traverses the macro information 412 in block 1702 and reads the next record / entry to be processed. If the record satisfies all three conditions: ObjectLinkedValid=ON, FuncSectionLinkedValid=ON, and StatementCompiledValid=ON, the record is marked as a valid code section, i.e., the section of computer instructions is compiled, linked, and included in the executable file 125 (blocks 1704, 1706, 1708, and 1712). Alternatively, if ObjectLinkedValid=ON, FuncSectionLinkedValid=ON, StatementCompiledValid=OFF, and MacroEnclosed=OFF, the record is marked as a valid code section (blocks 1704, 1706, 1708, 1710, and 1712). Marking may include adding a flag to each record indicating validity / invalidity. Alternatively, or additionally, the marking may include moving records to a section of macro information 412, where all records in that section are considered to be associated with valid computer instructions, where "valid" indicates that the computer instructions in a computer program have been compiled, linked, and included in executable file 125; whereas, "invalid" computer instructions do not result in machine-executable code being included in executable file 125.
[0094] If ObjectLinkedValid=OFF for a record in the macro information, the file name associated with that record is assigned as InvalidObjFile at blocks 1704, 1714. All records in the macro information 412 associated with the same file name are skipped from further processing at blocks 1716, 1718. In some embodiments, records associated with the same file name are marked invalid.
[0095] In this manner, the method 1700 can isolate records in the macro information 412 that correspond to valid computer instructions.
[0096] 18A, 18B, 18C, and 18D illustrate an example of code isolation being performed using a method 1700 according to one or more embodiments of the present invention. An exemplary scenario is shown in which intermediate files 312 containing macro information 412 are generated for various source code files 106. Records of various sections within the source code files 106 are identified with arrows and numbers. As can be seen, once a file "cc" is identified as an InvalidObjFile, all records associated with that file are considered invalid (see "1"). If FuncSectionLinkedValid=OFF is found in a record, the development tool 112 continues with the next record. Alternatively, if FuncSectionLinkedValid=ON and StatementCompiledValid=ON is found in a record, the record is considered valid (see "3"). Alternatively, if StatementCompiledValid=OFF and MacroEnclosed=ON, the record is considered invalid (see "4").
[0097] Embodiments of the present invention provide a technical solution for analyzing / isolating unnecessary files / functions in an efficient and improved manner compared to existing solutions when porting large-scale projects. Accordingly, embodiments of the present invention increase the efficiency of keeping large-scale projects up-to-date with upstream changes and branches, which may include code changes made in the open source community. One or more embodiments of the present invention facilitate finding whether code updates in upstream branches need to be included in the ported version. If not required for the target computing platform 130, the updates do not need to be analyzed and debugged. Furthermore, one or more embodiments of the present invention facilitate software development tool editors / user interfaces to provide a highly readable and more user-friendly view of large-scale enterprise projects by marking sections of computer programs based on the techniques described herein.
[0098] Additionally, the technical solutions described herein provide practical applications for supporting source code macro analysis by identifying and using macro information, including determining MacroEnclosed, CurrentMacroValue, Preprocesstype, and EarlierAssignedMacroValue, among other parameters, as part of the record for each macro and its compile-time conditions. In one or more embodiments of the present invention, a preprocessor collects and generates macro information records for all macros in a computer program and identifies included or unincluded computer instructions based on the macro definitions. A compiler and / or linker analyzes the macro information to detect macro definition conflicts by comparing the MacroEnclosed status and CurrentMacroValue of user-specified or default-specified type macros. These tools then search the records in the macro information to determine the corresponding definitions of the macros that cause the possible impact. Furthermore, a linker supports macro redefinition passes across multiple compilation units (e.g., files) by locating records of macro information with the MacroEnclosed status and Preprocesstype values and determining valid redefinitions after comparing the AssignedMacroValue and EarlierAssignedMacroValue.
[0099] The technical solutions described herein provide improvements in computing technology, particularly debugging. In one or more embodiments of the present invention, the technical solutions herein facilitate analyzing / resolving the root cause of macro conflicts that cause one or more computer instructions not to be compiled into an object file as expected and providing macro redefinition warnings across multiple compilation units (e.g., files). The technical solutions herein also increase the efficiency of root cause identification using macro information. The technical solutions herein also improve macro redefinition identification for developers, particularly for large enterprise open source projects with complex macro usage. The technical solutions facilitate editors / GUIs to provide a readable and more user-friendly view of macros and compile-time conditions that cause conflicts during compilation.
[0100] The technical solutions described herein may be or may be part of compilers and IDEs such as ECLIPSE®, VISUAL STUDIO®, etc. Although examples herein are described using specific computer programming languages, it is understood that the technical solutions herein are not limited to any specific computer programming language.
[0101] FIG. 19 illustrates an exemplary output according to one or more embodiments of the present invention. In response to a command to preprocess a computer program, a file "ac" is analyzed to generate macro information (step 1). The macro information is read by a highlighting / marking editor for one or more computer instructions within the computer program (steps 2 and 3). FIG. 20 illustrates another output according to one or more embodiments of the present invention, in which a file "ah" is preprocessed in response to a command to generate macro information. The macro information is used to display a pop-up with a notification to the user. Alternatively, or additionally, during user interaction with the computer program, or even with a different file, computer instructions that become part of the object code are marked, for example, with a mouse-over or other such user interaction. The user interfaces in FIGS. 19 and 20 also illustrate code sections that are not included within executable file 125 using an embodiment of the present invention (e.g., method 1700).
[0102] Although this disclosure includes detailed descriptions of cloud computing, it is understood that implementation of the teachings described herein is not limited to cloud computing environments. Rather, embodiments of the present invention can be implemented in conjunction with any other type of computing environment now known or later developed.
[0103] Cloud computing is a model of service delivery for enabling convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, network bandwidth, servers, processing, memory, storage, applications, virtual machines, and services) that can be rapidly provisioned and released with minimal administrative effort or interaction with a service provider. The cloud model can include at least five characteristics, at least three service models, and at least four deployment models.
[0104] Characteristics include: On-Demand Self-Service: Cloud consumers can unilaterally provision computing capacity, such as server time and network storage, automatically as needed, without requiring human interaction with the service provider. Wide Network Access: Capacity is available over the network and accessed through standard mechanisms that facilitate use by heterogeneous thin or thick client platforms (e.g., cell phones, laptops, and PDAs). Resource Pooling: Providers' computing resources are pooled to serve multiple consumers using a multi-tenant model, with various physical and virtual resources dynamically allocated and reallocated in line with demand. Consumers generally have no control or knowledge over the exact location of the resources provided, although there is some location independence in that it may be possible to specify location at a higher level of abstraction (e.g., country, state, or data center). Rapid Scalability: Capacity is provisioned quickly and elastically, sometimes automatically, and can be quickly scaled out or quickly released and quickly scaled in. To consumers, the capacity available for provisioning often appears unlimited and can be purchased in any quantity at any time. Metering Services: Cloud systems automatically control and optimize resource usage by leveraging metering capabilities appropriate to the type of service (e.g., storage, processing, bandwidth, and active user accounts) at a certain level of abstraction. Resource utilization can be monitored, controlled, and reported, providing transparency to both providers and consumers of the services used.
[0105] The service models are as follows: Software as a Service (SaaS): The consumer is offered the ability to use a provider's applications running on a cloud infrastructure. The applications are accessible from a variety of client devices through a thin-client interface, such as a web browser (e.g., web-based email). The consumer does not manage or control the underlying cloud infrastructure, including the network, servers, operating systems, storage, or even individual application capabilities, with the possible exception of limited user-specific application configuration settings. Platform as a Service (PaaS): The consumer is offered the ability to deploy consumer-created or acquired applications, written using programming languages and tools supported by the provider, on the cloud infrastructure. The consumer does not manage or control the underlying cloud infrastructure, including the network, servers, operating systems, or storage, but controls the deployed applications and, in some cases, the configuration of the application-hosting environment. Infrastructure as a Service (IaaS): The consumer is offered the ability to provision processing, storage, network, and other basic computing resources onto which the consumer can deploy and run any software, which may include operating systems and applications. Consumers do not manage or control the underlying cloud infrastructure, but they do control the operating system, storage, deployed applications, and in some cases, limited control over selected networking components (e.g., host firewalls).
[0106] Deployment models include: Private Cloud: The cloud infrastructure is operated exclusively for an organization. It may be managed by the organization or a third party and may reside on- or off-premises. Community Cloud: The cloud infrastructure is shared by multiple organizations to support a specific community with shared concerns (e.g., mission, security requirements, policies, and regulatory compliance considerations). The community cloud may be managed by those organizations or a third party and may reside on- or off-premises. Public Cloud: The cloud infrastructure is made available to the general public or large industry associations and is owned by an organization that sells cloud services. Hybrid Cloud: This cloud infrastructure is a composite of two or more clouds (private, community, or public) that remain unique entities but are bound together by standardized or proprietary technologies that enable data and application portability (e.g., cloud bursting for load balancing between clouds).
[0107] Cloud computing environments are service-oriented, focusing on statelessness, low coupling, modularity, and semantic interoperability. At the core of cloud computing is an infrastructure that includes a network of interconnected nodes.
[0108] Referring now to FIG. 21 , an exemplary cloud computing environment 50 is shown. As shown, the cloud computing environment 50 includes one or more cloud computing nodes 10 with which local computing devices used by cloud consumers (e.g., a personal digital assistant (PDA) or mobile phone 54A, a desktop computer 54B, a laptop computer 54C, and / or an automobile computer system 54N, etc.) may communicate. The nodes 10 may communicate with each other. They may be physically or virtually grouped (not shown) into one or more networks, such as a private cloud, community cloud, public cloud, or hybrid cloud, or combinations thereof, as described hereinabove. This enables the cloud computing environment 50 to provide infrastructure, platform, and / or software as a service for which cloud consumers are not required to maintain resources on their local computing devices. It should be understood that the types of computing devices 54A-54N illustrated in FIG. 21 are intended to be exemplary only, and that the computing nodes 10 and the cloud computing environment 50 can communicate with any type of computerized device through any type of network and / or network-addressable connection (e.g., using a web browser).
[0109] Referring now to Figure 22, there is shown a set of functional abstraction layers provided by cloud computing environment 50 (Figure 21). It should be understood in advance that the components, layers, and functions shown in Figure 22 are intended to be exemplary only, and embodiments of the present invention are not limited thereto. As shown, the following layers and corresponding functions are provided:
[0110] Hardware and software layer 60 includes hardware and software components. Examples of hardware components include mainframe 61; RISC (reduced instruction set computer) architecture-based server 62; server 63; blade server 64; storage device 65; and network and networking components 66. In some embodiments, software components include network application server software 67 and database software 68.
[0111] The virtualization layer 70 provides an abstraction layer in which the following examples of virtual entities may be provided: virtual servers 71; virtual storage 72; virtual networks, including virtual private networks 73; virtual applications and operating systems 74; and virtual clients 75.
[0112] In one example, management layer 80 may provide the functions described below. Resource provisioning 81 provides dynamic procurement of computing and other resources utilized to execute tasks within the cloud computing environment. Metering and pricing 82 provides cost tracking as resources are utilized within the cloud computing environment and accounting or billing for the consumption of these resources. In one example, these resources may include application software licenses. Security provides identity verification for cloud consumers and tasks and protection of data and other resources. User portal 83 provides consumers and system administrators with access to the cloud computing environment. Service level management 84 provides cloud computing resource allocation and management so that required service levels are met. Service level agreement (SLA) planning and fulfillment 85 provides advance arrangements and procurement of cloud computing resources where future requirements are anticipated according to SLAs.
[0113] The workload tier 90 provides examples of functions for which a cloud computing environment may be utilized. Examples of workloads and functions that may be provided from this tier include mapping and navigation 91; software development and lifecycle management 92; virtual classroom instructional delivery 93; data analytics processing 94; transaction processing 95; and computer program processing and analysis 96.
[0114] Referring now to FIG. 23 , a computer system 2300 according to an embodiment is generally illustrated. The computer system 2300 may be an electronic computer framework comprising and / or using any number and combination of computing devices and networks utilizing various communication technologies, as described herein. The computer system 2300 may be easily scalable, extensible, modular, and have the ability to change to different services or reconfigure some features independently of other features. The computer system 2300 may be, for example, a server, a desktop computer, a laptop computer, a tablet computer, or a smartphone. In some examples, the computer system 2300 may be a cloud computing node. Computer system 2300 may be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc. that perform particular tasks or implement particular abstract data types. Computer system 2300 may be practiced in distributed cloud computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computer system storage media, including memory storage devices.
[0115] As shown in FIG. 23, computer system 2300 has one or more central processing units (CPUs) 2301a, 2301b, 2301c, etc. (collectively or generally referred to as processor 2301). Processor 2301 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. Processor 2301, also referred to as a processing circuit, is coupled to system memory 2303 and various other components via a system bus 2302. System memory 2303 may include read-only memory (ROM) 2304 and random access memory (RAM) 2305. ROM 2304 is coupled to system bus 2302 and may include a basic input / output system (BIOS) that controls certain basic functions of computer system 2300. RAM is read-write memory coupled to system bus 2302 for use by processor 2301. System memory 2303 provides temporary memory space for the execution of the instructions described above during operation. The system memory 2303 may include random access memory (RAM), read-only memory, flash memory, or any other suitable memory system.
[0116] Computer system 2300 includes an input / output (I / O) adapter 2306 and a communications adapter 2307 coupled to a system bus 2302. I / O adapter 2306 may be a small computer system interface (SCSI) adapter and / or any other similar component that communicates with a hard disk 2308. I / O adapter 2306 and hard disk 2308 are collectively referred to herein as mass storage 2310.
[0117] Software 2311 for execution on computer system 2300 may be stored on mass storage 2310. Mass storage 2310 is an example of a tangible storage medium readable by processor 2301 and storing software 2311 as instructions for execution by processor 2301 to cause computer system 2300 to perform operations such as those described herein below with respect to various figures. Examples of computer program products and the execution of such instructions are described in more detail herein. Communications adapter 2307 interconnects system bus 2302 with network 2312, which may be an external network, enabling computer system 2300 to communicate with other such systems. In one embodiment, portions of system memory 2303 and mass storage 2310 collectively store an operating system, which may be any suitable operating system, such as IBM Corporation's z / OS or AIX operating systems, to coordinate the functioning of the various components shown in FIG. 23 .
[0118] Additional input / output devices are shown connected to the system bus 2302 via a display adapter 2315 and an interface adapter 2316. In one embodiment, adapters 2306, 2307, 2315, and 2316 may be connected to one or more I / O buses that are connected to the system bus 2302 via an intermediate bus bridge (not shown). A display 2319 (e.g., a screen or display monitor) is connected to the system bus 2302 by a display adapter 2315, which may include a graphics controller for improving performance of graphics-intensive applications and a video controller. A keyboard 2321, mouse 2322, speakers 2323, etc. may be interconnected to the system bus 2302 via an interface adapter 2316, which may include, for example, a super I / O chip that integrates multiple device adapters into a single integrated circuit. Suitable I / O buses for connecting peripheral devices such as hard disk controllers, network adapters, and graphics adapters typically include common protocols such as Peripheral Component Interconnect (PCI). Thus, as configured in FIG. 23, computer system 2300 includes processing capability in the form of processor 2301, storage capability including system memory 2303 and mass storage 2310, input means such as keyboard 2321 and mouse 2322, and output capability including speakers 2323 and display 2319.
[0119] In some embodiments, communications adapter 2307 may transmit data using any suitable interface or protocol, such as an Internet Small Computer System Interface, among others. Network 2312 may be a cellular network, a wireless network, a wide area network (WAN), a local area network (LAN), or the Internet, among others. External computing devices may be connected to computer system 2300 through network 2312. In some examples, the external computing device may be an external web server or a cloud computing node.
[0120] It should be understood that the block diagram of Figure 23 is not intended to indicate that computer system 2300 includes all of the components shown in Figure 23. Rather, computer system 2300 may include any suitable fewer or additional components (e.g., additional memory components, embedded controllers, modules, additional network interfaces, etc.) not shown in Figure 23. Furthermore, the embodiments described herein with respect to computer system 2300 may be implemented using any suitable logic, and logic as referred to herein may, in various embodiments, include any suitable hardware (e.g., a processor, embedded controller, or application specific integrated circuit, among others), software (e.g., an application, among others), firmware, or any suitable combination of hardware, software, and firmware.
[0121] The present invention may be a system, method and / or computer program product at any possible level of technical detail integration. The computer program product may include a computer-readable storage medium (or multiple computer-readable storage media) having computer-readable program instructions for causing a processor to perform aspects of the present invention.
[0122] A computer-readable storage medium may be a tangible device that can hold and store instructions for use by an instruction execution device. The computer-readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of computer-readable storage media includes portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD), memory stick, floppy disk, mechanically encoded devices such as punch cards or ridge-in-groove structures with recorded instructions, and any suitable combination of the foregoing. Computer-readable storage media, as used herein, should not be construed as signals that are ephemeral in nature, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., light pulses passing through a fiber optic cable), or electrical signals transmitted through wires.
[0123] The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to each computing / processing device or to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network may include copper transmission cables, optical transmission fiber, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage on a computer-readable storage medium within the respective computing / processing device.
[0124] The computer-readable program instructions for carrying out the operations of the present invention may be either assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, configuration data for integrated circuits, or source or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk® or C++, and procedural programming languages such as the “C” programming language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be to an external computer (e.g., through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA) may execute computer-readable program instructions by utilizing state information of the computer-readable program instructions to personalize the electronic circuitry to perform aspects of the present invention.
[0125] Aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0126] These computer-readable program instructions may be provided to a processor of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, executed by the computer's processor or other programmable data processing apparatus, create means for implementing the functions / acts specified in one or more blocks of the flowcharts and / or block diagrams. These computer-readable program instructions may be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and / or other device to function in a particular manner, such that the computer-readable storage medium on which the instructions are stored comprises an article of manufacture containing instructions that implement aspects of the functions / acts specified in one or more blocks of the flowcharts and / or block diagrams.
[0127] The computer-readable program instructions may be loaded into a computer, other programmable data processing apparatus, or other device to cause the computer, other programmable apparatus, or other device to perform a series of operational steps to create a computer-implemented process, such that the instructions executing on the computer, other programmable apparatus, or other device implement the functions / acts specified in one or more blocks of the flowcharts and / or block diagrams.
[0128] The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowcharts or block diagrams may represent a module, segment, or portion of instructions, including one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may actually be executed substantially concurrently, or in some cases, the blocks may be executed in the reverse order, depending on the functionality involved. It should also be noted that each block in the block diagrams and / or flowchart diagrams, and combinations of blocks in the block diagrams and / or flowchart diagrams, may be implemented by a dedicated hardware-based system that performs the specified functions or operations or executes a combination of dedicated hardware and computer instructions.
[0129] The description of various embodiments of the present invention is presented for illustrative purposes, but is not intended to be exhaustive or limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein has been selected to best explain the principles of the embodiments, practical applications of or technical improvements to the technology found in the market, or to enable others skilled in the art to understand the embodiments described herein. (Other possible items) (Item 1) receiving, by a processor, an updated version of a computer program, said updated version including a plurality of source code changes; preprocessing the plurality of source code changes with a compiler for a target computing platform, wherein preprocessing the plurality of source code changes with the compiler comprises: identifying a compile-time condition associated with one or more computer instructions encapsulated by the macro; determining current values of the compile-time conditions at the time of compiling the updated version of the computer program for the target computing platform; determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition; and storing a macro information record for the macro, the macro information record including the compile-time condition, the current value of the compile-time condition, and an identification of the one or more computer instructions. having; and preprocessing the plurality of source code changes with a linker for the target computing platform, wherein preprocessing the plurality of source code changes with the linker comprises: determining that the object code corresponding to the one or more computer instructions is not contained within an executable file; and updating the macro information record to indicate that the macro is not contained within the executable file; having 1. A computer-implemented method comprising: (Item 2) 2. The computer-implemented method of claim 1, further comprising receiving, by the compiler, instructions for analyzing the plurality of source code changes in the computer program. (Item 3) The instructions include a target macro, and the computer-implemented method comprises: detecting a conflict of the target macro with the second macro due to the compile-time condition associated with the target macro and the second macro, where the target macro and the second macro change the value of the same compile-time condition. Item 3. The computer-implemented method of item 2, further comprising: (Item 4) identifying in a user interface the one or more computer instructions encapsulated by the macro in response to the current value, wherein the current value indicates that the one or more computer instructions are not included in the executable file of the updated version of the computer program. Item 1. The computer-implemented method of item 1, further comprising: (Item 5) identifying one or more source code files in a user interface, wherein computer instructions in the one or more source code files are not included in the executable file of the updated version of the computer program; Item 1. The computer-implemented method of item 1, further comprising: (Item 6) preprocessing the plurality of source code modifications with the linker, determining that all computer instructions from a first source code file in the updated version of the computer program are not included in the executable file; and in response, retrieving any macro information records associated with the first source code file; and updating macro information records identified by said search to indicate that the corresponding macros are not contained within said executable file. further comprising: Item 1. The computer-implemented method of item 1. (Item 7) Item 10. The computer-implemented method of item 1, wherein the macro is defined in a first file of the computer program and used in a second file of the computer program. (Item 8) memory devices; and one or more processing units coupled to the memory device Equipped with The one or more processing units are configured to perform a method for analyzing an updated version of a computer program for a target computing platform, wherein the analysis includes: preprocessing, with a compiler, a plurality of source code changes in the updated version of the computer program, the preprocessing being performed for the target computing platform, wherein the preprocessing by the compiler comprises: identifying a compile-time condition associated with one or more computer instructions encompassed by the macro; determining current values of the compile-time conditions at the time of compiling the updated version of the computer program for the target computing platform; determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition; and storing a macro information record for the macro, the macro information record including the compile-time condition, the current value of the compile-time condition, and an identification of the one or more computer instructions. Contains; and preprocessing the plurality of source code modifications for the target computing platform with a linker, wherein the preprocessing with the linker comprises: determining that the object code corresponding to the one or more computer instructions is not contained within an executable file; and updating the macro information record to indicate that the macro is not contained within the executable file; Contains Including, system. (Item 9) 9. The system of claim 8, wherein the plurality of source code changes are analyzed in response to receiving instructions to analyze the updated version of the computer program for the target computing platform. (Item 10) The instructions include a target macro, and the analysis includes: detecting a conflict of the target macro with the second macro due to the compile-time conditions associated with the target macro and the second macro, where the target macro and the second macro change values of the same compile-time condition; further comprising: Item 9. The system according to item 9. (Item 11) the analyzing step includes identifying in a user interface the one or more computer instructions encapsulated by the macro in response to the current value, wherein the current value indicates that the one or more computer instructions are not included in the executable file of the updated version of the computer program. further comprising: Item 9. The system according to item 8. (Item 12) the analyzing includes identifying one or more source code files within a user interface, wherein computer instructions within the one or more source code files are not included within the executable file of the updated version of the computer program; further comprising: Item 9. The system according to item 8. (Item 13) The step of preprocessing the plurality of source code modifications with the linker comprises: determining that all computer instructions from a first source code file in the updated version of the computer program are not included in the executable file; and in response: retrieving any macro information records associated with the first source code file; and updating a macro information record identified by said search to indicate that the corresponding macro is not contained within said executable file; further comprising: Item 9. The system according to item 8. (Item 14) 9. The system of claim 8, wherein the macro is defined in a first file of the computer program and used in a second file of the computer program. (Item 15) 1. A computer program product comprising a computer-readable memory having computer-executable instructions stored thereon, the computer-executable instructions, when executed by a processor, causing the processor to perform a method of analyzing an updated version of a computer program, wherein the analysis comprises: a step of preprocessing source code changes with a compiler for a target computing platform, wherein the step of preprocessing the source code changes with the compiler comprises: identifying a compile-time condition associated with one or more computer instructions encompassed by the macro; determining current values of the compile-time conditions at the time of compiling the updated version of the computer program for the target computing platform; determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition; and storing a macro information record for the macro, the macro information record including the compile-time condition, the current value of the compile-time condition, and an identification of the one or more computer instructions. Contains; and preprocessing the source code changes with a linker for the target computing platform, wherein the preprocessing of the source code changes with the linker comprises: determining that the object code corresponding to the one or more computer instructions is not contained within an executable file; and updating the macro information record to indicate that the macro is not contained within the executable file; Contains Including, Computer program products. (Item 16) Item 16. The computer program product of item 15, wherein the source code changes are analyzed in response to receiving instructions to analyze the updated version of the computer program for the target computing platform. (Item 17) The instructions include a target macro, and the analysis includes: detecting a conflict of the target macro with the second macro due to the compile-time conditions associated with the target macro and the second macro, where the target macro and the second macro change values of the same compile-time condition; further comprising: Item 17. The computer program product according to item 16. (Item 18) the analyzing step includes identifying in a user interface the one or more computer instructions encapsulated by the macro in response to the current value, wherein the current value indicates that the one or more computer instructions are not included in the executable file of the updated version of the computer program. further comprising: Item 16. The computer program product according to item 15. (Item 19) the analyzing includes identifying one or more source code files within a user interface, wherein computer instructions within the one or more source code files are not included within the executable file of the updated version of the computer program; further comprising: Item 16. The computer program product according to item 15. (Item 20) The step of preprocessing the source code changes with the linker comprises: determining that all computer instructions from a first source code file in the updated version of the computer program are not included in the executable file; and in response, retrieving any macro information records associated with the first source code file; and updating a macro information record identified by said search to indicate that the corresponding macro is not contained within said executable file; further comprising: Item 16. The computer program product according to item 15. (Item 21) receiving, by a processor, a computer program comprising a plurality of source code files, each of the source code files comprising one or more computer instructions; generating macro information by preprocessing the computer program for a particular target computing platform with a compiler, wherein generating the macro information comprises: identifying a compile-time condition associated with one or more computer instructions encapsulated by the macro; determining a current value of the compile-time condition at the time of compiling an updated version of the computer program for the target computing platform; determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition; and storing a macro information record of the macro in the macro information, the macro information record including the compile-time condition, the current value of the compile-time condition, an identification of a location where the macro is defined, and an identification of a location where the macro is used. having; and processing the computer program together with the macro information with a linker, wherein said processing with the linker comprises: determining that the object code corresponding to the one or more computer instructions is not contained within an executable file; and updating the macro information record to indicate that the macro is not contained within the executable file; have 1. A computer-implemented method comprising: (Item 22) Item 22. The computer-implemented method of item 21, further comprising updating a display of the computer program through a user interface based on the macro information. (Item 23) updating the display includes identifying in the user interface the one or more computer instructions encapsulated by the macro in response to the current value, wherein the current value indicates that the one or more computer instructions are not included in the executable file of the updated version of the computer program. having Item 23. The computer-implemented method of item 22. (Item 24) 1. A computer program product comprising a computer-readable memory having computer-executable instructions stored thereon, the computer-executable instructions, when executed by a processor, causing the processor to perform a method for analyzing a computer program, wherein the analysis comprises: receiving, by a processor, a computer program comprising a plurality of source code files, each containing one or more computer instructions; generating macro information by preprocessing said computer program for a particular target computing platform with a compiler, wherein said generating macro information comprises: identifying a compile-time condition associated with one or more computer instructions encompassed by the macro; determining current values of the compile-time conditions at the time of compiling an updated version of the computer program for the target computing platform; determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition; and storing a macro information record for the macro in the macro information, the macro information record including the compile-time condition, the current value of the compile-time condition, an identification of a location where the macro is defined, and an identification of a location where the macro is used; Contains; and processing said computer program together with said macro information by a linker, said processing by said linker comprising: determining that the object code corresponding to the one or more computer instructions is not contained within an executable file; and updating the macro information record to indicate that the macro is not contained within the executable file; Contains Including, Computer program products. (Item 25) the analyzing includes identifying one or more source code files within a user interface, wherein computer instructions within the one or more source code files are not included within the executable file of the updated version of the computer program; further comprising: Item 25. The computer program product of item 24.
Claims
1. receiving, by a processor, an updated version of a computer program, the updated version including a plurality of source code changes; preprocessing the plurality of source code changes with a compiler for a target computing platform, wherein preprocessing the plurality of source code changes with the compiler comprises: identifying a compile-time condition associated with one or more computer instructions encapsulated by the macro; determining a current value of the compile-time condition at the time of compiling the updated version of the computer program for the target computing platform; determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition; and storing a macro information record for the macro, the macro information record including the compile-time condition, the current value of the compile-time condition, and an identification of the one or more computer instructions. and preprocessing the plurality of source code changes with a linker for the target computing platform, wherein preprocessing the plurality of source code changes with the linker comprises: determining that the object code corresponding to the one or more computer instructions is not contained within an executable file; and updating the macro information record to indicate that the macro is not contained within the executable file; having 1. A computer-implemented method comprising:
2. The computer-implemented method of claim 1 , further comprising receiving, by the compiler, instructions for analyzing the plurality of source code changes in the computer program.
3. The instructions include a target macro, and the computer-implemented method comprises: detecting a conflict of the target macro with the second macro due to the compile-time condition associated with the target macro and the second macro, where the target macro and the second macro change the value of the same compile-time condition. The computer-implemented method of claim 2 further comprising:
4. identifying in a user interface the one or more computer instructions encapsulated by the macro in response to the current value, wherein the current value indicates that the one or more computer instructions are not included in the executable file of the updated version of the computer program. The computer-implemented method of claim 1 further comprising:
5. identifying one or more source code files in a user interface, wherein computer instructions in the one or more source code files are not included in the executable file of the updated version of the computer program; The computer-implemented method of claim 1 further comprising:
6. preprocessing the plurality of source code modifications with the linker, determining that all computer instructions from a first source code file in the updated version of the computer program are not included in the executable file; and in response, retrieving any macro information records associated with the first source code file; and updating macro information records identified by said search to indicate that the corresponding macros are not contained within said executable file. further comprising: The computer-implemented method of claim 1 .
7. 7. The computer-implemented method of claim 1, wherein the macro is defined in a first file of the computer program and used in a second file of the computer program.
8. memory devices; and one or more processing units coupled to the memory device Equipped with The one or more processing units are configured to perform a method for analyzing an updated version of a computer program for a target computing platform, wherein the analysis includes: preprocessing, with a compiler, a plurality of source code changes in the updated version of the computer program, the preprocessing being performed for the target computing platform, wherein the preprocessing by the compiler comprises: identifying a compile-time condition associated with one or more computer instructions encapsulated by the macro; determining current values of the compile-time conditions at the time of compiling the updated version of the computer program for the target computing platform; determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition; and storing a macro information record for the macro, the macro information record including the compile-time condition, the current value of the compile-time condition, and an identification of the one or more computer instructions; Includes; and preprocessing the plurality of source code modifications for the target computing platform with a linker, wherein the preprocessing with the linker comprises: determining that the object code corresponding to the one or more computer instructions is not contained within an executable file; and updating the macro information record to indicate that the macro is not contained within the executable file; Contains Including, system.
9. The system of claim 8 , wherein the plurality of source code changes are analyzed in response to receiving instructions to analyze the updated version of the computer program for the target computing platform.
10. The instructions include a target macro, and the analysis includes: detecting a conflict of the target macro with the second macro due to the compile-time condition associated with the target macro and the second macro, where the target macro and the second macro change the value of the same compile-time condition; further comprising: The system of claim 9.
11. the analyzing step includes identifying in a user interface the one or more computer instructions encapsulated by the macro in response to the current value, wherein the current value indicates that the one or more computer instructions are not included in the executable file of the updated version of the computer program. further comprising: The system of claim 8.
12. the analysis includes identifying one or more source code files within a user interface, wherein computer instructions within the one or more source code files are not included within the executable file of the updated version of the computer program; further comprising: The system of claim 8.
13. The step of preprocessing the plurality of source code modifications with the linker comprises: determining that all computer instructions from a first source code file in the updated version of the computer program are not included in the executable file; and in response: retrieving any macro information records associated with the first source code file; and updating a macro information record identified by said search to indicate that the corresponding macro is not contained within said executable file; further comprising: The system of claim 8.
14. 14. The system of claim 8, wherein the macro is defined in a first file of the computer program and used in a second file of the computer program.
15. A computer program comprising computer-executable instructions that, when executed by a processor, cause the processor to perform a method of analyzing an updated version of a computer program, wherein the analysis comprises: a step of preprocessing source code changes with a compiler for a target computing platform, wherein the step of preprocessing the source code changes with the compiler comprises: identifying a compile-time condition associated with one or more computer instructions encapsulated by the macro; determining current values of the compile-time conditions at the time of compiling the updated version of the computer program for the target computing platform; determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition; and storing a macro information record for the macro, the macro information record including the compile-time condition, the current value of the compile-time condition, and an identification of the one or more computer instructions; and preprocessing the source code changes with a linker for the target computing platform, wherein the preprocessing of the source code changes with the linker comprises: determining that the object code corresponding to the one or more computer instructions is not contained within an executable file; and updating the macro information record to indicate that the macro is not contained within the executable file; Contains Including, Computer program.
16. 16. The computer program of claim 15, wherein the source code changes are analyzed in response to receiving instructions to analyze the updated version of the computer program for the target computing platform.
17. The instructions include a target macro, and the analysis includes: detecting a conflict of the target macro with the second macro due to the compile-time condition associated with the target macro and the second macro, where the target macro and the second macro change the value of the same compile-time condition; further comprising:
17. A computer program according to claim 16.
18. the analyzing step includes identifying in a user interface the one or more computer instructions encapsulated by the macro in response to the current value, wherein the current value indicates that the one or more computer instructions are not included in the executable file of the updated version of the computer program. further comprising:
16. A computer program according to claim 15.
19. the analysis includes identifying one or more source code files within a user interface, wherein computer instructions within the one or more source code files are not included within the executable file of the updated version of the computer program; further comprising:
16. A computer program according to claim 15.
20. The step of preprocessing the source code changes with the linker comprises: determining that all computer instructions from a first source code file in the updated version of the computer program are not included in the executable file; and in response, retrieving any macro information records associated with the first source code file; and updating a macro information record identified by said search to indicate that the corresponding macro is not contained within said executable file; further comprising:
20. A computer program according to any one of claims 15 to 19.
21. receiving, by a processor, a computer program comprising a plurality of source code files, each of the source code files comprising one or more computer instructions; generating macro information by preprocessing the computer program for a particular target computing platform with a compiler, wherein generating the macro information comprises: identifying a compile-time condition associated with one or more computer instructions encapsulated by the macro; determining a current value of the compile-time condition at the time of compiling an updated version of the computer program for the target computing platform; determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition; and storing a macro information record of the macro in the macro information, the macro information record including the compile-time condition, the current value of the compile-time condition, an identification of a location where the macro is defined, and an identification of a location where the macro is used. and processing the computer program together with the macro information with a linker, wherein said processing with the linker comprises: determining that the object code corresponding to the one or more computer instructions is not contained within an executable file; and updating the macro information record to indicate that the macro is not contained within the executable file; have 1. A computer-implemented method comprising:
22. 22. The computer-implemented method of claim 21, further comprising updating a display of the computer program through a user interface based on the macro information.
23. updating the display includes identifying in the user interface the one or more computer instructions encapsulated by the macro in response to the current value, wherein the current value indicates that the one or more computer instructions are not included in the executable file of the updated version of the computer program. having 23. The computer-implemented method of claim 22.
24. A computer program comprising computer-executable instructions that, when executed by a processor, cause the processor to perform a method of analyzing a computer program, wherein the analysis comprises: receiving, by a processor, a computer program comprising a plurality of source code files, each of the source code files comprising one or more computer instructions; generating macro information by preprocessing said computer program for a particular target computing platform with a compiler, wherein said generating macro information comprises: identifying a compile-time condition associated with one or more computer instructions encapsulated by the macro; determining current values of the compile-time conditions at the time of compiling an updated version of the computer program for the target computing platform; determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition; and storing a macro information record for the macro in the macro information, the macro information record including the compile-time condition, the current value of the compile-time condition, an identification of a location where the macro is defined, and an identification of a location where the macro is used; and processing said computer program together with said macro information by a linker, said processing by said linker comprising: determining that the object code corresponding to the one or more computer instructions is not contained within an executable file; and updating the macro information record to indicate that the macro is not contained within the executable file; Contains Including, Computer program.
25. the analysis includes identifying one or more source code files within a user interface, wherein computer instructions within the one or more source code files are not included within the executable file of the updated version of the computer program; further comprising:
25. A computer program according to claim 24.
Citation Information
Patent Citations
Data processor
JP1990245934A
Program edition device, its method, and computer-readable medium
JP1999085486A
Method for adjusting control timing, compile program, compile apparatus, and information processor
JP2009076002A
Software management device
JP2010277500A