linespec_parse_line_offset (const char *string)
{
const char *start = string;
- struct line_offset line_offset = {0, LINE_OFFSET_NONE};
+ struct line_offset line_offset;
if (*string == '+')
{
line_offset.sign = LINE_OFFSET_MINUS;
++string;
}
+ else
+ line_offset.sign = LINE_OFFSET_NONE;
if (*string != '\0' && !isdigit (*string))
error (_("malformed line offset: \"%s\""), start);
{
linespec_parser parser (0, language, NULL, NULL, 0, NULL);
- line_offset unknown_offset = { 0, LINE_OFFSET_UNKNOWN };
+ line_offset unknown_offset;
try
{
{
int index = 0;
const char *p;
- struct line_offset offset = {0, LINE_OFFSET_NONE};
+ line_offset offset;
p = (variable[1] == '$') ? variable + 2 : variable + 1;
if (*p == '$')
error (_("History values used in line "
"specs must have integer values."));
offset.offset = value_as_long (val_history);
+ offset.sign = LINE_OFFSET_NONE;
}
else
{
/* Try it as a convenience variable. If it is not a convenience
variable, return and allow normal symbol lookup to occur. */
ivar = lookup_only_internalvar (variable + 1);
- if (ivar == NULL)
- /* No internal variable with that name. Mark the offset
- as unknown to allow the name to be looked up as a symbol. */
- offset.sign = LINE_OFFSET_UNKNOWN;
- else
+ /* If there's no internal variable with that name, let the
+ offset remain as unknown to allow the name to be looked up
+ as a symbol. */
+ if (ivar != nullptr)
{
/* We found a valid variable name. If it is not an integer,
throw an error. */
error (_("Convenience variables used in line "
"specs must have integer values."));
else
- offset.offset = valx;
+ {
+ offset.offset = valx;
+ offset.sign = LINE_OFFSET_NONE;
+ }
}
}
/* A line offset relative to the start of the symbol
identified by the above fields or the current symtab
if the other fields are NULL. */
- struct line_offset line_offset = {0, LINE_OFFSET_UNKNOWN};
+ struct line_offset line_offset;
protected:
explicit_location_spec (const explicit_location_spec &other);