From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id 45465385E03D for ; Mon, 30 May 2022 12:32:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 45465385E03D Received: by mail-wr1-x432.google.com with SMTP id x17so5382811wrg.6 for ; Mon, 30 May 2022 05:32:18 -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:cc; bh=aCjPOAbLeWdEylrWuV7lHFRaIQEg5Yz0ta5iqCoOQQk=; b=r1MIrNC5/Gp/klFC1rzHmgslHE4kKAwYEI5GHiACoGCKFJKY7DJBBrSqvXHOl+5JOo X5zbdWSvRgbhTIBb9NsxRCzu9C8QpC6Ojr/2rcRcD4wVvRmLOG3P24bUFovmTW6SEkVh W2iu9J5ye2IlnfjM5L6yW2Aa5rEM1QidxT9YLYRLpeTEDJtInIHllFm+Z92jwr7UGm6M 6//9Txd7NFjL6fAeKgPJzu61EzTiTC2z+uBXr4flfkPLgq+/Oax0H2bK4ygOQjfU1nmK lgLAS8bvfXpwlFntsoYP8emTFNQZ7mgKemKlbaUuqQ3u7ca8NRj5WCf+YdnU7oPp5mY7 R9aQ== X-Gm-Message-State: AOAM531LLfaLqt0qozAx4AHUPfBV6O3DhS/8U2pAPRgxquyIyHHQvZ8u vcfehvntzfGws2zWeLG4GOdQBIApKWYDaqn8SSY= X-Google-Smtp-Source: ABdhPJyb8yNa8YUsAZZMcTSf45/oRAR7tpwZmby43AU5PlvZrdb22sW4yvOny9Xa4WTZLRLfrapXVN/QMUC+9Q0WkXA= X-Received: by 2002:a5d:6c66:0:b0:20f:86f3:ea05 with SMTP id r6-20020a5d6c66000000b0020f86f3ea05mr39906662wrz.154.1653913936977; Mon, 30 May 2022 05:32:16 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Mon, 30 May 2022 12:32:04 +0000 Message-ID: Subject: Re: Modify the gcc exit code for warning To: disquisitiones Cc: gcc-help X-Spam-Status: No, score=-0.9 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: Mon, 30 May 2022 12:32:20 -0000 On Sun, 29 May 2022, 18:01 disquisitiones via Gcc-help, < gcc-help@gcc.gnu.org> wrote: > 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. > No, the g++ driver spawns a child process to run the cc1plus program, then the parent waits for the child to exit and gets the exit status from the OS. 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++. > There is no file. > Am I on the right track? If so, any hint on where cc1plus stores the > diagnostic context in this temporary file for g++? > Learn about how the fork, exec, and wait functions work. The exit status of a child process is available to the parent process. > >