diff --git a/Contrib/Library/LibraryLocal/LibraryLocal.cpp b/Contrib/Library/LibraryLocal/LibraryLocal.cpp index 110411b8..cf4807a8 100644 --- a/Contrib/Library/LibraryLocal/LibraryLocal.cpp +++ b/Contrib/Library/LibraryLocal/LibraryLocal.cpp @@ -150,8 +150,8 @@ int _tmain(int argc, TCHAR* argv[]) } else { - fprintf(fHdr, "!define LIBRARY_VERSION_HIGH %u\n", high); - fprintf(fHdr, "!define LIBRARY_VERSION_LOW %u\n", low); + fprintf(fHdr, "!define LIBRARY_VERSION_HIGH %lu\n", high); + fprintf(fHdr, "!define LIBRARY_VERSION_LOW %lu\n", low); } fclose(fHdr); diff --git a/Contrib/Makensisw/makensisw.cpp b/Contrib/Makensisw/makensisw.cpp index ab66cdf7..2bf2ef19 100644 --- a/Contrib/Makensisw/makensisw.cpp +++ b/Contrib/Makensisw/makensisw.cpp @@ -768,7 +768,7 @@ DWORD WINAPI MakeNSISProc(LPVOID TreadParam) { } char oddbyte = (char)(cb % 2), incompsurr; cbofs = 0; - if (incompsurr = IS_HIGH_SURROGATE(p[cch-1])) + if ((incompsurr = IS_HIGH_SURROGATE(p[cch-1]))) wcl = p[--cch], cbofs = sizeof(WCHAR); // Store leading surrogate part and complete it later if (oddbyte) oddbyte = iob[cb-1], ++cbofs; diff --git a/Contrib/System/SConscript b/Contrib/System/SConscript index 0dc36609..676096b0 100644 --- a/Contrib/System/SConscript +++ b/Contrib/System/SConscript @@ -39,17 +39,19 @@ if env['TARGET_ARCH'] != 'amd64' or msvc: # BUGBUG: Call-amd64.S is missing GAS filename = 'Call' + srcsuff src_ascpp = """ - #if 1 /* a C style comment */ - .end + #if 0 /* a C style comment */ + ERROR: assembler-with-cpp required! #else - ERROR! + .end #endif """ conf = env.Configure() if conf.TryCompile('END', '.S'): files += ['Source/'+filename+'.S'] - elif conf.TryCompile(src_ascpp, '.S'): + elif (not msvc) and conf.TryCompile(src_ascpp, '.S'): files += ['Source/'+filename+'CPP.S'] + elif (not msvc) and conf.TryCompile(src_ascpp, '.sx'): + files += ['Source/'+filename+'CPP.sx'] else: print 'WARNING: System.dll: unable to find assembler for '+filename+'.S' conf.Finish() diff --git a/Contrib/System/Source/CallCPP.S b/Contrib/System/Source/CallCPP.S index 0f0a5543..72f68c77 100644 --- a/Contrib/System/Source/CallCPP.S +++ b/Contrib/System/Source/CallCPP.S @@ -1,4 +1,8 @@ #ifdef _MSC_VER #error "MSVC is supposed to use the plain .S file!" #endif +#if 0 +ERROR: assembler-with-cpp required! +#else #include "Call.S" +#endif diff --git a/Contrib/System/Source/CallCPP.sx b/Contrib/System/Source/CallCPP.sx new file mode 100644 index 00000000..c821f056 --- /dev/null +++ b/Contrib/System/Source/CallCPP.sx @@ -0,0 +1,8 @@ +#ifdef _MSC_VER +#error "MSVC is supposed to use the plain .S file!" +#endif +#if 0 +ERROR: assembler-with-cpp required! +#else +#include "CallCPP.S" +#endif diff --git a/Contrib/System/Source/System.c b/Contrib/System/Source/System.c index 4aafbe79..fccfc704 100644 --- a/Contrib/System/Source/System.c +++ b/Contrib/System/Source/System.c @@ -448,11 +448,6 @@ __int64 GetIntFromString(TCHAR **p) return myatoi64(buffer); } -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wuninitialized" // temp3 is set to 0 when we start parsing a new parameter -// must be outside of function for mingw -#endif SystemProc *PrepareProc(BOOL NeedForCall) { int SectionType = PST_PROC, // First section is always proc spec @@ -466,6 +461,10 @@ SystemProc *PrepareProc(BOOL NeedForCall) TCHAR *ibuf, *ib, *sbuf, *cbuf, *cb; unsigned int UsedTString = 0; +#if defined(__GNUC__) && ((__GNUC__ * 1000) + __GNUC_MINOR__) < 4006 + temp3 = 0; // "warning: 'temp3' may be used uninitialized in this function": temp3 is set to 0 when we start parsing a new parameter +#endif + // Retrieve proc specs cb = (cbuf = AllocString()); // Current String buffer sbuf = AllocString(); // Safe String buffer @@ -693,7 +692,14 @@ SystemProc *PrepareProc(BOOL NeedForCall) case _T('0'): case _T('1'): case _T('2'): case _T('3'): case _T('4'): case _T('5'): case _T('6'): case _T('7'): case _T('8'): case _T('9'): // Numeric inline +#if defined(__GNUC__) && ((__GNUC__ * 1000) + __GNUC_MINOR__) >= 4006 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuninitialized" // temp3 is set to 0 when we start parsing a new parameter +#endif if (temp3 == 0) +#if defined(__GNUC__) && ((__GNUC__ * 1000) + __GNUC_MINOR__) >= 4006 +#pragma GCC diagnostic pop +#endif { ib--; // It's stupid, I know, but I'm too lazy to do another thing @@ -762,7 +768,14 @@ SystemProc *PrepareProc(BOOL NeedForCall) if (temp3 == 1) proc->Params[ParamIndex].Output = (int) temp4; // Note: As long as we never assign a pointer to temp4 when parsing a destination the cast to int is OK. // Next parameter is output or something else +#if defined(__GNUC__) && ((__GNUC__ * 1000) + __GNUC_MINOR__) >= 4006 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuninitialized" +#endif temp3++; +#if defined(__GNUC__) && ((__GNUC__ * 1000) + __GNUC_MINOR__) >= 4006 +#pragma GCC diagnostic pop +#endif } ChangesDone = PCD_DONE; @@ -910,9 +923,6 @@ SystemProc *PrepareProc(BOOL NeedForCall) return proc; } -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif void ParamAllocate(SystemProc *proc) { diff --git a/Source/build.cpp b/Source/build.cpp index 4eb10d43..55113413 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -2993,7 +2993,7 @@ int CEXEBuild::write_output(void) ERROR_MSG(_T("Error: can't allocate memory for finalize command\n")); return PS_ERROR; } - *((unsigned char**)&arg) -= (UINT_PTR)cmdstr, *((unsigned char**)&arg) += (UINT_PTR)cmdstrbuf; + arg -= ((UINT_PTR)cmdstr)/sizeof(TCHAR), arg += ((UINT_PTR)cmdstrbuf)/sizeof(TCHAR); _tcscpy(cmdstrbuf,cmdstr); cmdstr = cmdstrbuf; memmove(arg+cchbldoutfile, arg+2, (_tcslen(arg+2)+1)*sizeof(TCHAR)); diff --git a/Source/exehead/Main.c b/Source/exehead/Main.c index 44864ffa..4c01c4cc 100644 --- a/Source/exehead/Main.c +++ b/Source/exehead/Main.c @@ -362,9 +362,9 @@ end: } IS=myGetProcAddress(MGA_InitiateShutdown); - if (IS && !IS(NULL, NULL, 0, SHUTDOWN_RESTART | SHUTDOWN_FORCE_OTHERS | SHUTDOWN_GRACE_OVERRIDE, reason) - || !ExitWindowsEx(EWX_REBOOT, reason) - ) + if ( (IS && !IS(NULL, NULL, 0, SHUTDOWN_RESTART | SHUTDOWN_FORCE_OTHERS | SHUTDOWN_GRACE_OVERRIDE, reason)) + || (!ExitWindowsEx(EWX_REBOOT, reason)) + ) ExecuteCallbackFunction(CB_ONREBOOTFAILED); } #endif//NSIS_SUPPORT_REBOOT diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 8e7b06dd..b86e7718 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -1031,6 +1031,10 @@ static INT_PTR CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l int available_set = 0; unsigned total, available; +#if defined(__GNUC__) && ((__GNUC__ * 1000) + __GNUC_MINOR__) < 4006 + available = 0; // warning: 'available' may be used uninitialized in this function +#endif + GetUIText(IDC_DIR,dir); if (!is_valid_instpath(dir)) error = NSIS_INSTDIR_INVALID; diff --git a/Source/script.cpp b/Source/script.cpp index a3f59d15..f46155b0 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -1400,7 +1400,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) case TOK_P_APPENDFILE: { - WORD tok = 0, cp; + WORD tok = 0, cp = 0; bool bom = false, forceEnc = false; TCHAR *param = line.gettoken_str(++tok), buf[9+1]; my_strncpy(buf,param,COUNTOF(buf)); diff --git a/Source/util.cpp b/Source/util.cpp index 57eb966d..461b9e4b 100644 --- a/Source/util.cpp +++ b/Source/util.cpp @@ -722,7 +722,7 @@ tstring& path_append_separator(tstring& path) { tstring::iterator ib = path.begin(), ie = path.end(); if (ib != ie && !IsPathSeparator(*--ie)) - path.push_back(PLATFORM_PATH_SEPARATOR_C); + path += PLATFORM_PATH_SEPARATOR_STR; return path; } diff --git a/Source/writer.cpp b/Source/writer.cpp index f083e34a..11da07c1 100644 --- a/Source/writer.cpp +++ b/Source/writer.cpp @@ -62,7 +62,7 @@ void writer_sink::write_string(const TCHAR *s, size_t size) if (m_build_unicode) { bool strEnd = false; - TCHAR ch; + TCHAR ch = L'\0'; for (; size ; size--) { if (!strEnd)