Fixed MinGW (GCC 4.5.2)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6530 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2014-07-19 19:21:43 +00:00
parent 5bfd937bd2
commit 9950ce1432
12 changed files with 50 additions and 22 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -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)
{

View file

@ -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));

View file

@ -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

View file

@ -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;

View file

@ -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));

View file

@ -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;
}

View file

@ -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)