From patchwork Thu Sep 3 18:32:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 53046 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 6578822E3F for ; Thu, 3 Sep 2015 18:32:36 +0000 (UTC) Received: by laeb10 with SMTP id b10sf20073645lae.1 for ; Thu, 03 Sep 2015 11:32:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=S2zyG9TkpjRDSaP+EFREDT79oYpGcCK4ocgYk7lEl4g=; b=mNFmtRKM2ttfjRhUUYyK2vL4vM8/yBHdbNZlyXNviM0RNK2OTD4aKU1kBNJuYiXCui y/ba/+rC9wo6mWXFITndJ903ju4jTnyFCi0gNvunjkHAJu3BJw3jv7U4BYq0bQiE5waD DllqCtu/eD1oHGyDP7v/zM4WFuCtj4ottgNWdDCQsKlwTDtDfV7Esc6rMtH2Z9EpEBWX ngu2Hk/aLPnisMWY2TGUM8WQzjyjmWcI12qAl08Vs0+MAn83JVEG4gwrp6h0sFg8z05R 8uAKbAqD9XwnSGsstKO0hvwrnMEqFNL6O/e7WnK+7BuN/ATFDfCBUS7+L2yGClmBWwhu 1Z6w== X-Gm-Message-State: ALoCoQlKs36JznfxU0HkYUmFv9tvjZA5WFoJe1VmYLP4JT9+Pb46cQMFTpPYsWP0dDP6Kv0Gb5J8 X-Received: by 10.194.19.33 with SMTP id b1mr11134054wje.6.1441305155319; Thu, 03 Sep 2015 11:32:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.10 with SMTP id o10ls261999lah.22.gmail; Thu, 03 Sep 2015 11:32:35 -0700 (PDT) X-Received: by 10.112.64.228 with SMTP id r4mr23091342lbs.103.1441305155140; Thu, 03 Sep 2015 11:32:35 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id q7si23868225laq.23.2015.09.03.11.32.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2015 11:32:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbmp1 with SMTP id mp1so29577970lbb.1 for ; Thu, 03 Sep 2015 11:32:35 -0700 (PDT) X-Received: by 10.112.141.136 with SMTP id ro8mr23192868lbb.88.1441305155001; Thu, 03 Sep 2015 11:32:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.164.42 with SMTP id yn10csp1450461lbb; Thu, 3 Sep 2015 11:32:33 -0700 (PDT) X-Received: by 10.107.170.37 with SMTP id t37mr942770ioe.166.1441305153727; Thu, 03 Sep 2015 11:32:33 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id qh4si267167igb.55.2015.09.03.11.32.32; Thu, 03 Sep 2015 11:32:33 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 8FB0761B3F; Thu, 3 Sep 2015 18:32:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id EEE6661B22; Thu, 3 Sep 2015 18:32:26 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0570261B2B; Thu, 3 Sep 2015 18:32:25 +0000 (UTC) Received: from mail-oi0-f42.google.com (mail-oi0-f42.google.com [209.85.218.42]) by lists.linaro.org (Postfix) with ESMTPS id B3ED661B1A for ; Thu, 3 Sep 2015 18:32:23 +0000 (UTC) Received: by oibi136 with SMTP id i136so33105438oib.3 for ; Thu, 03 Sep 2015 11:32:23 -0700 (PDT) X-Received: by 10.202.210.197 with SMTP id j188mr6378415oig.130.1441305143150; Thu, 03 Sep 2015 11:32:23 -0700 (PDT) Received: from Ubuntu15.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by smtp.gmail.com with ESMTPSA id p204sm17586577oia.21.2015.09.03.11.32.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Sep 2015 11:32:22 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org, maxim.uvarov@linaro.org Date: Thu, 3 Sep 2015 13:32:18 -0500 Message-Id: <1441305138-8911-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 X-Topics: patch Subject: [lng-odp] [PATCHv2] linux-generic: general: add odp_forward_typedefs to resolve clang issues X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bill.fischofer@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 With the addition of ordered queues, there is a circular typedef relationship between odp_queue_internal.h and odp_buffer_internal.h. The standard forward declaration technique that GCC accepts is strictly not acceptable to C99 and is flagged by clang. The solution is to create a common header file that can contain these forward declarations. Signed-off-by: Bill Fischofer --- platform/linux-generic/Makefile.am | 1 + .../linux-generic/include/odp_buffer_internal.h | 11 +++----- .../linux-generic/include/odp_forward_typedefs.h | 31 ++++++++++++++++++++++ .../linux-generic/include/odp_queue_internal.h | 5 ++-- 4 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 platform/linux-generic/include/odp_forward_typedefs.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index f2c081a..3132dc2 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -122,6 +122,7 @@ noinst_HEADERS = \ ${srcdir}/include/odp_classification_internal.h \ ${srcdir}/include/odp_crypto_internal.h \ ${srcdir}/include/odp_debug_internal.h \ + ${srcdir}/include/odp_forward_typedefs.h \ ${srcdir}/include/odp_internal.h \ ${srcdir}/include/odp_packet_internal.h \ ${srcdir}/include/odp_packet_io_internal.h \ diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 6badeba..0cf0805 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -29,7 +29,7 @@ extern "C" { #include #include #include - +#include #define ODP_BITSIZE(x) \ ((x) <= 2 ? 1 : \ @@ -101,13 +101,8 @@ typedef union odp_buffer_bits_t { }; } odp_buffer_bits_t; -/* forward declaration */ -struct odp_buffer_hdr_t; -union queue_entry_u; -typedef union queue_entry_u queue_entry_t; - /* Common buffer header */ -typedef struct odp_buffer_hdr_t { +struct odp_buffer_hdr_t { struct odp_buffer_hdr_t *next; /* next buf in a list--keep 1st */ union { /* Multi-use secondary link */ struct odp_buffer_hdr_t *prev; @@ -144,7 +139,7 @@ typedef struct odp_buffer_hdr_t { queue_entry_t *target_qe; /* ordered queue target */ uint64_t sync; /* for ordered synchronization */ }; -} odp_buffer_hdr_t; +}; /** @internal Compile time assert that the * allocator field can handle any allocator id*/ diff --git a/platform/linux-generic/include/odp_forward_typedefs.h b/platform/linux-generic/include/odp_forward_typedefs.h new file mode 100644 index 0000000..b0fba6e --- /dev/null +++ b/platform/linux-generic/include/odp_forward_typedefs.h @@ -0,0 +1,31 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP forward typedefs - implementation internal + * + * This needs to be a separate file because it is needed by both + * odp_queue_internal.h and odp_buffer_internal.h and clang prohibits forward + * "redefining" typedefs. + */ + +#ifndef ODP_FORWARD_TYPEDEFS_H_ +#define ODP_FORWARD_TYPEDEFS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct odp_buffer_hdr_t odp_buffer_hdr_t; +typedef union queue_entry_u queue_entry_t; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index 0f30965..1b622b8 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -19,6 +19,7 @@ extern "C" { #endif #include +#include #include #include #include @@ -86,10 +87,10 @@ struct queue_entry_s { odp_atomic_u64_t sync_out; }; -typedef union queue_entry_u { +union queue_entry_u { struct queue_entry_s s; uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(struct queue_entry_s))]; -} queue_entry_t; +}; queue_entry_t *get_qentry(uint32_t queue_id);