From d08bd3b61ba26f2dcc95e892f54d9aa036830fa4 Mon Sep 17 00:00:00 2001 From: David Engster Date: Sat, 19 Oct 2013 13:35:06 +0200 Subject: [PATCH] C/C++: Fix function pointer parsing * semantic/bovine/c.by (variablearg-opt-name): Support parsing of function pointers inside an argument list. * semantic/bovine/c.el (semantic-c-reconstitute-token): Change handling of function pointers; instead of seeing them as variables, handle them as functions with a 'function-pointer' attribute. Also, correctly deal with function pointers as function arguments. (semantic-c-reconstitute-function-arglist): New function to parse function pointers inside an argument list. (semantic-format-tag-name): Use 'function-pointer' attribute instead of the old 'functionpointer-flag'. * tests/cedet/semantic/test/manual/cedet/testsppreplace.c: * tests/cedet/semantic/test/manual/cedet/testsppreplaced.c: Disable test which now breaks due to improved function pointer parsing. This test is broken anyway, since it just succeeded because the argument list was not parsed at all before this commit. The underlying bug was always present in the semantic preprocessor. --- tests/cedet/semantic/test/manual/cedet/testsppreplace.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- test/manual/cedet/cedet/semantic/tests/testsppreplace.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/manual/cedet/cedet/semantic/tests/testsppreplace.c b/test/manual/cedet/cedet/semantic/tests/testsppreplace.c index 757a53cfb97..ae04d079ca2 100644 --- a/test/manual/cedet/cedet/semantic/tests/testsppreplace.c +++ b/test/manual/cedet/cedet/semantic/tests/testsppreplace.c @@ -151,11 +151,19 @@ OBJ(test) /* expands to ABtest */ /* TEST: Macro Recursion limits in arguments to a macro. * This code is from ALSA (with names changed to moose), noticed by Yupeng. */ + +/* David Engster: + This test is broken. The problem is not an infinite recursion, but that + the mr_moose macro shouldn't be applied when there are no arguments. + That this test succeeded was simply a bug in the function pointer + parser. + #define mr_moose(n) list_entry(n, struct mr_moose, list) struct mr_moose_ops { int (*mr_moose_disconnect)(struct mr_moose *dev); }; +*/ /* END */ -- 2.39.2