[reposting as the first didn't seem to appear in the archives after
a couple hours]
According to the man/info pages for diff, "-p" should "Show which C
function each change is in." However, if the function definition is
within the output context, it searches for the *previous* function.
Reproducible with the following:
===============================
$ cat > one.c <<EOF
int call_me(int maybe)
{
return maybe;
}
int main()
{
return 0;
}
EOF
$ sed s/0/1/ one.c > two.c
$ diff -pu one.c two.c
--- one.c 2012-08-21 12:56:14.446205916 -0500
+++ two.c 2012-08-21 13:06:16.454205832 -0500
@@ -5,5 +5,5 @@ int call_me(int maybe)
int main()
{
- return 0;
+ return 1;
}
$ # how does adding "-p" change the output?
$ diff <(diff -u one.c two) <(diff -pu one.c two.c)
3c3
< @@ -5,5 +5,4 @@
---
> @@ -5,5 +5,4 @@ int call_me(int maybe)
$ diff --version | head -1 # in Debian Stable
diff (GNU diffutils) 3.0
===============================
The edit was made in main(), but diff finds/shows call_me() as the
containing function name. FWIW, the same happens with context
rather than unified diffs.
-tkc