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 9DA8A43CDC; Mon, 18 Mar 2024 03:40:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C678402BF; Mon, 18 Mar 2024 03:40:12 +0100 (CET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id A48C340289; Mon, 18 Mar 2024 03:40:10 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1e0025ef1efso6994205ad.1; Sun, 17 Mar 2024 19:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710729609; x=1711334409; 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=ndMSvrCpAqF7t8oicgT1JyTBMpP3diAbcnqX9tXheLU=; b=IjmLvTHL7WxxPYV9yTLYpBu2Eq20Ue7Vq2jaAAl76rRQj4enT8y4ajXqbNlFE4EZya YV6UBrpDfmBEB+FHDIbwzcGyaneS7AAD2ZcAwX80SVCgpTxNwcmPqX+HIaDGgtj5E3RT 2UfannvIhyJJW2icBhK7CRmUKQjtBqv27Bfbuka1Uvi1FOZW1euK9JJop50KqWnN2nCn HroOFwkRG+CctN2zLW5eG+xLeIicXOMtWXECW3g13sBVYeSBvVREw6XrEXgPxn6q96/a 1hZYz5RbD3uIVvlN34iw3MKhbLfgQEb1ZvO0inx7GFzPIDZ7GecIKvGel811SlXziazT SmyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710729609; x=1711334409; 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=ndMSvrCpAqF7t8oicgT1JyTBMpP3diAbcnqX9tXheLU=; b=YGdbhhThtI+ZtZ5/WGKkRP7v4Z6TCZzzGp9ZyGby7NzT0+EZGhuCLjOW1tFzTIhrdU lKUXIoKAhHk6WSZwU9el/02ZcDEuf3OqV51xvGZ4i8RiHnkejdm5zDzFVuWrpySKmmPq xN7i5U8I8iyQMDSz//67XaPBQIaCiOV075nsGiFL+79HsbfqtI6yFnEbRzSQE4zlkvu5 SeEOkcJWFZWU8+7OLJa8aruDDKnYrf14KHUVNR2NMPW/UTKjCaROw9iAMKDwwLx/LqkO 6YXAX8oBuov688nD4Vx/la+vCT6Dy1G8IjQKAwX4VrRiJRcZtXg9w1zg1a3x0jW3vZf+ IgYw== X-Forwarded-Encrypted: i=1; AJvYcCXDUEXX6acEhGl0a4+Jrv1nqu9j++f/ozVWfvNqFXlg7093PlKY5z7KoJQqmXcqBpBl3TQQ/OehA8B7dXd7Em4= X-Gm-Message-State: AOJu0YxrY+mTQt2Q6OwymV+3y8anYF+njxege7vFXzT43rb7y5u8VfK1 B1y6LXPFm6TCC4ITzeMaZ4wPd8d1IfA4qcPNWM6uKpyRtkywNStWPPVilVOv2Zc= X-Google-Smtp-Source: AGHT+IHQq8gFlmtUVomRuin7ZhJ+KDQr+q17vJVAQVCyxKYKCJIopOCaEe4SFxE5/t+TP21pe2+0sw== X-Received: by 2002:a17:903:1112:b0:1dd:da9d:940d with SMTP id n18-20020a170903111200b001ddda9d940dmr12599149plh.38.1710729608792; Sun, 17 Mar 2024 19:40:08 -0700 (PDT) Received: from asadanan1-lnx.qualcomm.com (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id 13-20020a170902ee4d00b001dd7d66aa18sm7894556plo.67.2024.03.17.19.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Mar 2024 19:40:08 -0700 (PDT) From: Ashish Sadanandan To: dev@dpdk.org, Thomas Monjalon Cc: Ashish Sadanandan , nelio.laranjeiro@6wind.com, stable@dpdk.org Subject: [PATCH v2 1/1] eal: add C++ include guard in generic/rte_vect.h Date: Sun, 17 Mar 2024 20:40:02 -0600 Message-Id: <20240318024002.551435-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: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-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..da57cc1f80 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 defintions 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