Added /WX compiler switch (treat warnings as errors)
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6520 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9ed46ac829
commit
89a2cbb770
4 changed files with 26 additions and 3 deletions
|
@ -22,6 +22,8 @@ Released on ?, 2014
|
|||
|
||||
\b Added System::Call direct register memory access type. (\W{http://sf.net/p/nsis/patches/249}{patch #249})
|
||||
|
||||
\b Added WX compiler switch
|
||||
|
||||
\b Fixed POSIX !searchparse bug (\W{http://sf.net/p/nsis/patches/251}{patch #251})
|
||||
|
||||
\b Fixed !macroundef
|
||||
|
|
|
@ -35,6 +35,8 @@ If you want to use MakeNSIS on the command line, the syntax of the makensis comm
|
|||
|
||||
\b /PPO or /SAFEPPO will only run the preprocessor and print the result to stdout. The safe version will not execute instructions like !appendfile or !system. !packhdr and !finalize are never executed.
|
||||
|
||||
\b /WX treats warnings as errors
|
||||
|
||||
\b Using the /D switch one or more times will add to symbols to the globally defined list (See !define).
|
||||
|
||||
\b Using the /X switch one or more times will execute the code you specify following it. Example: "/XAutoCloseWindow false"
|
||||
|
|
|
@ -3409,11 +3409,24 @@ void CEXEBuild::warning_fl(const TCHAR *s, ...)
|
|||
_stprintf(&buf[cchMsg],_T(" (%") NPRIs _T(":%u)"),curfilename,linecnt);
|
||||
|
||||
m_warnings.add(buf,0);
|
||||
notify(MakensisAPI::NOTIFY_WARNING,buf.GetPtr());
|
||||
|
||||
MakensisAPI::notify_e hostcode = MakensisAPI::NOTIFY_WARNING;
|
||||
extern bool g_warnaserror;
|
||||
if (g_warnaserror)
|
||||
hostcode = MakensisAPI::NOTIFY_ERROR, display_warnings = display_errors;
|
||||
notify(hostcode,buf.GetPtr());
|
||||
|
||||
if (display_warnings)
|
||||
{
|
||||
PrintColorFmtMsg_WARN(_T("warning: %") NPRIs _T("\n"),buf.GetPtr());
|
||||
}
|
||||
if (g_warnaserror)
|
||||
{
|
||||
ERROR_MSG(_T("Error: warning treated as error\n"));
|
||||
extern int g_display_errors;
|
||||
if (!has_called_write_output) g_display_errors = false; // This is a hack to avoid the "stale file in %temp%" warning.
|
||||
extern void quit(); quit();
|
||||
}
|
||||
}
|
||||
|
||||
void CEXEBuild::ERROR_MSG(const TCHAR *s, ...) const
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
bool g_dopause=false;
|
||||
bool g_dopause=false, g_warnaserror=false;
|
||||
int g_display_errors=1;
|
||||
FILE *g_output;
|
||||
NStreamEncoding g_outputenc;
|
||||
|
@ -61,7 +61,7 @@ void quit()
|
|||
{
|
||||
if (g_display_errors)
|
||||
{
|
||||
PrintColorFmtMsg_WARN(_T("\nNote: you may have one or two (large) stale temporary file(s)\n")
|
||||
PrintColorFmtMsg_WARN(_T("\nNote: you may have one or two (large) stale temporary file(s) ")
|
||||
_T("left in your temporary directory (Generally this only happens on Windows 9x).\n"));
|
||||
}
|
||||
exit(1);
|
||||
|
@ -169,6 +169,7 @@ static void print_usage()
|
|||
_T(" ") _T(" 3=above normal,2=normal,1=below normal,0=idle\n")
|
||||
#endif
|
||||
_T(" ") OPT_STR _T("Vx verbosity where x is 4=all,3=no script,2=no info,1=no warnings,0=none\n")
|
||||
_T(" ") OPT_STR _T("WX treat warnings as errors\n")
|
||||
_T(" ") OPT_STR _T("Ofile specifies a text file to log compiler output (default is stdout)\n")
|
||||
_T(" ") OPT_STR _T("PAUSE pauses after execution\n")
|
||||
_T(" ") OPT_STR _T("NOCONFIG disables inclusion of <path to makensis.exe>") PLATFORM_PATH_SEPARATOR_STR _T("nsisconf.nsh\n")
|
||||
|
@ -367,6 +368,10 @@ static inline int makensismain(int argc, TCHAR **argv)
|
|||
{
|
||||
no_logo=swname[1] >= _T('0') && swname[1] <= _T('2');
|
||||
}
|
||||
else if (!_tcsicmp(swname,_T("WX")))
|
||||
{
|
||||
g_warnaserror = true;
|
||||
}
|
||||
// This must be parsed last because it will eat other switches
|
||||
else if (S7IsChEqualI('o',swname[0]) && swname[1]) stdoutredirname=swname+1;
|
||||
}
|
||||
|
@ -444,6 +449,7 @@ static inline int makensismain(int argc, TCHAR **argv)
|
|||
{
|
||||
const TCHAR* const swname = &argv[argpos][1];
|
||||
if (!_tcsicmp(swname,_T("PPO")) || !_tcsicmp(swname,_T("SafePPO"))) {} // Already parsed
|
||||
else if (!_tcsicmp(swname,_T("WX"))) {} // Already parsed
|
||||
else if (!_tcsicmp(swname,_T("NOCD"))) do_cd=false;
|
||||
else if (!_tcsicmp(swname,_T("NOCONFIG"))) noconfig=true;
|
||||
else if (!_tcsicmp(swname,_T("PAUSE"))) g_dopause=true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue