]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-family: -Wleading-whitespace= argument spelling
authorJakub Jelinek <jakub@redhat.com>
Sun, 27 Oct 2024 15:42:53 +0000 (16:42 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 27 Oct 2024 15:42:53 +0000 (16:42 +0100)
On Thu, Oct 24, 2024 at 03:33:25PM -0400, Eric Gallager wrote:
> On Thu, Oct 24, 2024 at 4:17 AM Jakub Jelinek <jakub@redhat.com> 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-27  Jakub Jelinek  <jakub@redhat.com>

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.

gcc/c-family/c.opt
gcc/doc/invoke.texi
gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-2.c
gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-3.c
gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-7.c
gcc/testsuite/c-c++-common/cpp/Wtrailing-whitespace-8.c

index af79e4f726b74ac77c891e8d5ead449a754ffc85..3fd331cda829b3f741e742be91d9d7ff713d4cbf 100644 (file)
@@ -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)
index 6f946421462a8074e4d685d9f49d5dc6af20227a..ae52cc68c5116495edff4133c3f9af176aa0583c 100644 (file)
@@ -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.
index b31c925026011bb2b447fd236beab0b1849c7194..b95cd5b3cbb255bf40578052673a495fc60c3814 100644 (file)
@@ -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 } */
index 3c3a9ac4db74ed1b7d4d422dd7fee4e377c07a05..1d42776c76b0e65e4fa344039390af435fbdc30e 100644 (file)
@@ -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 } */
index 6f9bac345668f19bc75adc4e49943eb82cef6af9..79c2160c76c52b87e54c0a995058cb5579a25c89 100644 (file)
@@ -1,6 +1,6 @@
 /* This test uses intentionally DOS line endings (CR+LF).  */\r
 /* { dg-do compile { target { c || c++11 } } } */\r
-/* { dg-options "-Wtrailing-whitespace=blank" } */\r
+/* { dg-options "-Wtrailing-whitespace=blanks" } */\r
 \r
 int i;   \r
 /* { dg-warning "trailing whitespace" "" { target *-*-* } .-1 } */\r
index 29dae90e1e29effe8fc1c2fafc9d3435f59fdf38..5e20ee6a671fb119f4531c850d99782c090a9a36 100644 (file)
@@ -1,6 +1,6 @@
 /* This test uses intentionally DOS line endings (CR+LF).  */\r
 /* { dg-do compile { target { c || c++11 } } } */\r
-/* { dg-options "-Wtrailing-whitespace=space" } */\r
+/* { dg-options "-Wtrailing-whitespace=any" } */\r
 \r
 int i;   \r
 /* { dg-warning "trailing whitespace" "" { target *-*-* } .-1 } */\r