Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove the undocumented/untested tag <include>
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 4 Nov 2017 17:10:52 +0000 (18:10 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 4 Nov 2017 17:51:46 +0000 (18:51 +0100)
ChangeLog
src/surf/xml/simgrid_dtd.c
src/surf/xml/surfxml_sax_cb.cpp
tools/cmake/MaintainerMode.cmake

index be9dcc0..4930ddf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,9 @@ SimGrid (3.18) NOT RELEASED YET (target: December 24 2017)
  - Removed unused functions:
    - xbt/file.h: xbt_basename(), xbt_dirname(), xbt_getline()
    - xbt/str.h: xbt_str_join()
+   
+ XML
+ - Remove the undocumented/untested tag <include>
 
 SimGrid (3.17) Released October 8 2017
 
index 40d7cad..ac9cb57 100644 (file)
@@ -6454,7 +6454,7 @@ case YY_STATE_EOF(S_surfxml_AS_3):
 case YY_STATE_EOF(S_surfxml_AS_4):
 case YY_STATE_EOF(S_surfxml_AS_6):
 case YY_STATE_EOF(S_surfxml_AS_8):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</AS>' expected.");
+FAIL("Premature EOF: `</AS>' expected.");
        YY_BREAK
 
 case 47:
@@ -6553,10 +6553,10 @@ YY_RULE_SETUP
   if (!AX_surfxml_ASroute_src) FAIL("Required attribute `src' not set for `ASroute' element.");
   LEAVE; STag_surfxml_ASroute(); surfxml_pcdata_ix = 0; ETag_surfxml_ASroute(); popbuffer(); /* attribute */
   switch (YY_START) {
-   case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
-   case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
-   case S_surfxml_zone_1: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
-   case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
+   case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
+   case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+   case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
+   case S_surfxml_zone_1: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
   }
  }
        YY_BREAK
@@ -6580,10 +6580,10 @@ YY_RULE_SETUP
   ETag_surfxml_ASroute();
   popbuffer(); /* attribute */
   switch (YY_START) {
-   case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
-   case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
-   case S_surfxml_zone_1: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
-   case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
+   case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
+   case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+   case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
+   case S_surfxml_zone_1: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
   }
  }
        YY_BREAK
@@ -6599,7 +6599,7 @@ FAIL("Unexpected character `%c': `</ASroute>' expected.",surf_parse_text[0]);
 case YY_STATE_EOF(E_surfxml_ASroute):
 case YY_STATE_EOF(S_surfxml_ASroute):
 case YY_STATE_EOF(S_surfxml_ASroute_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</ASroute>' expected.");
+FAIL("Premature EOF: `</ASroute>' expected.");
        YY_BREAK
 
 case 68:
@@ -6734,7 +6734,7 @@ FAIL("Unexpected character `%c': `</actor>' expected.",surf_parse_text[0]);
 case YY_STATE_EOF(E_surfxml_actor):
 case YY_STATE_EOF(S_surfxml_actor):
 case YY_STATE_EOF(S_surfxml_actor_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</actor>' expected.");
+FAIL("Premature EOF: `</actor>' expected.");
        YY_BREAK
 
 case 89:
@@ -6815,7 +6815,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</argument>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_argument):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</argument>' expected.");
+FAIL("Premature EOF: `</argument>' expected.");
        YY_BREAK
 
 case 100:
@@ -6924,7 +6924,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</backbone>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_backbone):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</backbone>' expected.");
+FAIL("Premature EOF: `</backbone>' expected.");
        YY_BREAK
 
 case 115:
