"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: diff -p redux
To:
Dag-Erling Smørgrav <des@freebsd.org>
Cc:
gameoftrees@openbsd.org, thj@freebsd.org
Date:
Fri, 8 Mar 2024 09:57:30 +0100

Download raw body.

Thread
On Thu, Mar 07, 2024 at 05:22:55PM +0100, Dag-Erling Smørgrav wrote:
> Hi,
> 
> I believe the attached patch solves the issue of function prototype
> detection, cf. dc306c6bd88271ab911e205539974da98be82d17.  It simply
> moves the calculation of chunk_start_line up and passes that to
> diff_output_match_function_prototype(), which can then start the search
> at the line preceding chunk_start_line.
> 
> The patch also includes a change to is_function_prototype() which causes
> it to recognize Objective C methods, feel free to leave it out if you
> don't care about Objective C.

Unfortunately, your patch reintroduces the problems described here:
https://marc.gameoftrees.org/mail/1692696001.69872_0.html

With your patch applied, diff -p shows context lines in hunk headers,
for both cases discussed in the thread linked above (btrace.c and Makefile).
This is the reason the original change made by Tom was backed out.

Example 1:
(using blob 25333f98510f8805602824e43e841f1df4f95769 from OpenBSD src.git)
[[[
@@ -117,6 +117,7 @@ struct dt_evt		 bt_devt;	/* fake event for BEGIN/END *
 struct dtioc_arg_info  **dt_args;	/* array of probe arguments */
 
 struct dt_evt		 bt_devt;	/* fake event for BEGIN/END */
+#define FOO 0
 uint64_t		 bt_filtered;	/* # of events filtered out */
 
 struct syms		*kelf, *uelf;
]]]

With traditional -p behaviour the above hunk header looks like this:

@@ -117,6 +117,7 @@ size_t			 dt_ndtpi;	/* # of elements in the array */


Example 2:
(using blob 62353bfe8ea8bc8fab8208fe41bf34edfdac30d2 from OpenBSD ports.git)
[[[
--- /tmp/1
+++ /tmp/2
@@ -2,7 +2,7 @@ COMMENT =		statically typed systems programming langua
 
 COMMENT =		statically typed systems programming language
 
-DISTNAME =		nim-1.6.12
+DISTNAME =		nim-1.6.14
 EXTRACT_SUFX =		.tar.xz
 
 CATEGORIES =		lang
]]]

With traditional -p behaviour the above hunk header looks like this:

@@ -2,7 +2,7 @@ ONLY_FOR_ARCHS =	amd64 arm64 i386