<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>That would be a nice improvement. I have some enums with more than 100 elements which cause a lot of warnings.</div><div><br></div><div>Alexandre</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 16, 2010, at 9:12 AM, Chris Lattner wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 16, 2010, at 6:42 AM, Douglas Gregor wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On Sep 16, 2010, at 3:30 AM, Alexandre Colucci wrote:<br><br><blockquote type="cite">Hey,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I noticed that clang++ seems to always use the option '-Wswitch-enum'. Shouldn't it be turned off by default?<br></blockquote><br>No, it's an excellent warning to have on by default.<br><br><blockquote type="cite">Or is there a way to turn it off?<br></blockquote><br>-Wno-switch-enum<font class="Apple-style-span"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><br></div><div>I think that a more serious issue with the warning is that it can produce a *ton* of noise.  In a simple example:</div><div><br></div><div><div>enum x { a, b, c, d, e, f, g };</div><div><br></div><div>void foo(enum x a) {</div><div>  switch (a) {</div><div>  case b:</div><div>  case c: break;</div><div>  }</div><div>}</div><div><br></div><div>we produce:</div><div><br></div><div><div>t.c:4:11: warning: enumeration value 'a' not handled in switch [-Wswitch-enum]</div><div>  switch (a) {</div><div>          ^</div><div>t.c:4:11: warning: enumeration value 'd' not handled in switch [-Wswitch-enum]</div><div>t.c:4:11: warning: enumeration value 'e' not handled in switch [-Wswitch-enum]</div><div>t.c:4:11: warning: enumeration value 'f' not handled in switch [-Wswitch-enum]</div><div>t.c:4:11: warning: enumeration value 'g' not handled in switch [-Wswitch-enum]</div><div>5 warnings generated.</div></div><div><br></div><div>In this case, I think it would be better to emit one warning say:</div><div><br></div><div>t.c:4:11: warning: 5 enumeration values not handled in switch: 'a', 'd', 'e' ... [-Wswitch-enum]</div><div><br></div><div>or something like that.  What do you think?</div></div></div></blockquote><br>I think that's an excellent idea.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">    </span>- Doug</div><br></div></blockquote></div><br></body></html>