From patchwork Mon Oct 1 21:33:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 147936 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp4396212lji; Mon, 1 Oct 2018 14:33:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV63w5TTNPQGydmHX+1SWdrpr3z2ImM+/W+ySACFloG1UVMGolWps6lRWzt6eXPlAHL8ajZQ5 X-Received: by 2002:a62:41d6:: with SMTP id g83-v6mr13423265pfd.44.1538429624750; Mon, 01 Oct 2018 14:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538429624; cv=none; d=google.com; s=arc-20160816; b=AoCONSGYolb5On9xCN2J1kmclfjTX/Chp9xzh5NxR8zuT2vDYtPOBXcm2Z7bLS7Oe9 3/G1qE9UqNbMXgl2LTM84nGBMKWmsiUTJVe4rnNuA0KmpUmhrbkD6TiuNR/xYajLdY6y 3EVfrsGzDFiMIMmihYJbXm6PQJqZpkoKr1+jpNYaLpb1PnA7qabmIlZldQHwWQgPpT1I q0i5RG2DLQKQKktGR8ly5FVBk44+BobqqvvqA7ojBHcqWxpfSypRqPApWkfIIGNkObA/ R8NjR9Oi4ZsdcNbCn+Q0b6yTmUpAyihJGcMGn+d/psov11ZchTzfktwdUS1m9fmjhvPx bjuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:dkim-signature :delivered-to:sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=9UrqWkmkHFdU9lfxB+b/do3tnwW/2Yi9CvA/HbXAXck=; b=omgi0MKMV6naT7L23SUPh2Q9ESyaTBmtfT1avdsmUhhRmExwXe2M+5T4blQx72tKi+ dfqBnxZ7BYvSl8ZLFQam8jQZA5HgSGLdH1AZnXtiL8+mp2kGsPyjSiiUGCzR2CTrDvID Ui8X7uvGlOFTHPol4kqt8sPDWD1dWQRgCIUOEwJLaVIBzJhXOnbIkBGOlliETWP5qk3b 8gR1WgOzGetFBaocgMUPtsM+dF8d/FPWG7N/yOYH20iJaNbasTiZZoTyz0KpRQ3JBQ2v 2odKWaRSSC63j7FimBtOckvUSN3VMAypr+JIXslu7ghx2vypb2j1JyQBg5dPBOxgHtV4 jZPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=ijCodksA; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="YoBgc8/o"; spf=pass (google.com: domain of newlib-return-16505-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="newlib-return-16505-patch=linaro.org@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id f1-v6si14524830pln.317.2018.10.01.14.33.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Oct 2018 14:33:44 -0700 (PDT) Received-SPF: pass (google.com: domain of newlib-return-16505-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=ijCodksA; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="YoBgc8/o"; spf=pass (google.com: domain of newlib-return-16505-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="newlib-return-16505-patch=linaro.org@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:from:date:message-id:subject:to :content-type; q=dns; s=default; b=sJwcNmCO57TDEp9RYhwY6PckdkX5j TgU84GhwOjuDccRHu5srQBIDTV+vRlx7oj9Pphv+fzNW7P2VIBmva3BWHGHn4cLT oArfeC0ZkOslcIdw07kPh9KAbP5bOLF12f10frbDRFKUxzZMf4oyK2aauP99D1AG yUcVV+sDVWnI6U= 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:mime-version:from:date:message-id:subject:to :content-type; s=default; bh=n/KPZvNmWY9DsVy+C8raZKtqiRo=; b=ijC odksAPqgO2zaOCmGVEHHg6twth6W/YxKPGpOMocwewOEukL7/8cwMrcweWikudg6 TM6VUMahspPa2IedcZKetA+5x6hBOvU419WWZtshreX02bd4ILmpR5GYXIwAXkx+ 94NfBh3IjJ9E8RpukwgiaEru4R4sdZJxZnzq/2lo= Received: (qmail 38458 invoked by alias); 1 Oct 2018 21:33:36 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Delivered-To: mailing list newlib@sourceware.org Received: (qmail 38440 invoked by uid 89); 1 Oct 2018 21:33:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-ua1-f48.google.com Received: from mail-ua1-f48.google.com (HELO mail-ua1-f48.google.com) (209.85.222.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 01 Oct 2018 21:33:34 +0000 Received: by mail-ua1-f48.google.com with SMTP id y5so1058436uap.4 for ; Mon, 01 Oct 2018 14:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=KaRzYiX87I7VRyGV9bUbXz7Izf6j4AMYirKVEdSzewk=; b=YoBgc8/otwrUReZuSzPUMuPsB6KiaV4KnWFicFgoLVTSuwaxMX5fkdivoONOChwCG6 7ayewW0so2G01iBhEhampOJkU5uB3/qTlOp0Z82/zt9tJpLX8o2ct5jUGYj+x6mJzzTX O/XIVYKVTi5Q52P4QaS9t2wMaV6qrqr5omquM= MIME-Version: 1.0 From: Christophe Lyon Date: Mon, 1 Oct 2018 23:33:20 +0200 Message-ID: Subject: Cast "const char *" pointers to "char *" to avoid compiler warnings. To: newlib@sourceware.org X-IsSubscribed: yes Hi, GCC complains that some assignments loose the const-ness of several data. This small patch adds explicit (char *) casts, but I'm not familiar enough with what newlib does with these to be sure that they are not modified. Maybe the proper fix would be to declare the destinations as "const"? Christophe commit 349a08c43cd4baf0d93f28ea8ca7351bf9606d50 Author: Christophe Lyon Date: Mon Oct 1 18:53:37 2018 +0000 Cast "const char *" pointers to "char *" to avoid compiler warnings. 2018-10-01 Christophe Lyon * newlib/libc/ctype/ctype_.c (__set_ctype): Cast "_ctype_" to "char *". * newlib/libc/ctype/jp2uc.c (_jp2uc_l, _uc2jp_l): Cast output of "__locale_charset()" and "__current_locale_charset()" to "char *". * newlib/libc/locale/locale.c (__loadlocale): Cast "new_locale" to "char *". diff --git a/newlib/libc/ctype/ctype_.c b/newlib/libc/ctype/ctype_.c index 28727e8..851fc06 100644 --- a/newlib/libc/ctype/ctype_.c +++ b/newlib/libc/ctype/ctype_.c @@ -176,7 +176,7 @@ __set_ctype (struct __locale_t *loc, const char *charset) # if defined(ALLOW_NEGATIVE_CTYPE_INDEX) ctype_ptr = _ctype_b; # else - ctype_ptr = _ctype_; + ctype_ptr = (char *) _ctype_; # endif } # if defined(ALLOW_NEGATIVE_CTYPE_INDEX) diff --git a/newlib/libc/ctype/jp2uc.c b/newlib/libc/ctype/jp2uc.c index b89b5ea..00272eb 100644 --- a/newlib/libc/ctype/jp2uc.c +++ b/newlib/libc/ctype/jp2uc.c @@ -166,7 +166,7 @@ __uc2jp (wint_t c, int type) wint_t _jp2uc_l (wint_t c, struct __locale_t * l) { - char * cs = l ? __locale_charset(l) : __current_locale_charset(); + char * cs = l ? (char *) __locale_charset(l) : (char *) __current_locale_charset(); if (0 == strcmp (cs, "JIS")) c = __jp2uc (c, JP_JIS); else if (0 == strcmp (cs, "SJIS")) @@ -186,7 +186,7 @@ _jp2uc (wint_t c) wint_t _uc2jp_l (wint_t c, struct __locale_t * l) { - char * cs = l ? __locale_charset(l) : __current_locale_charset(); + char * cs = l ? (char *) __locale_charset(l) : (char *) __current_locale_charset(); if (0 == strcmp (cs, "JIS")) c = __uc2jp (c, JP_JIS); else if (0 == strcmp (cs, "SJIS")) diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 791a775..79da35f 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -515,7 +515,7 @@ restart: } # define FAIL goto restart #else - locale = new_locale; + locale = (char *) new_locale; # define FAIL return NULL #endif