From patchwork Mon Jul 21 17:17:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 34007 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B9BF720672 for ; Mon, 21 Jul 2014 17:17:46 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id h18sf15234953igc.1 for ; Mon, 21 Jul 2014 10:17:46 -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:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=vW+vebqxQKE8BDKDw5bF61h5TXHdbdQa1iOIgo5iH+I=; b=HaZPv8xfJIRV2XgKJwM3JZl+ArCcONzex0g9AMjcVketd87DSRZIE4FSKhKxoMh4dR CwUER6EpzmGS0Edo4xzt1q3GFyRsyGqfxmJ3MqVVnhqkbGmEooQbiLqIIrAbr6y0QY0T t/em9eQzJPEa5A4tFMMtvxv08PVXDLaHxbhK7aymnrVgBcR9KYiBXTqmkGuyTekdJ5Po B5zuh0sqVeGmuo8SASJJ6JbGrbAb7XObYBHrh7IolOz9f/tlywZ3SNb4iiS7umuZZ/Hp LZwCDQKftuCFrqo5pAS8LnWvOpAI5DWnjvZb44FopTdhEjaX6LPlkG/vlYAjHhsuTTW/ n6TA== X-Gm-Message-State: ALoCoQn02SCKnWomZL2psOZa5PadeskZMeDDTqq92t82PzNSIxWJUSRGj6JJGe39vGW3RqKKw5j4 X-Received: by 10.42.100.138 with SMTP id a10mr4404248ico.32.1405963066265; Mon, 21 Jul 2014 10:17:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.117 with SMTP id b108ls2049716qga.19.gmail; Mon, 21 Jul 2014 10:17:46 -0700 (PDT) X-Received: by 10.53.9.234 with SMTP id dv10mr16356696vdd.56.1405963066099; Mon, 21 Jul 2014 10:17:46 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id sx9si3408367vdb.2.2014.07.21.10.17.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 10:17:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so8004440vcb.7 for ; Mon, 21 Jul 2014 10:17:46 -0700 (PDT) X-Received: by 10.52.37.81 with SMTP id w17mr3336022vdj.95.1405963066002; Mon, 21 Jul 2014 10:17:46 -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.221.37.5 with SMTP id tc5csp129943vcb; Mon, 21 Jul 2014 10:17:45 -0700 (PDT) X-Received: by 10.140.50.133 with SMTP id s5mr7900135qga.33.1405963065493; Mon, 21 Jul 2014 10:17:45 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id m3si29837978qao.110.2014.07.21.10.17.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 21 Jul 2014 10:17:45 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1X9HDc-0000P5-Pt; Mon, 21 Jul 2014 17:17:44 +0000 Received: from mail-la0-f44.google.com ([209.85.215.44]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1X9HDP-0000OR-0K for lng-odp@lists.linaro.org; Mon, 21 Jul 2014 17:17:31 +0000 Received: by mail-la0-f44.google.com with SMTP id e16so5033609lan.31 for ; Mon, 21 Jul 2014 10:17:25 -0700 (PDT) X-Received: by 10.112.25.104 with SMTP id b8mr4936578lbg.95.1405963045014; Mon, 21 Jul 2014 10:17:25 -0700 (PDT) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id 5sm9450990lau.29.2014.07.21.10.17.23 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 10:17:24 -0700 (PDT) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Mon, 21 Jul 2014 20:17:12 +0300 Message-Id: <1405963033-29230-3-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1405963033-29230-1-git-send-email-taras.kondratiuk@linaro.org> References: <1405963033-29230-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/3] debug: Replace ODP_ASSERT with ODP_STATIC_ASSERT X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: taras.kondratiuk@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.220.176 as permitted sender) smtp.mail=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 Replace ODP_ASSERT with ODP_STATIC_ASSERT and stringify error messages. Signed-off-by: Taras Kondratiuk Reviewed-by: Anders Roxell Tested-by: Mike Holmes --- include/helper/odp_eth.h | 6 +++--- include/helper/odp_icmp.h | 2 +- include/helper/odp_ip.h | 4 ++-- include/helper/odp_udp.h | 2 +- .../linux-generic/include/odp_buffer_internal.h | 2 +- .../linux-generic/include/odp_packet_internal.h | 14 +++++++------- .../linux-generic/include/odp_packet_io_queue.h | 4 ++-- platform/linux-generic/include/odp_packet_socket.h | 4 ++-- .../linux-generic/include/odp_timer_internal.h | 8 ++++---- platform/linux-generic/odp_buffer_pool.c | 4 ++-- platform/linux-generic/odp_schedule.c | 2 +- .../linux-keystone2/include/odp_buffer_internal.h | 4 ++-- .../linux-keystone2/include/odp_packet_internal.h | 8 ++++---- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/helper/odp_eth.h b/include/helper/odp_eth.h index 401b915..542594b 100644 --- a/include/helper/odp_eth.h +++ b/include/helper/odp_eth.h @@ -39,7 +39,7 @@ typedef struct ODP_PACKED { } odp_ethaddr_t; /** @internal Compile time assert */ -ODP_ASSERT(sizeof(odp_ethaddr_t) == ODP_ETHADDR_LEN, ODP_ETHADDR_T__SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(odp_ethaddr_t) == ODP_ETHADDR_LEN, "ODP_ETHADDR_T__SIZE_ERROR"); /** * Ethernet header @@ -51,7 +51,7 @@ typedef struct ODP_PACKED { } odp_ethhdr_t; /** @internal Compile time assert */ -ODP_ASSERT(sizeof(odp_ethhdr_t) == ODP_ETHHDR_LEN, ODP_ETHHDR_T__SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(odp_ethhdr_t) == ODP_ETHHDR_LEN, "ODP_ETHHDR_T__SIZE_ERROR"); /** * VLAN header @@ -64,7 +64,7 @@ typedef struct ODP_PACKED { } odp_vlanhdr_t; /** @internal Compile time assert */ -ODP_ASSERT(sizeof(odp_vlanhdr_t) == ODP_VLANHDR_LEN, ODP_VLANHDR_T__SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(odp_vlanhdr_t) == ODP_VLANHDR_LEN, "ODP_VLANHDR_T__SIZE_ERROR"); /* Ethernet header Ether Type ('type') values, a selected few */ diff --git a/include/helper/odp_icmp.h b/include/helper/odp_icmp.h index ab8c409..5ac88b9 100644 --- a/include/helper/odp_icmp.h +++ b/include/helper/odp_icmp.h @@ -90,7 +90,7 @@ typedef struct ODP_PACKED { exceeded*/ /** @internal Compile time assert */ -ODP_ASSERT(sizeof(odp_icmphdr_t) == ODP_ICMPHDR_LEN, ODP_ICMPHDR_T__SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(odp_icmphdr_t) == ODP_ICMPHDR_LEN, "ODP_ICMPHDR_T__SIZE_ERROR"); #ifdef __cplusplus } diff --git a/include/helper/odp_ip.h b/include/helper/odp_ip.h index 6f4e028..fb04e4d 100644 --- a/include/helper/odp_ip.h +++ b/include/helper/odp_ip.h @@ -62,7 +62,7 @@ typedef struct ODP_PACKED { } odp_ipv4hdr_t; /** @internal Compile time assert */ -ODP_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPV4HDR_LEN, ODP_IPV4HDR_T__SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPV4HDR_LEN, "ODP_IPV4HDR_T__SIZE_ERROR"); /** * Check if IPv4 checksum is valid @@ -135,7 +135,7 @@ typedef struct ODP_PACKED { } odp_ipv6hdr_t; /** @internal Compile time assert */ -ODP_ASSERT(sizeof(odp_ipv6hdr_t) == ODP_IPV6HDR_LEN, ODP_IPV6HDR_T__SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(odp_ipv6hdr_t) == ODP_IPV6HDR_LEN, "ODP_IPV6HDR_T__SIZE_ERROR"); /** @name * IP protocol values (IPv4:'proto' or IPv6:'next_hdr') diff --git a/include/helper/odp_udp.h b/include/helper/odp_udp.h index 0ad1541..966d7f3 100644 --- a/include/helper/odp_udp.h +++ b/include/helper/odp_udp.h @@ -93,7 +93,7 @@ static inline uint16_t odp_ipv4_udp_chksum(odp_packet_t pkt) } /** @internal Compile time assert */ -ODP_ASSERT(sizeof(odp_udphdr_t) == ODP_UDPHDR_LEN, ODP_UDPHDR_T__SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(odp_udphdr_t) == ODP_UDPHDR_LEN, "ODP_UDPHDR_T__SIZE_ERROR"); #ifdef __cplusplus } diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 11024f8..bffd0dd 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -96,7 +96,7 @@ typedef struct odp_buffer_hdr_t { } odp_buffer_hdr_t; /* Ensure next header starts from 8 byte align */ -ODP_ASSERT((sizeof(odp_buffer_hdr_t) % 8) == 0, ODP_BUFFER_HDR_T__SIZE_ERROR); +ODP_STATIC_ASSERT((sizeof(odp_buffer_hdr_t) % 8) == 0, "ODP_BUFFER_HDR_T__SIZE_ERROR"); /* Raw buffer header */ diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 45ed412..0ab3be2 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -58,7 +58,7 @@ typedef union { }; } input_flags_t; -ODP_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t), INPUT_FLAGS_SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t), "INPUT_FLAGS_SIZE_ERROR"); /** * Packet error flags @@ -77,7 +77,7 @@ typedef union { }; } error_flags_t; -ODP_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t), ERROR_FLAGS_SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t), "ERROR_FLAGS_SIZE_ERROR"); /** * Packet output flags @@ -92,7 +92,7 @@ typedef union { }; } output_flags_t; -ODP_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t), OUTPUT_FLAGS_SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t), "OUTPUT_FLAGS_SIZE_ERROR"); /** * Internal Packet header @@ -118,10 +118,10 @@ typedef struct { uint8_t buf_data[]; /* start of buffer data area */ } odp_packet_hdr_t; -ODP_ASSERT(sizeof(odp_packet_hdr_t) == ODP_OFFSETOF(odp_packet_hdr_t, buf_data), - ODP_PACKET_HDR_T__SIZE_ERR); -ODP_ASSERT(sizeof(odp_packet_hdr_t) % sizeof(uint64_t) == 0, - ODP_PACKET_HDR_T__SIZE_ERR2); +ODP_STATIC_ASSERT(sizeof(odp_packet_hdr_t) == ODP_OFFSETOF(odp_packet_hdr_t, buf_data), + "ODP_PACKET_HDR_T__SIZE_ERR"); +ODP_STATIC_ASSERT(sizeof(odp_packet_hdr_t) % sizeof(uint64_t) == 0, + "ODP_PACKET_HDR_T__SIZE_ERR2"); /** * Return the packet header diff --git a/platform/linux-generic/include/odp_packet_io_queue.h b/platform/linux-generic/include/odp_packet_io_queue.h index d5f9850..d323a5e 100644 --- a/platform/linux-generic/include/odp_packet_io_queue.h +++ b/platform/linux-generic/include/odp_packet_io_queue.h @@ -24,8 +24,8 @@ extern "C" { /** Max nbr of pkts to receive in one burst (keep same as QUEUE_MULTI_MAX) */ #define ODP_PKTIN_QUEUE_MAX_BURST 16 /* pktin_deq_multi() depends on the condition: */ -ODP_ASSERT(ODP_PKTIN_QUEUE_MAX_BURST >= QUEUE_MULTI_MAX, - ODP_PKTIN_DEQ_MULTI_MAX_ERROR); +ODP_STATIC_ASSERT(ODP_PKTIN_QUEUE_MAX_BURST >= QUEUE_MULTI_MAX, + "ODP_PKTIN_DEQ_MULTI_MAX_ERROR"); int pktin_enqueue(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr); odp_buffer_hdr_t *pktin_dequeue(queue_entry_t *queue); diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h index f6248b2..f991806 100644 --- a/platform/linux-generic/include/odp_packet_socket.h +++ b/platform/linux-generic/include/odp_packet_socket.h @@ -54,8 +54,8 @@ struct ring { struct tpacket_req req; }; -ODP_ASSERT(offsetof(struct ring, mm_space) <= ODP_CACHE_LINE_SIZE, - ERR_STRUCT_RING); +ODP_STATIC_ASSERT(offsetof(struct ring, mm_space) <= ODP_CACHE_LINE_SIZE, + "ERR_STRUCT_RING"); /** Packet socket using mmap rings for both Rx and Tx */ typedef struct { diff --git a/platform/linux-generic/include/odp_timer_internal.h b/platform/linux-generic/include/odp_timer_internal.h index c6e3de6..ad28f53 100644 --- a/platform/linux-generic/include/odp_timer_internal.h +++ b/platform/linux-generic/include/odp_timer_internal.h @@ -53,12 +53,12 @@ typedef struct odp_timeout_hdr_t { -ODP_ASSERT(sizeof(odp_timeout_hdr_t) == +ODP_STATIC_ASSERT(sizeof(odp_timeout_hdr_t) == ODP_OFFSETOF(odp_timeout_hdr_t, buf_data), - ODP_TIMEOUT_HDR_T__SIZE_ERR); + "ODP_TIMEOUT_HDR_T__SIZE_ERR"); -ODP_ASSERT(sizeof(odp_timeout_hdr_t) % sizeof(uint64_t) == 0, - ODP_TIMEOUT_HDR_T__SIZE_ERR2); +ODP_STATIC_ASSERT(sizeof(odp_timeout_hdr_t) % sizeof(uint64_t) == 0, + "ODP_TIMEOUT_HDR_T__SIZE_ERR2"); /** diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c index b73cbb2..a48781a 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -46,8 +46,8 @@ union buffer_type_any_u { odp_timeout_hdr_t tmo; }; -ODP_ASSERT((sizeof(union buffer_type_any_u) % 8) == 0, - BUFFER_TYPE_ANY_U__SIZE_ERR); +ODP_STATIC_ASSERT((sizeof(union buffer_type_any_u) % 8) == 0, + "BUFFER_TYPE_ANY_U__SIZE_ERR"); /* Any buffer type header */ typedef struct { diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 12f192b..9e399f1 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -38,7 +38,7 @@ /* Mask of queues per priority */ typedef uint8_t pri_mask_t; -ODP_ASSERT((8*sizeof(pri_mask_t)) >= QUEUES_PER_PRIO, pri_mask_t_is_too_small); +ODP_STATIC_ASSERT((8*sizeof(pri_mask_t)) >= QUEUES_PER_PRIO, "pri_mask_t_is_too_small"); typedef struct { diff --git a/platform/linux-keystone2/include/odp_buffer_internal.h b/platform/linux-keystone2/include/odp_buffer_internal.h index 3973b5c..d66e88d 100644 --- a/platform/linux-keystone2/include/odp_buffer_internal.h +++ b/platform/linux-keystone2/include/odp_buffer_internal.h @@ -67,8 +67,8 @@ typedef struct odp_buffer_hdr_t { * Chunk of buffers (in single pool) */ -ODP_ASSERT(sizeof(odp_buffer_hdr_t) <= ODP_CACHE_LINE_SIZE*2, - ODP_BUFFER_HDR_T__SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(odp_buffer_hdr_t) <= ODP_CACHE_LINE_SIZE*2, + "ODP_BUFFER_HDR_T__SIZE_ERROR"); static inline odp_buffer_hdr_t *odp_buf_to_hdr(odp_buffer_t buf) { diff --git a/platform/linux-keystone2/include/odp_packet_internal.h b/platform/linux-keystone2/include/odp_packet_internal.h index 8ccf705..a6f7de8 100644 --- a/platform/linux-keystone2/include/odp_packet_internal.h +++ b/platform/linux-keystone2/include/odp_packet_internal.h @@ -58,7 +58,7 @@ typedef union { }; } input_flags_t; -ODP_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t), INPUT_FLAGS_SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t), "INPUT_FLAGS_SIZE_ERROR"); /** * Packet error flags @@ -77,7 +77,7 @@ typedef union { }; } error_flags_t; -ODP_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t), ERROR_FLAGS_SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t), "ERROR_FLAGS_SIZE_ERROR"); /** * Packet output flags @@ -92,7 +92,7 @@ typedef union { }; } output_flags_t; -ODP_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t), OUTPUT_FLAGS_SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t), "OUTPUT_FLAGS_SIZE_ERROR"); /** * Internal Packet header @@ -114,7 +114,7 @@ typedef struct { } odp_packet_hdr_t; -ODP_ASSERT(sizeof(odp_packet_hdr_t) <= 128, ODP_PACKET_HDR_T_SIZE_ERROR); +ODP_STATIC_ASSERT(sizeof(odp_packet_hdr_t) <= 128, "ODP_PACKET_HDR_T_SIZE_ERROR"); /** * Return the packet header