ide/Project: (#241) Seeing GCC warnings when building from IDE
[sdk] / ide / src / project / Project.ec
index c1e0e8c..77463d5 100644 (file)
@@ -21,7 +21,7 @@ import "IDESettings"
 
 default:
 
-static void DummyFunction()
+static __attribute__((unused)) void DummyFunction()
 {
 int a;
 a.OnFree();
@@ -42,8 +42,8 @@ IDESettingsContainer settingsContainer
 
    void OnLoad(GlobalSettingsData data)
    {
-      IDESettings settings = (IDESettings)data;
 #ifndef MAKEFILE_GENERATOR
+      IDESettings settings = (IDESettings)data;
       globalSettingsDialog.ideSettings = settings;
       ide.UpdateRecentMenus();
       ide.UpdateCompilerConfigs(true);
@@ -374,7 +374,7 @@ define PEEK_RESOLUTION = (18.2 * 10);
 #define SEPS    "/"
 #define SEP     '/'
 
-static Array<String> notLinkerOptions
+static Array<const String> notLinkerOptions
 { [
    "-static-libgcc",
    "-shared",
@@ -427,9 +427,10 @@ define stringFrom =               "                 from ";
 // NOTES: - this function should get only unescaped unix style paths
 //        - paths with literal $(somestring) in them are not supported
 //          my_$(messed_up)_path would likely become my__path
-void EscapeForMake(char * output, char * input, bool hideSpace, bool allowVars, bool allowDblQuote)
+void EscapeForMake(char * output, const char * input, bool hideSpace, bool allowVars, bool allowDblQuote)
 {
-   char ch, *i = input, *o = output;
+   char ch, *o = output;
+   const char *i = input;
    bool inVar = false;
 #ifdef _DEBUG
    int len = strlen(input);
@@ -482,7 +483,7 @@ void EscapeForMakeToFile(File output, char * input, bool hideSpace, bool allowVa
    delete buf;
 }
 
-void EscapeForMakeToDynString(DynamicString output, char * input, bool hideSpace, bool allowVars, bool allowDblQuote)
+void EscapeForMakeToDynString(DynamicString output, const char * input, bool hideSpace, bool allowVars, bool allowDblQuote)
 {
    char * buf = new char[strlen(input)*2+1];
    EscapeForMake(buf, input, hideSpace, allowVars, allowDblQuote);
@@ -490,7 +491,7 @@ void EscapeForMakeToDynString(DynamicString output, char * input, bool hideSpace
    delete buf;
 }
 
-int OutputFileList(File f, char * name, Array<String> list, Map<String, int> varStringLenDiffs, char * prefix)
+int OutputFileList(File f, const char * name, Array<String> list, Map<String, int> varStringLenDiffs, const char * prefix)
 {
    int numOfBreaks = 0;
    const int breakListLength = 1536;
@@ -580,7 +581,7 @@ int OutputFileList(File f, char * name, Array<String> list, Map<String, int> var
    return numOfBreaks;
 }
 
-void OutputFileListActions(File f, char * name, int parts, char * fileName)
+void OutputFileListActions(File f, const char * name, int parts, const char * fileName)
 {
    if(parts > 1)
    {
@@ -592,7 +593,7 @@ void OutputFileListActions(File f, char * name, int parts, char * fileName)
    }
 }
 
-void OutputCleanActions(File f, char * name, int parts)
+void OutputCleanActions(File f, const char * name, int parts)
 {
    if(parts > 1)
    {
@@ -608,7 +609,7 @@ enum LineOutputMethod { inPlace, newLine, lineEach };
 enum StringOutputMethod { asIs, escape, escapePath};
 
 enum ToolchainFlag { any, _D, _I, _isystem, _Wl, _L/*, _Wl-rpath*/ };
-String flagNames[ToolchainFlag] = { "", "-D", "-I", "-isystem ", "-Wl,", /*"-Wl,--library-path="*/"-L"/*, "-Wl,-rpath "*/ };
+const String flagNames[ToolchainFlag] = { "", "-D", "-I", "-isystem ", "-Wl,", /*"-Wl,--library-path="*/"-L"/*, "-Wl,-rpath "*/ };
 void OutputFlags(File f, ToolchainFlag flag, Array<String> list, LineOutputMethod lineMethod)
 {
    if(list.count)
@@ -666,9 +667,12 @@ static void OutputLibraries(File f, Array<String> libraries)
 
 void CamelCase(char * string)
 {
-   int c, len = strlen(string);
-   for(c=0; c<len && string[c] >= 'A' && string[c] <= 'Z'; c++)
-      string[c] = (char)tolower(string[c]);
+   if(string)
+   {
+      int c, len = strlen(string);
+      for(c=0; c<len && string[c] >= 'A' && string[c] <= 'Z'; c++)
+         string[c] = (char)tolower(string[c]);
+   }
 }
 
 CompilerConfig GetCompilerConfig()
@@ -744,7 +748,7 @@ define platformTargetType =
                projectPOs.options.targetType : TargetTypes::unset;
 
 
-char * PlatformToMakefileTargetVariable(Platform platform)
+const char * PlatformToMakefileTargetVariable(Platform platform)
 {
    return platform == win32 ? "WINDOWS_TARGET" :
           platform == tux   ? "LINUX_TARGET"   :
@@ -752,7 +756,7 @@ char * PlatformToMakefileTargetVariable(Platform platform)
                               "ERROR_BAD_TARGET";
 }
 
-char * TargetTypeToMakefileVariable(TargetTypes targetType)
+const char * TargetTypeToMakefileVariable(TargetTypes targetType)
 {
    return targetType == executable    ? "executable" :
           targetType == sharedLibrary ? "sharedlib"  :
@@ -761,7 +765,7 @@ char * TargetTypeToMakefileVariable(TargetTypes targetType)
 }
 
 // Move this to ProjectConfig? null vs Common to consider...
-char * GetConfigName(ProjectConfig config)
+const char * GetConfigName(ProjectConfig config)
 {
    return config ? config.name : "Common";
 }
@@ -782,28 +786,28 @@ public:
    float version;
    String moduleName;
 
-   property char * moduleVersion
+   property const char * moduleVersion
    {
       set { delete moduleVersion; if(value && value[0]) moduleVersion = CopyString(value); } // TODO: use CopyString function that filters chars
       get { return moduleVersion ? moduleVersion : ""; }                                     //       version number should only use digits and dots
       isset { return moduleVersion != null && moduleVersion[0]; }                            //       add leading/trailing 0 if value start/ends with dot(s)
    }
 
-   property char * description
+   property const char * description
    {
       set { delete description; if(value && value[0]) description = CopyString(value); }
       get { return description ? description : ""; }
       isset { return description != null && description[0]; }
    }
 
-   property char * license
+   property const char * license
    {
       set { delete license; if(value && value[0]) license = CopyString(value); }
       get { return license ? license : ""; }
       isset { return license != null && license[0]; }
    }
 
-   property char * compilerConfigsDir
+   property const char * compilerConfigsDir
    {
       set { delete compilerConfigsDir; if(value && value[0]) compilerConfigsDir = CopyString(value); }
       get { return compilerConfigsDir ? compilerConfigsDir : ""; }
@@ -872,7 +876,7 @@ private:
    FileMonitor fileMonitor
    {
       this, FileChange { modified = true };
-      bool OnFileNotify(FileChange action, char * param)
+      bool OnFileNotify(FileChange action, const char * param)
       {
          fileMonitor.StopMonitoring();
          if(OnProjectModified(action, param))
@@ -894,7 +898,7 @@ private:
       return true;
    }
 
-   bool OnProjectModified(FileChange fileChange, char * param)
+   bool OnProjectModified(FileChange fileChange, const char * param)
    {
       char temp[4096];
       sprintf(temp, $"The project %s was modified by another application.\n"
@@ -998,7 +1002,7 @@ private:
       }
    }
 
-   property char * filePath
+   property const char * filePath
    {
       set
       {
@@ -1020,7 +1024,7 @@ private:
       }
    }
 
-   ProjectConfig GetConfig(char * configName)
+   ProjectConfig GetConfig(const char * configName)
    {
       ProjectConfig result = null;
       if(configName && configName[0] && configurations.count)
@@ -1034,10 +1038,10 @@ private:
       return result;
    }
 
-   ProjectNode FindNodeByObjectFileName(char * fileName, IntermediateFileType type, bool dotMain, ProjectConfig config)
+   ProjectNode FindNodeByObjectFileName(const char * fileName, IntermediateFileType type, bool dotMain, ProjectConfig config)
    {
       ProjectNode result;
-      char * cfgName;
+      const char * cfgName;
       if(!config)
          config = this.config;
       cfgName = config ? config.name : "";
@@ -1066,10 +1070,10 @@ private:
       return false;
    }
 
-   char * GetObjDirExpression(ProjectConfig config)
+   const char * GetObjDirExpression(ProjectConfig config)
    {
       // TODO: Support platform options
-      char * expression = localObjectsDirectory;
+      const char * expression = localObjectsDirectory;
       if(!expression)
          expression = settingsObjectsDirectory;
       return expression;
@@ -1077,16 +1081,16 @@ private:
 
    DirExpression GetObjDir(CompilerConfig compiler, ProjectConfig config, int bitDepth)
    {
-      char * expression = GetObjDirExpression(config);
+      const char * expression = GetObjDirExpression(config);
       DirExpression objDir { type = intermediateObjectsDir };
       objDir.Evaluate(expression, this, compiler, config, bitDepth);
       return objDir;
    }
 
-   char * GetTargetDirExpression(ProjectConfig config)
+   const char * GetTargetDirExpression(ProjectConfig config)
    {
       // TODO: Support platform options
-      char * expression = localTargetDirectory;
+      const char * expression = localTargetDirectory;
       if(!expression)
          expression = settingsTargetDirectory;
       return expression;
@@ -1094,7 +1098,7 @@ private:
 
    DirExpression GetTargetDir(CompilerConfig compiler, ProjectConfig config, int bitDepth)
    {
-      char * expression = GetTargetDirExpression(config);
+      const char * expression = GetTargetDirExpression(config);
       DirExpression targetDir { type = DirExpressionType::targetDir /*intermediateObjectsDir*/};
       targetDir.Evaluate(expression, this, compiler, config, bitDepth);
       return targetDir;
@@ -1142,9 +1146,9 @@ private:
       return fastMath == true;
    }
 
-   String GetDefaultNameSpace(ProjectConfig config)
+   const String GetDefaultNameSpace(ProjectConfig config)
    {
-      String defaultNameSpace = localDefaultNameSpace;
+      const String defaultNameSpace = localDefaultNameSpace;
       return defaultNameSpace;
    }
 
@@ -1154,9 +1158,9 @@ private:
       return strictNameSpaces == true;
    }
 
-   String GetTargetFileName(ProjectConfig config)
+   const String GetTargetFileName(ProjectConfig config)
    {
-      String targetFileName = localTargetFileName;
+      const String targetFileName = localTargetFileName;
       return targetFileName;
    }
 
@@ -1179,6 +1183,8 @@ private:
    {
 #ifndef MAKEFILE_GENERATOR
       return ide.project == this && ide.debugger && ide.debugger.prjConfig == config && ide.debugger.isActive;
+#else
+      return false;
 #endif
    }
 
@@ -1186,6 +1192,8 @@ private:
    {
 #ifndef MAKEFILE_GENERATOR
       return ide.project == this && ide.debugger && ide.debugger.prjConfig == config && ide.debugger.isPrepared;
+#else
+      return false;
 #endif
    }
 
@@ -1197,7 +1205,7 @@ private:
    }
 
 #ifndef MAKEFILE_GENERATOR
-   bool Save(char * fileName)
+   bool Save(const char * fileName)
    {
       File f;
       /*char output[MAX_LOCATION];
@@ -1229,7 +1237,7 @@ private:
    void CatTargetFileName(char * string, CompilerConfig compiler, ProjectConfig config)
    {
       TargetTypes targetType = GetTargetType(config);
-      String targetFileName = GetTargetFileName(config);
+      const String targetFileName = GetTargetFileName(config);
       if(targetType == staticLibrary)
       {
          PathCatSlash(string, "lib");
@@ -1256,7 +1264,7 @@ private:
                strcat(string, ".dylib");
             else
                strcat(string, ".so");
-            if(compiler.targetPlatform == tux && GetRuntimePlatform() == tux && moduleVersion && moduleVersion[0])
+            if(compiler.targetPlatform == tux && __runtimePlatform == tux && moduleVersion && moduleVersion[0])
             {
                strcat(string, ".");
                strcat(string, moduleVersion);
@@ -1363,7 +1371,7 @@ private:
    void ModifiedAllConfigs(bool making, bool compiling, bool linking, bool symbolGen)
    {
       Map<String, NameCollisionInfo> cfgNameCollision;
-      MapIterator<String, Map<String, NameCollisionInfo>> it { map = configsNameCollisions };
+      MapIterator<const String, Map<String, NameCollisionInfo>> it { map = configsNameCollisions };
       if(it.Index("", false))
       {
          cfgNameCollision = it.data;
@@ -1475,9 +1483,9 @@ private:
       bool loggedALine = false;
       int lenMakeCommand = strlen(compiler.makeCommand);
       int testLen = 0;
-      char * t, * s;
+      const char * t, * s, * s2;
       char moduleName[MAX_FILENAME];
-      char * gnuToolchainPrefix = compiler.gnuToolchainPrefix ? compiler.gnuToolchainPrefix : "";
+      const char * gnuToolchainPrefix = compiler.gnuToolchainPrefix ? compiler.gnuToolchainPrefix : "";
 
       DynamicString test { };
       DynamicString ecp { };
@@ -1539,15 +1547,15 @@ private:
             //printf("Peeking and GetLine...\n");
             if((result = f.Peek()) && (result = f.GetLine(line, sizeof(line)-1)) && line[0])
             {
-               char * message = null;
-               char * inFileIncludedFrom = strstr(line, stringInFileIncludedFrom);
-               char * from = strstr(line, stringFrom);
+               const char * message = null;
+               const char * inFileIncludedFrom = strstr(line, stringInFileIncludedFrom);
+               const char * from = strstr(line, stringFrom);
                test.copyLenSingleBlankReplTrim(line, ' ', true, testLen);
-               if((t = strstr(line, (s=": recipe for target"))) && (t = strstr(t+strlen(s), (s=" failed"))) && (t+strlen(s))[0] == '\0')
+               if((t = strstr(line, (s=": recipe for target"))) && (t = strstr(t+strlen(s), (s2 = " failed"))) && (t+strlen(s2))[0] == '\0')
                   ; // ignore this new gnu make error but what is it about?
                else if(strstr(line, compiler.makeCommand) == line && line[lenMakeCommand] == ':')
                {
-                  char * module = strstr(line, "No rule to make target `");
+                  const char * module = strstr(line, "No rule to make target `");
                   if(module)
                   {
                      char * end;
@@ -1606,7 +1614,7 @@ private:
 
                   if(module)
                   {
-                     byte * tokens[1];
+                     char * tokens[1];
                      if(!compiling && !isPrecomp)
                      {
                         ide.outputView.buildBox.Logf($"Compiling...\n");
@@ -1646,7 +1654,7 @@ private:
                   if(module) module++;
                   if(module)
                   {
-                     byte * tokens[1];
+                     char * tokens[1];
                      char * dashF = strstr(module, "-F ");
                      if(dashF)
                      {
@@ -1668,13 +1676,13 @@ private:
                {
                   if(linking || compiling || precompiling)
                   {
-                     char * start = inFileIncludedFrom ? inFileIncludedFrom + strlen(stringInFileIncludedFrom) : from ? from + strlen(stringFrom) : line;
-                     char * colon = strstr(start, ":"); //, * bracket;
+                     const char * start = inFileIncludedFrom ? inFileIncludedFrom + strlen(stringInFileIncludedFrom) : from ? from + strlen(stringFrom) : line;
+                     const char * colon = strstr(start, ":"); //, * bracket;
                      if(colon && (colon[1] == '/' || colon[1] == '\\'))
                         colon = strstr(colon + 1, ":");
                      if(colon)
                      {
-                        char * sayError = "";
+                        const char * sayError = "";
                         char moduleName[MAX_LOCATION], temp[MAX_LOCATION];
                         char * pointer;
                         char * error;
@@ -1783,7 +1791,53 @@ private:
                               numErrors++;
                            }
                            else if(compilingEC == 1 || (objDir && objDir == moduleName))
-                              continue;
+                           {
+                              bool skip = false;
+
+                              // Filter out these warnings caused by eC generated C code:
+
+                              // Declaration ordering bugs -- Awaiting topo sort implementation
+                                   if(strstr(line, "declared inside parameter list")) skip = true;
+                              else if(strstr(line, "its scope is only this definition")) skip = true;
+                              else if(strstr(line, "note: expected 'struct ") || strstr(line, "note: expected ‘struct "))
+                              {
+                                 #define STRUCT_A "'struct "
+                                 #define STRUCT_B "‘struct "
+                                 char * struct1, * struct2, ch1, ch2;
+                                 struct1 = strstr(line, STRUCT_A);
+                                 if(struct1) { struct1 += sizeof(STRUCT_A)-1; } else { struct1 = strstr(line, STRUCT_B); struct1 += sizeof(STRUCT_B)-1; };
+
+                                 struct2 = strstr(struct1, STRUCT_A);
+                                 if(struct2) { struct2 += sizeof(STRUCT_A)-1; } else { struct2 = strstr(struct1, STRUCT_B); if(struct2) struct2 += sizeof(STRUCT_B)-1; };
+
+                                 if(struct1 && struct2)
+                                 {
+                                    while(ch1 = *(struct1++), ch2 = *(struct2++), ch1 && ch2 && (ch1 == '_' || isalnum(ch1)) && (ch2 == '_' || isalnum(ch2)));
+                                    if(ch1 == ch2)
+                                       skip = true;
+                                 }
+                              }
+                              // Pointers warnings (eC should already warn about relevant problems, more forgiving for function pointers, should cast in generated code)
+                              else if((strstr(line, "note: expected '") || strstr(line, "note: expected ‘")) && strstr(line, "(*)")) skip = true;
+                              else if(strstr(line, "expected 'void **") || strstr(line, "expected ‘void **")) skip = true;
+                              else if(strstr(line, "from incompatible pointer type")) skip = true;
+                              else if(strstr(line, "comparison of distinct pointer types lacks a cast")) skip = true;
+
+                              // Things being defined for potential use -- Should mark as unused
+                              else if(strstr(line, "unused variable") && (strstr(line, "'__") || strstr(line, "‘__") || strstr(line, "'class'") || strstr(line, "‘class’"))) skip = true;
+                              else if(strstr(line, "defined but not used") && strstr(line, "__ecereProp")) skip = true;
+
+                              // For preprocessed code from objidl.h (MinGW-w64 headers)
+                              else if(strstr(line, "declaration does not declare anything")) skip = true;
+
+                              // Location information that could apply to ignored warnings
+                              else if(strstr(line, "In function '") || strstr(line, "In function ‘") ) skip = true;
+                              else if(strstr(line, "At top level")) skip = true;
+                              else if(strstr(line, "(near initialization for '") || strstr(line, "(near initialization for ‘")) skip = true;
+
+                              if(skip) continue;
+                              numWarnings++;
+                           }
                            else if(strstr(line, "warning:"))
                            {
                               numWarnings++;
@@ -1797,7 +1851,7 @@ private:
                         {
                            char fullModuleName[MAX_LOCATION];
                            FileAttribs found = 0;
-                           Project foundProject = this;
+                           //Project foundProject = this;
                            if(moduleName[0])
                            {
                               char * loc = strstr(moduleName, ":");
@@ -1829,7 +1883,7 @@ private:
                                           found = FileExists(fullModuleName);
                                           if(found)
                                           {
-                                             foundProject = prj;
+                                             //foundProject = prj;
                                              break;
                                           }
                                        }
@@ -1847,7 +1901,7 @@ private:
                                              found = FileExists(fullModuleName);
                                              if(found)
                                              {
-                                                foundProject = prj;
+                                                //foundProject = prj;
                                                 break;
                                              }
                                           }
@@ -1907,7 +1961,7 @@ private:
       {
          if(f.GetExitCode() && !numErrors)
          {
-            bool result = f.GetLine(line, sizeof(line)-1);
+            /*bool result = */f.GetLine(line, sizeof(line)-1);
             ide.outputView.buildBox.Logf($"Fatal Error: child process terminated unexpectedly\n");
          }
          else if(buildType != install)
@@ -1994,8 +2048,8 @@ private:
       char configName[MAX_LOCATION];
       DirExpression objDirExp = GetObjDir(compiler, config, bitDepth);
       PathBackup pathBackup { };
-      bool crossCompiling = (compiler.targetPlatform != GetRuntimePlatform());
-      char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
+      bool crossCompiling = (compiler.targetPlatform != __runtimePlatform);
+      const char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
 
       bool eC_Debug = mode.eC_ToolsDebug;
       bool singleProjectOnlyNode = onlyNodes && onlyNodes.count == 1 && onlyNodes[0].type == project;
@@ -2033,7 +2087,6 @@ private:
          }
          else
          {
-            int len;
             char pushD[MAX_LOCATION];
             char cfDir[MAX_LOCATION];
             GetIDECompilerConfigsDir(cfDir, true, true);
@@ -2042,7 +2095,7 @@ private:
             // Create object dir if it does not exist already
             if(!FileExists(objDirExp.dir).isDirectory)
             {
-               sprintf(command, "%s CF_DIR=\"%s\"%s%s%s%s COMPILER=%s objdir -C \"%s\"%s -f \"%s\"",
+               sprintf(command, "%s CF_DIR=\"%s\"%s%s%s%s%s COMPILER=%s objdir -C \"%s\"%s -f \"%s\"",
                      compiler.makeCommand, cfDir,
                      crossCompiling ? " TARGET_PLATFORM=" : "",
                      targetPlatform,
@@ -2073,7 +2126,7 @@ private:
 
       if(compiler.type.isVC)
       {
-         bool result = false;
+         //bool result = false;
          char oldwd[MAX_LOCATION];
          GetWorkingDir(oldwd, sizeof(oldwd));
          ChangeWorkingDir(topNode.path);
@@ -2086,7 +2139,7 @@ private:
          {
             ProcessPipeOutputRaw(f);
             delete f;
-            result = true;
+            //result = true;
          }
          ChangeWorkingDir(oldwd);
       }
@@ -2190,8 +2243,8 @@ private:
       char * compilerName;
       DualPipe f;
       PathBackup pathBackup { };
-      bool crossCompiling = (compiler.targetPlatform != GetRuntimePlatform());
-      char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
+      bool crossCompiling = (compiler.targetPlatform != __runtimePlatform);
+      const char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
 
       compilerName = CopyString(compiler.name);
       CamelCase(compilerName);
@@ -2204,7 +2257,7 @@ private:
 
       if(compiler.type.isVC)
       {
-         bool result = false;
+         //bool result = false;
          char oldwd[MAX_LOCATION];
          GetWorkingDir(oldwd, sizeof(oldwd));
          ChangeWorkingDir(topNode.path);
@@ -2217,7 +2270,7 @@ private:
          {
             ProcessPipeOutputRaw(f);
             delete f;
-            result = true;
+            //result = true;
          }
          ChangeWorkingDir(oldwd);
          //return result;
@@ -2255,7 +2308,7 @@ private:
       delete compilerName;
    }
 
-   void Run(char * args, CompilerConfig compiler, ProjectConfig config, int bitDepth)
+   void Run(const char * args, CompilerConfig compiler, ProjectConfig config, int bitDepth)
    {
       String target = new char[maxPathLen];
       char oldDirectory[MAX_LOCATION];
@@ -2381,7 +2434,7 @@ private:
       char * name;
       char * compilerName;
       bool gccCompiler = compiler.ccCommand && (strstr(compiler.ccCommand, "gcc") != null || strstr(compiler.ccCommand, "g++") != null);
-      char * gnuToolchainPrefix = compiler.gnuToolchainPrefix ? compiler.gnuToolchainPrefix : "";
+      const char * gnuToolchainPrefix = compiler.gnuToolchainPrefix ? compiler.gnuToolchainPrefix : "";
       Platform platform = compiler.targetPlatform;
 
       compilerName = CopyString(compiler.name);
@@ -2567,7 +2620,7 @@ private:
       return result;
    }
 
-   bool GenerateMakefile(char * altMakefilePath, bool noResources, char * includemkPath, ProjectConfig config)
+   bool GenerateMakefile(const char * altMakefilePath, bool noResources, const char * includemkPath, ProjectConfig config)
    {
       bool result = false;
       char filePath[MAX_LOCATION];
@@ -2601,7 +2654,7 @@ private:
          char targetDirExpNoSpaces[MAX_LOCATION];
          char fixedModuleName[MAX_FILENAME];
          char fixedConfigName[MAX_FILENAME];
-         int c, len;
+         int c;
          int lenObjDirExpNoSpaces, lenTargetDirExpNoSpaces;
          // Non-zero if we're building eC code
          // We'll have to be careful with this when merging configs where eC files can be excluded in some configs and included in others
@@ -2610,7 +2663,7 @@ private:
          int numRCObjects = 0;
          bool containsCXX = false; // True if the project contains a C++ file
          bool relObjDir, sameOrRelObjTargetDirs;
-         String objDirExp = GetObjDirExpression(config);
+         const String objDirExp = GetObjDirExpression(config);
          TargetTypes targetType = GetTargetType(config);
 
          char cfDir[MAX_LOCATION];
@@ -2717,7 +2770,7 @@ private:
          if(compilerConfigsDir && compilerConfigsDir[0])
          {
             strcpy(cfDir, compilerConfigsDir);
-            if(cfDir && cfDir[0] && cfDir[strlen(cfDir)-1] != '/')
+            if(cfDir[0] && cfDir[strlen(cfDir)-1] != '/')
                strcat(cfDir, "/");
          }
          else
@@ -2794,7 +2847,7 @@ private:
 
          {
             int c;
-            char * map[5][2] = { { "COBJECTS", "C" }, { "SYMBOLS", "S" }, { "IMPORTS", "I" }, { "ECOBJECTS", "O" }, { "BOWLS", "B" } };
+            const char * map[5][2] = { { "COBJECTS", "C" }, { "SYMBOLS", "S" }, { "IMPORTS", "I" }, { "ECOBJECTS", "O" }, { "BOWLS", "B" } };
 
             numCObjects = topNode.GenMakefilePrintNode(f, this, eCsources, namesInfo, listItems, config, null);
             if(numCObjects)
@@ -2890,7 +2943,7 @@ private:
 
          topNode.GenMakefilePrintNode(f, this, sources, null, listItems, config, null);
          {
-            char * prefix;
+            const char * prefix;
             if(numCObjects && numRCObjects)
                prefix = "$(ECSOURCES) $(RCSOURCES)";
             else if(numCObjects)
@@ -2920,7 +2973,7 @@ private:
             f.Puts("\n");
          }
 
-         topNode.GenMakeCollectAssignNodeFlags(config, numCObjects,
+         topNode.GenMakeCollectAssignNodeFlags(config, numCObjects != 0,
                cflagsVariations, nodeCFlagsMapping,
                ecflagsVariations, nodeECFlagsMapping, null);
 
@@ -3517,12 +3570,12 @@ private:
    void GenMakefilePrintMainObjectRule(File f, ProjectConfig config)
    {
       char extension[MAX_EXTENSION] = "c";
-      char modulePath[MAX_LOCATION];
+      //char modulePath[MAX_LOCATION];
       char fixedModuleName[MAX_FILENAME];
-      DualPipe dep;
-      char command[2048];
+      //DualPipe dep;
+      //char command[2048];
       char objDirNoSpaces[MAX_LOCATION];
-      String objDirExp = GetObjDirExpression(config);
+      const String objDirExp = GetObjDirExpression(config);
 
       ReplaceSpaces(objDirNoSpaces, objDirExp);
       ReplaceSpaces(fixedModuleName, moduleName);
@@ -3608,7 +3661,7 @@ private:
 #endif
    }
 
-   void GenMakePrintCustomFlags(File f, String variableName, bool printNonCustom, Map<String, int> cflagsVariations)
+   void GenMakePrintCustomFlags(File f, const String variableName, bool printNonCustom, Map<String, int> cflagsVariations)
    {
       int c;
       for(c = printNonCustom ? 0 : 1; c <= cflagsVariations.count; c++)
@@ -3661,7 +3714,7 @@ private:
 
 static inline void ProjectLoadLastBuildNamesInfo(Project prj, ProjectConfig cfg)
 {
-   char * cfgName = cfg ? cfg.name : "";
+   const char * cfgName = cfg ? cfg.name : "";
    Map<String, NameCollisionInfo> cfgNameCollisions = prj.configsNameCollisions[cfgName];
    if(cfgNameCollisions)
    {
@@ -3672,7 +3725,7 @@ static inline void ProjectLoadLastBuildNamesInfo(Project prj, ProjectConfig cfg)
    prj.topNode.GenMakefileGetNameCollisionInfo(cfgNameCollisions, cfg);
 }
 
-Project LegacyBinaryLoadProject(File f, char * filePath)
+Project LegacyBinaryLoadProject(File f, const char * filePath)
 {
    Project project = null;
    char signature[sizeof(epjSignature)];
@@ -3839,7 +3892,6 @@ void ProjectConfig::LegacyProjectConfigLoad(File f)
       char section[128];
       char subSection[128];
       char * equal;
-      int len;
       uint pos;
 
       pos = f.Tell();
@@ -3972,10 +4024,10 @@ void ProjectConfig::LegacyProjectConfigLoad(File f)
    makingModified = true;
 }
 
-Project LegacyAsciiLoadProject(File f, char * filePath)
+Project LegacyAsciiLoadProject(File f, const char * filePath)
 {
    Project project = null;
-   ProjectNode node = null;
+   //ProjectNode node = null;
    int pos;
    char parentPath[MAX_LOCATION];
    char section[128] = "";
@@ -4043,7 +4095,7 @@ Project LegacyAsciiLoadProject(File f, char * filePath)
                   child.type = file;
                   child.icon = NodeIcons::SelectFileIcon(child.name);
                   parent.files.Add(child);
-                  node = child;
+                  //node = child;
                   //child = null;
                }
                else
@@ -4077,7 +4129,7 @@ Project LegacyAsciiLoadProject(File f, char * filePath)
                PathCatSlash(parentPath, child.name);
                parent.files.Add(child);
                parent = child;
-               node = child;
+               //node = child;
                //child = null;
             }
             else if(!strcmpi(section, "Configurations"))
@@ -4121,7 +4173,7 @@ Project LegacyAsciiLoadProject(File f, char * filePath)
             project.filePath = topNodePath;
             parentPath[0] = '\0';
             parent = project.topNode;
-            node = parent;
+            //node = parent;
             strcpy(section, "Target");
             equal = &buffer[6];
             if(equal[0] == ' ')
@@ -4158,7 +4210,7 @@ Project LegacyAsciiLoadProject(File f, char * filePath)
             child.icon = archiveFile;
             project.resNode = child;
             parent = child;
-            node = child;
+            //node = child;
             strcpy(subSection, buffer);
          }
          else
@@ -4466,12 +4518,11 @@ void CombineIdenticalConfigOptions(Project project)
                   continue;
                if(cfg != firstConfig)
                {
-                  cfg.platforms.Free();
-                  delete cfg.platforms;
+                  cfg.platforms = null;
                }
             }
             project.platforms = firstConfig.platforms;
-            firstConfig.platforms = null;
+            *&firstConfig.platforms = null;
          }
       }
 
@@ -4487,7 +4538,7 @@ void CombineIdenticalConfigOptions(Project project)
    }
 }
 
-Project LoadProject(char * filePath, char * activeConfigName)
+Project LoadProject(const char * filePath, const char * activeConfigName)
 {
    Project project = null;
    File f = FileOpen(filePath, read);
@@ -4497,7 +4548,7 @@ Project LoadProject(char * filePath, char * activeConfigName)
       if(!project)
       {
          JSONParser parser { f = f };
-         JSONResult result = parser.GetObject(class(Project), &project);
+         /*JSONResult result = */parser.GetObject(class(Project), &project);
          if(project)
          {
             char insidePath[MAX_LOCATION];
@@ -4579,7 +4630,8 @@ Project LoadProject(char * filePath, char * activeConfigName)
    return project;
 }
 
-static GccVersionInfo GetGccVersionInfo(CompilerConfig compiler, String compilerCommand)
+#ifndef MAKEFILE_GENERATOR
+static GccVersionInfo GetGccVersionInfo(CompilerConfig compiler, const String compilerCommand)
 {
    GccVersionInfo result = unknown;
    if(compiler.ccCommand)
@@ -4650,3 +4702,4 @@ static enum GccVersionInfo
       return result;
    }
 };
+#endif