From: <and...@us...> - 2014-07-11 21:57:03
|
Revision: 6520 http://sourceforge.net/p/nsis/code/6520 Author: anders_k Date: 2014-07-11 21:57:00 +0000 (Fri, 11 Jul 2014) Log Message: ----------- Added /WX compiler switch (treat warnings as errors) Modified Paths: -------------- NSIS/trunk/Docs/src/history.but NSIS/trunk/Docs/src/usage.but NSIS/trunk/Source/build.cpp NSIS/trunk/Source/makenssi.cpp Modified: NSIS/trunk/Docs/src/history.but =================================================================== --- NSIS/trunk/Docs/src/history.but 2014-07-11 21:11:11 UTC (rev 6519) +++ NSIS/trunk/Docs/src/history.but 2014-07-11 21:57:00 UTC (rev 6520) @@ -22,6 +22,8 @@ \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 Modified: NSIS/trunk/Docs/src/usage.but =================================================================== --- NSIS/trunk/Docs/src/usage.but 2014-07-11 21:11:11 UTC (rev 6519) +++ NSIS/trunk/Docs/src/usage.but 2014-07-11 21:57:00 UTC (rev 6520) @@ -35,6 +35,8 @@ \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" Modified: NSIS/trunk/Source/build.cpp =================================================================== --- NSIS/trunk/Source/build.cpp 2014-07-11 21:11:11 UTC (rev 6519) +++ NSIS/trunk/Source/build.cpp 2014-07-11 21:57:00 UTC (rev 6520) @@ -3409,11 +3409,24 @@ _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 Modified: NSIS/trunk/Source/makenssi.cpp =================================================================== --- NSIS/trunk/Source/makenssi.cpp 2014-07-11 21:11:11 UTC (rev 6519) +++ NSIS/trunk/Source/makenssi.cpp 2014-07-11 21:57:00 UTC (rev 6520) @@ -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 @@ { 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 @@ _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 @@ { 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 @@ { 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; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |