This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ob/pushed] ARI: Remove true/false checks (Re: New ARI warning Thu Oct 13 01:55:56 UTC 2016)


On 10/13/2016 02:55 AM, GDB Administrator wrote:
> 33a34,35
>> gdb/breakpoint.c:14787: regression: false: Definitely do not use 'false' in boolean expressions
> gdb/breakpoint.c:14787:      bool match = false;
>> gdb/breakpoint.c:14799: regression: true: Do not try to use 'true' in boolean expressions
> gdb/breakpoint.c:14799:		match = true;
> 57a60,64
>> gdb/cli/cli-utils.c:134: regression: false: Definitely do not use 'false' in boolean expressions
> gdb/cli/cli-utils.c:134:  m_finished = false;
>> gdb/cli/cli-utils.c:139: regression: false: Definitely do not use 'false' in boolean expressions
> gdb/cli/cli-utils.c:139:  m_in_range = false;
>> gdb/cli/cli-utils.c:158: regression: false: Definitely do not use 'false' in boolean expressions
> gdb/cli/cli-utils.c:158:	  m_in_range = false;
>> gdb/cli/cli-utils.c:189: regression: true: Do not try to use 'true' in boolean expressions
> gdb/cli/cli-utils.c:189:	    m_in_range = true;
>> gdb/cli/cli-utils.c:206: regression: true: Do not try to use 'true' in boolean expressions
> gdb/cli/cli-utils.c:206:  m_in_range = true;
> 592a600,604
>> gdb/tid-parse.c:130: regression: false: Definitely do not use 'false' in boolean expressions
> gdb/tid-parse.c:130:  m_qualified = false;
>> gdb/tid-parse.c:214: regression: true: Do not try to use 'true' in boolean expressions
> gdb/tid-parse.c:214:	  m_qualified = true;
>> gdb/tid-parse.c:218: regression: false: Definitely do not use 'false' in boolean expressions
> gdb/tid-parse.c:218:	    return false;
>> gdb/tid-parse.c:223: regression: false: Definitely do not use 'false' in boolean expressions
> gdb/tid-parse.c:223:	  m_qualified = false;
>> gdb/tid-parse.c:246: regression: false: Definitely do not use 'false' in boolean expressions
> gdb/tid-parse.c:246:      return false;
> 

I pushed the ARI patch below as obvious.  Results in:

$ diff -up ari.before ari.after
--- ari.before  2016-10-13 18:14:38.290291424 +0100
+++ ari.after   2016-10-13 18:19:39.354312583 +0100
@@ -1,10 +1,3 @@
-./breakpoint.c:14787: regression: Definitely do not use `false' in boolean expressions
-./breakpoint.c:14799: regression: Do not try to use `true' in boolean expressions
-./cli/cli-utils.c:134: regression: Definitely do not use `false' in boolean expressions
-./cli/cli-utils.c:139: regression: Definitely do not use `false' in boolean expressions
-./cli/cli-utils.c:158: regression: Definitely do not use `false' in boolean expressions
-./cli/cli-utils.c:189: regression: Do not try to use `true' in boolean expressions
-./cli/cli-utils.c:206: regression: Do not try to use `true' in boolean expressions
 ./command.h:64: regression: Replace var_boolean with add_setshow_boolean_cmd
 ./common/agent.c:152: regression: Do not use strerror(), instead use safe_strerror()
 ./common/agent.c:171: regression: Do not use strerror(), instead use safe_strerror()
@@ -23,11 +16,6 @@
 ./python/py-unwind.c:502: regression: Do not use __FUNCTION__, ISO C 90 does not support this macro
 ./python/py-unwind.c:526: regression: Do not use __FUNCTION__, ISO C 90 does not support this macro
 ./python/py-unwind.c:614: regression: Do not use __FUNCTION__, ISO C 90 does not support this macro
-./tid-parse.c:130: regression: Definitely do not use `false' in boolean expressions
-./tid-parse.c:214: regression: Do not try to use `true' in boolean expressions
-./tid-parse.c:218: regression: Definitely do not use `false' in boolean expressions
-./tid-parse.c:223: regression: Definitely do not use `false' in boolean expressions
-./tid-parse.c:246: regression: Definitely do not use `false' in boolean expressions
 ./utils.c:528: regression: Do not use abort, instead use internal_error; GDB should never abort
 ./utils.c:542: regression: Do not use abort, instead use internal_error; GDB should never abort
 ./utils.c:662: regression: Do not use abort, instead use internal_error; GDB should never abort

[PATCH] ARI: Remove true/false checks

These don't make sense with C++.

gdb/ChangeLog:
2016-10-13  Pedro Alves  <palves@redhat.com>

	* contrib/ari/gdb_ari.sh (boolean): Suggest bool instead.
	(false, true): Remove checks.
---
 gdb/ChangeLog              |  5 +++++
 gdb/contrib/ari/gdb_ari.sh | 22 +---------------------
 2 files changed, 6 insertions(+), 21 deletions(-)
 mode change 100644 => 100755 gdb/contrib/ari/gdb_ari.sh

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0efe9c1..57fdc64 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-13  Pedro Alves  <palves@redhat.com>
+
+	* contrib/ari/gdb_ari.sh (boolean): Suggest bool instead.
+	(false, true): Remove checks.
+
 2016-10-12  Tom Tromey  <tom@tromey.com>
 
 	* machoread.c (macho_symfile_read_all_oso): Use std::string.
diff --git a/gdb/contrib/ari/gdb_ari.sh b/gdb/contrib/ari/gdb_ari.sh
old mode 100644
new mode 100755
index 43f0206..7e639e3
--- a/gdb/contrib/ari/gdb_ari.sh
+++ b/gdb/contrib/ari/gdb_ari.sh
@@ -1136,7 +1136,7 @@ Do not use strnicmp(), instead use strncasecmp()"
 # Boolean expressions and conditionals
 
 BEGIN { doc["boolean"] = "\
-Do not use `boolean'\'',  use `int'\'' instead"
+Do not use `boolean'\'',  use `bool'\'' instead"
     category["boolean"] = ari_regression
 }
 /(^|[^_[:alnum:]])boolean([^_[:alnum:]]|$)/ {
@@ -1145,26 +1145,6 @@ Do not use `boolean'\'',  use `int'\'' instead"
     }
 }
 
-BEGIN { doc["false"] = "\
-Definitely do not use `false'\'' in boolean expressions"
-    category["false"] = ari_regression
-}
-/(^|[^_[:alnum:]])false([^_[:alnum:]]|$)/ {
-    if (is_yacc_or_lex == 0) {
-       fail("false")
-    }
-}
-
-BEGIN { doc["true"] = "\
-Do not try to use `true'\'' in boolean expressions"
-    category["true"] = ari_regression
-}
-/(^|[^_[:alnum:]])true([^_[:alnum:]]|$)/ {
-    if (is_yacc_or_lex == 0) {
-       fail("true")
-    }
-}
-
 # Typedefs that are either redundant or can be reduced to `struct
 # type *''.
 # Must be placed before if assignment otherwise ARI exceptions
-- 
2.5.5



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]