From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 13C7C3858009 for ; Wed, 24 Jan 2024 11:19:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 13C7C3858009 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 13C7C3858009 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706095200; cv=none; b=VMKh/FDYyiyC3NTsEpE02iUMAoqgdZBUE/vYp4JJvyLvypbAMCwABCdbXuBmMrSZ6Vpnfj7QpPMgN5gU4ElIzxuF6xLlRsieFwR8TwbPnN8quMzaIHH07j6eUbXM/6TvKkyPilmG9r+q4KDgLRjgPA81ATAuUHLhVbqnvYa/OmA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706095200; c=relaxed/simple; bh=G7UIrhHXAybZk4sByIYwvjBxw8jNqjHzTOA3J45tOIc=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=hwyBVfUrtgFgmnmaoVNdllnQLJKizW1eZVzP8lZYeKfAR7unmlruxiIR/7Wi5oRcJCzHN+fk6Xjr/HFiU5YzUd7oe80//6gVZsmtkD0DwPxZBn8cyPMzrbYc852u9z8Dv1dnqi+FIz6gUtqVoV4F5/cDW1G1wl1aRERlKGXKHMg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706095197; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7F+VhRWWmbVWKN/SGA4ivTAv0ryXR3oisg2vZ9QOw3s=; b=eL7Di5dA4aQnfgw1t/hOc823ExyaCVxpQ8y9F1FfDMlhNYP7r3wJBHxi5QqaGv6csCvcEL cLQFjjfdIMLyGN1lImo/pzeC+HbaMWWroHpl+Pz+uieggUs+5HkWyTeI5/dqBDMuVqP2bE oaGyKT6XI7va8I9Q6r58DaI575WfNqw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-f56A4djWN2qKIlMjHGLDOw-1; Wed, 24 Jan 2024 06:19:55 -0500 X-MC-Unique: f56A4djWN2qKIlMjHGLDOw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9739229AC02A for ; Wed, 24 Jan 2024 11:19:55 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.192.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 75B712166B32 for ; Wed, 24 Jan 2024 11:19:55 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 64B08A806DE; Wed, 24 Jan 2024 12:19:54 +0100 (CET) Date: Wed, 24 Jan 2024 12:19:54 +0100 From: Corinna Vinschen To: newlib@sourceware.org Subject: Re: -Wall Message-ID: Reply-To: newlib@sourceware.org Mail-Followup-To: newlib@sourceware.org References: <9d3d3c81-e8e1-4e75-b585-d6425cbc5335@systematicsw.ab.ca> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: On Jan 23 22:38, brian.inglis@systematicsw.ab.ca wrote: > On 2024-01-20 11:17, brian.inglis@systematicsw.ab.ca wrote: > > On 2024-01-19 05:55, Corinna Vinschen wrote: > > > if you saw my today's pushes, you're aware that I only found a bug > > > because I used -Wall.  I fixed the bug and a few less crucial warnings. > > > I did NOT fix the warnings in code we took verbatim from some BSDs, > > > which often contain unused variables, or in some cases expressions which > > > are deemed to profit from extra paranthesis, e. g. > > >    if (a >= 0 ^ b == 0) > > > For that reason, I'd like to suggest to add -Wall by default to the > > > build flags for newlib, just as it is already for ages in the Cygwin > > > tree. > > > Anybody having a strong opinion, pro or contra? > > > ++ > > I also like: > >     -Wextra -Wformat=2 -Wformat-overflow=2 -Werror=format-security > > to get more useful warnings, and error if there are security issues like > > totally variable format strings; use `info gcc W...` for descriptions; > > YL/100kmMV > > I have also found the following work well for development with recent gcc: > >     -fanalyzer -fsanitize-recover=all > >     -fstack-check -fstack-protector-all > >     --param=ssp-buffer-size=4 > > but may be inappropriate for production builds; use `info gcc f...` for > > descriptions. > > Linux added -Wstringop-overflow to diagnose provable buffer overflows, > except with GCC == 11 which mishandles the test: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=610347effc2ecb5ededf5037e82240b151f883ab > > For extra Linux warning flags W=1/2/3 available see: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/Makefile.extrawarn This is going a tad bit too far. I was just asking if we should add -Wall unconditionally. I'm fully aware that this doesn't cover all possible warnings an over-protective compiler can generate, but this is, IMHO, a medium sized compromise. Ok or not? Corinna