Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.groff.bug > #1845

[bug #58314] [PATCH] preconv.cpp: Add block delimiters for an if-clause

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Ingo Schwarze <INVALID.NOREPLY@gnu.org>
Newsgroups gnu.groff.bug
Subject [bug #58314] [PATCH] preconv.cpp: Add block delimiters for an if-clause
Date Fri, 8 May 2020 08:30:51 -0400 (EDT)
Lines 76
Approved bug-groff@gnu.org
Message-ID <mailman.2416.1588941052.3066.bug-groff@gnu.org> (permalink)
References <20200506-203934.sv93188.74567@savannah.gnu.org> <20200507-222556.sv108747.87164@savannah.gnu.org> <20200508-123050.sv97361.91915@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 1588941052 17959 209.51.188.17 (8 May 2020 12:30:52 GMT)
X-Complaints-To action@cs.stanford.edu
To "G. Branden Robinson" <g.branden.robinson@gmail.com>, Bjarni Ingi Gislason <bjarniig@rhi.hi.is>, Ingo Schwarze <schwarze@usta.de>, 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; OpenBSD amd64; rv:75.0) Gecko/20100101 Firefox/75.0
X-Apparently-From 87.173.115.25 (Savane authenticated user schwarze)
In-Reply-To <20200507-222556.sv108747.87164@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" <bug-groff.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-groff>, <mailto:bug-groff-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-groff>
List-Post <mailto:bug-groff@gnu.org>
List-Help <mailto:bug-groff-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-groff>, <mailto:bug-groff-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <20200508-123050.sv97361.91915@savannah.gnu.org>
X-Mailman-Original-References <20200506-203934.sv93188.74567@savannah.gnu.org> <20200507-222556.sv108747.87164@savannah.gnu.org>
Xref csiph.com gnu.groff.bug:1845

Show key headers only | View raw


Update of bug #58314 (project groff):

                Category:                    Core => Preprocessor preconv   
                Severity:              3 - Normal => 1 - Wish               
                  Status:               Need Info => Invalid                
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #2:

This ticket is now moot because gbranden@ decided to revert the code change
causing the compiler warning, for reasons unrelated to this ticket.

Anyway, i consider opening tickets for personal style issues that  clearly do
not indicate bugs rather pointless behaviour.

> ../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)

Most coding styles agree that

        if (outer) {
                if (inner)
                        do_this();
                else
                        do_that();
        }

is easier to read than

        if (outer)  
                if (inner)
                        do_this();
                else
                        do_that();

which you used.


gbranden@ wrote:

> https://www.gnu.org/prep/standards/html_node/Formatting.html

I don't see that page talking about -Wdangling-else in particular.

> That's not the brace style in use in the codebase.

It is, for example look at the functions unicode_entity() and
conversion_iconv() in the file preconv.cpp which contain if-else statements
right inside if and else clauses and which do use braces on the outer if and
else clauses even though these outer braces are not required by the C
standard.

> My own brace style preference is 1TBS.
> I welcome comments from other groff developers.

Unsurprisingly, my personal preference is K&R style in the BSD KNF variant in
the OpenBSD KNF variant,

  https://man.openbsd.org/style.9

but i don't think that matters here at all.  :-)

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58314>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/

Back to gnu.groff.bug | Previous | Next | Find similar


Thread

[bug #58314] [PATCH] preconv.cpp: Add block delimiters for an if-clause Ingo Schwarze <INVALID.NOREPLY@gnu.org> - 2020-05-08 08:30 -0400

csiph-web