all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#50331: 28.0.50; Propose to obsolete cwarn.el
@ 2021-09-02  6:30 Zhiwei Chen
  2021-09-02  7:27 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Zhiwei Chen @ 2021-09-02  6:30 UTC (permalink / raw)
  To: 50331; +Cc: andlind


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





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-09-03  6:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-02  6:30 bug#50331: 28.0.50; Propose to obsolete cwarn.el Zhiwei Chen
2021-09-02  7:27 ` 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

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.