From 973d00665e4ad04402f9f2059bd72ecba745f6e3 Mon Sep 17 00:00:00 2001 From: Chris White Date: Sun, 24 Mar 2024 21:14:38 -0400 Subject: [PATCH] find-file-doc-comments.pl: don't look for a doc comment before the file starts Related to #232 --- find-file-doc-comments.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/find-file-doc-comments.pl b/find-file-doc-comments.pl index bb46662..cc61d63 100755 --- a/find-file-doc-comments.pl +++ b/find-file-doc-comments.pl @@ -105,6 +105,9 @@ sub main { # back to it manually. Move to the first line that might be a doc comment. --$lineno; + # If we ran off the beginning of the file, there's no doc comment. + next if $lineno <= 0; + # TODO make sure we're not still in the definition. # E.g., memblock.h:for_each_mem_range(). The defintion is reported # on the second line of the #define, not the first line.