Checking source code validity when updating code
By preprocessing source code changes to record macro information and compile-time conditions, the method efficiently analyzes and debugs computer programs for new platforms, addressing macro expansion challenges and reducing development time and resource waste.
Patent Information
- Application Number
- JP2024519110
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2021-10-11
- Filing Date
- 2022-10-07
- Publication Date
- 2024-10-04
- Estimated Expiration
- 2042-10-07
AI Technical Summary
Existing solutions for porting computer programs, especially open source programs, to new computing platforms face challenges in managing macros, leading to complex debugging and inefficient code analysis due to unpredictable macro expansion and lack of accurate static analysis tools, resulting in significant development delays and resource wastage.
A method and system that preprocesses source code changes for a target platform, recording macro information and compile-time conditions to determine which instructions are included in the executable file, allowing for efficient analysis and debugging by generating macro information records and using a linker to verify inclusion in the executable.
This approach reduces development time and effort by identifying unnecessary code sections, ensuring only valid updates are analyzed, and providing a user-friendly interface for debugging, thus improving project delivery efficiency and reducing resource consumption.
Smart Images

Figure 2024536124000001_ABST
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 a computer program product, and more particularly to checking the validity of computer instructions that include or are contained 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 for 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 continuous use of software using such computer programs.
[0003] Existing technical solutions for analyzing computer programs and debugging computer instructions do not anticipate the particular 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 the ported code that is specific to the target computing platform. Summary of the Invention
[0004] In accordance with 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, where preprocessing the source code changes with the compiler includes identifying a compile-time condition 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 within an executable file, and updating the macro information record to indicate that the macro is not included within the executable file.
[0005] In accordance with 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 a computer program including a plurality of source code changes. The method further includes preprocessing, by a compiler, the source code changes for the target computing platform, where preprocessing, by a compiler, the source code changes includes identifying a compile-time condition associated with one or more computer instructions encapsulated by a macro. Preprocessing, by a compiler, the source code changes 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, by a compiler, the source code changes 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 comprises 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 comprises 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 within an executable file, and updating the macro information record to indicate that the macro is not included within the executable file.
[0006] In accordance with one or more embodiments of the present invention, a computer program product comprises a computer-readable memory having computer-executable instructions stored thereon that, when executed by a processor, cause the processor to perform a method of analyzing an updated version of a computer program. The method comprises receiving, by a processor, an updated version of a computer program including a plurality of source code changes. The method further comprises preprocessing, by a compiler, the source code changes for a target computing platform, where preprocessing, by a compiler, the source code changes comprises identifying a compile-time condition associated with one or more computer instructions encapsulated by a macro. Preprocessing, by a compiler, the source code changes further comprises 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, by a compiler, the source code changes further comprises 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 comprises 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 comprises 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 within an executable file, and updating the macro information record to indicate that the macro is not included within the executable file.
[0007] According to one or more embodiments of the 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 particular target computing platform with a compiler. The generating macro information includes identifying compile-time conditions associated with one or more computer instructions encapsulated by a macro. The generating macro information 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. The generating macro information further includes determining object code corresponding to the one or more computer instructions based on the current value of the compile-time condition. The generating 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 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] The computer program product comprises a computer readable memory having computer executable instructions stored thereon which, when executed by a processor, cause the processor to perform a method of analyzing a computer program. The method comprises receiving, by a processor, a computer program including a plurality of source code files, each including one or more computer instructions. The method further comprises generating macro information by preprocessing, by a compiler, the computer program for a particular target computing platform. The generating macro information comprises identifying compile time conditions associated with one or more computer instructions encapsulated by a macro. The generating macro information further comprises 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. The generating macro information further comprises determining object code corresponding to the one or more computer instructions based on the current value of the compile time condition. The generating macro information further comprises 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 comprises processing the computer program together with the macro information with a linker, the processing 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.
[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] The embodiments of the present invention provide a technical solution for analyzing / isolating unnecessary files / functions / code in an efficient and improved manner compared to existing solutions when porting large-scale projects. Thus, the 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 out whether code updates in upstream branches need to be included in the ported version. If not necessary 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 the editor / user interface of a software development tool to provide a highly readable and more 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 description 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 in accordance with one or more embodiments of the present invention. [Figure 3B] (collectively, FIG. 3) illustrates two versions of an exemplary source code file in accordance with 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, FIG. 5) illustrates an example expansion scenario of a macro during debugging, in accordance with one or more embodiments of the present invention. [Figure 5B] (collectively, FIG. 5) illustrates an example expansion scenario of a macro during debugging, in accordance with one or more embodiments of the present invention. [Figure 5C] (collectively, FIG. 5) illustrates an example expansion scenario of 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 in accordance with 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] 2 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] 1 illustrates an example 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 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] 1 illustrates an exemplary output according to one or more embodiments of the present invention. [Figure 20] 13 illustrates another output in accordance with 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 modifications 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 these 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 numbers. With few exceptions, the left-most digit of each reference number corresponds to the figure in which the element is first shown. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0015] A technical solution is described herein for validating 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 a computing platform, a technical challenge is to maintain a robust ecosystem that allows the execution of computer programs 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 a computer program, the computer program instructions (i.e., source code, code, executable instructions, etc.) of such a computer program need to be compiled for a particular computing platform.
[0016] Typically, a computer program includes one or more macros. In a computer program, a macro is a tool that allows a developer 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 sequence 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. The use of macros can make the source code of a computer program compact and avoid duplication efforts. However, the use of macros makes the analysis of the source code technically difficult. Furthermore, the use of macros also makes the debugging of the source code technically difficult.
[0017] It is a technical challenge to check whether the computer instructions contained by a macro are included in an object file (the result of compilation) (i.e., the macro is expanded). This is because, for example, the definition of the macro may be included in a file separate from the file that actually contains (or uses) the macro. Alternatively or additionally, the macro expansion may be overridden if the source code is compiled with a particular runtime option (i.e., when a compiler is executed 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 that is 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 the 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 of such macro definition files. Therefore, it may be difficult to predict which macro was expanded at the time of compilation of file F1.
[0018] As a result, the technical challenge of the unpredictability of macro expansion makes it technically difficult to debug computer programs that contain macros. Thus, porting computer programs, such as open source computer programs, to a target computing platform is technically difficult. Additionally, some tools, such as aclocal, autoconfig, automake, libtool (all libraries as part of the GNU PROJECT), MESON build system, NINJA build system, etc., 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, it may be difficult to make a software program portable because C compilers vary from system to system. Alternatively, or in addition, certain library functions may be missing in some systems. Alternatively, or in addition, header files may have different names. To address such challenges with portability, programmers generally use conditional code, where code blocks are selected by preprocessor directives (#ifdef). For example, these preprocessor directives instruct the compiler to compile only certain parts 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 may become unmanageable and thus 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 settings, such as autoheader, autoconf, automake, etc., 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 the operating system, 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 to be supported, making debugging the code 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 case of failure.
[0021] In addition, current existing solutions may facilitate pre-processing, e.g., compiling with specific options (e.g., gcc with option "-E") to generate one intermediate file that expands all macros and incorporates all content of included files. However, generating such intermediate files may take a long time (hours), especially for large projects (thousands of lines of code). Moreover, such intermediate files are not easy to read. For example, one source code file with 303 lines may expand to an intermediate file with 7148 lines.
[0022] There are also tools available (such as VSCODE) that can analyze source code and identify if 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, to a different color (e.g., gray) font, if the definition of the macro is not located in the same file as the file that uses the macro.
[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 typically misidentified by such tools.
[0024] Additionally, several open source software (i.e., computer programs) are currently available to support or enhance the functionality of enterprise-level projects and / or platforms. For example, there are several open source tools that developers can use to support cloud platform development, especially for container support. Porting such open source tools from one platform to another is essential for platform development organizations to build a robust ecosystem 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.) may be a technical challenge. Without such porting, providing the functionality of the first platform on the second platform may be a technical challenge. For example, without such porting, a computer program executable on the first platform may not be executable on the second platform. Alternatively, a developer may need to overcome a steep learning curve to make a computer program executable on the first platform executable on the second platform.
[0025] Technical challenges faced (and especially with open source computer programs) while making a computer program from a first platform compatible (i.e., executable) with a second platform include 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. In addition, the computer program may include one or more features 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 the upstream version of the computer program from the open source community. For example, when 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 large corporate efforts to code and test ported versions of an open source computer program for a target platform every time the computer program is updated, embodiments of the present invention determine whether the 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] Thus, the embodiments of the present invention are rooted in computing technology and provide improvements in computing technology, particularly computer software development. The 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 that is to be ported to a target platform. Thus, the embodiments of the present invention reduce development efforts and improve project delivery efficiency. The 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. The linker also adds 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 / link options instead of static source code analysis of the computer program, the embodiments of the present invention provide dynamic results of checking the validity of computer programs, particularly updates to computer programs.
[0029] The embodiments of the present invention provide technical solutions to address such technical problems with improvements over existing tools. The embodiments of the present invention are rooted in computing technology, and in particular in identifying computer program instructions within computer programs (i.e., source code). Furthermore, the embodiments of the present invention are rooted in computing technology because computing technology improves the debugging of computer programs (i.e., source code) that contain macros. The embodiments of the present invention provide practical applications for identifying macros and debugging computer programs that contain macros. Without the 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] An embodiment of the present invention facilitates the processing of a computer program during compilation and linking of the computer program. Preprocessing information about computer instructions encapsulated by a macro is recorded according to the macro definition or compilation options. These records further facilitate analyzing / debugging the computer program to check whether the computer instructions have been compiled into an object file (the result of the compilation). Because an embodiment of the present invention generates records based on compilation options instead of static source code analysis, a dynamic compilation or linking result is 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 is understood 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 an 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, but separate runtime instructions, as used herein, "compiling" or "building" a computer program 106 may include compiling, linking, and any other operations that may be necessary to convert 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 possible for a human being, 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 efficiency of execution of the computer program 106 when executing on the target computing platform 130.
[0033] Computer program 106 may include multiple source code files, including, for example, 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., 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, the source code file 102 includes several macros 104. Each of the illustrated macros 104 may be an instance of a different macro. Alternatively, or in addition, the macros 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 in addition, the conditional expansion may depend on one or more environmental settings (e.g., operating system level variables, hardware type, etc.) of the computing platform 130. Alternatively, or in addition, 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 invention, other dependencies of conditional expansion may be used. In one or more embodiments of the invention, the macros 104 used in the file 102 may be defined in the 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 that is used to interact with the source code files 102, 103. A user can navigate the directory structure and perform operations, such as add, delete, copy, paste, move, edit, etc., with the source code files of the computer program 106. 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-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 in a directory structure 212.
[0037] The comparison result 220 of the two versions 242, 244 indicates the number of same files, different files, similar files, and orphan files in each version. Here, the "same files" include files in the two versions 242, 244 where no changes have been detected. The "similar files" include files where the 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). Although "changed lines" is used as a metric in the above example, it is understood that other metrics can be used in other examples, such as "changed characters", "changed functions", etc. 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 in the other version. An orphan file may be present in the first version 242 (if that file is not present in the second version 244); similarly, the second version 244 may have an orphan file (second file) (if that (second) file is not present in the first version 242).
[0038] 3A-3B show 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 portion). 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 those 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 a combination type of hardware and software of the target computing platform 130. For example, the compile-time condition 202 may indicate that the macro 104 is expanded only if the platform uses a particular operating system, such as, for example, LINUX, AIX, INTERIX, Z / OS, etc. Alternatively or additionally, the compile-time condition 202 may indicate that the macro 104 is expanded only if one or more other source code files (e.g., header files) are included. In some examples, the expanded macro 104 itself may be the inclusion of additional source code files, such as libraries, application program interfaces, etc. Alternatively, or in addition, the expanded macro 104 may "implement" a particular type of hardware or software component, where "implementation" includes gaining access to the component before registering the component for use, e.g., recognizing, reading, and processing file system structures, storage media, etc. In one or more embodiments of the invention, a number of additional or alternative operations may be performed by computer instructions embodied within the macro 104.
[0041] 5A, 5B, and 5C illustrate an exemplary expansion scenario of macros 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 run-time command 320 to start 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 FIG. 5A, 5B, and 5C, command 320 causes compiler 110 to run to IDE 112 to export expanded macros and included file (e.g., a.h 306) information to preprocessed file a.p 312. The preprocessed file 312 is later used to generate the object code 120. However, the result of the 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. The compile-time conditions 202B and 202C cause subsequent expansion of computer instructions in the 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 large projects with 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] The 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 non-contained macros. Alternatively or additionally, the 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 of the computer program 106 compiled into an object file 120 (e.g., lines of code), 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 predefined annotations, such as, for example, MacroEnclosed, CurrentMacroValue, Preprocesstype, EarlierAssignedMacroValue, etc. In one or more embodiments of the invention, a predefined 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 case of an error.
[0043] Further, in one or more embodiments of the present invention, a preprocessor collects, identifies, and generates records of computer instructions that are (and are not) enclosed within a macro 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 analysis and identification of the root causes of macro conflicts that may (or may not) cause computer instructions to be compiled into an object 120 file, as well as providing macro redefinition warnings across several source code files.
[0044] An embodiment of the present invention can realize 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 thus provide practical applications for improving technical problems underlying computer program development and porting, since they can save time and resources.
[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 identification of macros 104, compile-time conditions 202, values of compile-time conditions 202, updating of a user interface, debugging of 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 identification of macros in 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 the compile-time conditions 202, the current values of the compile-time conditions, the assigned compile-time condition values, the macro name, the preprocessor type, the referenced macro name, 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 of 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] In addition, development tools 112 include a compiler 110 and a linker 115 that convert computer programs 106 into object code 120 and machine-executable instructions for a target computing platform 130. In one or more embodiments of the invention, development tools 112 are a separate computing system from computing platform 130. Alternatively, development tools 112 are part of computing platform 130, e.g., software that executes on computing platform 130. In other cases, computing platform 130 may be considered to be development tools 112.
[0050] 7 illustrates a flow chart of a method for detecting macros in a computer program and identifying paths of compile-time conditions that may cause compilation and / or execution errors in accordance with 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 to detect 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 initiate 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 response to receiving the command, at block 504, the macro preprocessor 410 parses the computer program 106 to generate macro information 412. The macro information 412 may 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 of the macro 104 begin. LineNoEnd indicates the ending line number of the macro 104. Preprocesstype indicates the action associated with the compile-time condition 202. MacroName indicates the 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 by syntactic and semantic analysis of 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] 5B illustrates an exemplary scenario of detecting macro information 412 according to one or more embodiments of the present invention. In FIG. 5B, macro information 412 is generated for exemplary files 302, 304, 306 based on received command 320. It is understood that macro information 412 may be stored in a different format than that illustrated in FIG. 5B. As illustrated, macro information 412 is parsed to indicate the location of compile time condition 202 in source code file 302, 306, 308. Furthermore, a value assigned to compile time condition 202 based on received command or based on source code is identified. Additionally, if applicable, a previous compile time condition 202 (in the hierarchy) is also identified and a value assigned to the previous compile time condition 202 is 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 in addition, the macro information 412 is stored in a file. For example, a file for storing the macro information 412 may be<program name> In some embodiments of the invention, a file name for storing the macro information 412 may be specified in the command for triggering pre-processing.
[0055] FIG. 8 illustrates exemplary macro information 412 according to 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 that are expanded / extracted after preprocessing are enclosed by the compile-time condition 202. MacroEnclosed "OFF" indicates that the computer instructions are not enclosed by the compile-time condition 202. LineNoStart and LineNoEnd respectively indicate the start and end line numbers of the computer instructions enclosed by the macro 104. Preprocesstype "S" indicates the source code range that is enclosed by the macro, while "D" indicates the definition of the macro. MacroName is the name of the defined macro 104. AssignedMacroValue is the value that is 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 a target computing platform 130, e.g., _MVS_ for ZOS®, AIX for AIX®. SpecificMacroType "P" indicates whether the macro 104 is associated with a target computing platform 130. ReferredMacroName provides a reference name for 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 in 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, including generating source code for macro 104 in response to compile-time conditions encompassing the macro. Figure 9 shows a flowchart of a method 800 for generating computer instructions for a macro 104, in accordance with one or more embodiments of the present invention. For purposes of illustration, the description herein includes a walk-through of example macro MYDEF 104 from Figure 5A (lines 8-18 in file "ac" 302).
[0058] Referring to the flow chart of method 800, in 802, the compiler 110 checks whether macro detection is enabled (block 502). If macro detection is triggered in block 804, the compiler 110 scans the computer program 106 with the macro preprocessor 410 (block 806), otherwise the compiler proceeds (block 808) to typical macro processing according to existing solutions.
[0059] For each computer instruction, the compiler 110 checks whether the current computer instruction is a definition of a compile-time condition 202 in block 810. 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. Furthermore, in this case (flag S), the macro name, current value and type are shown from the computer instruction in block 816. Furthermore, in block 810, if there is a computer instruction 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.
[0060] When 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 searching 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 searches and retrieves the last value assigned to the compile time condition 202 (e.g., "1" in the illustrative example of MYDEF; the 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 at block 822, such as file name, line numbers (start, end), etc. 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 walk-through of the exemplary 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 compile command. Consider that all computer instructions that meet the conditions, including "MYDEF" being defined, are expanded in object file 120, but the computer instructions in lines 9-10 of file "ac" 302 are not expanded and therefore are not compiled.
[0064] The conflict check facilitates identification of the root cause of a conflict between contained macros 104, which, as in this case, is 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 be checked. In block 906, if the type of the macro 104 is not a predefined type (e.g., "T"), then a conflict check 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] At 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 conflicts 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 at 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, background color, 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 a conflict (e.g., the compile time condition "PRO=0" affects "MYDEF"). Other compile time conditions 202 that interact with the macro 104 being checked may be identified from the macro information 412 record of the macro 104. For example, the macro information 412 may 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, e.g., via a start command, one or more target macros 104 to be checked for conflicts. Alternatively, or in addition, all distinct macros 104 are checked in this manner for conflicts.
[0070] Referring to the flowchart of method 500, once the conflicting macros are highlighted, in block 510, the development tool provides support for a macro redefine path. Figure 11 shows a flowchart of a method 1000 for macro redefine path support in accordance with one or more embodiments of the present invention. For purposes of illustration, the description herein includes a walk-through of the example macro MYDEF 104 from Figure 5A (lines 8-18 in file "ac" 302).
[0071] At block 1002, the method 1000 includes starting path change detection of 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), via an environment variable, or any other setting that the linker 115 can check, then at block 1006, the path change detection is terminated. Alternatively, if the setting is turned ON, then at block 1008, a record from the macro information 412 is read for further analysis.
[0072] This analysis involves checking at least four conditions: is MacroEnclosed ON (1010); is Preprocesstype=D (1012); is EarlierAssignedMacroValue present (1014); and is the new compile-time condition value 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). Then, if an EarlierAssignedMacroValue exists (i.e., PRO exists per "bh" line 2), then (1012); otherwise, the other option needs to be executed (i.e., "bh" line 5). Furthermore, 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 the detection and use of macro information 412 described above, one or more embodiments of the present invention facilitate source code updates (including identification of compiled and linked source code) in large (enterprise) projects with support for multi-level and cross-compilation unit isolation. To this end, in addition to the above information, compiler 110 detects and provides StatementCompiledValid status of each macro 104 (see FIG. 6). Macro preprocessor 410 provides information to linker 115, which may further add information about ObjectLinkedValid and FuncSectionLinkedValid to macro information 412 based on checking object files 120 and whether functions are linked to executable file 125. The flags added to macro information 412 along with the identity (e.g., name) of the macro are used to isolate compiled portions of computer program 106 and hierarchically linked to 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 a user interface to guide a 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 efforts and improve project delivery efficiency.
[0076] The improvement is based on generating the macro information 412 using a macro preprocessor, and further preprocessing the source code file 106 with the linker 115 to enhance the macro information 412 to determine for each macro 104 a status value representing ObjectLinkedValid, FuncSectionLinkedValid and StatementCompiledValid. ObjectLinkedValid represents link invalidity when the object file is not linked to 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 that is not covered by the compile-time condition 202 is compiled into the object file 120, the compiler 110 marks the flag StatementCompiledValid with the compilation validity.
[0077] In some embodiments of the invention, the development tool 112 includes a source code isolation module 420 that determines link validity of portions of the object file 120 based on the value of the flag "ObjectLinkedValid" from the macro information 412. If the value is invalid (e.g., "OFF"), the source code isolation module 420 skips all macro information records of the object file. Otherwise, the source code isolation module 420 continues to determine validity of linked function sections and indicates validity based on the value of the flag "FuncSectionLinkedValid". For example, if the value is invalid (e.g., "OFF"), the source code isolation module 420 skips macro inclusion records of function sections. Otherwise, the source code isolation module 420 continues to determine validity of source code segment compilation and indicates validity using the flag "StatementCompiledValid". If the value is valid (e.g., "ON"), the source code isolation module 420 inserts the record into a valid source section. Otherwise, the source code isolation module 420 continues to determine validity of macros and indicates validity using the flag "MacroEnclosed". If the value is valid (e.g., "ON"), the source code isolation module 420 inserts the record into the valid source section. In one or more embodiments of the invention, the editor and user interface 404 can highlight the record in the 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 is to be generated. For example, the command 320 includes a parameter "p" and the name of the source code file 106 that is thus processed to generate the macro information 412.
[0079] 13 illustrates an example 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 the linker 115 to generate an intermediate file 312 (e.g., "ap") that includes the 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 "ON" if the object (in the object file 120) corresponding to the macro 104 is linked into the executable file 125; otherwise, it has a value "OFF". The value of FuncSectionLinkedValid is set to "ON" if the function included by the macro 104 is linked into the executable file 125; otherwise, it is set to "OFF". In addition, 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 post-preprocessing active compile-time conditions 202; otherwise, it is set to "OFF." It is understood that in other embodiments, "ON" and "OFF" may be substituted with other values.
[0080] FIG. 14 shows a flow chart of a method 1400 of generating computer instructions for a macro 104 according to one or more embodiments of the present invention. For illustrative purposes, the description herein includes a walk-through of the example macro MYDEF 104 from FIG. 5A, FIG. 5B, FIG. 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 to typical macro processing according to existing solutions.
[0081] At each computer instruction, the compiler 110 checks whether the current computer instruction is a definition of a compile-time condition 202 in block 1410. If the current computer instruction is a definition of a compile-time condition 202 (e.g., "#undef MYDEF"), the compiler 110 assigns the 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 whether the value of the compile-time condition 202 is ON in block 1413. In other words, it is checked whether the value of the compile-time condition 202 facilitates the compilation of the contained 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 revealed from the computer instructions 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] When 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 searching 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 searches and retrieves the last value assigned to the compile time condition 202 (e.g., "1" in the illustrative example of MYDEF; the 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, e.g., file name, line numbers (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, with the expansion of the macros 104 and the compiling and linking of 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 the method 1500 from Figure 15 in an example scenario. The linker 115 is triggered to determine part of the macro information 412 by parameters specified in the 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 no linker information is 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 that are 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 was removed prior to the generation of the executable file 125. Here, the "object" may be the source code file 106, e.g., "cc". If the object was removed, in block 1510, the development tool iterates through all records (in the macro information 412) of that object (having the same condition, i.e., MacroEnclosed=ON) and the object is removed. 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 an object that is not linked and is therefore unused and removed by the linker 115. Therefore, the ObjectLinkedValid of all records in the macro information 412 corresponding to that file are marked as "OFF" (marked as "1" in FIG. 16).
[0090] Alternatively, if the object was not removed (1508), the development tool parses and reads the function section in block 1514, where the 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 has been removed prior to generation of the executable file 125. For example, the function section may be unused and removed if the function is never used in the remainder of the computer program 106. Alternatively, or additionally, the function section may be unused and removed if the entire function is contained within a compile-time condition 202 that is not ON at the time of compilation. 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 thus, 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 generation of the executable file 125.
[0091] If the function is unused and is to 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, since func_ee() is removed by the linker 115 during optimization, then all MacroEnclosed records of the function section are identified and for each of them, the field "FuncSectionLinkedValid" is assigned "OFF" as shown (see "2" which shows the processing computer instructions from the source code file "dc" 1602).
[0092] As described, when all objects and functions in object file 120 have been analyzed and macro information 412 has been updated, method 1500 is complete. 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 flow chart of a method 1700 for isolating a source code portion according to 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, 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 valid / invalid. Alternatively, or in addition, the marking may include moving the 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 as 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, 18D show an example of code isolation being performed using a method 1700 according to one or more embodiments of the present invention. An example scenario is shown in which an intermediate file 312 containing macro information 412 is generated for various source code files 106. Records of various sections in 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 to the next record. If instead FuncSectionLinkedValid=ON is found in a record, the record is considered valid (see "3"). If instead StatementCompiledValid=ON is found in a record, the record is considered invalid (see "4").
[0097] The 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. Thus, the 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 out whether code updates in upstream branches need to be included in the ported version. If not necessary 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 the editor / user interface of a software development tool to provide a highly readable and more friendly view of large-scale enterprise projects by marking sections of computer programs based on the techniques described herein.
[0098] In addition, 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 of each macro and compile-time condition. 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 computer instructions that are enclosed or not enclosed based on the macro definition. 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 possible impacts. Furthermore, the linker supports macro redefinition passes across multiple compilation units (e.g., files) by locating records of the macro information with the status of MacroEnclosed and the value of Preprocesstype, and determining valid redefinitions after comparing AssignedMacroValue and EarlierAssignedMacroValue.
[0099] The technical solutions described herein provide improvements in computing technology, particularly in debugging. In one or more embodiments of the present invention, the technical solutions herein facilitate analyzing / solving 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 a specific computer programming language, it is understood that the technical solutions herein are not limited to any specific computer programming language.
[0101] FIG. 19 shows an exemplary output according to one or more embodiments of the present invention. A file "ac" is analyzed to generate macro information in response to a command to preprocess a computer program (step 1). The macro information is read by a highlighting / marking editor for one or more computer instructions in the computer program (steps 2, 3). FIG. 20 shows another output according to one or more embodiments of the present invention, where 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, and even with different files, computer instructions that become part of the object code are marked, for example, on mouse over or other such user interaction. The user interfaces in FIG. 19 and FIG. 20 also show code sections that are not included in the executable file 125 using an embodiment of the present invention (e.g., method 1700).
[0102] Although this disclosure includes a detailed description of cloud computing, it is understood that implementation of the teachings described herein is not limited to a cloud computing environment. Rather, embodiments of the 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 may include at least five characteristics, at least three service models, and at least four deployment models.
[0104] The characteristics are: On-Demand Self-Service: Cloud consumers can unilaterally provision computing capacity, such as server time and network storage, as needed and automatically, without requiring human interaction with the service provider. Broad 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: Provider 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 the consumer, the capacity available for provisioning often appears unlimited, and can be purchased at any time and in any amount. Metered 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, thus providing transparency to both providers and consumers of the services being utilized.
[0105] The service models are as follows: Software as a Service (SaaS): The capability offered to the consumer is to use the 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 capability offered to the consumer is to deploy applications that the consumer creates or acquires, created 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 does control the deployed applications and, in some cases, the configuration of the application hosting environment. Infrastructure as a Service (IaaS): The capability offered to the consumer is 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 do control the operating system, storage, deployed applications, and in some cases, limited control over selected networking components (e.g., host firewalls).
[0106] The deployment models are as follows: Private Cloud: The cloud infrastructure is operated solely for the organization. It may be managed by the organization or a third party and may exist on-premise or off-premise. Community Cloud: The cloud infrastructure is shared by multiple organizations to support a particular 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 exist on-premise or off-premise. Public Cloud: The cloud infrastructure is made available to the general public or large industry groups 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 with a focus 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] 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., personal digital assistant (PDA) or mobile phone 54A, desktop computer 54B, laptop computer 54C, and / or 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 herein above. This allows the cloud computing environment 50 to provide infrastructure, platform, and / or software as a service for which the cloud consumer does not need to maintain resources on the local computing device. It should be understood that the types of computing devices 54A to 54N illustrated in FIG. 21 are intended to be merely exemplary, and that the computing nodes 10 and the cloud computing environment 50 may communicate with any type of computerized device through any type of network and / or network addressable connection (e.g., using a web browser).
[0109] 22, a set of functional abstraction layers provided by cloud computing environment 50 (FIG. 21) is shown. It should be understood in advance that the components, layers, and functions shown in FIG. 22 are intended to be illustrative 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 servers 62; servers 63; blade servers 64; storage devices 65; and networks 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 within 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 arrangement and procurement of cloud computing resources where future requirements are anticipated according to SLAs.
[0113] 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 shown. The computer system 2300 may be an electronic computer framework that comprises and / or uses 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, 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 a distributed cloud computing environment where tasks are performed by remote processing devices 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, the computer system 2300 has one or more central processing units (CPUs) 2301a, 2301b, 2301c, etc. (collectively or generally referred to as processor 2301). The processor 2301 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The processor 2301, also referred to as a processing circuit, is coupled to a system memory 2303 and various other components via a system bus 2302. The system memory 2303 may include a read-only memory (ROM) 2304 and a random access memory (RAM) 2305. The ROM 2304 is coupled to the system bus 2302 and may include a basic input / output system (BIOS) that controls certain basic functions of the computer system 2300. The RAM is a read-write memory coupled to the system bus 2302 for use by the processor 2301. The system memory 2303 provides temporary memory space for the operation of the above-mentioned instructions 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. The 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. The I / O adapter 2306 and the 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, on which software 2311 is stored 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, allowing 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 depicted in FIG. 23.
[0118] Additional input / output devices are shown as connected to the system bus 2302 via a display adapter 2315 and an interface adapter 2316. In one embodiment, the 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 the performance of graphics-intensive applications and a video controller. A keyboard 2321, a 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 a processor 2301, storage capabilities including system memory 2303 and mass storage 2310, input means such as a keyboard 2321 and a mouse 2322, and output capabilities including speakers 2323 and a display 2319.
[0119] In some embodiments, the communications adapter 2307 may transmit data using any suitable interface or protocol, such as an Internet Small Computer System Interface, among others. The 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. An external computing device may be connected to the computer system 2300 through the 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 include, in various embodiments, 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. A computer-readable storage medium may be, for example, but 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 memories (RAMs), read-only memories (ROMs), erasable programmable read-only memories (EPROMs or flash memories), static random access memories (SRAMs), portable compact disk read-only memories (CD-ROMs), digital versatile disks (DVDs), memory sticks, floppy disks, 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 being signals that are inherently ephemeral, 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 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 comprise 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 transfers the computer-readable program instructions for storage in 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, instructions of an instruction set architecture (ISA), machine instructions, machine dependent instructions, microcode, firmware instructions, state setting data, configuration data for an integrated circuit, 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 stand-alone 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 made 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 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 generate a machine, such that the instructions, executed via the processor of the computer 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 capable of directing 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 may comprise an article of manufacture including 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 generate a computer-implemented process, such that the instructions executing on the computer, other programmable apparatus, or other device implement the functions / operations 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 be performed in a different order than that noted in the figures. For example, two blocks shown in succession may in fact be executed substantially simultaneously, or in some cases, these 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 executes 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 in this specification is selected to best explain the principles of the embodiments, the practical application of the technology found in the market, or technical improvements thereto, or to enable others skilled in the art to understand the embodiments described herein.
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 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 further 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 a 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 embodied by the macro in response to the current value, where 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 in a user interface one or more source code files, where 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 corresponding macros are not contained within said executable file. Further comprising: The computer-implemented method of claim 1 .
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 of analyzing an updated version of a computer program for a target computing platform, the analysis comprising: preprocessing a plurality of source code changes in the updated version of the computer program with a compiler, the preprocessing being performed for the target computing platform, where the preprocessing by 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. Contains; and preprocessing the plurality of source code modifications for the target computing platform with a linker, the preprocessing with the 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; Includes Including, system.
9. The system of claim 8 , wherein the plurality of source code changes are analyzed in response to receiving an instruction 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 includes identifying in a user interface the one or more computer instructions encapsulated by the macro in response to the current value, where 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 in a user interface one or more source code files, where 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; 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 macro information records identified by said search to indicate that corresponding macros are not contained within said executable file; Further comprising: The system of claim 8.
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.
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, the analysis comprising: preprocessing source code changes with a compiler for a target computing platform, the preprocessing of the source code changes with the compiler comprising: 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 source code changes with a linker for the target computing platform, where the preprocessing 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; Includes Including, Computer program products.
16. 16. The computer program product 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 product according to claim 16.
18. the analyzing includes identifying in a user interface the one or more computer instructions encapsulated by the macro in response to the current value, where 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 product according to claim 15.
19. the analysis includes identifying in a user interface one or more source code files, where 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; Further comprising:
16. A computer program product 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 macro information records identified by said search to indicate that corresponding macros are not contained within said executable file; Further comprising:
16. A computer program product according to claim 15.
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 said computer program for a particular target computing platform with a compiler, said generating macro information comprising: 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 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 with a linker, said processing with 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. have 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 embodied by the macro in response to the current value, where 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. 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 a computer program, the analysis comprising: 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, said generating macro information comprising: 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 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; Includes Including, Computer program products.
25. the analysis includes identifying in a user interface one or more source code files, where 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; Further comprising:
25. A computer program product 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
