From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id 611793829BCF for ; Sun, 29 May 2022 18:00:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 611793829BCF Received: by mail-ed1-x529.google.com with SMTP id fd25so10961917edb.3 for ; Sun, 29 May 2022 11:00:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=GczAZv4YO4OUPHRrq440VQtmVVpaCI7M6kdbVBF0ScI=; b=afu5MGOMLGh3mtORfWOsuY2r1KYaqgvZ9lTK6PGCebl0oyTZxZdzBKWw/AtHGIlTvJ zA1faGDRVdNS5pl8q5JR7eWj8yA8BJ4hd/xjh+UNGmGQT5JJzLKMO9fg9q1Q3q8M4nk+ 7Icq+yH0WpLW68xpMQsgHAhiXKxnpU+ylQglX3b/UKSBG9LzoV6aeBW5Lf0aOL2Y7xB2 5FG4Dybq2w8UpcvhBFr8bJGGrcEqqoSdtcqnywlUFS3jeX2vzozLV5+WVvhXwFMlCMb1 7f1GJtsnkVVQty3Ir4tgLUdsRPdZ6RUH8JiCTzvsc+ZZ8CceRHSEk5uGYjdAHzdZF8cV XYFw== X-Gm-Message-State: AOAM531S6KwpiQd9QJUDwZQUvyXxCTG5SRPcBoMU8aV8xqQFiHAE8/er 5WFXrFLFLr7CRWoJl2yQFXL3knRCD+OYDip2LmPObZ+aoQ== X-Google-Smtp-Source: ABdhPJwmGoUkuhcgVXUpHpGHDqP35zN14AWUqHtWSKWTpj08qaYAG4akflSlMd5rozftyvZHAqgPP0oaAg38rfY4Vlk= X-Received: by 2002:a50:d7c6:0:b0:42d:5065:568d with SMTP id m6-20020a50d7c6000000b0042d5065568dmr11796864edj.116.1653847214945; Sun, 29 May 2022 11:00:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: disquisitiones Date: Sun, 29 May 2022 20:00:03 +0200 Message-ID: Subject: Re: Modify the gcc exit code for warning To: gcc-help@gcc.gnu.org X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2022 18:00:18 -0000 Hi and thanks for the hint. I've determined that the following function defined in gcc/gcc.cc (in my understanding the source code related to g++) */* Determine what the exit code of the driver should be. */* *intdriver::get_exit_code () const { ... }* is responsible for the return value of g++. The "warningcount" macro evaluates from the diagnostic context the number of warnings generated in the compilation. The problem is that the warningcount macro evaluates correctly in cc1plus but always evaluates to 0 in g++, so it's not possible to solve the problem modifying only this function. So I think that the information about the warning count is lost from the diagnostic context of cc1plus and the diagnostic context available to g++. Given that g++ and cc1plus are different applications, I assume that cc1plus passes the diagnostic context back to g++ via some temporary file. And maybe the point could be to make cc1plus update also the warning count information in this file, so that it will be available to g++. Am I on the right track? If so, any hint on where cc1plus stores the diagnostic context in this temporary file for g++? Thanks, Luca On Thu, May 26, 2022 at 2:35 AM disquisitiones via Gcc-help wrote: >>* I would like to modify the exit code returned by gcc in case of warning *>* from 0 to some other value, but I'm not familiar with the gcc large source *>* code base. *>>* Could you provide an hint to which is the file in the gcc source code that *>* I should modify for modifying the exit value? * Try to find out where -Werror gets handled. This will lead you to the correct places. Il giorno gio 26 mag 2022 alle ore 02:35 disquisitiones < disquisitiones@gmail.com> ha scritto: > Hi, > > I would like to modify the exit code returned by gcc in case of warning > from 0 to some other value, but I'm not familiar with the gcc large source > code base. > > Could you provide an hint to which is the file in the gcc source code that > I should modify for modifying the exit value? > > Many thanks, > > Luca >