Commit c160e755 authored by Petr Machata's avatar Petr Machata Committed by Petr Machata

In protolibs, allow return types starting with string "typedef"

- The problem was reported by Roman Donchenko.
parent 212945fe
......@@ -380,7 +380,6 @@ parse_typedef_name(struct protolib *plib, char **str)
static int
parse_typedef(struct protolib *plib, struct locus *loc, char **str)
{
(*str) += strlen("typedef");
eat_spaces(str);
char *name = parse_ident(loc, str);
......@@ -1072,7 +1071,7 @@ process_line(struct protolib *plib, struct locus *loc, char *buf)
if (*str == ';' || *str == 0 || *str == '\n' || *str == '#')
return 0;
if (strncmp(str, "typedef", 7) == 0) {
if (try_parse_kwd(&str, "typedef") >= 0) {
parse_typedef(plib, loc, &str);
return 0;
}
......
# This file is part of ltrace.
# Copyright (C) 2012, 2013, 2014 Petr Machata, Red Hat Inc.
# Copyright (C) 2012, 2013, 2014, 2015 Petr Machata, Red Hat Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
......@@ -271,4 +271,17 @@ ltraceMatch1 [ltraceLibTest {
somefunc();
}] {somefunc\(\)} == 1
# Test that a return type can start with a "typedef".
ltraceMatch1 [ltraceLibTest {
typedef typedef1 = int;
typedef1 somefunc();
} {
int somefunc(void);
} {
int somefunc(void) { return 7; }
} {
somefunc();
}] {somefunc\(\)} == 1
ltraceDone
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment