Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Warn on undefined #if, and enjoy that feature
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 9 Mar 2016 09:28:15 +0000 (10:28 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 9 Mar 2016 09:28:18 +0000 (10:28 +0100)
- remove the #include <simgrid_config.h> from xbt/base.h now that it's safe
- Add the include where needed. Amusingly, xbt/string.hpp was unable
  of getting the definition of HAVE_MC alone. Fixing this leaves me with
  only 2 broken tests in MC mode where I had 17 of them before...

include/xbt/base.h
include/xbt/signal.hpp
include/xbt/string.hpp
src/xbt/xbt_os_file.c
tools/cmake/GCCFlags.cmake

index d042d98..9d4ea07 100644 (file)
@@ -9,8 +9,6 @@
 #ifndef XBT_BASE_H
 #define XBT_BASE_H
 
-#include "simgrid_config.h"
-
 /* Define _GNU_SOURCE for getline, isfinite, etc. */
 #ifndef _GNU_SOURCE
   #define _GNU_SOURCE
index 714ae0d..26bd2df 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef SIMGRID_XBT_SIGNAL_HPP
 #define SIMGRID_XBT_SIGNAL_HPP
 
+#include "simgrid_config.h"
 #if SIMGRID_HAVE_LIBSIG
 #include <sigc++/sigc++.h>
 #else
index 71f7545..633162a 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef SIMGRIC_XBT_STRING_HPP
 #define SIMGRIC_XBT_STRING_HPP
 
+#include "src/internal_config.h"
 #if HAVE_MC
 
 #include <stdexcept>
index 2dda1b2..be781e1 100644 (file)
@@ -67,7 +67,7 @@ ssize_t xbt_getline(char **buf, size_t *n, FILE *stream)
  * The argument is never modified, and the returned value must be freed after use.
  */
 char *xbt_dirname(const char *path) {
-#if _MSC_VER
+#ifdef _MSC_VER
     char drive[_MAX_DRIVE];
     char dir[_MAX_DIR];
     errno_t err;
@@ -85,7 +85,7 @@ char *xbt_dirname(const char *path) {
  * The argument is never modified, and the returned value must be freed after use.
  */
 char *xbt_basename(const char *path) {
-#if _MSC_VER
+#ifdef _MSC_VER
     char file[1024];
     char ext[1024];
     errno_t err;
index 31c50d7..b1ecbda 100644 (file)
@@ -15,12 +15,12 @@ set(optCFLAGS "")
 
 
 if(enable_compile_warnings)
-  set(warnCFLAGS "-fno-common -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror ")
+  set(warnCFLAGS "-fno-common -Wall -Wundef -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror ")
   if(CMAKE_COMPILER_IS_GNUCC)
     set(warnCFLAGS "${warnCFLAGS}-Wclobbered -Wno-error=clobbered  -Wno-unused-local-typedefs")
   endif()
 
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wunused -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment  -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wunused -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment  -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror")
   if(CMAKE_COMPILER_IS_GNUCXX)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wclobbered -Wno-error=clobbered  -Wno-unused-local-typedefs")
   endif()