Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Document last change
[simgrid.git] / src / surf / xml / surfxml_parseplatf.cpp
index 4794750..19f1909 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -62,20 +62,18 @@ void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs*
 /* This function acts as a main in the parsing area. */
 void parse_platform_file(std::string file)
 {
-#if SIMGRID_HAVE_LUA
   const char* cfile = file.c_str();
   int len           = strlen(cfile);
   int is_lua        = len > 3 && file[len - 3] == 'l' && file[len - 2] == 'u' && file[len - 1] == 'a';
-#endif
 
   sg_platf_init();
 
-#if SIMGRID_HAVE_LUA
   /* Check if file extension is "lua". If so, we will use
    * the lua bindings to parse the platform file (since it is
    * written in lua). If not, we will use the (old?) XML parser
    */
   if (is_lua) {
+#if SIMGRID_HAVE_LUA
     lua_State* L = luaL_newstate();
     luaL_openlibs(L);
 
@@ -88,8 +86,10 @@ void parse_platform_file(std::string file)
     }
     lua_close(L);
     return;
-  }
+#else
+    XBT_WARN("This looks like a lua platform file, but your SimGrid was not compiled with lua. Loading it as XML.");
 #endif
+  }
 
   // Use XML parser