From patchwork Fri Oct 25 13:11:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 99581 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A8BE23858CDA for ; Fri, 25 Oct 2024 13:12:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id D44093858D21 for ; Fri, 25 Oct 2024 13:11:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D44093858D21 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 D44093858D21 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729861919; cv=none; b=qSyg1WvncWXXZtALByQY6m+Xe3hLtdFlxGv0MD47tSO8Gx0IWtSaxARpfXC75nbSYryVacGSerLVQFtV/oEcoQ1JEKiqPXShOf9WSgi72sBRcfXY7pdBl/j98tQL8L9u0v1e3xirnphv51K8FCIyjgOP/S/5piX4x6JJBr1eiAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729861919; c=relaxed/simple; bh=Jrj3psQNLASr3SOOPRwCf6kffnV0Y3r+T5IbEK1RWMo=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=npN7iHV1931TVnMnKo+TWglyVRByei5sAnXRZoEja66+nCMvwJDdQ5Wf2KZhhVjnMeRDqQSqzd65pcTIQx1slsRIZof+sHndk6tYNJ+0tHSMHzXxdobcpUSJiS5YN8vV+JrJMUvUOS57d4JXUzNtKHZkqR4Q5HKws+G0GSEgPe0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729861915; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5v1AY8l7NPG//6SdyOTvwy/ECBya341SCyuVPzmeXLQ=; b=TRn3eFnhvRpgLHgH/PuicdS78FDiFLSUPTSfTqNqbj9FZd950WtReh9+KhLPEHkVp0ptTX 4yMfYM6dM/h/A65Yi8KOUAx85JIWe3sCyEd0Jnwq4QWG5KFaMCOCHemPO8vKgRh2uEWkqg hI5bSMy7PH2gdSzgWw09RQweVsC8+uU= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-658-FI_CLHaaPYaF_Zqmqy_aNw-1; Fri, 25 Oct 2024 09:11:53 -0400 X-MC-Unique: FI_CLHaaPYaF_Zqmqy_aNw-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8969C1956088; Fri, 25 Oct 2024 13:11:52 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.16]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B75A019560A2; Fri, 25 Oct 2024 13:11:51 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 49PDBm5I1443754 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 25 Oct 2024 15:11:49 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 49PDBm581443753; Fri, 25 Oct 2024 15:11:48 +0200 Date: Fri, 25 Oct 2024 15:11:48 +0200 From: Jakub Jelinek To: "Joseph S. Myers" , Eric Gallager Cc: gcc-patches@gcc.gnu.org Subject: [RFC PATCH] c-family: -Wleading-whitespace= argument spelling Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Hi! On Thu, Oct 24, 2024 at 03:33:25PM -0400, Eric Gallager wrote: > On Thu, Oct 24, 2024 at 4:17 AM Jakub Jelinek wrote: > > I've tried to build stage3 with > > -Wleading-whitespace=blanks -Wtrailing-whitespace=blank -Wno-error=leading-whitespace=blanks -Wno-error=trailing-whitespace=blank > > So wait, it's "blanks" (plural) when it's leading, but "blank" > (singular) when it's trailing? That inconsistency bothers me... I've mentioned it already in https://gcc.gnu.org/pipermail/gcc-patches/2024-October/664664.html Citing that here: Not sure about the kinds for the option, given -Wleading-whitespace= uses plural and this option singular and -Wleading-whitespace= spaces means literally just ' ' characters, while space in -Wtrailing-whitespace= was ' ', '\t', '\v' and '\f'; so category; perhaps just use any and blanks? Other preferences? Here is a patch to do the blank->blanks and space->any changes. 2024-10-25 Jakub Jelinek gcc/ * doc/invoke.texi (Wtrailing-whitespace=): Change blank argument to blanks and space argument to any. gcc/c-family/ * c.opt (warn_trailing_whitespace_kind): Change blank to blanks and space to any. gcc/testsuite/ * c-c++-common/cpp/Wtrailing-whitespace-2.c: Use -Wtrailing-whitespace=blanks rather than -Wtrailing-whitespace=blank. * c-c++-common/cpp/Wtrailing-whitespace-3.c: Use -Wtrailing-whitespace=any rather than -Wtrailing-whitespace=space. * c-c++-common/cpp/Wtrailing-whitespace-7.c: Use -Wtrailing-whitespace=blanks rather than -Wtrailing-whitespace=blank. * c-c++-common/cpp/Wtrailing-whitespace-8.c: Use -Wtrailing-whitespace=any rather than -Wtrailing-whitespace=space. Jakub --- gcc/c-family/c.opt.jj 2024-10-23 09:54:23.806659741 +0200 +++ gcc/c-family/c.opt 2024-10-25 15:01:55.739006953 +0200 @@ -1492,18 +1492,18 @@ EnumValue Enum(warn_trailing_whitespace_kind) String(none) Value(0) EnumValue -Enum(warn_trailing_whitespace_kind) String(blank) Value(1) +Enum(warn_trailing_whitespace_kind) String(blanks) Value(1) EnumValue -Enum(warn_trailing_whitespace_kind) String(space) Value(2) +Enum(warn_trailing_whitespace_kind) String(any) Value(2) Wtrailing-whitespace= C ObjC C++ ObjC++ CPP(cpp_warn_trailing_whitespace) CppReason(CPP_W_TRAILING_WHITESPACE) Enum(warn_trailing_whitespace_kind) Joined RejectNegative Var(warn_trailing_whitespace) Init(0) Warning Warn about trailing whitespace on lines except when in raw string literals. Wtrailing-whitespace -C ObjC C++ ObjC++ Alias(Wtrailing-whitespace=,blank,none) Warning -Warn about trailing whitespace on lines except when in raw string literals. Equivalent to Wtrailing-whitespace=blank when enabled or Wtrailing-whitespace=none when disabled. +C ObjC C++ ObjC++ Alias(Wtrailing-whitespace=,blanks,none) Warning +Warn about trailing whitespace on lines except when in raw string literals. Equivalent to Wtrailing-whitespace=blanks when enabled or Wtrailing-whitespace=none when disabled. Wtrigraphs C ObjC C++ ObjC++ CPP(warn_trigraphs) CppReason(CPP_W_TRIGRAPHS) Var(cpp_warn_trigraphs) Init(2) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) --- gcc/doc/invoke.texi.jj 2024-10-23 09:54:23.799659841 +0200 +++ gcc/doc/invoke.texi 2024-10-25 15:02:58.321121856 +0200 @@ -8784,8 +8784,8 @@ This warning is enabled by @option{-Wall Warn about trailing whitespace at the end of lines, including inside of comments, but excluding trailing whitespace in raw string literals. @code{-Wtrailing-whitespace} is equivalent to -@code{-Wtrailing-whitespace=blank} and warns just about trailing space and -horizontal tab characters. @code{-Wtrailing-whitespace=space} warns about +@code{-Wtrailing-whitespace=blanks} and warns just about trailing space and +horizontal tab characters. @code{-Wtrailing-whitespace=any} warns about those or trailing form feed or vertical tab characters. @code{-Wno-trailing-whitespace} or @code{-Wtrailing-whitespace=none} disables the warning, which is the default. --- gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-2.c.jj 2024-10-15 07:53:35.358935155 +0200 +++ gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-2.c 2024-10-25 15:03:37.606566245 +0200 @@ -1,5 +1,5 @@ /* { dg-do compile { target { c || c++11 } } } */ -/* { dg-options "-Wtrailing-whitespace=blank" } */ +/* { dg-options "-Wtrailing-whitespace=blanks" } */ int i; /* { dg-warning "trailing whitespace" "" { target *-*-* } .-1 } */ --- gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-3.c.jj 2024-10-15 07:53:35.358935155 +0200 +++ gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-3.c 2024-10-25 15:05:06.787304962 +0200 @@ -1,5 +1,5 @@ /* { dg-do compile { target { c || c++11 } } } */ -/* { dg-options "-Wtrailing-whitespace=space" } */ +/* { dg-options "-Wtrailing-whitespace=any" } */ int i; /* { dg-warning "trailing whitespace" "" { target *-*-* } .-1 } */ --- gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-7.c.jj 2024-10-15 07:53:35.359935141 +0200 +++ gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-7.c 2024-10-25 15:03:31.477652927 +0200 @@ -1,6 +1,6 @@ /* This test uses intentionally DOS line endings (CR+LF). */ /* { dg-do compile { target { c || c++11 } } } */ -/* { dg-options "-Wtrailing-whitespace=blank" } */ +/* { dg-options "-Wtrailing-whitespace=blanks" } */ int i; /* { dg-warning "trailing whitespace" "" { target *-*-* } .-1 } */ --- gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-8.c.jj 2024-10-15 07:53:35.359935141 +0200 +++ gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-8.c 2024-10-25 15:05:00.563392987 +0200 @@ -1,6 +1,6 @@ /* This test uses intentionally DOS line endings (CR+LF). */ /* { dg-do compile { target { c || c++11 } } } */ -/* { dg-options "-Wtrailing-whitespace=space" } */ +/* { dg-options "-Wtrailing-whitespace=any" } */ int i; /* { dg-warning "trailing whitespace" "" { target *-*-* } .-1 } */