Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Bjarni Ingi Gislason Newsgroups: gnu.groff.bug Subject: [bug #58314] [PATCH] preconv.cpp: Add block delimiters for an if-clause Date: Wed, 6 May 2020 16:39:35 -0400 (EDT) Lines: 88 Approved: bug-groff@gnu.org Message-ID: References: <20200506-203934.sv93188.74567@savannah.gnu.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain;charset=UTF-8 X-Trace: usenet.stanford.edu 1588797580 32064 209.51.188.17 (6 May 2020 20:39:40 GMT) X-Complaints-To: action@cs.stanford.edu To: Bjarni Ingi Gislason , bug-groff@gnu.org Envelope-to: bug-groff@gnu.org X-PHP-Originating-Script: 1001:sendmail.php X-Savane-Server: savannah.gnu.org:443 [209.51.188.72] X-Savane-Project: groff X-Savane-Tracker: bugs X-Savane-Item-ID: 58314 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 X-Apparently-From: 31.209.211.187 (Savane authenticated user bjarniig) In-Reply-To: X-BeenThere: bug-groff@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Bug reports for the GNU version of nroff, troff et al" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20200506-203934.sv93188.74567@savannah.gnu.org> Xref: csiph.com gnu.groff.bug:1832 URL: Summary: [PATCH] preconv.cpp: Add block delimiters for an if-clause Project: GNU troff Submitted by: bjarniig Submitted on: Wed 06 May 2020 08:39:34 PM UTC Category: Core Severity: 3 - Normal Item Group: Warning/Suspicious behaviour Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Planned Release: None _______________________________________________________ Details: >From bfda94f0ffbf1cce3a35370f650564affe4a5535 Mon Sep 17 00:00:00 2001 From: Bjarni Ingi Gislason Date: Wed, 6 May 2020 20:29:43 +0000 Subject: [PATCH] preconv.cpp: Add block delimiters for an if-clause Warning from the compiler: ../src/preproc/preconv/preconv.cpp: In function 'char* get_late_coding_tag(FILE*)': ../src/preproc/preconv/preconv.cpp:959:6: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else] 959 | if (fseek(fp, -limit, SEEK_END) != 0) | ^ Always use block delimiters to help the compiler to know explicitly what belongs to a block. Indention is a pseudo (unreal) structure element, intended only for humans. Compilers don't "see" nor do they count, how many tabs or space characters there are in front of a command word. Signed-off-by: Bjarni Ingi Gislason --- src/preproc/preconv/preconv.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/preproc/preconv/preconv.cpp b/src/preproc/preconv/preconv.cpp index b4da04d0..f068bad6 100644 --- a/src/preproc/preconv/preconv.cpp +++ b/src/preproc/preconv/preconv.cpp @@ -956,11 +956,12 @@ get_late_coding_tag(FILE *fp) if (fseek(fp, 0, SEEK_END) != 0) return NULL; // Seek to `limit` bytes from the end of the buffer, or the beginning. - if (fseek(fp, -limit, SEEK_END) != 0) + if (fseek(fp, -limit, SEEK_END) != 0) { if (errno == EINVAL) rewind(fp); else return NULL; + } char *tmpbuf = (char *) calloc(1, limit + 1 /* trailing '\0' */); if (!tmpbuf) { error("unable to allocate memory"); -- 2.26.2 -verbatim _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via Savannah https://savannah.gnu.org/