From patchwork Thu Apr 30 13:02:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1280367 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=NDlY1ZZe; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49CbC30GxXz9sSd for ; Thu, 30 Apr 2020 23:02:39 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0E05B389851C; Thu, 30 Apr 2020 13:02:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0E05B389851C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588251757; bh=SgBDmNO7mWiaCc3BR0ceXk6Otgq4paXCqleTFEbc7t8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=NDlY1ZZeZGkJGavnKxrpRxERwEZ55hMfZXyS13DLZuFjcMVFM2WgB0//bHPf09Jub MiRw57bU2udRMCQDRNkXBhl3j0YQ12aOJMUYIqSiLLJLCPLblG3+P3K0qxyv29aoor mUEqb126UoGJKN0nDEt5sh7LXBjvGuSb9KwXE4Us= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 74BDE3892007 for ; Thu, 30 Apr 2020 13:02:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 74BDE3892007 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-160-NKTECaE-OwK-EWg2IZ5Z9Q-1; Thu, 30 Apr 2020 09:02:31 -0400 X-MC-Unique: NKTECaE-OwK-EWg2IZ5Z9Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EBB061895A37 for ; Thu, 30 Apr 2020 13:02:30 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-104.ams2.redhat.com [10.36.112.104]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 94729605CB; Thu, 30 Apr 2020 13:02:30 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 03UD2Sj7030375; Thu, 30 Apr 2020 15:02:28 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 03UD2REf030374; Thu, 30 Apr 2020 15:02:27 +0200 Date: Thu, 30 Apr 2020 15:02:27 +0200 To: David Malcolm Subject: [PATCH] diagnostics: get_option_html_page fixes Message-ID: <20200430130227.GV2424@tucnak> MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-16.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi! (Sorry to David, apparently I've posted it only privately, not to gcc-patches, so reposting). While testing the --with-documentation-root-url= changes, I run into [Wreturn-type] URL pointing to gfortran documentation where it obviously isn't documented. The following patch updates the list of options to match reality (on the other side -Wconversion-extra is gfortran only option documented in gfortran.texi). Or, perhaps better use the attached patch instead, which doesn't have a hardcoded list and instead uses the flags? I went through options.c and the updated list of options matches exactly the cases where CL_Fortran is set for "-W*" options together with CL_C and/or CL_CXX (ok, there is also -Wall and -Wextra, but hopefully we don't emit [Wall] or [Wextra] for anything). I have successfully bootstrapped/regtested the second patch (CL_C & CL_CXX) on x86_64-linux and i686-linux, ok for trunk, or do you prefer the first one? 2020-04-30 Jakub Jelinek * opts.c (get_option_html_page): For OPT_Wconversion_extra look in gfortran documentation rather than in generic, while for OPT_Wmaybe_uninitialized, OPT_Wpedantic, OPT_Wreturn_type, OPT_Wuninitialized and OPT_Wunused look in generic documentation rather than gfortran. Jakub 2020-04-30 Jakub Jelinek * opts.c (get_option_html_page): Instead of hardcoding a list of options common between C/C++ and Fortran only use gfortran/ documentation for warnings that have CL_Fortran set but not CL_C or CL_CXX. --- gcc/opts.c.jj 2020-04-30 09:37:17.039303011 +0200 +++ gcc/opts.c 2020-04-30 10:54:20.753713744 +0200 @@ -3141,25 +3141,17 @@ get_option_html_page (int option_index) return "gcc/Static-Analyzer-Options.html"; #ifdef CL_Fortran - if (cl_opt->flags & CL_Fortran) - { - switch (option_index) - { - default: - /* Most Fortran warnings are documented on this page. */ - return "gfortran/Error-and-Warning-Options.html"; - - case OPT_Wdate_time: - case OPT_Wconversion: - case OPT_Wconversion_extra: - case OPT_Wmissing_include_dirs: - case OPT_Wopenmp_simd: - /* These warnings are marked in fortran/lang.opt as - "Documented in C" and thus use the common - Warning-Options page below. */ - break; - } - } + if ((cl_opt->flags & CL_Fortran) != 0 + /* If it is option common to both C/C++ and Fortran, it is documented + in gcc/ rather than gfortran/ docs. */ +#ifdef CL_C + && (cl_opt->flags & CL_C) == 0 +#endif +#ifdef CL_CXX + && (cl_opt->flags & CL_CXX) == 0 +#endif + ) + return "gfortran/Error-and-Warning-Options.html"; #endif return "gcc/Warning-Options.html"; --- gcc/opts.c.jj 2020-04-30 09:37:17.039303011 +0200 +++ gcc/opts.c 2020-04-30 10:27:30.871585618 +0200 @@ -3151,9 +3151,13 @@ get_option_html_page (int option_index) case OPT_Wdate_time: case OPT_Wconversion: - case OPT_Wconversion_extra: + case OPT_Wmaybe_uninitialized: case OPT_Wmissing_include_dirs: case OPT_Wopenmp_simd: + case OPT_Wpedantic: + case OPT_Wreturn_type: + case OPT_Wuninitialized: + case OPT_Wunused: /* These warnings are marked in fortran/lang.opt as "Documented in C" and thus use the common Warning-Options page below. */