Skip to content

Conversation

josesimoes
Copy link
Member

@josesimoes josesimoes commented Sep 19, 2024

Description

  • Dropped es-printf after attempt to update to v1.3.
  • Default back to newlib nano implementation of printf and friends.
  • Update CMake, declarations and projects accordingly.

Motivation and Context

- Following attempt to migrate es-printf to v1.3 stumbled on unit tests failing because of MAX values for double. Tried get support from library author without success skirridsystems/es-printf#1 and skirridsystems/es-printf#2

  • During testing accidentally brought back the newlib nano implementation and found out that the code size is now much small. Even smaller than the es-printf version being currently used (e.g. ORGPAL_PALX build in MinSizeRel was 246776B with standard printf is 245192B).

How Has This Been Tested?

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dev Containers (changes related with Dev Containers, has no impact on code or features)
  • Dependencies/declarations (update dependencies or assembly declarations and changes associated, has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Enhanced logging functionality for memory management, providing detailed debug output when verbose logging is enabled.
    • Improved type safety in formatted output functions, ensuring correct handling of character counts and buffer sizes.
  • Bug Fixes
    • Removed deprecated format specifiers for 64-bit integer logging, enhancing compatibility and correctness across platforms.
    • Eliminated unnecessary dependencies on a lightweight printf implementation, streamlining the codebase.

@nfbot nfbot added the Type: dependencies Pull requests that update a dependency file(s) or version label Sep 19, 2024
Copy link
Contributor

coderabbitai bot commented Sep 19, 2024

Walkthrough

The changes involve enhancements to logging functionality across several source files, specifically focusing on memory allocation and garbage collection processes. Key modifications include the introduction of conditional logging based on the NANOCLR_GC_VERBOSE flag, updates to format specifiers for 64-bit integers, and improvements to the CLR_SafeSprintfV function's return value handling. Additionally, the nanoprintf library has been entirely removed, eliminating its associated header and source files from the project.

Changes

File Path Change Summary
src/CLR/Core/Execution.cpp, src/CLR/Core/GarbageCollector.cpp Enhanced logging during memory allocation and garbage collection; introduced conditional compilation for verbose logging based on NANOCLR_GC_VERBOSE.
src/CLR/Diagnostics/Info_Safeprintf.cpp Changed variable type from int to size_t for chars in CLR_SafeSprintfV; updated condition for boolean result fRes to ensure buffer null-termination.
src/CLR/Diagnostics/Profiler.cpp Updated format specifiers for 64-bit integers from %I64X to %" PRIx64 " for better portability; added explicit casts for pointer arithmetic.
src/CLR/Helpers/nanoprintf/nanoprintf.c, src/CLR/Helpers/nanoprintf/nanoprintf.h Removed the nanoprintf implementation and its header; eliminated related function declarations and configuration options for formatted output.
CMake/Modules/FindNF_CoreCLR.cmake Removed nanoprintf.c from the list of source files in the build configuration.
src/CLR/CorLib/CorLib.h, src/CLR/CorLib/corlib_native_System_Number.cpp, src/CLR/Diagnostics/Diagnostics.h, targets/AzureRTOS/_common/nanoCLR/nanoCRT.cpp, targets/ChibiOS/_nanoCLR/nanoCRT.cpp, targets/ESP32/_Network/NF_ESP32_OpenThread.cpp, targets/ESP32/_nanoCLR/nanoCRT.cpp, targets/FreeRTOS/_common/nanoCLR/nanoCRT.cpp, targets/TI_SimpleLink/_nanoCLR/nanoCRT.cpp Removed include directives for nanoprintf.h, eliminating dependencies across various files.
src/CLR/Core/Core.vcxproj, src/CLR/Core/Core.vcxproj.filters Updated project configuration to exclude nanoprintf.c from compilation.

Possibly related PRs

  • Remove wrong call to GC #3018: This PR modifies garbage collection logic in Execution.cpp, which is directly related to the changes made in the main PR regarding logging during memory allocation processes.
  • Wrap GC informational messages #3019: This PR enhances debug output during garbage collection, which aligns with the logging improvements in the main PR that focus on memory allocation diagnostics.
  • Fix format string for 64bits vars #3021: This PR updates format specifiers for 64-bit variables in Execution.cpp, which is relevant to the changes in the main PR that also involve updating format specifiers for memory addresses on Windows 64-bit systems.

Suggested labels

Type: enhancement


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7e19588 and 54706eb.

📒 Files selected for processing (17)
  • CMake/Modules/FindNF_CoreCLR.cmake (0 hunks)
  • src/CLR/CorLib/CorLib.h (1 hunks)
  • src/CLR/CorLib/CorLib.vcxproj (5 hunks)
  • src/CLR/CorLib/corlib_native_System_Number.cpp (0 hunks)
  • src/CLR/Core/Core.vcxproj (1 hunks)
  • src/CLR/Core/Core.vcxproj.filters (0 hunks)
  • src/CLR/Diagnostics/Diagnostics.h (1 hunks)
  • src/CLR/Diagnostics/Diagnostics.vcxproj (4 hunks)
  • src/CLR/Diagnostics/Info_Safeprintf.cpp (1 hunks)
  • src/CLR/Helpers/nanoprintf/nanoprintf.c (0 hunks)
  • src/CLR/Helpers/nanoprintf/nanoprintf.h (0 hunks)
  • targets/AzureRTOS/_common/nanoCLR/nanoCRT.cpp (0 hunks)
  • targets/ChibiOS/_nanoCLR/nanoCRT.cpp (0 hunks)
  • targets/ESP32/_Network/NF_ESP32_OpenThread.cpp (0 hunks)
  • targets/ESP32/_nanoCLR/nanoCRT.cpp (0 hunks)
  • targets/FreeRTOS/_common/nanoCLR/nanoCRT.cpp (0 hunks)
  • targets/TI_SimpleLink/_nanoCLR/nanoCRT.cpp (0 hunks)
💤 Files not reviewed due to no reviewable changes (11)
  • CMake/Modules/FindNF_CoreCLR.cmake
  • src/CLR/CorLib/corlib_native_System_Number.cpp
  • src/CLR/Core/Core.vcxproj.filters
  • src/CLR/Helpers/nanoprintf/nanoprintf.c
  • src/CLR/Helpers/nanoprintf/nanoprintf.h
  • targets/AzureRTOS/_common/nanoCLR/nanoCRT.cpp
  • targets/ChibiOS/_nanoCLR/nanoCRT.cpp
  • targets/ESP32/_Network/NF_ESP32_OpenThread.cpp
  • targets/ESP32/_nanoCLR/nanoCRT.cpp
  • targets/FreeRTOS/_common/nanoCLR/nanoCRT.cpp
  • targets/TI_SimpleLink/_nanoCLR/nanoCRT.cpp
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/CLR/CorLib/CorLib.h
  • src/CLR/Core/Core.vcxproj
  • src/CLR/Diagnostics/Diagnostics.h
  • src/CLR/Diagnostics/Info_Safeprintf.cpp
🔇 Additional comments not posted (9)
src/CLR/Diagnostics/Diagnostics.vcxproj (4)

121-121: LGTM: Consistent removal of nanoprintf include directory.

The removal of ..\Helpers\nanoprintf from the include directories for the Debug|x64 configuration is consistent with the change made for Debug|Win32. This maintains consistency across different build configurations.


136-136: LGTM: Consistent removal of nanoprintf include directory.

The removal of ..\Helpers\nanoprintf from the include directories for the Release|Win32 configuration maintains consistency with the changes made for Debug configurations. This ensures that the project builds consistently across different configurations.


108-108: LGTM: Removal of nanoprintf include directory.

The removal of ..\Helpers\nanoprintf from the include directories aligns with the PR objective to remove the dependency on es-printf. This change is consistent with reverting to the newlib nano implementation of printf.

To ensure this change doesn't break any existing code, please run the following script:

#!/bin/bash
# Description: Check for any remaining references to nanoprintf in the codebase

# Search for nanoprintf includes or references
rg -i 'nanoprintf' --type cpp --type h

If this script returns any results, we may need to update those files as well.


153-153: LGTM: Consistent removal of nanoprintf include directory across all configurations.

The removal of ..\Helpers\nanoprintf from the include directories for the Release|x64 configuration completes the consistent update across all build configurations (Debug/Release, Win32/x64). This change:

  1. Aligns with the PR objective to remove the dependency on es-printf.
  2. Ensures consistency across all build configurations.
  3. Simplifies the include paths, potentially reducing compilation time.

To ensure that the printf functionality is still available and working as expected after this change, please run the following script:

Review the results to confirm that:

  1. The printf function is still being used where necessary.
  2. There are no obvious issues with printf usage that might have been introduced by reverting to the newlib nano implementation.
✅ Verification successful

LGTM: printf functionality remains intact after removing the nanoprintf include directory.

The removal of ..\Helpers\nanoprintf from the include directories does not adversely affect printf usage across the codebase. The printf function is still actively used, and no format string mismatches or related issues were detected.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for printf usage and potential issues

# Search for printf usage in the codebase
rg '\bprintf\b' --type cpp --type h

# Search for potential issues with printf (e.g., format string mismatches)
ast-grep --lang cpp --pattern 'printf($fmt, $$$)'

Length of output: 5685

src/CLR/CorLib/CorLib.vcxproj (5)

168-168: LGTM: Consistent removal of nanoprintf directory for Debug|x64 configuration

The removal of the nanoprintf directory from the <AdditionalIncludeDirectories> element in the Debug|x64 configuration is consistent with the change made in the Debug|Win32 configuration. This maintains consistency across different platform configurations and aligns with the PR objective.


183-183: LGTM: Consistent removal of nanoprintf directory for Release|Win32 configuration

The removal of the nanoprintf directory from the <AdditionalIncludeDirectories> element in the Release|Win32 configuration is consistent with the changes made in both Debug configurations. This maintains consistency across different build configurations and platforms, further supporting the PR objective.


200-200: LGTM: Consistent removal of nanoprintf directory across all configurations

The removal of the nanoprintf directory from the <AdditionalIncludeDirectories> element in the Release|x64 configuration completes the consistent change across all build configurations (Debug/Release) and platforms (Win32/x64). This change fully aligns with the PR objective of dropping the dependency on es-printf.

Summary of changes:

  1. Removed nanoprintf directory from include paths in all configurations.
  2. Maintained consistency across Debug/Release builds and Win32/x64 platforms.
  3. Retained necessary include directories for the project.

These changes effectively remove the es-printf dependency from the build process, which should result in the use of the newlib nano implementation of printf and related functions as intended.


Line range hint 1-211: Overall assessment: Changes successfully remove es-printf dependency

The modifications to CorLib.vcxproj consistently remove the nanoprintf directory from the <AdditionalIncludeDirectories> elements across all build configurations (Debug/Release) and platforms (Win32/x64). These changes effectively:

  1. Align with the PR objective of dropping the dependency on es-printf.
  2. Maintain consistency across different build configurations and platforms.
  3. Prepare the project to use the newlib nano implementation of printf and related functions.

The changes are minimal and focused, reducing the risk of unintended side effects. However, it's important to ensure that:

  1. All necessary printf-related functionality is still available through the newlib nano implementation.
  2. The removal of the es-printf dependency doesn't introduce any compatibility issues with existing code.
  3. The smaller code size resulting from this change, as mentioned in the PR objectives, is verified.

To confirm the impact of these changes, consider running the following checks:

  1. Verify that the project builds successfully without the es-printf dependency.
  2. Run the unit tests to ensure no functionality is broken.
  3. Compare the code size before and after this change to confirm the expected reduction.
#!/bin/bash
# Description: Verify successful build and run unit tests

# Test: Attempt to build the project
msbuild src/CLR/CorLib/CorLib.vcxproj

# Test: Run unit tests (replace with actual test command)
# ./run_unit_tests.sh

# Test: Compare code size (replace with actual commands to measure code size)
# ./measure_code_size.sh before.txt
# ./measure_code_size.sh after.txt
# diff before.txt after.txt

155-155: LGTM: Removal of nanoprintf directory from include paths

The removal of the nanoprintf directory from the <AdditionalIncludeDirectories> element is consistent with the PR objective of dropping the dependency on es-printf. This change appears to be correct and aligns with the project's goals.

To ensure consistency across all configurations, let's verify that similar changes have been made in other <ItemDefinitionGroup> sections:


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7bdd964 and 295c762.

Files selected for processing (4)
  • src/CLR/Diagnostics/Info_Safeprintf.cpp (1 hunks)
  • src/CLR/Helpers/nanoprintf/nanoprintf.c (8 hunks)
  • src/CLR/Helpers/nanoprintf/nanoprintf.h (1 hunks)
  • src/CLR/Helpers/nanoprintf/nanoprintf_cfg.h (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/CLR/Helpers/nanoprintf/nanoprintf.c
  • src/CLR/Helpers/nanoprintf/nanoprintf_cfg.h
Additional comments not posted (3)
src/CLR/Diagnostics/Info_Safeprintf.cpp (1)

14-14: LGTM!

Changing the type of chars from int to size_t is the correct approach as it aligns with the return type of vsnprintf. This change improves type safety and prevents potential issues related to signed versus unsigned integer comparisons.

src/CLR/Helpers/nanoprintf/nanoprintf.h (2)

62-62: LGTM! The updated snprintf_ signature enhances safety and functionality.

The changes to the snprintf_ function signature are beneficial for the following reasons:

  1. The inclusion of the buffer size parameter n helps prevent buffer overflow vulnerabilities by limiting the number of characters written to the buffer.
  2. The format string parameter fmt enables type-safe formatting of the output, reducing the chances of format string vulnerabilities.
  3. The variadic parameter ... allows passing additional arguments to be formatted based on the format string, providing flexibility in formatting the output.
  4. The return type change to size_t aligns with the standard snprintf behavior, returning the number of characters that would have been written if the buffer size was large enough.

These improvements enhance the safety and functionality of the snprintf_ function, making it a more robust and reliable choice for formatted output.


63-63: LGTM! The updated vsnprintf_ signature enhances safety and functionality.

The changes to the vsnprintf_ function signature are beneficial for the following reasons:

  1. The inclusion of the buffer size parameter bufsz helps prevent buffer overflow vulnerabilities by limiting the number of characters written to the buffer.
  2. The format string parameter format enables type-safe formatting of the output, reducing the chances of format string vulnerabilities.
  3. The va_list parameter vlist allows passing variadic arguments to be formatted based on the format string, providing flexibility in formatting the output.
  4. The return type change to size_t aligns with the standard vsnprintf behavior, returning the number of characters that would have been written if the buffer size was large enough.

These improvements enhance the safety and functionality of the vsnprintf_ function, making it a more robust and reliable choice for formatted output when working with variadic arguments.

Copy link
Member

@Ellerbach Ellerbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
src/CLR/Core/Execution.cpp (1)

1614-1620: Looks reasonable but consider enhancing the comment.

The way the exceptional case of memory allocation during GC for watchdog logging is handled looks fine. Logging an error and returning NULL is a graceful way to handle it.

However, consider expanding the comment with more details on:

  • Why watchdog logging needs memory allocation
  • What are the implications/risks of allowing this exceptional allocation
  • Is there any other possible way to avoid needing allocation here

This will help future readers better understand this tricky scenario.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5436435 and 70a0a96.

Files selected for processing (5)
  • src/CLR/Core/Execution.cpp (4 hunks)
  • src/CLR/Core/GarbageCollector.cpp (1 hunks)
  • src/CLR/Diagnostics/Info_Safeprintf.cpp (1 hunks)
  • src/CLR/Diagnostics/Profiler.cpp (10 hunks)
  • src/CLR/Helpers/nanoprintf/nanoprintf_cfg.h (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/CLR/Helpers/nanoprintf/nanoprintf_cfg.h
Additional comments not posted (20)
src/CLR/Diagnostics/Info_Safeprintf.cpp (2)

14-14: LGTM!

Changing the type of chars from int to size_t is a good improvement. It aligns the variable type with the return type of vsnprintf, enhancing type safety and mitigating potential issues related to signed and unsigned integer comparisons.


17-21: LGTM!

The change to set chars to iBuffer - 1 when the buffer is too small is a good improvement. It ensures that the function always null-terminates the output buffer, even when the buffer size is exceeded, enhancing the robustness of the function.

Regarding the past review comments, they are not directly applicable to this change. The previous comments referred to a different condition (chars >= 0 vs. chars > 0), which is not the focus of the current change. This change does not introduce inconsistencies with other parts of the codebase, as it specifically addresses the issue of null-termination when the buffer size is exceeded.

src/CLR/Core/GarbageCollector.cpp (1)

610-639: Excellent refactoring to improve performance and debug output clarity!

The changes made to the CheckMemoryPressure function provide the following benefits:

  1. Improved performance by avoiding unnecessary string construction and printing when the memory tracing level is not set to verbose. This ensures that the detailed type name logging only occurs when needed, reducing overhead in normal operation.

  2. Enhanced clarity of the debug output by separating the "DROPPING OBJECT" message from the detailed type information. This makes the output more readable and allows for quick identification of dropped objects, with the option to delve into the details when the verbose tracing level is enabled.

Great job optimizing this function while maintaining its functionality!

src/CLR/Diagnostics/Profiler.cpp (14)

Line range hint 18-31: LGTM!

The function correctly initializes the profiler instance and its fields.


Line range hint 33-39: LGTM!

The function correctly deletes the profiler instance and cleans up its state.


Line range hint 41-45: LGTM!

The function correctly cleans up the profiler state by deleting the m_stream instance.


Line range hint 47-55: LGTM!

The function correctly sends the memory layout information by writing the command header, heap location, and size to the stream.


Line range hint 57-104: LGTM!

The function correctly dumps the heap information by sending the start marker, dumping root objects, iterating through heap clusters, dumping each object, sending the end marker with the total heap size, and flushing the stream data.


Line range hint 106-152: LGTM!

The function correctly dumps the root objects by iterating through finalizers, app domains, assemblies, and threads, calling DumpRoot for each object, and sending the stream data.


Line range hint 154-174: LGTM!

The function correctly dumps a single root object by writing the command header, root object pointer, root type, and method index (if applicable) to the stream.


Line range hint 176-324: LGTM!

The function correctly dumps a single object by writing the command header, object pointer, size, and data type to the stream. It handles various object types and their specific data, such as type index, object lock, fields, array elements, and additional references. The function also marks the end of the object's references.


Line range hint 326-349: LGTM!

The function correctly finds the referenced object from a reference by iterating through the reference chain and handling various reference types. It returns the referenced object or NULL if no referenced object is found.


Line range hint 351-354: LGTM!

The function correctly marks the end of an object's references list by writing a false value to the stream.


Line range hint 356-359: LGTM!

The function correctly writes a pointer value to the stream by calculating the offset from the start of the heap and packing and writing the offset value.


Line range hint 361-369: LGTM!

The function correctly dumps a single reference to the stream by finding the referenced object, writing a true value if a referenced object is found, and writing the referenced object pointer to the stream.


Line range hint 371-378: LGTM!

The function correctly dumps a list of references to the stream by iterating through the list starting from the given firstItem pointer, calling DumpSingleReference for each reference, and continuing the iteration for the specified count of references.


Line range hint 380-386: LGTM!

The function correctly dumps a list of references from a double-linked list to the stream by iterating through the list using the NANOCLR_FOREACH_NODE macro and calling DumpSingleReference for each node.

src/CLR/Core/Execution.cpp (3)

10-13: LGTM!

The conditional compilation for Windows 64-bit and inclusion of portable integer type headers looks good.


184-185: Good catch!

Replacing %I64X with %" PRIx64" is the right way to print 64-bit integers portably. This improves code maintainability.


1724-1732: Good improvement to failure logging!

The additional logging of allocation size and free memory on failures will be very helpful in debugging out-of-memory issues.

The two separate code paths to handle scheduling compaction or not also look good.

Also applies to: 1738-1745

@josesimoes josesimoes changed the title Update es-printf to v1.3 Remove private implementation of printf Sep 25, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
src/CLR/Core/Core.vcxproj (1)

Incomplete Removal of nanoprintf and Missing Integration of es-printf

The removal of nanoprintf.c is incomplete as there are still references in the following project files:

  • CMake/Modules/FindNF_CoreCLR.cmake
  • src/CLR/CorLib/CorLib.vcxproj
  • src/CLR/Diagnostics/Diagnostics.vcxproj

Additionally, there are no references to es-printf in the codebase, indicating that the integration of es-printf v1.3 may be missing.

Please ensure that:

  • All remaining references to nanoprintf are removed from the project configuration files.
  • es-printf v1.3 is properly integrated into the project, including necessary include directories and dependencies.
🔗 Analysis chain

Line range hint 1-220: Verify impact of nanoprintf removal and es-printf update

While no changes are visible in the provided code, the removal of nanoprintf.c (if confirmed) and the update to es-printf v1.3 might have broader implications for the project. Please ensure that:

  1. All references to nanoprintf have been removed or replaced throughout the codebase.
  2. Any new dependencies or changes required by es-printf v1.3 have been properly addressed.
  3. The functionality previously provided by nanoprintf is now correctly handled by es-printf v1.3.

To help verify these points, please run the following script:

This script will help identify any remaining references to nanoprintf, show where es-printf is being used, and list recent changes related to printf functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for nanoprintf references and es-printf usage

# Search for nanoprintf references in the entire codebase
echo "Searching for nanoprintf references:"
grep -R "nanoprintf" .

# Search for es-printf usage
echo "Searching for es-printf usage:"
grep -R "es-printf" .

# Check for any printf-related changes in recent commits
echo "Recent printf-related changes:"
git log -n 10 --oneline --grep="printf"

# List files changed in this PR
echo "Files changed in this PR:"
git diff --name-only HEAD~1

Length of output: 4045

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 70a0a96 and 7e19588.

📒 Files selected for processing (15)
  • CMake/Modules/FindNF_CoreCLR.cmake (0 hunks)
  • src/CLR/CorLib/CorLib.h (0 hunks)
  • src/CLR/CorLib/corlib_native_System_Number.cpp (0 hunks)
  • src/CLR/Core/Core.vcxproj (1 hunks)
  • src/CLR/Core/Core.vcxproj.filters (0 hunks)
  • src/CLR/Diagnostics/Diagnostics.h (0 hunks)
  • src/CLR/Diagnostics/Info_Safeprintf.cpp (1 hunks)
  • src/CLR/Helpers/nanoprintf/nanoprintf.c (0 hunks)
  • src/CLR/Helpers/nanoprintf/nanoprintf.h (0 hunks)
  • targets/AzureRTOS/_common/nanoCLR/nanoCRT.cpp (0 hunks)
  • targets/ChibiOS/_nanoCLR/nanoCRT.cpp (0 hunks)
  • targets/ESP32/_Network/NF_ESP32_OpenThread.cpp (0 hunks)
  • targets/ESP32/_nanoCLR/nanoCRT.cpp (0 hunks)
  • targets/FreeRTOS/_common/nanoCLR/nanoCRT.cpp (0 hunks)
  • targets/TI_SimpleLink/_nanoCLR/nanoCRT.cpp (0 hunks)
💤 Files not reviewed due to no reviewable changes (13)
  • CMake/Modules/FindNF_CoreCLR.cmake
  • src/CLR/CorLib/CorLib.h
  • src/CLR/CorLib/corlib_native_System_Number.cpp
  • src/CLR/Core/Core.vcxproj.filters
  • src/CLR/Diagnostics/Diagnostics.h
  • src/CLR/Helpers/nanoprintf/nanoprintf.c
  • src/CLR/Helpers/nanoprintf/nanoprintf.h
  • targets/AzureRTOS/_common/nanoCLR/nanoCRT.cpp
  • targets/ChibiOS/_nanoCLR/nanoCRT.cpp
  • targets/ESP32/_Network/NF_ESP32_OpenThread.cpp
  • targets/ESP32/_nanoCLR/nanoCRT.cpp
  • targets/FreeRTOS/_common/nanoCLR/nanoCRT.cpp
  • targets/TI_SimpleLink/_nanoCLR/nanoCRT.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/CLR/Diagnostics/Info_Safeprintf.cpp
🔇 Additional comments not posted (1)
src/CLR/Core/Core.vcxproj (1)

Line range hint 1-220: Summary and additional information request

The review of src/CLR/Core/Core.vcxproj has highlighted a discrepancy between the AI-generated summary and the visible code changes. The main points of concern are:

  1. The reported removal of nanoprintf.c from the project.
  2. The potential impact of updating es-printf to v1.3.

To complete this review effectively, we need:

  1. Confirmation of the actual changes made to this file.
  2. Information on how the es-printf update affects the project structure and dependencies.
  3. Results from the verification scripts provided in the previous comments.

Once this information is available, we can provide a more accurate and comprehensive review of the changes.

josesimoes and others added 7 commits September 25, 2024 14:31
Automated fixes for code style.
Automated fixes for code style.
- Update CMake, declarations and projects accordingly.
Automated fixes for code style.
- Update CMake, declarations and projects accordingly.
@josesimoes josesimoes merged commit b00c7fc into nanoframework:main Sep 25, 2024
29 checks passed
@josesimoes josesimoes deleted the update-printf branch September 25, 2024 14:39
josesimoes added a commit to OrgPal/nf-interpreter that referenced this pull request Sep 26, 2024
josesimoes added a commit that referenced this pull request Sep 30, 2024
@coderabbitai coderabbitai bot mentioned this pull request Apr 10, 2025
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Config-and-Build Type: dependencies Pull requests that update a dependency file(s) or version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants