Browse Source

ENH: Added error reporting for missing arguments to ENDIF.

Brad King 24 years ago
parent
commit
aa49d94ce0
1 changed files with 17 additions and 1 deletions
  1. 17 1
      Source/cmIfCommand.cxx

+ 17 - 1
Source/cmIfCommand.cxx

@@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 bool cmIfFunctionBlocker::
 IsFunctionBlocked(const char *name, const std::vector<std::string> &args, 
-                  cmMakefile &)
+                  cmMakefile &mf)
 {
   if (!strcmp(name,"ELSE") || !strcmp(name,"ENDIF"))
     {
@@ -51,6 +51,22 @@ IsFunctionBlocked(const char *name, const std::vector<std::string> &args,
       {
       return false;
       }
+    else if(args.empty())
+      {
+      std::string err = "Empty arguments for ";
+      err += name;
+      err += ".  Did you mean ";
+      err += name;
+      err += "( ";
+      for(std::vector<std::string>::const_iterator a = m_Args.begin();
+          a != m_Args.end();++a)
+        {
+        err += *a;
+        err += " ";
+        }
+      err += ")?";
+      cmSystemTools::Error(err.c_str());
+      }
     }
   return true;
 }