From patchwork Thu Sep 3 18:23:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 53044 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 16D8A22E3F for ; Thu, 3 Sep 2015 18:24:00 +0000 (UTC) Received: by laeb10 with SMTP id b10sf20006188lae.1 for ; Thu, 03 Sep 2015 11:23:59 -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=kjfZ3QXZeJMMHCimRfncGPsTr0FN79nTidwfQ3i5WyM=; b=AGAPLwlXblB7leFwi+rIgDtGpQXoad7qzQKk5jCQOUu8bUF0LcF1jXzaoAEBOUFRNR kXtwckc8sCsdV7t0iq4MmdXECuRv3+2bXm1ZUHQ/fBG/wGg1amJztbJC1rIU7XB7VZX1 YSvsT0LbKwVUk/qNJSy4MzdcHne3aDbc4mBvW4qLBZE7rOSNgWkHV4DFLxsBSq2Tg+s/ SIHBcqD54cUFPlqYGxhzTEt5WgRexkOkDPuxmataaweP8iMNNtIIJ3nigGJ2/rPEwHjk /NteLJF8mqqJ46yov/MCA4peaAO7cl7ABy2Q7uRhGqzpcwD3V5HIgpyNFnZy8hvVng8a wpTg== X-Gm-Message-State: ALoCoQl05Jh0IX/mcOUtJWjKgJwM8QNaceSxgRsPWFAHOLFzVe54NzgsioAN06WgVNHU3OOixxgY X-Received: by 10.194.93.198 with SMTP id cw6mr11115938wjb.3.1441304639069; Thu, 03 Sep 2015 11:23:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.11 with SMTP id ua11ls101055lac.85.gmail; Thu, 03 Sep 2015 11:23:58 -0700 (PDT) X-Received: by 10.152.207.10 with SMTP id ls10mr10452647lac.80.1441304638771; Thu, 03 Sep 2015 11:23:58 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id s12si23836468lbp.106.2015.09.03.11.23.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2015 11:23:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lagj9 with SMTP id j9so34954159lag.2 for ; Thu, 03 Sep 2015 11:23:58 -0700 (PDT) X-Received: by 10.152.198.140 with SMTP id jc12mr13879705lac.19.1441304638619; Thu, 03 Sep 2015 11:23:58 -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 yn10csp1446219lbb; Thu, 3 Sep 2015 11:23:57 -0700 (PDT) X-Received: by 10.140.231.211 with SMTP id b202mr72489341qhc.83.1441304637579; Thu, 03 Sep 2015 11:23:57 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 141si173298qht.87.2015.09.03.11.23.56; Thu, 03 Sep 2015 11:23:57 -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 C24D761B1D; Thu, 3 Sep 2015 18:23:56 +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 AB93B61A52; Thu, 3 Sep 2015 18:23:52 +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 56CC461B1B; Thu, 3 Sep 2015 18:23:49 +0000 (UTC) Received: from mail-ob0-f170.google.com (mail-ob0-f170.google.com [209.85.214.170]) by lists.linaro.org (Postfix) with ESMTPS id 4D37E619DC for ; Thu, 3 Sep 2015 18:23:48 +0000 (UTC) Received: by obqa2 with SMTP id a2so39734646obq.3 for ; Thu, 03 Sep 2015 11:23:47 -0700 (PDT) X-Received: by 10.60.98.40 with SMTP id ef8mr28917129oeb.7.1441304627724; Thu, 03 Sep 2015 11:23:47 -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 wa2sm17311923oeb.2.2015.09.03.11.23.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Sep 2015 11:23:47 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org, maxim.uvarov@linaro.org Date: Thu, 3 Sep 2015 13:23:42 -0500 Message-Id: <1441304622-6537-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 X-Topics: patch Subject: [lng-odp] [PATCH] 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.215.43 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 | 32 ++++++++++++++++++++++ .../linux-generic/include/odp_queue_internal.h | 5 ++-- 4 files changed, 39 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..ef3cf9c --- /dev/null +++ b/platform/linux-generic/include/odp_forward_typedefs.h @@ -0,0 +1,32 @@ +/* Copyright (c) 2013, 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 + * 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);