From patchwork Wed Nov 26 00:17:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 414931 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ED7C81401AA for ; Wed, 26 Nov 2014 11:17:56 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=xAM3qRjIT67Pm4Ai/j7q1x2ZSL6wh SAzalIOogCqXpEV8EA3ZmrZBF9Taheftaenv0/SZFlhhzXC0RLgYmYrRz9I/7TRF 05OIozp7HO+KQWR2Q7EORfoSt0AB/0gvXxuR4icLX951vLAFk6HN2TsFkbjJ3v0z M+wZki4TzGTHYk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=afmn61V37HyPh+z+chEMX/cy6ZE=; b=G3v gh2EsgEpgi5OqbrikfmGR3IJWhEsdyiwYC6f0l3ZfRxqlrONgE4T+23eZXyrOeY/ 4Vw3ELmzGNzv7BaKv5vDjJhMmJmvatHB1HNBaCG43HrH9uAnJtm+AR5g/VXkUkt/ LUkwrT+stZeGmNPlSeRCnFeiDOaLCxY5N3YJQWaM= Received: (qmail 21289 invoked by alias); 26 Nov 2014 00:17:51 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 21273 invoked by uid 89); 26 Nov 2014 00:17:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Wed, 26 Nov 2014 00:17:44 +0000 From: Joseph Myers To: Subject: Fix test-strchr.c warnings for wide string testing Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 string/test-strchr.c is used for both wide and narrow string testing, but produces a series of warnings for wide string testing because of hardcoded use of narrow characters in the function check1. This patch fixes that function to use macros abstracting away the wide / narrow string choice, adding a new such macro to handle the string and character constants. Tested for x86_64. 2014-11-26 Joseph Myers * string/test-strchr.c [!WIDE] (L): New macro. [WIDE] (L): Likewise. (check1): Use CHAR instead of char. Use L on string and character constants. diff --git a/string/test-strchr.c b/string/test-strchr.c index 12cd9d8..fe2dfd2 100644 --- a/string/test-strchr.c +++ b/string/test-strchr.c @@ -44,6 +44,7 @@ # define MIDDLE_CHAR 127 # define SMALL_CHAR 23 # define UCHAR unsigned char +# define L(s) s #else # include # define STRCHR wcschr @@ -53,6 +54,7 @@ # define MIDDLE_CHAR 1121 # define SMALL_CHAR 851 # define UCHAR wchar_t +# define L(s) L ## s #endif #ifdef USE_FOR_STRCHRNUL @@ -219,9 +221,9 @@ do_random_tests (void) static void check1 (void) { - char s[] __attribute__((aligned(16))) = "\xff"; - char c = '\xfe'; - char *exp_result = stupid_STRCHR (s, c); + CHAR s[] __attribute__((aligned(16))) = L ("\xff"); + CHAR c = L ('\xfe'); + CHAR *exp_result = stupid_STRCHR (s, c); FOR_EACH_IMPL (impl, 0) check_result (impl, s, c, exp_result);