DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH 1/2] build: build eal library with MSVC
Date: Tue, 27 Feb 2024 11:21:59 -0800	[thread overview]
Message-ID: <1709061720-4843-2-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1709061720-4843-1-git-send-email-roretzla@linux.microsoft.com>

* MSVC now has limited handling of GCC __extension__ keyword when
  compiling C so only expand __extension__ empty on MSVC when
  building with C++.

* When building with MSVC enable the statement expressions compiler
  extension.

* When building with MSVC enable building of eal library.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 config/meson.build           | 7 ++++++-
 lib/eal/include/rte_common.h | 2 ++
 lib/meson.build              | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/config/meson.build b/config/meson.build
index f8f2149..68186e1 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -39,13 +39,18 @@ if is_ms_compiler
     # temporarily disable msvc specific warnings
     # - 4244 compiler detected conversion of integer to smaller type
     # - 4267 compiler detected conversion of size_t to smaller type
-    add_project_arguments('/wd4244', '/wd4267', language: 'c')
+    # - 4146 unary minus applied to unsigned type
+    add_project_arguments('/wd4244', '/wd4267', '/wd4146', language: 'c')
 
     # enable non-locking atomic operations
     add_project_arguments('/experimental:c11atomics', language: 'c')
 
     # enable typeof operator
     add_project_arguments('/d1experimental:typeof', language: 'c')
+
+    # enable statement expressions extension
+    add_project_arguments('/experimental:statementExpressions', language: 'c')
+
 endif
 
 # set the major version, which might be used by drivers and libraries
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 1cc1222..99128d8 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -38,8 +38,10 @@
 #endif
 
 #ifdef RTE_TOOLCHAIN_MSVC
+#ifdef __cplusplus
 #define __extension__
 #endif
+#endif
 
 /*
  * RTE_TOOLCHAIN_GCC is defined if the target is built with GCC,
diff --git a/lib/meson.build b/lib/meson.build
index 4fb01f0..d77bfbc 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -73,6 +73,7 @@ if is_ms_compiler
             'log',
             'kvargs',
             'telemetry',
+            'eal',
     ]
 endif
 
-- 
1.8.3.1


  reply	other threads:[~2024-02-27 19:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 19:21 [PATCH 0/2] build eal & ring libraries " Tyler Retzlaff
2024-02-27 19:21 ` Tyler Retzlaff [this message]
2024-02-27 19:22 ` [PATCH 2/2] build: build ring library " Tyler Retzlaff
2024-02-28  9:07 ` [PATCH 0/2] build eal & ring libraries " Bruce Richardson
2024-03-06 10:00 ` David Marchand
2024-03-06 14:48   ` Patrick Robb

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=1709061720-4843-2-git-send-email-roretzla@linux.microsoft.com \
    --to=roretzla@linux.microsoft.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).