From patchwork Tue Sep 12 11:38:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 112297 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp5056422qgf; Tue, 12 Sep 2017 04:38:57 -0700 (PDT) X-Received: by 10.84.232.133 with SMTP id i5mr16763682plk.396.1505216337893; Tue, 12 Sep 2017 04:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505216337; cv=none; d=google.com; s=arc-20160816; b=dbiwL6/xEsLpqlVNJ8onM5v/JU0M1V+bbfespGxp24DNnPDWEvxGlQK4UjCQ80XRoy Y/q7MMzQ7ukH2n+pJKLadbA+hwxpBYWa6yKPqtmqYxWh4s0wIRQ/vmddwoKaJXwPQebV xXSChoMwFY/js88ArRaYeZjfRgDIkdxNPH1VGG0lYGSFwXgPFKlSOKEwdN/LrHw5nwaF cYcdTvECZzxhnRytQKiRHdlT7C6D8NJdLXsiLhB2dk7WlP25MoUdMgStLajJVxtouIo8 hNwqN9Zh7FHsMazgyyKGfq1kJIAIYF41kUc+NE+nmMBzq2RSvC4N3vYru2NPqnVnAgz+ pisw== 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:delivered-to:sender :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=8S/rCe3kpQ4e1QnEUg9IfPw9hkEm4zJLSqxALyeCBiQ=; b=fTWO8O17S5YqrAi+cYPzUJO93zWWfzuISJOORWbPfyYxV7/D9jCvOSs9wA1iomZfxk AkVU2gTglqsLxbADXW6/lTPoHYnZR4V/qVqN4qgqlTiD1uJ0ZxMCFCibeFagrITA7TVk U1edE1pZz5ga3AaN81Jv1r+kVXgWakEMuwfJOkji/Qpv3cyFweQ3jVuP5ukLSaTp+jlE ygSx+1oDDQ/YgZr4Td66m3KqRjDlP+lChk8fSTbgOxJjs9l69/i3yBZ28U+gsFiUTSPn xyfo9cqlF4pZunSY/ZH5d1+yI7Xj93X0EMJUw2I3zkBbK4gE6Tcrzwns5s/k1CNkvbFM tVjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kEt+SSrG; spf=pass (google.com: domain of gcc-patches-return-461908-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-461908-patch=linaro.org@gcc.gnu.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 w12si7342140pgr.630.2017.09.12.04.38.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 04:38:57 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-461908-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kEt+SSrG; spf=pass (google.com: domain of gcc-patches-return-461908-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-461908-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=jk19kNqrJ9YTT1FTEAH1ABwlHu99UFXIpg+UYALw0J5bVB VJ914YfdsWD0bacvTNY2NhB3dTD2qa8KFSpbiWxJ3YZBgTyWnS7UtNjmfNEPO9YM 3KRG3uA7uK0d86Q6/5IS2G+CN/f2dXJhTVtQCoWrj7r6+GOY7oAlZHjeDngZg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=AMOFoHLLCcs+ld/2wjsYVoWkWIY=; b=kEt+SSrGYEQqFd9DbrpJ k48h0n7k1Cmcy6zMv6/ibcELcXz4XzliOZDyveq58qqA5tM3Dfcm+hFnLTbharxf 1F1SjzNhHupDDVldczLcRvboGuQUQxPNm7jlsjell8r+TwgDfc8rZFKxuw6WnAG8 iNGVsCUcP511xwFqCI4XjZo= Received: (qmail 59558 invoked by alias); 12 Sep 2017 11:38:47 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 59539 invoked by uid 89); 12 Sep 2017 11:38:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Cast, kin, UD:access, sk:consume X-HELO: mail-wr0-f173.google.com Received: from mail-wr0-f173.google.com (HELO mail-wr0-f173.google.com) (209.85.128.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Sep 2017 11:38:44 +0000 Received: by mail-wr0-f173.google.com with SMTP id m18so21078345wrm.2 for ; Tue, 12 Sep 2017 04:38:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=+fp2auHmRSesRGZLQTxWx/tWyD4VSlCyJgNVOiArONk=; b=qtVo8E2niEyY0Y6K4BZ+2hGiEcB8YezTO5TCgv3Fsfr5rhtxoQuwPyxwOquYAqJ8Xc r4B7S0xROvofyy748x4bEJ21Lz6/mPs/YCf3ky446wWHOVKlVk8RYaKGwhXa8dhPJPJ7 Lc2Qj8GbxDjTqfDIGWlMFMlze6T9rb6IQQHa655d2XT/LDiraqb9dyEaETFabNfmROCl jJ56PhyYFNOa8pR5WDAFRYNae5EjfdqcmVXAOdCnpo+D7F/vBBouLG3dSK6Yl2DN0bHx 5nKLFBpmkOKkzS45JQsMQYAlcB5cUb/mm7OAp85za78WtD4btog/7b5kDNXEGGdBP98n EXbA== X-Gm-Message-State: AHPjjUjgc8dXh6/nuUPqBqn5aYU+socTpbqYrjWsoU+w8Z9wCdDmYGkl 0Y5h4hcw4zZklV1YBRbb4ZWYbky2JMZvT6g3tA== X-Google-Smtp-Source: ADKCNb4iW3SRZ0TGioFxr+BtiSa7k8pPh65szKd3Jh3lxqwWSypF/Fmd7iSV15k6CDPzVtv/1gYdXIgiwvcT69VNnMc= X-Received: by 10.223.138.235 with SMTP id z40mr12911671wrz.14.1505216321792; Tue, 12 Sep 2017 04:38:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.130.110 with HTTP; Tue, 12 Sep 2017 04:38:40 -0700 (PDT) From: Prathamesh Kulkarni Date: Tue, 12 Sep 2017 17:08:40 +0530 Message-ID: Subject: [libgfortran] Replace implicit conversions between enums in io/transfer.c by explicit casts. To: gcc Patches , fortran@gcc.gnu.org X-IsSubscribed: yes Hi, I am working on patch for PR78736 (https://gcc.gnu.org/ml/gcc-patches/2017-09/msg00011.html), which adds a new warning -Wenum-conversion to C front-end to warn for implicit conversion between different enums. The warning in that patch triggered on io/transfer.c for following implicit conversions: i) Implicit conversion from unit_mode to file_mode ii) Implicit conversion from unit_sign_s to unit_sign. I was wondering if the warning for above implicit conversions would be correct since unit_mode and file_mode are different enums and similarly unit_sign_s and unit_sign are different enums ? Or are these warnings false positives ? The attached patch makes the conversion explicit to silence the warnings. Bootstrap+tested on x86_64-unknown-linux-gnu. Does the patch look OK ? Thanks, Prathamesh 2017-09-12 Prathamesh Kulkarni libgfortran/ * io/transfer.c (current_mode): Cast FORM_UNSPECIFIED to file_mode. (formatted_transfer_scalar_read): Cast SIGN_S, SIGN_SS, SIGN_SP to unit_sign. (formatted_transfer_scalar_write): Likewise. diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 529637061b1..3307d213bb7 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -196,7 +196,7 @@ current_mode (st_parameter_dt *dtp) { file_mode m; - m = FORM_UNSPECIFIED; + m = (file_mode) FORM_UNSPECIFIED; if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT) { @@ -1671,17 +1671,17 @@ formatted_transfer_scalar_read (st_parameter_dt *dtp, bt type, void *p, int kind case FMT_S: consume_data_flag = 0; - dtp->u.p.sign_status = SIGN_S; + dtp->u.p.sign_status = (unit_sign) SIGN_S; break; case FMT_SS: consume_data_flag = 0; - dtp->u.p.sign_status = SIGN_SS; + dtp->u.p.sign_status = (unit_sign) SIGN_SS; break; case FMT_SP: consume_data_flag = 0; - dtp->u.p.sign_status = SIGN_SP; + dtp->u.p.sign_status = (unit_sign) SIGN_SP; break; case FMT_BN: @@ -2130,17 +2130,17 @@ formatted_transfer_scalar_write (st_parameter_dt *dtp, bt type, void *p, int kin case FMT_S: consume_data_flag = 0; - dtp->u.p.sign_status = SIGN_S; + dtp->u.p.sign_status = (unit_sign) SIGN_S; break; case FMT_SS: consume_data_flag = 0; - dtp->u.p.sign_status = SIGN_SS; + dtp->u.p.sign_status = (unit_sign) SIGN_SS; break; case FMT_SP: consume_data_flag = 0; - dtp->u.p.sign_status = SIGN_SP; + dtp->u.p.sign_status = (unit_sign) SIGN_SP; break; case FMT_BN: