From patchwork Tue Nov 21 02:42:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 10067605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A6E1D60375 for ; Tue, 21 Nov 2017 02:42:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D7E229584 for ; Tue, 21 Nov 2017 02:42:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6056D29586; Tue, 21 Nov 2017 02:42:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9796929584 for ; Tue, 21 Nov 2017 02:42:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752085AbdKUCmy (ORCPT ); Mon, 20 Nov 2017 21:42:54 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:43431 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752010AbdKUCmx (ORCPT ); Mon, 20 Nov 2017 21:42:53 -0500 Received: by mail-qt0-f196.google.com with SMTP id w10so5389388qtb.10 for ; Mon, 20 Nov 2017 18:42:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dev-mellanox-co-il.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=wy0odQGXO5A6/hcDDLQDGjOjYjAEeUkzROs4KHS0R+A=; b=oHGOK12fHfiSIWKWLThJlmHtw9t0qPN+onOUnlCP2g5B0YvoiT4qV0llQNtAntoUj9 rK2NMoWWP0OA6iwW1IySq1/KZzWAfTHtCwkbxXY6HKJrcghSrsHSyFfUBQ01LioO6fPT 4vmsnMtEAMTiNG7lgK8AhiuiPS6+044O46aPxJPxq8QmvyUZsD2GqXqvours4+QPnXej hE94iJomDw2bl9HuMCTj0CmeKHcA6p9m+qKjtlJoU9VT3QttiEIG6JyxU7UustwIm0nN M+jz9T5kakbjEW34hpsvcGykNNrTeLqP/7d8W2dQyMNQoTf1TwtM5ztjylEeq7q/UUTT 3BnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=wy0odQGXO5A6/hcDDLQDGjOjYjAEeUkzROs4KHS0R+A=; b=pp4lMcpRgM3dEEeKNA2XHmU/S+YvTTx7R2gyFtyN9xQ99ry5W+VoVm6BS9FbPGbXi5 0IrVze0qBaC4wuJQUHzthTRTu4cwuxL0KbR80ViMWljL3OQbxJZqXSaQqZBLncHVnlJj DtOB/20hzQwhnArMqncbiiANKjZhSbFUOcmnK6iiFEXwKK4go1H4bDa2BAVxesk9xgWu SGIkNGXF5a1YbGKuXot8WpU7lBKIGUkVBuy9GrR4pOy/S29odrpCgKnE22VrJqkGeILd jTb2ibAFg+vDmsxRdRILdjoJCulG97Ut7Ic8tEhqg22N6Nq+UfCFitOqQsu+iabAPCpe l3FA== X-Gm-Message-State: AJaThX7MWT2ABhHuisMf7Bxrb9YMbT0BgL13MQLB2WUBtNlxJunFmVei cO9oTyRiEC/nsq/pzGyvqlV48nkf X-Google-Smtp-Source: AGs4zMbJ9CvEWUjui8a+L43IXroUPiNapMFK+oFUvcvHB2/hnBG7wKYzT2nGXptsScpIeSuBsYXZeQ== X-Received: by 10.237.60.206 with SMTP id e14mr22409232qtf.157.1511232172433; Mon, 20 Nov 2017 18:42:52 -0800 (PST) Received: from [192.168.1.183] (c-73-182-207-166.hsd1.ma.comcast.net. [73.182.207.166]) by smtp.googlemail.com with ESMTPSA id 6sm8153902qtz.68.2017.11.20.18.42.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 18:42:51 -0800 (PST) To: "linux-rdma@vger.kernel.org" From: Hal Rosenstock Subject: [PATCH rdma-core] Eliminate BEGIN_C_DECLS and END_C_DECLS macros in libibverbs and libibumad headers Message-ID: <774ff06e-2274-13e3-00c0-97ccba78b1a6@dev.mellanox.co.il> Date: Mon, 20 Nov 2017 21:42:50 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-US Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP to reduce symbol pollution Replace these macros with open coding Signed-off-by: Hal Rosenstock --- libibumad/umad.h | 14 +++++--------- libibumad/umad_cm.h | 14 +++++--------- libibumad/umad_sa.h | 14 +++++--------- libibumad/umad_sm.h | 14 +++++--------- libibumad/umad_str.h | 14 +++++--------- libibumad/umad_types.h | 14 +++++--------- libibverbs/driver.h | 8 -------- libibverbs/marshall.h | 14 +++++--------- libibverbs/tm_types.h | 14 +++++--------- libibverbs/verbs.h | 17 +++++++---------- 10 files changed, 47 insertions(+), 90 deletions(-) diff --git a/libibumad/umad.h b/libibumad/umad.h index 479165a..59677f3 100644 --- a/libibumad/umad.h +++ b/libibumad/umad.h @@ -41,14 +41,8 @@ #include /* __be16, __be32 and __be64 */ #ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } -#else /* !__cplusplus */ -# define BEGIN_C_DECLS -# define END_C_DECLS -#endif /* __cplusplus */ - -BEGIN_C_DECLS +extern "C" { +#endif typedef __be16 __attribute__((deprecated)) be16_t; typedef __be32 __attribute__((deprecated)) be32_t; @@ -259,5 +253,7 @@ static inline __attribute__((deprecated)) uint64_t htonll(uint64_t x) { return h #define htonll htonll #endif -END_C_DECLS +#ifdef __cplusplus +} +#endif #endif /* _UMAD_H */ diff --git a/libibumad/umad_cm.h b/libibumad/umad_cm.h index e063f8a..dd077f7 100644 --- a/libibumad/umad_cm.h +++ b/libibumad/umad_cm.h @@ -37,14 +37,8 @@ #include #ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } -#else /* !__cplusplus */ -# define BEGIN_C_DECLS -# define END_C_DECLS -#endif /* __cplusplus */ - -BEGIN_C_DECLS +extern "C" { +#endif /* Communication management attributes */ enum { @@ -63,5 +57,7 @@ enum { UMAD_CM_ATTR_SPR = 0x001C, }; -END_C_DECLS +#ifdef __cplusplus +} +#endif #endif /* _UMAD_CM_H */ diff --git a/libibumad/umad_sa.h b/libibumad/umad_sa.h index 3f0f877..ba41216 100644 --- a/libibumad/umad_sa.h +++ b/libibumad/umad_sa.h @@ -39,14 +39,8 @@ #include #ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } -#else /* !__cplusplus */ -# define BEGIN_C_DECLS -# define END_C_DECLS -#endif /* __cplusplus */ - -BEGIN_C_DECLS +extern "C" { +#endif /* SA specific methods */ enum { @@ -144,5 +138,7 @@ struct umad_sa_packet { uint8_t data[UMAD_LEN_SA_DATA]; /* network-byte order */ }; -END_C_DECLS +#ifdef __cplusplus +} +#endif #endif /* _UMAD_SA_H */ diff --git a/libibumad/umad_sm.h b/libibumad/umad_sm.h index d912608..5a326e5 100644 --- a/libibumad/umad_sm.h +++ b/libibumad/umad_sm.h @@ -41,14 +41,8 @@ #include #ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } -#else /* !__cplusplus */ -# define BEGIN_C_DECLS -# define END_C_DECLS -#endif /* __cplusplus */ - -BEGIN_C_DECLS +extern "C" { +#endif enum { UMAD_SMP_DIRECTION = 0x8000, @@ -124,5 +118,7 @@ struct umad_smp { uint8_t return_path[UMAD_SMP_MAX_HOPS]; }; -END_C_DECLS +#ifdef __cplusplus +} +#endif #endif /* _UMAD_SM_H */ diff --git a/libibumad/umad_str.h b/libibumad/umad_str.h index f343942..ddd6867 100644 --- a/libibumad/umad_str.h +++ b/libibumad/umad_str.h @@ -37,14 +37,8 @@ #include #ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } -#else /* !__cplusplus */ -# define BEGIN_C_DECLS -# define END_C_DECLS -#endif /* __cplusplus */ - -BEGIN_C_DECLS +extern "C" { +#endif const char * umad_class_str(uint8_t mgmt_class); const char * umad_method_str(uint8_t mgmt_class, uint8_t method); @@ -53,5 +47,7 @@ const char * umad_attribute_str(uint8_t mgmt_class, __be16 attr_id); const char * umad_common_mad_status_str(__be16 status); const char * umad_sa_mad_status_str(__be16 status); -END_C_DECLS +#ifdef __cplusplus +} +#endif #endif /* _UMAD_STR_H */ diff --git a/libibumad/umad_types.h b/libibumad/umad_types.h index 7d29dd4..bb0d57f 100644 --- a/libibumad/umad_types.h +++ b/libibumad/umad_types.h @@ -41,14 +41,8 @@ #include #ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } -#else /* !__cplusplus */ -# define BEGIN_C_DECLS -# define END_C_DECLS -#endif /* __cplusplus */ - -BEGIN_C_DECLS +extern "C" { +#endif #define UMAD_BASE_VERSION 1 #define UMAD_QKEY 0x80010000 @@ -213,5 +207,7 @@ umad_class_resp_time(struct umad_class_port_info *cpi) & UMAD_CLASS_RESP_TIME_MASK); } -END_C_DECLS +#ifdef __cplusplus +} +#endif #endif /* _UMAD_TYPES_H */ diff --git a/libibverbs/driver.h b/libibverbs/driver.h index 04071a7..4b1e5dd 100644 --- a/libibverbs/driver.h +++ b/libibverbs/driver.h @@ -42,14 +42,6 @@ #include #include -#ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } -#else /* !__cplusplus */ -# define BEGIN_C_DECLS -# define END_C_DECLS -#endif /* __cplusplus */ - struct verbs_device; enum verbs_xrcd_mask { diff --git a/libibverbs/marshall.h b/libibverbs/marshall.h index 1dab111..c5ba62c 100644 --- a/libibverbs/marshall.h +++ b/libibverbs/marshall.h @@ -39,14 +39,8 @@ #include #ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } -#else /* !__cplusplus */ -# define BEGIN_C_DECLS -# define END_C_DECLS -#endif /* __cplusplus */ - -BEGIN_C_DECLS +extern "C" { +#endif void ibv_copy_qp_attr_from_kern(struct ibv_qp_attr *dst, struct ibv_kern_qp_attr *src); @@ -60,6 +54,8 @@ void ibv_copy_path_rec_from_kern(struct ibv_sa_path_rec *dst, void ibv_copy_path_rec_to_kern(struct ib_user_path_rec *dst, struct ibv_sa_path_rec *src); -END_C_DECLS +#ifdef __cplusplus +} +#endif #endif /* INFINIBAND_MARSHALL_H */ diff --git a/libibverbs/tm_types.h b/libibverbs/tm_types.h index 9a50d45..f1b302a 100644 --- a/libibverbs/tm_types.h +++ b/libibverbs/tm_types.h @@ -37,14 +37,8 @@ #include #ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } -#else /* !__cplusplus */ -# define BEGIN_C_DECLS -# define END_C_DECLS -#endif /* __cplusplus */ - -BEGIN_C_DECLS +extern "C" { +#endif enum ibv_tmh_op { IBV_TMH_NO_TAG = 0, @@ -66,5 +60,7 @@ struct ibv_rvh { __be32 len; }; -END_C_DECLS +#ifdef __cplusplus +} +#endif #endif /* _TM_TYPES_H */ diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index b39dc30..ce18b50 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -48,21 +48,16 @@ #include #endif -#ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } -#else /* !__cplusplus */ -# define BEGIN_C_DECLS -# define END_C_DECLS -#endif /* __cplusplus */ - #if __GNUC__ >= 3 # define __attribute_const __attribute__((const)) #else # define __attribute_const #endif -BEGIN_C_DECLS +#ifdef __cplusplus +extern "C" { +#endif + union ibv_gid { uint8_t raw[16]; @@ -2535,7 +2530,9 @@ static inline int ibv_is_qpt_supported(uint32_t caps, enum ibv_qp_type qpt) return !!(caps & (1 << qpt)); } -END_C_DECLS +#ifdef __cplusplus +} +#endif # undef __attribute_const