Thread (21 messages) flat view 21 messages, 8 authors, 2016-06-15

Re: [PATCH] attr: map builtin userdiff drivers to well-known extensions

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:52:39

Am 12/16/2011 12:00, schrieb Jeff King:
 static const char *builtin_attr[] = {
...
+	"*.c diff=cpp",
+	"*.cc diff=cpp",
+	"*.cxx diff=cpp",
+	"*.cpp diff=cpp",
+	"*.h diff=cpp",
+	"*.hpp diff=cpp",
Please don't do this. It would be a serious regression for C++ coders, and
some C coders as well. The built-in hunk header patterns are severly
broken and don't work well with C++ code. I know for sure that the
following are not recognized:

- template declarations, e.g. template<class T> func(T x);
- constructor definitionss, e.g. MyClass::MyClass()
- functions that return references, e.g. const string& func()
- function definitions along the GNU coding style, e.g.

     void
     the_func ()

I am currently using this pattern (but I'm sure it can be optimized) with
an appropriate xcpp attribute:

[diff "xcpp"]
        xfuncname = "!^[
\\t]*[a-zA-Z_][a-zA-Z_0-9]*[^()]*:[[:space:]]*$\n^[a-zA-Z_][a-zA-Z_0-9]*.*"

(modulo MUA line wrapping).

-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help