From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4384 invoked by alias); 26 Nov 2014 09:39:30 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 4373 invoked by uid 89); 26 Nov 2014 09:39:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f174.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=99mkIkKHrchatioI6X/f+6vwtrXuLT+9uwXrmQm/5e4=; b=BuN9qdfjxgXWa3VggPrJQkbsVwPukH+kvf2Cmr/ISMwHtwFNKKQjuDHgZgjZHV6m10 ZpodO7iiW0V23YatzIdp30IHSxl2MjELRcZWRJukTjsiK8zBw5jDWZSJB5dOZCdbAGZi gz/pg1MVSNv9CtDO4iKTAIUDUaArTcIa6gWbcErbSn1ixEmblbypzgclwc1Z9O9L19sL vxkYQExeV1jJi2SMvT4pdR2ZpGgGhyo7kAgbLVPH/qU1Eq64n37iPlKF1CdfqOBAQf7f LNOUu01pdMBDIFz8+F/YyChhly/+NJjwTs8BtzHTUgobKvlwKz1plUn7/ejr5rNq1fSv Vy1A== X-Gm-Message-State: ALoCoQlz04u1DF2r2rZQNzKhQpktw0N8w1H3Opx6zErpliK9DgLGLu4JOoxpOaRIRSkL+yO9dsKk MIME-Version: 1.0 X-Received: by 10.50.77.74 with SMTP id q10mr19093316igw.30.1416994766486; Wed, 26 Nov 2014 01:39:26 -0800 (PST) In-Reply-To: References: Date: Wed, 26 Nov 2014 09:39:00 -0000 Message-ID: Subject: Re: Fix test-strchr.c warnings for wide string testing From: Will Newton To: Joseph Myers Cc: libc-alpha Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2014-11/txt/msg00759.txt.bz2 On 26 November 2014 at 00:17, Joseph Myers wrote: > 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. Looks ok to me. > 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); > > -- > Joseph S. Myers > joseph@codesourcery.com -- Will Newton Toolchain Working Group, Linaro