[ltrace-commits] 01/03: In protolibs, allow return types starting with string "typedef"
Petr Machata
pmachata-guest at moszumanska.debian.org
Mon Apr 20 07:48:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
pmachata-guest pushed a commit to branch master
in repository ltrace.
commit c91343359db6743e7476022564f40f7f6a8324b4
Author: Petr Machata <pmachata at redhat.com>
Date: Mon Apr 20 09:43:35 2015 +0200
In protolibs, allow return types starting with string "typedef"
- The problem was reported by Roman Donchenko.
---
read_config_file.c | 3 +--
testsuite/ltrace.main/parameters2.exp | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/read_config_file.c b/read_config_file.c
index 427c0ea..6c48b38 100644
--- a/read_config_file.c
+++ b/read_config_file.c
@@ -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;
}
diff --git a/testsuite/ltrace.main/parameters2.exp b/testsuite/ltrace.main/parameters2.exp
index 1c7b3b4..01e707b 100644
--- a/testsuite/ltrace.main/parameters2.exp
+++ b/testsuite/ltrace.main/parameters2.exp
@@ -1,5 +1,5 @@
# 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
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/ltrace.git
More information about the ltrace-commits
mailing list