All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Stanislav Fomichev <sdf@fomichev.me>, <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <donald.hunter@gmail.com>,
	<horms@kernel.org>, <jstancek@redhat.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] tools: ynl: make ynl.c more c++ friendly
Date: Thu, 14 Aug 2025 14:29:23 -0700	[thread overview]
Message-ID: <fa3700a0-dfdb-4861-82f7-1512374c2cd7@intel.com> (raw)
In-Reply-To: <20250814164413.1258893-1-sdf@fomichev.me>


[-- Attachment #1.1: Type: text/plain, Size: 1181 bytes --]



On 8/14/2025 9:44 AM, Stanislav Fomichev wrote:
> Compiling ynl.c in a C++ code base requires invoking C compiler and
> using extern "C" for the headers. To make it easier, we can add
> small changes to the ynl.c file to make it palatable to the native
> C++ compiler. The changes are:
> - avoid using void* pointer arithmetic, use char* instead
> - avoid implicit void* type casts, add c-style explicit casts
> - avoid implicit int->enum type casts, add c-style explicit casts
> - avoid anonymous structs (for type casts)
> - namespacify cpp version, this should let us compile both ynl.c
>   as c and ynl.c as cpp in the same binary (YNL_CPP can be used
>   to enable/disable namespacing)
> 

The changes seem ok to me. Obviously these violate several of the usual
kernel style guidelines.. But this is a library which has a lot more
reason to be compiled with C++.

> Also add test_cpp rule to make sure ynl.c won't break C++ in the future.
> 
Thanks. Is this run in some part of automation so we can catch issues
from future patches? Ah. I see it is run as part of the normal "all"
target. Ok.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  reply	other threads:[~2025-08-14 21:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14 16:44 [PATCH net-next] tools: ynl: make ynl.c more c++ friendly Stanislav Fomichev
2025-08-14 21:29 ` Jacob Keller [this message]
2025-08-14 22:27 ` Jakub Kicinski
2025-08-14 23:36   ` Stanislav Fomichev
2025-08-15  0:05     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa3700a0-dfdb-4861-82f7-1512374c2cd7@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jstancek@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.