all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Zhiwei Chen <condy0919@gmail.com>
To: 50331@debbugs.gnu.org
Cc: andlind@gmail.com
Subject: bug#50331: 28.0.50; Propose to obsolete cwarn.el
Date: Thu, 02 Sep 2021 14:30:44 +0800	[thread overview]
Message-ID: <87y28fa3qj.fsf@gmail.com> (raw)


Today, modern compilers can recognize the three cases described in cwarn file.

# semicolon after if/for/while

if (value);
  foo();

g++ -Wall produces helpful diagnostic information:

a.cpp:11:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   11 |     foo();
      |     ^~~


# assignment in expression

if (x = 0)
  foo();

a.cpp:10:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   10 |   if (x = 0);
      |       ~~^~~

g++ -Wall does a great job.


# reference parameter uses

int bar(int& a) {
  return a;
}

I don't think it should be displayed in warning face, it's widely used today.

# conclusion

Since the first two cases are not existent, and the last one is false
positive (IMO), I propose to obsolete cwarn.

CCed Anders Lindgren, the author of cwarn.

-- 
Zhiwei Chen





             reply	other threads:[~2021-09-02  6:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02  6:30 Zhiwei Chen [this message]
2021-09-02  7:27 ` bug#50331: 28.0.50; Propose to obsolete cwarn.el Eli Zaretskii
2021-09-02  8:12   ` Zhiwei Chen
2021-09-02  8:28     ` Eli Zaretskii
2021-09-02  8:51       ` Zhiwei Chen
2021-09-02 11:10 ` Anders Lindgren
2021-09-02 16:12   ` Lars Ingebrigtsen
2021-09-03  6:18 ` bug#50331: [Anders Lindgren] " Zhiwei Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y28fa3qj.fsf@gmail.com \
    --to=condy0919@gmail.com \
    --cc=50331@debbugs.gnu.org \
    --cc=andlind@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.