From patchwork Thu Sep 3 18:59:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 53047 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id AEB9622E3F for ; Thu, 3 Sep 2015 19:00:10 +0000 (UTC) Received: by laeb10 with SMTP id b10sf20308772lae.1 for ; Thu, 03 Sep 2015 12:00:09 -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=XjdhFx+uVMYDlm4UZhf1djZGqchygb97Gt+SQ3aySsE=; b=DHOpbUm2d0Sm24KExGl4eTRJ2RKLgIeklDkrQnZCS3x/Bsnyy+AV++BucyPGL7CCIl iiVO1bojt59VpgF4I8NuLHBwfPyZV9mORoSSWN6AfpRR/Hw2GWKZ+l+9/uPaCtPqVHBB p/SlWSYPaV1QESmBdcGV216h0RlMQ0Bzlw+1/4Py9AryLlmYrqg0g9CW9Ll69uK68FGt 6ipliLE7tTCN/S33/HE+M9upPJYVUYaJgZHtSm48/qOZE+tZ+cqRSlWlQbZjpKF792y3 Vl5XtXHCLcdeHeMOH9l+/vUqNBA+MeLSxgSXlKrlUuh0B9CHH8X+dyG7HY1r181GI2zb rHYA== X-Gm-Message-State: ALoCoQmvggPLGmWxJcfPNu4Stnc0Ae9yircnWp9I2vDdWucC1DDl4tOsjjNEUbbvQ3XrAmdyHThJ X-Received: by 10.194.118.65 with SMTP id kk1mr4908813wjb.5.1441306809430; Thu, 03 Sep 2015 12:00:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.129 with SMTP id 1ls205422lau.58.gmail; Thu, 03 Sep 2015 12:00:09 -0700 (PDT) X-Received: by 10.112.47.73 with SMTP id b9mr23022068lbn.46.1441306809130; Thu, 03 Sep 2015 12:00:09 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id li5si23937021lab.84.2015.09.03.12.00.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2015 12:00:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbcjc2 with SMTP id jc2so29824907lbc.0 for ; Thu, 03 Sep 2015 12:00:08 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr24101678laf.32.1441306808584; Thu, 03 Sep 2015 12:00:08 -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 yn10csp1463098lbb; Thu, 3 Sep 2015 12:00:07 -0700 (PDT) X-Received: by 10.55.50.7 with SMTP id y7mr42035969qky.86.1441306807615; Thu, 03 Sep 2015 12:00:07 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v23si17644526qkv.126.2015.09.03.11.59.37; Thu, 03 Sep 2015 12:00:07 -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 5A4A761B54; Thu, 3 Sep 2015 18:59:37 +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 0C0AF61B43; Thu, 3 Sep 2015 18:59:32 +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 4A46D61B4D; Thu, 3 Sep 2015 18:59:29 +0000 (UTC) Received: from mail-ob0-f177.google.com (mail-ob0-f177.google.com [209.85.214.177]) by lists.linaro.org (Postfix) with ESMTPS id 5148E61B42 for ; Thu, 3 Sep 2015 18:59:28 +0000 (UTC) Received: by obbbh8 with SMTP id bh8so40623462obb.0 for ; Thu, 03 Sep 2015 11:59:27 -0700 (PDT) X-Received: by 10.60.132.45 with SMTP id or13mr29309534oeb.20.1441306767662; Thu, 03 Sep 2015 11:59:27 -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 w127sm4103514oiw.29.2015.09.03.11.59.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Sep 2015 11:59:26 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org, maxim.uvarov@linaro.org Date: Thu, 3 Sep 2015 13:59:22 -0500 Message-Id: <1441306762-22068-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 X-Topics: patch Subject: [lng-odp] [PATCHv3] linux-generic: general: add odp_forward_typedefs to resolve clang issue 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.171 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 Reviewed-by: Mike Holmes --- platform/linux-generic/Makefile.am | 1 + .../linux-generic/include/odp_buffer_internal.h | 11 ++------ .../include/odp_forward_typedefs_internal.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_internal.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index f2c081a..4c79730 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_internal.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..4cacca1 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_internal.h b/platform/linux-generic/include/odp_forward_typedefs_internal.h new file mode 100644 index 0000000..f8832f7 --- /dev/null +++ b/platform/linux-generic/include/odp_forward_typedefs_internal.h @@ -0,0 +1,32 @@ +/* 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. Note that this file can be extended with additional + * forward typedefs as needed. + */ + +#ifndef ODP_FORWARD_TYPEDEFS_INTERNAL_H_ +#define ODP_FORWARD_TYPEDEFS_INTERNAL_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..19a0f07 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);