<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 12, 2014 at 11:01 AM, Patrik Hägglund H <span dir="ltr"><<a href="mailto:patrik.h.hagglund@ericsson.com" target="_blank">patrik.h.hagglund@ericsson.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">







<div lang="EN-US" link="blue" vlink="purple">
<div><span class="">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">> What was the particular warning here?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
</span><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">../tools/llvm-<span>cov</span>/llvm-cov.cpp:53:49: error: ISO C++ forbids zero-size array '<span>argv</span>'
 [-<span>Werror</span>=pedantic]<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><span>      
</span><span>std</span>::string Invocation(<span>std</span>::string(<span>argv</span>[0]) + " " +
<span>argv</span>[1]);</span></p></span></div></div></blockquote><div><br></div><div>Wait, what... (sorry, not "what"ing you, I'm "what"ing GCC). Is GCC's warning getting confused and thinking 'argv' is a declaration here? (yet then going on to correctly parse this as an expression?<br><br>Does this warning go away if you instead write the code as:<br><br>  std::string Invocation = std::string(argv[0]) + " " + argv[1];<br><br>?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><span class=""><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
</span><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David
 Blaikie [mailto:<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>] <br>
<b>Sent:</b> den 24 augusti 2014 23:15<br>
<b>To:</b> Patrik Hägglund H<br>
<b>Cc:</b> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [llvm] r216344 - Silence gcc -Wpedantic.<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p><br>
On Aug 24, 2014 1:05 PM, "Patrik Hagglund" <<a href="mailto:patrik.h.hagglund@ericsson.com" target="_blank">patrik.h.hagglund@ericsson.com</a>> wrote:<br>
><br>
> Author: patha<br>
> Date: Sun Aug 24 04:12:33 2014<br>
> New Revision: 216344<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=216344&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=216344&view=rev</a><br>
> Log:<br>
> Silence gcc -Wpedantic.<u></u><u></u></p>
<p>What was the particular warning here?<u></u><u></u></p>
<p>><br>
> Modified:<br>
>     llvm/trunk/tools/llvm-cov/llvm-cov.cpp<br>
><br>
> Modified: llvm/trunk/tools/llvm-cov/llvm-cov.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/llvm-cov.cpp?rev=216344&r1=216343&r2=216344&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/llvm-cov.cpp?rev=216344&r1=216343&r2=216344&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-cov/llvm-cov.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-cov/llvm-cov.cpp Sun Aug 24 04:12:33 2014<br>
> @@ -50,7 +50,7 @@ int main(int argc, const char **argv) {<br>
>        func = gcov_main;<br>
><br>
>      if (func) {<br>
> -      std::string Invocation(std::string(argv[0]) + " " + argv[1]);<br>
> +      std::string Invocation(std::string() + argv[0] + " " + argv[1]);<br>
>        argv[1] = Invocation.c_str();<br>
>        return func(argc - 1, argv + 1);<br>
>      }<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><u></u><u></u></p>
</div></div></div>
</div>

</blockquote></div><br></div></div>