[PATCH v11 0/3] add diagnostics macros to make code portable
Stephen Hemminger
stephen at networkplumber.org
Fri Jan 3 20:24:02 CET 2025
On Fri, 3 Jan 2025 07:36:48 -0800
Andre Muezerie <andremue at linux.microsoft.com> wrote:
> From: Andre Muezerie <andremue at linux.microsoft.com>
> To: andremue at linux.microsoft.com
> Cc: dev at dpdk.org, stephen at networkplumber.org
> Subject: [PATCH v11 0/3] add diagnostics macros to make code portable
> Date: Fri, 3 Jan 2025 07:36:48 -0800
> X-Mailer: git-send-email 1.8.3.1
>
> 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.
Since 90% of these cases are about removing const from a pointer,
maybe it would be better to have a macro that did that?
Would not work for base driver code which is pretending to be platform independent.
More information about the dev
mailing list