浏览代码

Adjusted to only check the module name against the leaf of the filename, to prevent unnecessary warnings if the source file isn't in the current directory.

dtrg 18 年之前
父节点
当前提交
ce6de53e60
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      lang/m2/comp/program.g

+ 7 - 2
lang/m2/comp/program.g

@@ -236,10 +236,15 @@ ProgramModule
 		{ 
 		  if (state == IMPLEMENTATION) {
 		  	int len = strlen(dot.TOK_IDF->id_text);
+		  	char* leafname = strrchr(FileName, '/');
+		  	if (leafname)
+		  		leafname++;
+		  	else
+		  		leafname = FileName;
 
 		  	if (len > 10) len = 10;
-		  	if (strncmp(FileName, dot.TOK_IDF->id_text, len)) {
-				warning(W_ORDINARY, "modulename %s does not match filename %s", dot.TOK_IDF->id_text, FileName);
+		  	if (strncmp(leafname, dot.TOK_IDF->id_text, len)) {
+				warning(W_ORDINARY, "modulename %s does not match filename %s", dot.TOK_IDF->id_text, leafname);
 		  	}
 			df = GetDefinitionModule(dot.TOK_IDF, 0);
 			CurrVis = df->mod_vis;