GNU bug report logs - #75964
Switching the Emacs build to -Wswitch-enum in src/

Previous Next

Package: emacs;

Reported by: Pip Cet <pipcet <at> protonmail.com>

Date: Fri, 31 Jan 2025 09:41:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: acorallo <at> gnu.org, pipcet <at> protonmail.com, eggert <at> cs.ucla.edu, 75964 <at> debbugs.gnu.org, stefankangas <at> gmail.com
Subject: bug#75964: Switching the Emacs build to -Wswitch-enum in src/
Date: Mon, 03 Feb 2025 14:18:16 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  eggert <at> cs.ucla.edu,
>   75964 <at> debbugs.gnu.org,  stefankangas <at> gmail.com,  Andrea Corallo
>  <acorallo <at> gnu.org>
> Date: Sun, 02 Feb 2025 22:01:23 -0500
> 
> > 	      switch (bidi_it->type)
> > 		{
> > 		case STRONG_L:
> > 		  flag = ((embedding_level & 1) == 0
> > 			  ? FLAG_EMBEDDING_INSIDE
> > 			  : FLAG_OPPOSITE_INSIDE);
> > 		  l2r_seen = true;
> > 		  break;
> > 		case STRONG_R:
> > 		case WEAK_EN:
> > 		case WEAK_AN:
> > 		  flag = ((embedding_level & 1) == 1
> > 			  ? FLAG_EMBEDDING_INSIDE
> > 			  : FLAG_OPPOSITE_INSIDE);
> > 		  r2l_seen = true;
> > 		  break;
> > 		case UNKNOWN_BT:
> > 		case WEAK_BN:
> > 		case NEUTRAL_B:
> > 		case STRONG_AL:
> > 		case LRE:
> > 		case LRO:
> > 		case RLE:
> > 		case RLO:
> > 		case PDF:
> > 		case LRI:
> > 		case RLI:
> > 		case FSI:
> > 		case PDI:
> > 		case WEAK_ES:
> > 		case WEAK_ET:
> > 		case WEAK_CS:
> > 		case WEAK_NSM:
> > 		case NEUTRAL_S:
> > 		case NEUTRAL_WS:
> > 		case NEUTRAL_ON:
> > 		default: 		  break;
> > 		}
> >
> > I think that could be rewritten to be more readable in a number of ways,
> 
> The most obvious one is to remove all the `case ..:` just before `default:`.

That's what the current code does:

	      switch (bidi_it->type)
		{
		case STRONG_L:
		  flag = ((embedding_level & 1) == 0
			  ? FLAG_EMBEDDING_INSIDE
			  : FLAG_OPPOSITE_INSIDE);
		  l2r_seen = true;
		  break;
		case STRONG_R:
		case WEAK_EN:
		case WEAK_AN:
		  flag = ((embedding_level & 1) == 1
			  ? FLAG_EMBEDDING_INSIDE
			  : FLAG_OPPOSITE_INSIDE);
		  r2l_seen = true;
		  break;
		default:
		  break;
		}




This bug report was last modified 127 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.