-
Notifications
You must be signed in to change notification settings - Fork 0
Compiler support expansion #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the portability and maintainability of the embeutils library by significantly refactoring the compiler support macros and cleaning up the CMake install script for better readability and less verbose logging.
- Major refactor of
compiler_support.hto support multiple compilers (GCC, Clang, MSVC, IAR, Keil) with portable attribute macros - Addition of comprehensive documentation and feature detection for compiler attributes
- CMake install script improvements with better formatting and reduced verbosity
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/include/embetech/compiler_support.h | Complete refactor to provide portable compiler attribute macros with extensive documentation and multi-compiler support |
| cmake/install.cmake | Formatting improvements and message verbosity reduction from STATUS to VERBOSE |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| #define EMBEUTILS_RESTRICT __restrict | ||
| #else | ||
| ///@brief alias to C99 restrict keyword | ||
| #elif __STDC_VERSION_ >= 199901L |
Copilot
AI
Sep 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing underscore in __STDC_VERSION_ - should be __STDC_VERSION__
| #elif __STDC_VERSION_ >= 199901L | |
| #elif __STDC_VERSION__ >= 199901L |
| #if defined(EMBEUTILS_COMPILER_GCC) || defined(EMBEUTILS_COMPILER_CLANG) | ||
| #define EMBEUTILS_WEAK __attribute__((weak)) | ||
| #elif defined(EMBEUTILS_COMPILER_MSVC) | ||
| #define EMBEUTILS_WEAK __declspec(selectany) | ||
| #elif defined(EMBEUTILS_COMPILER_IAR) || defined(EMBEUTILS_COMPILER_KEIL) | ||
| #define EMBEUTILS_WEAK __weak | ||
| #else | ||
| #define EMBEUTILS_WEAK | ||
| #endif |
Copilot
AI
Sep 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent use of numeric comparison vs defined check. Lines 60-70 use (1 == EMBEUTILS_COMPILER_*) while this section uses defined(EMBEUTILS_COMPILER_*). This creates a mismatch since the compiler macros are defined as 1 but checked differently.
|
lkrzak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it



This pull request introduces significant improvements to the portability and maintainability of the
embeutilslibrary's compiler attribute macros. The main focus is a major refactor ofcompiler_support.hto support multiple compilers in a portable way, with detailed documentation and robust feature detection. Additionally, the CMake install script is cleaned up for better readability and logging.Enhancements to portable compiler attribute macros:
compiler_support.hto provide portable definitions for macros such asEMBEUTILS_PACKED,EMBEUTILS_NORETURN,EMBEUTILS_WEAK,EMBEUTILS_NODISCARD,EMBEUTILS_FALLTHROUGH,EMBEUTILS_INLINE,EMBEUTILS_RESTRICT,EMBEUTILS_UNUSED,EMBEUTILS_NONNULL,EMBEUTILS_STATIC_ASSERT,EMBEUTILS_ALIGNAS, andEMBEUTILS_ALIGNOF, supporting GCC, Clang, MSVC, IAR, and Keil compilers. The file now uses feature detection and standard attributes where available, and includes extensive documentation for each macro.CMake script improvements:
messagecalls fromSTATUStoVERBOSEfor less noisy output during header configuration and Doxygen header processing. [1] [2]