Great! Attached is an updated version.
Hi Anton,

Here are some suggestions.

-All you need to be able to invoke scan-build from an arbitrary location is to add the path to scan-build to your PATH environment variable. +To invoke scan-build from an arbitrary location, add the path to the folder containing scan-build.bat to your PATH environment variable.

New section uses a lot of bold, which makes it stand out from the rest of the page. How about something like this:

  * If getting unexpected"fatal error: no input files"while building
    with MSYSmake from the Windows cmd, try one of the these solutions:
      o /Use MinGWmingw32-makeinstead of MSYSmake and exclude the path
        to MSYS from PATH to preventmingw32-makefrom using MSYS utils.
        /MSYS utils are dependent on the MSYS runtime and they are not
        intended for being run from the Windows cmd. Specifically,
        makefile commands with backslashed quotes may be heavily
        corrupted when passed for execution.
      o Runmake from the sh shell:


/ $scan-build [options] sh -c "make [options]” // Use the proper formatting for this. like other invocations of scan build./

  * If getting "Error : *** target pattern contains no `%’” while
    using GNU Make 3.81, try to use another version of make.


Please, don’t use <tt> instead of italics for the error messages.

I’ve left out some links and explanations of why the errors happen. I think these are not essential to the user and we want to keep the section brief since the page contains simple scan-build use instructions.

Thanks!
Anna.

On Oct 30, 2014, at 11:03 AM, Anton Yartsev <[email protected] <mailto:[email protected]>> wrote:

Attached is an updated patch.

Anton,

I think the bulleted list might benefit from restructuring a bit to make it sound more like a recommendation on what needs to be done under different circumstances.
Restructured the bulleted list, now it looks much more better.


My understanding is that the most reliable way is to use MinGW instead of make. (This is addressed by the first bullet.)

However, some projects might get away with using make. In that case, the other recommendations (2d and 3d bullet) would apply.
There are two reliable ways - either use pure MinGW or run make from the sh shell. The 2d bullet is really a recipe for healing a problem from the 1st bullet, eliminated it.
Pleas look at the updated list.

Thank you for looking at this!

Is this correct?

Thanks,
Anna.

On Oct 20, 2014, at 1:49 PM, Anton Yartsev <[email protected] <mailto:[email protected]>> wrote:

Updated the "For Windows Users" section with helpful hints, OK to commit?

Anton,

Thanks for the investigation.

Please, send the proposed wording as a patch. (Not sure if it would be possible to describe the symptoms of the problem.)

Anna.
On Oct 18, 2014, at 1:56 AM, Anton Yartsev <[email protected] <mailto:[email protected]>> wrote:

As I was explained in the MSYS community the MSYS utils are dependent on the MSYS runtime and their usage from cmd.exe is unsupported. "You are welcome to try it, but if you observe odd behaviour, such as here, then you are out of luck".

I performed several tests and found out that proper processing is performed with either running scan-build with MSYS make in the following way:
scan-build ... sh -c "make"
or with using mingw32-make and removal of MSYS from PATH (otherwise mingw32-make tries to use MSYS utils).

from the MinGW FAQ:
"What's the difference between make and mingw32-make?
The "native" (i.e.: MSVCRT dependent) port of make is lacking in some functionality and has modified functionality due to the lack of POSIX on Win32. There also exists a version of make in the MSYS distribution that is dependent on the MSYS runtime. This port operates more as make was intended to operate and gives less headaches during execution. Based on this, the MinGW developers/maintainers/packagers decided it would be best to rename the native version so that both the "native" version and the MSYS version could be present at the same time without file name collision."

Is it OK to add the recommendations to thescan-build: running the analyzer from the command line <http://clang-analyzer.llvm.org/scan-build.html#scanbuild_forwindowsusers>, "For Windows Users" section?

Sorry, that's not a solution.

The goal of the patch is to pass unmodified arguments to compilers as they were written in the makefile. Arguments taken from @ARGV may be modified by the system and Perl, at least quotes and backslash sequences are processed. Using this arguments may cause compiler errors. Sometimes system+Perl corrupt arguments completely, for example, using perl from MSYS 1.0 on Windows I got:
Line from makefile:
$(CXX) -DMACRO=\"string\" file.cpp "asd dff ghh" -o file.exe

arguments red from @ARGV by c++-analyzer:
"-DMACRO=\string\" file.cpp -o file.exe"

Please review!


--
Anton

--
Anton
<scan-build.html.patch>

--
Anton
<scan-build.htmlv_02.patch>



--
Anton

Index: scan-build.html
===================================================================
--- scan-build.html	(revision 220907)
+++ scan-build.html	(working copy)
@@ -124,12 +124,34 @@
 
 <h3 id="scanbuild_forwindowsusers">For Windows Users</h3>
 
-<p>Windows users must have Perl installed to use scan-build. Currently scan-build 
-is known to work with the msys perl port.</p>
+<p>Windows users must have Perl installed to use scan-build.</p>
 
-<p>scan-build.bat script allows you to launch scan-build in the same way as it described in the Basic Usage section above.
-All you need to be able to invoke scan-build from an arbitrary location is to add the path to scan-build to your PATH environment variable.</p>
+<p><tt>scan-build.bat</tt> script allows you to launch scan-build in the same
+way as it described in the Basic Usage section above. To invoke scan-build from
+an arbitrary location, add the path to the folder containing scan-build.bat to
+your PATH environment variable.</p>
 
+<p>If you have unexpected compilation/make problems when running scan-build
+with MinGW/MSYS the following information may be helpful:</p>
+
+<ul>
+ <li> If getting unexpected <i>"fatal error: no input files"</i> while building
+with MSYS make from the Windows cmd, try one of the these solutions:</li>
+ <ul>
+ <li> Use MinGW <tt>mingw32-make</tt> instead of MSYS <tt>make</tt> and
+exclude the path to MSYS from PATH to prevent <tt>mingw32-make</tt> from using
+MSYS utils. MSYS utils are dependent on the MSYS runtime and they are not
+intended for being run from the Windows cmd. Specifically, makefile commands
+with backslashed quotes may be heavily corrupted when passed for execution.</li>
+ <li> Run <tt>make</tt> from the sh shell:
+<pre class="code_example">
+$ <span class="code_highlight">scan-build</span> <i>[scan-build options]</i> sh -c "make <i>[make options]</i>"
+</pre></li>
+ </ul>
+ <li> If getting <i>"Error : *** target pattern contains no `%’”</i> while using
+GNU Make 3.81, try to use another version of make.</li>
+</ul>
+
 <h3 id="scanbuild_otheroptions">Other Options</h3>
 
 <p>As mentioned above, extra options can be passed to <tt>scan-build</tt>. These
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to