Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: "G. Branden Robinson" Newsgroups: gnu.groff.bug Subject: [bug #58314] [PATCH] preconv.cpp: Add block delimiters for an if-clause Date: Thu, 7 May 2020 18:25:57 -0400 (EDT) Lines: 67 Approved: bug-groff@gnu.org Message-ID: References: <20200506-203934.sv93188.74567@savannah.gnu.org> <20200507-222556.sv108747.87164@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 1588890360 27574 209.51.188.17 (7 May 2020 22:26:00 GMT) X-Complaints-To: action@cs.stanford.edu To: "G. Branden Robinson" , 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: 1.129.111.28 (Savane authenticated user gbranden) In-Reply-To: <20200506-203934.sv93188.74567@savannah.gnu.org> 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: <20200507-222556.sv108747.87164@savannah.gnu.org> X-Mailman-Original-References: <20200506-203934.sv93188.74567@savannah.gnu.org> Xref: csiph.com gnu.groff.bug:1838 Update of bug #58314 (project groff): Status: None => Need Info Assigned to: None => gbranden _______________________________________________________ Follow-up Comment #1: Please remember the '' tag in the future. The Savannah bug renderer on the Web is not very robust in its absence. [comment #0 original submission:] > 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. That's not the brace style in use in the codebase. > 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. I'm aware of all this. My own brace style preference is 1TBS. The groff brace style is pretty close to that mandated by the GNU Coding Standards: https://www.gnu.org/prep/standards/html_node/Formatting.html However, a grep reveals that the existing codebase does not brace 'do-while' structures as GNU instructs. Possibly an oversight, as do-whiles are rare relative to while-do. The code works as I intend (I have a whole pile of negative test cases I can share). Does this warning get thrown for anything else in the groff source tree? I welcome comments from other groff developers. _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via Savannah https://savannah.gnu.org/