From 8090b426b57bd9ebfa4c593ba3e6f939b2911739 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 17 Jul 2017 15:51:55 +0100 Subject: Introduce CP_OPERATOR_STR/CP_OPERATOR_LEN and use throughout Move LENGTH_OF_OPERATOR from cp-support.c to cp-support.h so we can use it elsewhere. Since there's already CP_ANONYMOUS_NAMESPACE_STR/CP_ANONYMOUS_NAMESPACE_LEN there, follow the same naming pattern for the new symbols. gdb/ChangeLog: 2017-07-17 Pedro Alves * c-exp.y (operator_stoken): Use CP_OPERATOR_LEN and CP_OPERATOR_STR. * c-typeprint.c (is_type_conversion_operator): Use CP_OPERATOR_STR. * cp-support.c (LENGTH_OF_OPERATOR): Delete. (cp_find_first_component_aux): Use CP_OPERATOR_STR and CP_OPERATOR_LEN. * cp-support.h (CP_OPERATOR_STR, CP_OPERATOR_LEN): New. * gnu-v2-abi.c (gnuv2_is_operator_name): Use CP_OPERATOR_STR. * gnu-v3-abi.c (gnuv3_is_operator_name): Use CP_OPERATOR_STR. * linespec.c (linespec_lexer_lex_string): Use CP_OPERATOR_LEN and CP_OPERATOR_STR. * location.c: Include "cp-support.h". (explicit_location_lex_one): Use CP_OPERATOR_LEN and CP_OPERATOR_STR. * symtab.c (operator_chars): Use CP_OPERATOR_STR and CP_OPERATOR_LEN. --- gdb/location.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gdb/location.c') diff --git a/gdb/location.c b/gdb/location.c index 87963207ba..d711d7b25b 100644 --- a/gdb/location.c +++ b/gdb/location.c @@ -24,6 +24,7 @@ #include "linespec.h" #include "cli/cli-utils.h" #include "probe.h" +#include "cp-support.h" #include #include @@ -473,8 +474,8 @@ explicit_location_lex_one (const char **inp, { /* Special case: C++ operator,. */ if (language->la_language == language_cplus - && strncmp (*inp, "operator", 8) == 0) - (*inp) += 8; + && startswith (*inp, CP_OPERATOR_STR)) + (*inp) += CP_OPERATOR_LEN; ++(*inp); } } -- cgit v1.2.3