<div dir="rtl"><div dir="ltr">Hi,</div><div dir="ltr"><br></div><div dir="ltr">I am using the clang-format plug in for Visual Studio from <a href="http://llvm.org/builds/">http://llvm.org/builds/</a></div><div dir="ltr">It reformats:</div>

<div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"><font face="courier new, monospace">#  define _NOEXCEPT throw ()</font></div><div><br></div><div> into</div><div><br></div><div><div><font face="courier new, monospace">#define _NOEXCEPT throw()</font></div>

</div><div><br></div><div>removing all extra whitespaces.</div><div><br></div><div>A comment is certainly helpful.</div><div><br></div><div>The compiler catching redefinition mismatch is indeed a good thing since I'm not sure what __config should do if the definitions don't match. It can't just redefine _NOEXCEPT since the client may depend upon the Visual C++ definition. </div>

<div><br></div><div>The best solution would be to replace _NOEXCEPT with _LIBCXX_NOEXCEPT so there won't be a macro name clash with Visual C++. This is a simple change although it will change many files.</div><div>libstdc++ library uses  _GLIBCXX_NOEXCEPT for the purpose</div>

<div><br></div><div> Is such a change OK?</div><div>if not I'd say your patch is the next best alternative.</div><div><br></div><div>Yaron</div><div><br></div></div></div><div class="gmail_extra"><div dir="ltr"><br><br>

<div class="gmail_quote">2014/1/6 G M <span dir="ltr"><<a href="mailto:gmisocpp@gmail.com" target="_blank">gmisocpp@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #ccc solid;padding-left:1ex;padding-right:1ex">

Hi Yaron<div class="gmail_extra"><br><br><div class="gmail_quote"><div class="im">On Tue, Jan 7, 2014 at 12:14 AM, Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div dir="rtl"><div dir="ltr">Hi G M,</div><div dir="ltr">



<br></div><div dir="ltr">This patch will solve the redefinition problem (since it's identical definition) but may get lost if someone manually changes back the format to be consistent with the rest of libcxx or just clang-formats the file without realizing the whitespace is important.</div>



<span><font color="#888888">

<div dir="ltr"><br></div><div dir="ltr">Yaron</div></font></span></div></blockquote><div><br></div></div><div><div>I haven't used clang format, but I'm not aware that clang format would make such a change? Why would it? Have you seen it do this?</div>



<div>I'm leaning to worrying  about that if it happens unless you have a better suggestion.</div><div><br></div><div>If clang-format does make such changes then surely it would still do that if it were wrapped in a #ifndef block.</div>


<div><br></div><div>And we have no guarantee that the #defines will be what we want.</div><div><br></div><div>By always #define 'ing it the compiler will tell us if it doesn't match.</div><div><br></div><div>If we don't define it at all, we can't be sure yvals.h will be included by the time we need _NOEXCEPT. The only other option I can think of is to include yvals.h in __config. That may actually be necessary soon, but I'd rather do that when we need it and not just for this problem.</div>


<div><br></div><div>I think a comment might be helpful though. I've added one in this revision.</div><div><br></div><div>If this reasoning doesn't persuade you this patch is better, I'm ok to go with your patch instead for now. Let me know what you think or if you have another idea.<br>


</div> </div><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div dir="rtl"><span><font color="#888888"><div dir="ltr">



<br></div></font></span></div><div><div><div class="gmail_extra"><div dir="ltr"><br><br><div class="gmail_quote">2014/1/6 G M <span dir="ltr"><<a href="mailto:gmisocpp@gmail.com" target="_blank">gmisocpp@gmail.com</a>></span><br>





<blockquote class="gmail_quote" style="margin:0px 0.8ex;padding-right:1ex;padding-left:1ex;border-right-color:rgb(204,204,204);border-left-color:rgb(204,204,204);border-right-width:1px;border-left-width:1px;border-right-style:solid;border-left-style:solid">



Hi everyone (sorry for the late reply, I've been on holiday)<br><div class="gmail_extra">

<br></div><div class="gmail_extra">Regarding the  _NOEXCEPT macro and it's interaction with MSVC's version of it, mentioned by yaron here:<br>
<br></div><div><div><div class="gmail_quote">On Fri, Dec 27, 2013 at 1:52 AM, Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">
<div dir="rtl"><div dir="ltr">With Visual C++ __config redefines _NOEXCEPT resulting in a warning:</div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"><font face="courier new, monospace">ibcxx\include\__config(434) : warning C4005: '_NOEXCEPT' : macro redefinition</font></div>








<div dir="ltr"><font face="courier new, monospace">        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\yvals.h(25) : see previous definition of '_NOEXCEPT'</font></div><div dir="ltr"><br></div>







<div>
I checked and at least Visual C++ 2012, 2013 define _NOEXCEPT in yvals.h.</div><div><br></div><div>This patch #ifndef _NOEXCEPT to avoid the warning.</div><div><br></div><div>Alternative solution could be to remove it completely, as Visual C++ seems to supply it. Maybe it was for an older version of Visual C++.</div>






<span><font color="#888888">

<div><br></div><div>Yaron</div><div><br></div></font></span></div></div>
</blockquote></div><p><br></p></div></div><div>I actually submitted a "fix" for this myself sometime ago but it seems it got "lost".</div><div class="gmail_extra"><br></div><div class="gmail_extra">MSVC's yvals.h (or something like that) defines _NOEXCEPT as the same thing except for spacing.</div>






<div class="gmail_extra"><br></div><div class="gmail_extra">My previously submitted solution which I'm attaching here again, is just to change libcxx's definition to exactly match (i.e. the white space) MS's definition that MS's yvals.h uses.</div>






<div class="gmail_extra"><br></div><div class="gmail_extra">This stops MSVC from complaining about duplicate definitions when yvals.h is included after __config and effectively removes 100's of warnings for the msvc build of libcxx.<br>






</div><div class="gmail_extra"><br></div><div class="gmail_extra">I can't see any risk to libcxx here on other platforms.</div><div class="gmail_extra"><br></div><div class="gmail_extra">There weren't any objections when I submitted this patch before, it was just forgotten. Any objections to this patch this time?</div>






<div class="gmail_extra"><br></div><div class="gmail_extra">Thanks</div><div class="gmail_extra">PS As a suggestion: It'd be great if the _NOEXCEPT_ macro (as opposed to the one without a trailing _) in libcxx's __config header had a different name. It's too close to _NOEXCEPT and an easy mistake make. MS use _NOEXCEPT_OP instead for _NOEXCEPT_ which I think that's much clearer. A mechanical tool could perhaps be used to make this change? I imagine there's no will to do this though. Just a suggestion anyway.</div>






<div class="gmail_extra"><br></div></blockquote></div></div></div>
</div></div></blockquote></div></div><br></div></blockquote></div></div></div>