@@ -7049,7 +7049,7 @@ FAIL("Unexpected character `%c': `</bypassASroute>' expected.",surf_parse_text[0
 case YY_STATE_EOF(E_surfxml_bypassASroute):
 case YY_STATE_EOF(S_surfxml_bypassASroute):
 case YY_STATE_EOF(S_surfxml_bypassASroute_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</bypassASroute>' expected.");
+FAIL("Premature EOF: `</bypassASroute>' expected.");
        YY_BREAK
 
 case 132:
@@ -7146,7 +7146,7 @@ FAIL("Unexpected character `%c': `</bypassRoute>' expected.",surf_parse_text[0])
 case YY_STATE_EOF(E_surfxml_bypassRoute):
 case YY_STATE_EOF(S_surfxml_bypassRoute):
 case YY_STATE_EOF(S_surfxml_bypassRoute_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</bypassRoute>' expected.");
+FAIL("Premature EOF: `</bypassRoute>' expected.");
        YY_BREAK
 
 case 145:
@@ -7271,7 +7271,7 @@ FAIL("Unexpected character `%c': `</bypassZoneRoute>' expected.",surf_parse_text
 case YY_STATE_EOF(E_surfxml_bypassZoneRoute):
 case YY_STATE_EOF(S_surfxml_bypassZoneRoute):
 case YY_STATE_EOF(S_surfxml_bypassZoneRoute_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</bypassZoneRoute>' expected.");
+FAIL("Premature EOF: `</bypassZoneRoute>' expected.");
        YY_BREAK
 
 case 162:
@@ -7440,7 +7440,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</cabinet>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_cabinet):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</cabinet>' expected.");
+FAIL("Premature EOF: `</cabinet>' expected.");
        YY_BREAK
 
 case 185:
@@ -7776,7 +7776,7 @@ FAIL("Unexpected character `%c': `</cluster>' expected.",surf_parse_text[0]);
 case YY_STATE_EOF(E_surfxml_cluster):
 case YY_STATE_EOF(S_surfxml_cluster):
 case YY_STATE_EOF(S_surfxml_cluster_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</cluster>' expected.");
+FAIL("Premature EOF: `</cluster>' expected.");
        YY_BREAK
 
 case 242:
@@ -7855,7 +7855,7 @@ FAIL("Unexpected character `%c': `</config>' expected.",surf_parse_text[0]);
 case YY_STATE_EOF(E_surfxml_config):
 case YY_STATE_EOF(S_surfxml_config):
 case YY_STATE_EOF(S_surfxml_config_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</config>' expected.");
+FAIL("Premature EOF: `</config>' expected.");
        YY_BREAK
 
 case 253:
@@ -8012,7 +8012,7 @@ FAIL("Unexpected character `%c': `</host>' expected.",surf_parse_text[0]);
 case YY_STATE_EOF(E_surfxml_host):
 case YY_STATE_EOF(S_surfxml_host):
 case YY_STATE_EOF(S_surfxml_host_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</host>' expected.");
+FAIL("Premature EOF: `</host>' expected.");
        YY_BREAK
 
 case 276:
@@ -8121,7 +8121,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</host_link>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_host___link):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</host_link>' expected.");
+FAIL("Premature EOF: `</host_link>' expected.");
        YY_BREAK
 
 /* <!-- tag include is deprecated. Not documented, and soon removed -->  */
@@ -8209,7 +8209,7 @@ FAIL("Unexpected character `%c': `</include>' expected.",surf_parse_text[0]);
 case YY_STATE_EOF(E_surfxml_include):
 case YY_STATE_EOF(S_surfxml_include):
 case YY_STATE_EOF(S_surfxml_include_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</include>' expected.");
+FAIL("Premature EOF: `</include>' expected.");
        YY_BREAK
 
 case 302:
@@ -8377,7 +8377,7 @@ FAIL("Unexpected character `%c': `</link>' expected.",surf_parse_text[0]);
 case YY_STATE_EOF(E_surfxml_link):
 case YY_STATE_EOF(S_surfxml_link):
 case YY_STATE_EOF(S_surfxml_link_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</link>' expected.");
+FAIL("Premature EOF: `</link>' expected.");
        YY_BREAK
 
 case 329:
@@ -8489,7 +8489,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</link_ctn>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_link___ctn):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</link_ctn>' expected.");
+FAIL("Premature EOF: `</link_ctn>' expected.");
        YY_BREAK
 
 /* <!-- <!ATTLIST model_prop key CDATA #REQUIRED> -->
@@ -8584,7 +8584,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</model_prop>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_model___prop):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</model_prop>' expected.");
+FAIL("Premature EOF: `</model_prop>' expected.");
        YY_BREAK
 
 case 359:
@@ -8677,7 +8677,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</mount>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_mount):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</mount>' expected.");
+FAIL("Premature EOF: `</mount>' expected.");
        YY_BREAK
 
 case 372:
@@ -8852,7 +8852,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</peer>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_peer):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</peer>' expected.");
+FAIL("Premature EOF: `</peer>' expected.");
        YY_BREAK
 
 /* <!-- 
@@ -8989,7 +8989,7 @@ case YY_STATE_EOF(S_surfxml_platform_3):
 case YY_STATE_EOF(S_surfxml_platform_4):
 case YY_STATE_EOF(S_surfxml_platform_6):
 case YY_STATE_EOF(S_surfxml_platform_8):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</platform>' expected.");
+FAIL("Premature EOF: `</platform>' expected.");
        YY_BREAK
 
 case 408:
@@ -9124,7 +9124,7 @@ FAIL("Unexpected character `%c': `</process>' expected.",surf_parse_text[0]);
 case YY_STATE_EOF(E_surfxml_process):
 case YY_STATE_EOF(S_surfxml_process):
 case YY_STATE_EOF(S_surfxml_process_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</process>' expected.");
+FAIL("Premature EOF: `</process>' expected.");
        YY_BREAK
 
 /* <!-- <!ATTLIST prop key CDATA #REQUIRED> -->
@@ -9237,7 +9237,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</prop>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_prop):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</prop>' expected.");
+FAIL("Premature EOF: `</prop>' expected.");
        YY_BREAK
 
 case 442:
@@ -9426,7 +9426,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</random>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_random):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</random>' expected.");
+FAIL("Premature EOF: `</random>' expected.");
        YY_BREAK
 
 case 473:
@@ -9539,7 +9539,7 @@ FAIL("Unexpected character `%c': `</route>' expected.",surf_parse_text[0]);
 case YY_STATE_EOF(E_surfxml_route):
 case YY_STATE_EOF(S_surfxml_route):
 case YY_STATE_EOF(S_surfxml_route_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</route>' expected.");
+FAIL("Premature EOF: `</route>' expected.");
        YY_BREAK
 
 case 490:
@@ -9632,7 +9632,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</router>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_router):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</router>' expected.");
+FAIL("Premature EOF: `</router>' expected.");
        YY_BREAK
 
 case 503:
@@ -9755,7 +9755,7 @@ FAIL("Unexpected character `%c': `</storage>' expected.",surf_parse_text[0]);
 case YY_STATE_EOF(E_surfxml_storage):
 case YY_STATE_EOF(S_surfxml_storage):
 case YY_STATE_EOF(S_surfxml_storage_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</storage>' expected.");
+FAIL("Premature EOF: `</storage>' expected.");
        YY_BREAK
 
 case 520:
@@ -9876,7 +9876,7 @@ FAIL("Unexpected character `%c': `</storage_type>' expected.",surf_parse_text[0]
 case YY_STATE_EOF(E_surfxml_storage___type):
 case YY_STATE_EOF(S_surfxml_storage___type):
 case YY_STATE_EOF(S_surfxml_storage___type_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</storage_type>' expected.");
+FAIL("Premature EOF: `</storage_type>' expected.");
        YY_BREAK
 
 case 537:
@@ -9985,7 +9985,7 @@ YY_RULE_SETUP
 FAIL("Unexpected end-tag `%s': `</trace>' expected.",surf_parse_text);
        YY_BREAK
 case YY_STATE_EOF(IN_trace):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</trace>' expected.");
+FAIL("Premature EOF: `</trace>' expected.");
        YY_BREAK
 
 case 551:
@@ -10121,7 +10121,7 @@ YY_RULE_SETUP
 FAIL("Unexpected character `%c': `</trace_connect>' expected.",surf_parse_text[0]);
        YY_BREAK
 case YY_STATE_EOF(E_surfxml_trace___connect):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</trace_connect>' expected.");
+FAIL("Premature EOF: `</trace_connect>' expected.");
        YY_BREAK
 
 case 574:
@@ -10286,7 +10286,7 @@ case YY_STATE_EOF(S_surfxml_zone_3):
 case YY_STATE_EOF(S_surfxml_zone_4):
 case YY_STATE_EOF(S_surfxml_zone_6):
 case YY_STATE_EOF(S_surfxml_zone_8):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</zone>' expected.");
+FAIL("Premature EOF: `</zone>' expected.");
        YY_BREAK
 
 case 605:
@@ -10385,10 +10385,10 @@ YY_RULE_SETUP
   if (!AX_surfxml_zoneRoute_src) FAIL("Required attribute `src' not set for `zoneRoute' element.");
   LEAVE; STag_surfxml_zoneRoute(); surfxml_pcdata_ix = 0; ETag_surfxml_zoneRoute(); popbuffer(); /* attribute */
   switch (YY_START) {
-   case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
-   case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
-   case S_surfxml_zone_1: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
-   case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
+   case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
+   case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+   case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
+   case S_surfxml_zone_1: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
   }
  }
        YY_BREAK
@@ -10412,10 +10412,10 @@ YY_RULE_SETUP
   ETag_surfxml_zoneRoute();
   popbuffer(); /* attribute */
   switch (YY_START) {
-   case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
-   case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
-   case S_surfxml_zone_1: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
-   case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
+   case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
+   case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+   case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
+   case S_surfxml_zone_1: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
   }
  }
        YY_BREAK
@@ -10431,7 +10431,7 @@ FAIL("Unexpected character `%c': `</zoneRoute>' expected.",surf_parse_text[0]);
 case YY_STATE_EOF(E_surfxml_zoneRoute):
 case YY_STATE_EOF(S_surfxml_zoneRoute):
 case YY_STATE_EOF(S_surfxml_zoneRoute_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</zoneRoute>' expected.");
+FAIL("Premature EOF: `</zoneRoute>' expected.");
        YY_BREAK
 
 /* EPILOG: after the root element. */
index 13de767..6730a35 100644 (file)
@@ -23,22 +23,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF
 
 extern "C" {
 
-int ETag_surfxml_include_state();
-
 #include "simgrid_dtd.c"
 
-/*
- * Stuff relative to the <include> tag
- */
-static std::vector<YY_BUFFER_STATE> surf_input_buffer_stack;
-static std::vector<FILE*> surf_file_to_parse_stack;
-static std::vector<std::string> surf_parsed_filename_stack;
-
-static inline const char* surf_parsed_filename() // to locate parse error messages
-{
-  return surf_parsed_filename_stack.empty() ? nullptr : surf_parsed_filename_stack.back().c_str();
-}
-
+static const char* surf_parsed_filename; // Currently parsed file (for the error messages)
 std::vector<simgrid::surf::LinkImpl*> parsed_link_list; /* temporary store of current list link of a route */
 
 /*
@@ -49,7 +36,7 @@ void surf_parse_assert(bool cond, std::string msg)
   if (not cond) {
     int lineno = surf_parse_lineno;
     cleanup();
-    XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename(), lineno, msg.c_str());
+    XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename, lineno, msg.c_str());
     surf_exit();
     xbt_die("Exiting now");
   }
@@ -59,7 +46,7 @@ void surf_parse_error(std::string msg)
 {
   int lineno = surf_parse_lineno;
   cleanup();
-  XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename(), lineno, msg.c_str());
+  XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename, lineno, msg.c_str());
   surf_exit();
   xbt_die("Exiting now");
 }
@@ -96,7 +83,7 @@ void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::stri
 
 void surf_parse_warn(std::string msg)
 {
-  XBT_WARN("%s:%d: %s", surf_parsed_filename(), surf_parse_lineno, msg.c_str());
+  XBT_WARN("%s:%d: %s", surf_parsed_filename, surf_parse_lineno, msg.c_str());
 }
 
 double surf_parse_get_double(std::string s)
@@ -290,7 +277,6 @@ std::map<std::string, std::string>* current_property_set       = nullptr;
 std::map<std::string, std::string>* current_model_property_set = nullptr;
 int ZONE_TAG                            = 0; // Whether we just opened a zone tag (to see what to do with the properties)
 
-YY_BUFFER_STATE surf_input_buffer;
 FILE *surf_file_to_parse = nullptr;
 
 /* Stuff relative to storage */
@@ -356,61 +342,15 @@ void ETag_surfxml_mount()
 
 void STag_surfxml_include()
 {
-  XBT_ERROR("<include> tag is deprecated, and will be removed in SimGrid v3.18. Please stop using it now (or tell us why you need it).");
-  parse_after_config();
-  XBT_DEBUG("STag_surfxml_include '%s'",A_surfxml_include_file);
-  surf_parsed_filename_stack.emplace_back(A_surfxml_include_file); // save file name
-
-  surf_file_to_parse_stack.push_back(surf_file_to_parse); // save old file descriptor
-
-  surf_file_to_parse = surf_fopen(A_surfxml_include_file, "r"); // read new file descriptor
-  xbt_assert((surf_file_to_parse), "Unable to open \"%s\"\n", A_surfxml_include_file);
-
-  surf_input_buffer_stack.push_back(surf_input_buffer);
-  surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, YY_BUF_SIZE);
-  surf_parse_push_buffer_state(surf_input_buffer);
-
-  fflush(nullptr);
-}
-
-void ETag_surfxml_include() {
-/* Nothing to do when done with reading the include tag.
- * Instead, the handling should be deferred until the EOF of current buffer -- see below */
+  xbt_die("<include> tag was removed in SimGrid v3.18. Please stop using it now.");
 }
 
-/** @brief When reaching EOF, check whether we are in an include tag, and behave accordingly if yes
- *
- * This function is called automatically by sedding the parser in tools/cmake/MaintainerMode.cmake
- * Every FAIL on "Premature EOF" is preceded by a call to this function, which role is to restore the
- * previous buffer if we reached the EOF /of an include file/. Its return code is used to avoid the
- * error message in that case.
- *
- * Yeah, that's terribly hackish, but it works. A better solution should be dealed with in flexml
- * directly: a command line flag could instruct it to do the correct thing when the include directive is encountered
- * on a line. One day maybe, if the maya allow it.
- */
-int ETag_surfxml_include_state()
+void ETag_surfxml_include()
 {
-  fflush(nullptr);
-  XBT_DEBUG("ETag_surfxml_include_state '%s'",A_surfxml_include_file);
-
-  if (surf_input_buffer_stack.empty()) // nope, that's a true premature EOF. Let the parser die verbosely.
-    return 0;
-
-  // Yeah, we were in an <include> Restore state and proceed.
-  fclose(surf_file_to_parse);
-  surf_file_to_parse_stack.pop_back();
-  surf_parse_pop_buffer_state();
-  surf_input_buffer_stack.pop_back();
-
-  // Restore the filename for error messages
-  surf_parsed_filename_stack.pop_back();
-
-  return 1;
+  /* Won't happen since <include> is now removed since v3.18. */
 }
 
 /* Stag and Etag parse functions */
-
 void STag_surfxml_platform() {
   XBT_ATTRIB_UNUSED double version = surf_parse_get_double(A_surfxml_platform_version);
 
@@ -444,19 +384,19 @@ void STag_surfxml_platform() {
              "Use simgrid_update_xml to update your file automatically. "
              "This program is installed automatically with SimGrid, or "
              "available in the tools/ directory of the source archive.",
-             surf_parsed_filename(), version);
+             surf_parsed_filename, version);
   if (version < 4.1) {
     XBT_INFO("You're using a v%.1f XML file (%s) while the current standard is v4.1 "
              "That's fine, the new version is backward compatible. \n\n"
              "Use simgrid_update_xml to update your file automatically. "
              "This program is installed automatically with SimGrid, or "
              "available in the tools/ directory of the source archive.",
-             version, surf_parsed_filename());
+             version, surf_parsed_filename);
   }
   xbt_assert(version <= 4.1, "******* FILE %s COMES FROM THE FUTURE (v:%.1f) *********\n "
                              "The most recent formalism that this version of SimGrid understands is v4.1.\n"
                              "Please update your code, or use another, more adapted, file.",
-             surf_parsed_filename(), version);
+             surf_parsed_filename, version);
 
   sg_platf_begin();
 }
@@ -1051,11 +991,13 @@ void ETag_surfxml_argument(){/* Nothing to do */}
 void ETag_surfxml_model___prop(){/* Nothing to do */}
 
 /* Open and Close parse file */
+YY_BUFFER_STATE surf_input_buffer;
+
 void surf_parse_open(const char *file)
 {
   xbt_assert(file, "Cannot parse the nullptr file. Bypassing the parser is strongly deprecated nowadays.");
 
-  surf_parsed_filename_stack.emplace_back(file);
+  surf_parsed_filename = file;
   std::string dir      = simgrid::xbt::Path(file).getDirname();
   surf_path.push_back(dir);
 
@@ -1069,11 +1011,7 @@ void surf_parse_open(const char *file)
 
 void surf_parse_close()
 {
-  if (surf_parsed_filename()) {
-    surf_path.pop_back();
-  }
-
-  surf_parsed_filename_stack.pop_back();
+  surf_path.pop_back(); // remove the dirname of the opened file, that was added in surf_parse_open()
 
   if (surf_file_to_parse) {
     surf_parse__delete_buffer(surf_input_buffer);
index 78f17b6..14a4c81 100644 (file)
@@ -162,7 +162,6 @@ if(enable_maintainer_mode AND NOT WIN32)
     set(string5  "'s/SET(DOCTYPE)/SET(ROOT_dax__adag)/'")
     set(string9  "'s/#include <unistd.h>/#if defined(_WIN32)\\n#  ifndef __STRICT_ANSI__\\n#    include <io.h>\\n#    include <process.h>\\n#  endif\\n#else\\n#  include <unistd.h>\\n#endif/g'")
     set(string14 "'\\!^ \\* Generated [0-9/]\\{10\\} [0-9:]\\{8\\}\\.$$!d'")
-    set(string15 "'s/FAIL(\"Premature EOF/if(!ETag_surfxml_include_state()) FAIL(\"Premature EOF/'")
 
     ADD_CUSTOM_COMMAND(
       OUTPUT   ${CMAKE_HOME_DIRECTORY}/src/surf/xml/simgrid_dtd.h
@@ -206,7 +205,6 @@ if(enable_maintainer_mode AND NOT WIN32)
       COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_HOME_DIRECTORY}/src/surf/xml/simgrid_dtd.c
       COMMAND ${FLEX_EXE} -o src/surf/xml/simgrid_dtd.c -Psurf_parse_ --noline src/surf/xml/simgrid_dtd.l
       COMMAND ${SED_EXE} -i ${string9} src/surf/xml/simgrid_dtd.c
-      COMMAND ${SED_EXE} -i ${string15} src/surf/xml/simgrid_dtd.c
       COMMAND ${SED_EXE} -i 's/int yyl\;/unsigned int yyl\;/' src/surf/xml/simgrid_dtd.c
       COMMAND ${SED_EXE} -i 's/int surf_parse_leng\;/unsigned int surf_parse_leng\;/' src/surf/xml/simgrid_dtd.c
       COMMAND ${SED_EXE} -i 's/n = 0\; n < max_size/n = 0\; n < (size_t) max_size/' src/surf/xml/simgrid_dtd.c