From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 17B1043CDC for ; Mon, 18 Mar 2024 03:44:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1DA7D402BF; Mon, 18 Mar 2024 03:44:24 +0100 (CET) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id F229E40289; Mon, 18 Mar 2024 03:44:21 +0100 (CET) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1def89f0cfdso14161195ad.0; Sun, 17 Mar 2024 19:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710729860; x=1711334660; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KO3j/agUJ3Cx0IYqfZBzN/mR7cC2no8PWtYEdd6bxrI=; b=M5FD1lX/bulaCBFLsUTF9Zq9whgPgmmVbfdKNskE4/Q1qEDklElMarN0icfyAy2PYn FBynGo1evRa2Qqc+NmN0IoOX4hjoosEd054DwmabH9sElrpZpe0Fpy/4chZZ8V0vjEwu x+Rtn2CAZ1Tfnt9wud/Zwi9PH/Hnb/WKVSDrBAvx32FiEpxoe/K/vjiEYqgITR6PIKWb nPUKvsMwMkyeGqQjVryoYbQwFNaAY3xp9BV6AUNLo6koBKSTsRzxh3OXM3R8orHke0pv hXT7dQI2daS4cwADWKD/oPJcrDHiPBpIzGr+QpWQdYuU9avQBWJJiOUdvbbBCFZqyLTH iwxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710729860; x=1711334660; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KO3j/agUJ3Cx0IYqfZBzN/mR7cC2no8PWtYEdd6bxrI=; b=xNY/1JzodRoImR52SgecFzb0LOZpGBTQ0ltuy+OXx9wpwA32aSiKY7uuQl8jZmr2tN BeJqF0xDNVu3AuhS3vZX5QcfK9ZENdSESoMEvoHZ2wN7ugHuOGihD97e0iSgG4po7ROU VeMvihsZBkPywDCaoUnhns+2nNFXRDcnzjHfI3wPGoUnz+RefTqBfy1SzB5J1LkOZwaf C9L/t9iEu8Lag9TVvlzlx0GXzklLyhV93kWYgUm3NdP0CsCANonemuOcKnZPMcb59teK Lht3Gk4MfpTV0AvX4eBk2KPjZm9mYnD6A9yh+njtWmDq3N68672IUTnsNXtDZ7UXvLfF 8inQ== X-Forwarded-Encrypted: i=1; AJvYcCXm+qqrEMjsM2t8kIZsE/xY0nqJRhw7AGNibh8Sl7ECOEThCjiKq+1zw32nxCrq/0UsQ5DJvvWz5dxo+FA0AvI= X-Gm-Message-State: AOJu0YxJEEzwEdU5915v24xbd6ndb22Ajg6uDNNEfG2EhVykzkjYxQD1 M12I3ugLa46XQlF2OrBA1/w8ZJhxj+eqUt7l2oCAnP+8WD1qD9obloAiomqc3Nk= X-Google-Smtp-Source: AGHT+IGGQ3kmdG97Q+fvUw4H1gfIf3RpHGmZcAuQS6b5PfDfOT//0Zd30qjXLZ8+Hj8QW1BZLKfEew== X-Received: by 2002:a17:902:c403:b0:1dd:8ed:997d with SMTP id k3-20020a170902c40300b001dd08ed997dmr20439571plk.3.1710729860250; Sun, 17 Mar 2024 19:44:20 -0700 (PDT) Received: from asadanan1-lnx.qualcomm.com (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id m12-20020a1709026bcc00b001dc05535632sm517781plt.170.2024.03.17.19.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Mar 2024 19:44:19 -0700 (PDT) From: Ashish Sadanandan To: dev@dpdk.org, Thomas Monjalon Cc: Ashish Sadanandan , nelio.laranjeiro@6wind.com, stable@dpdk.org Subject: [PATCH v3 1/1] eal: add C++ include guard in generic/rte_vect.h Date: Sun, 17 Mar 2024 20:44:15 -0600 Message-Id: <20240318024415.555614-1-ashish.sadanandan@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240202051335.776290-1-ashish.sadanandan@gmail.com> References: <20240202051335.776290-1-ashish.sadanandan@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org The header was missing the extern "C" directive which causes name mangling of functions by C++ compilers, leading to linker errors complaining of undefined references to these functions. Also updated the coding style contribution guideline with a new "Language Linkage" section stating `extern "C"` block should be added to public headers. Fixes: 86c743cf9140 ("eal: define generic vector types") Cc: nelio.laranjeiro@6wind.com Cc: stable@dpdk.org Signed-off-by: Ashish Sadanandan --- .mailmap | 2 +- doc/guides/contributing/coding_style.rst | 21 +++++++++++++++++++++ lib/eal/include/generic/rte_vect.h | 8 ++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 50726e1232..24de59ba89 100644 --- a/.mailmap +++ b/.mailmap @@ -142,7 +142,7 @@ Ashijeet Acharya Ashish Gupta Ashish Jain Ashish Paul -Ashish Sadanandan +Ashish Sadanandan Ashish Shah Ashwin Sekhar T K Asim Jamshed diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contributing/coding_style.rst index 1ebc79ca3c..27c947fcec 100644 --- a/doc/guides/contributing/coding_style.rst +++ b/doc/guides/contributing/coding_style.rst @@ -106,6 +106,27 @@ Headers should be protected against multiple inclusion with the usual: #endif /* _FILE_H_ */ +Language Linkage +~~~~~~~~~~~~~~~~ + +Public headers should enclose all function and variable declarations and definitions in an ``extern "C"`` block to facilitate interoperability with C++. + +.. code-block:: c + + #ifndef _FILE_H_ + #define _FILE_H_ + + #ifdef __cplusplus + extern "C" { + #endif + + /* Code */ + + #ifdef __cplusplus + } + #endif + + #endif /* _FILE_H_ */ Macros ~~~~~~ diff --git a/lib/eal/include/generic/rte_vect.h b/lib/eal/include/generic/rte_vect.h index 6540419cd2..3578d8749b 100644 --- a/lib/eal/include/generic/rte_vect.h +++ b/lib/eal/include/generic/rte_vect.h @@ -15,6 +15,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #ifndef RTE_TOOLCHAIN_MSVC /* Unsigned vector types */ @@ -226,4 +230,8 @@ uint16_t rte_vect_get_max_simd_bitwidth(void); */ int rte_vect_set_max_simd_bitwidth(uint16_t bitwidth); +#ifdef __cplusplus +} +#endif + #endif /* _RTE_VECT_H_ */ -- 2.31.1