[PATCH v16 2/3] drivers/common: add diagnostics macros to make code portable

Morten Brørup mb at smartsharesystems.com
Thu Jan 23 09:09:07 CET 2025


> From: Andre Muezerie [mailto:andremue at linux.microsoft.com]
> Sent: Tuesday, 21 January 2025 23.36
> 
> It was a common pattern to have "GCC diagnostic ignored" pragmas
> sprinkled over the code and only activate these pragmas for certain
> compilers (gcc and clang). Clang supports GCC's pragma for
> compatibility with existing source code, so #pragma GCC diagnostic
> and #pragma clang diagnostic are synonyms for Clang
> (https://clang.llvm.org/docs/UsersManual.html).
> 
> Now that effort is being made to make the code compatible with MSVC
> these expressions would become more complex. It makes sense to hide
> this complexity behind macros. This makes maintenance easier as these
> macros are defined in a single place. As a plus the code becomes
> more readable as well.
> 
> Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
> ---

Acked-by: Morten Brørup <mb at smartsharesystems.com>



More information about the dev mailing list