From 9c0fb73485cb2c90bb10cb4d3cf1d27e36f9ff01 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 19 Apr 2023 09:40:20 -0600 Subject: Add dynamic_prop::is_constant I noticed many spots checking whether a dynamic property's kind is PROP_CONST. Some spots, I think, are doing a slightly incorrect check -- checking for != PROP_UNDEFINED where == PROP_CONST is actually required, the key thing being that const_val may only be called for PROP_CONST properties. This patch adds dynamic::is_constant and then updates these checks to use it. Regression tested on x86-64 Fedora 36. --- gdb/p-typeprint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/p-typeprint.c') diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index 563f619..a3c2ef8 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -238,7 +238,7 @@ pascal_language::type_print_varspec_prefix (struct type *type, gdb_printf (stream, "("); gdb_printf (stream, "array "); if (type->target_type ()->length () > 0 - && type->bounds ()->high.kind () != PROP_UNDEFINED) + && type->bounds ()->high.is_constant ()) gdb_printf (stream, "[%s..%s] ", plongest (type->bounds ()->low.const_val ()), plongest (type->bounds ()->high.const_val ())); -- cgit v1.1