mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-20 23:03:14 +01:00
Use the new Port::stricmp() method.
This commit is contained in:
@@ -40,12 +40,6 @@
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include <map>
|
||||
|
||||
#if _WIN32
|
||||
#define strcasecmp(s1, s2) _stricmp(s1, s2)
|
||||
#else
|
||||
#define strcasecmp(s1, s2) strcmp(s1, s2)
|
||||
#endif
|
||||
|
||||
static llvm::cl::opt<bool> preservePaths("op",
|
||||
llvm::cl::desc("Do not strip paths from source file"),
|
||||
llvm::cl::ZeroOrMore);
|
||||
@@ -213,7 +207,7 @@ File* Module::buildFilePath(const char* forcename, const char* path, const char*
|
||||
// allow for .o and .obj on windows
|
||||
#if _WIN32
|
||||
if (ext == global.params.objdir && FileName::ext(argobj)
|
||||
&& strcasecmp(FileName::ext(argobj), global.obj_ext_alt) == 0)
|
||||
&& Port::stricmp(FileName::ext(argobj), global.obj_ext_alt) == 0)
|
||||
return new File((char*)argobj);
|
||||
#endif
|
||||
return new File(FileName::forceExt(argobj, ext));
|
||||
@@ -313,17 +307,17 @@ void Module::buildTargetFiles(bool singleObj)
|
||||
hdrfile = Module::buildFilePath(global.params.hdrname, global.params.hdrdir, global.hdr_ext);
|
||||
|
||||
// safety check: never allow obj, doc or hdr file to have the source file's name
|
||||
if(strcasecmp(FileName::name(objfile->name->str), FileName::name((char*)this->arg)) == 0)
|
||||
if(Port::stricmp(FileName::name(objfile->name->str), FileName::name((char*)this->arg)) == 0)
|
||||
{
|
||||
error("Output object files with the same name as the source file are forbidden");
|
||||
fatal();
|
||||
}
|
||||
if(docfile && strcasecmp(FileName::name(docfile->name->str), FileName::name((char*)this->arg)) == 0)
|
||||
if(docfile && Port::stricmp(FileName::name(docfile->name->str), FileName::name((char*)this->arg)) == 0)
|
||||
{
|
||||
error("Output doc files with the same name as the source file are forbidden");
|
||||
fatal();
|
||||
}
|
||||
if(hdrfile && strcasecmp(FileName::name(hdrfile->name->str), FileName::name((char*)this->arg)) == 0)
|
||||
if(hdrfile && Port::stricmp(FileName::name(hdrfile->name->str), FileName::name((char*)this->arg)) == 0)
|
||||
{
|
||||
error("Output header files with the same name as the source file are forbidden");
|
||||
fatal();
|
||||
|
||||
@@ -340,12 +340,12 @@ char *Port::strupr(char *s)
|
||||
|
||||
int Port::memicmp(const char *s1, const char *s2, int n)
|
||||
{
|
||||
return ::memicmp(s1, s2, n);
|
||||
return ::_memicmp(s1, s2, n);
|
||||
}
|
||||
|
||||
int Port::stricmp(const char *s1, const char *s2)
|
||||
{
|
||||
return ::stricmp(s1, s2);
|
||||
return ::_stricmp(s1, s2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -51,12 +51,6 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if _WIN32
|
||||
#define strcasecmp(s1, s2) _stricmp(s1, s2)
|
||||
#else
|
||||
#define strcasecmp(s1, s2) strcmp(s1, s2)
|
||||
#endif
|
||||
|
||||
// Needs Type already declared.
|
||||
#include "cond.h"
|
||||
|
||||
@@ -806,9 +800,9 @@ int main(int argc, char** argv)
|
||||
if (strcmp(ext, global.obj_ext) == 0 ||
|
||||
strcmp(ext, global.bc_ext) == 0)
|
||||
#else
|
||||
if (strcasecmp(ext, global.obj_ext) == 0 ||
|
||||
strcasecmp(ext, global.obj_ext_alt) == 0 ||
|
||||
strcasecmp(ext, global.bc_ext) == 0)
|
||||
if (Port::stricmp(ext, global.obj_ext) == 0 ||
|
||||
Port::stricmp(ext, global.obj_ext_alt) == 0 ||
|
||||
Port::stricmp(ext, global.bc_ext) == 0)
|
||||
#endif
|
||||
{
|
||||
global.params.objfiles->push(static_cast<char *>(files.data[i]));
|
||||
@@ -818,9 +812,9 @@ int main(int argc, char** argv)
|
||||
#if POSIX
|
||||
if (strcmp(ext, "a") == 0)
|
||||
#elif __MINGW32__
|
||||
if (stricmp(ext, "a") == 0)
|
||||
if (Port::stricmp(ext, "a") == 0)
|
||||
#else
|
||||
if (strcasecmp(ext, "lib") == 0)
|
||||
if (Port::stricmp(ext, "lib") == 0)
|
||||
#endif
|
||||
{
|
||||
global.params.libfiles->push(static_cast<char *>(files.data[i]));
|
||||
@@ -841,27 +835,27 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
#if !POSIX
|
||||
if (strcasecmp(ext, "res") == 0)
|
||||
if (Port::stricmp(ext, "res") == 0)
|
||||
{
|
||||
global.params.resfile = static_cast<char *>(files.data[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(ext, "def") == 0)
|
||||
if (Port::stricmp(ext, "def") == 0)
|
||||
{
|
||||
global.params.deffile = static_cast<char *>(files.data[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(ext, "exe") == 0)
|
||||
if (Port::stricmp(ext, "exe") == 0)
|
||||
{
|
||||
global.params.exefile = static_cast<char *>(files.data[i]);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strcasecmp(ext, global.mars_ext) == 0 ||
|
||||
strcasecmp(ext, global.hdr_ext) == 0)
|
||||
if (Port::stricmp(ext, global.mars_ext) == 0 ||
|
||||
Port::stricmp(ext, global.hdr_ext) == 0)
|
||||
{
|
||||
ext--; // skip onto '.'
|
||||
assert(*ext == '.');
|
||||
|
||||
Reference in New Issue
Block a user