From 0dcda218187c4874a539a6887b132ed5e6cc77dd Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 9 Mar 2016 21:52:55 +0100 Subject: [PATCH] kill the portable header such centralized header is not a good idea, as it tend to the inflation of header inclusions. I prefer having each file specifying precisely which header they need. --- src/include/surf/maxmin.h | 2 +- src/include/surf/surf.h | 2 +- src/portable.h | 30 ------------------------------ src/simix/ThreadContext.cpp | 2 +- src/simix/smx_context.cpp | 2 +- src/simix/smx_global.cpp | 2 +- src/surf/surf_interface.cpp | 2 +- src/xbt/cunit.c | 2 +- src/xbt/dict.c | 2 +- src/xbt/ex.c | 2 +- src/xbt/log.c | 2 +- src/xbt/mmalloc/mmprivate.h | 2 +- src/xbt/xbt_log_layout_format.c | 2 +- src/xbt/xbt_log_layout_simple.c | 2 +- src/xbt/xbt_main.c | 2 +- src/xbt/xbt_os_file.c | 6 +++++- src/xbt/xbt_os_thread.c | 5 +++-- src/xbt/xbt_str.c | 2 +- tools/cmake/DefinePackages.cmake | 1 - 19 files changed, 23 insertions(+), 49 deletions(-) delete mode 100644 src/portable.h diff --git a/src/include/surf/maxmin.h b/src/include/surf/maxmin.h index 2e0f5ad551..1c7e1e85d0 100644 --- a/src/include/surf/maxmin.h +++ b/src/include/surf/maxmin.h @@ -7,7 +7,7 @@ #ifndef _SURF_MAXMIN_H #define _SURF_MAXMIN_H -#include "src/portable.h" +#include "src/internal_config.h" #include "xbt/misc.h" #include "xbt/asserts.h" #include "surf/datatypes.h" diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 5a78792ae3..405f4e0a9b 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -13,7 +13,7 @@ #include "xbt/graph.h" #include "xbt/misc.h" #include "xbt/config.h" -#include "src/portable.h" +#include "src/internal_config.h" #include "surf/surf_routing.h" #include "surf/datatypes.h" #include "xbt/lib.h" diff --git a/src/portable.h b/src/portable.h deleted file mode 100644 index c9a77e3545..0000000000 --- a/src/portable.h +++ /dev/null @@ -1,30 +0,0 @@ -/* portable -- header loading to write portable code within SimGrid */ - -/* Copyright (c) 2004, 2016. 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. */ - -#ifndef SIMGRID_PORTABLE_H -#define SIMGRID_PORTABLE_H - -#include "src/internal_config.h" /* some information about the environment */ - -#ifdef _WIN32 -# include -#endif - -#ifdef HAVE_SYS_PARAM_H -# include -#endif -#ifdef HAVE_SYS_SYSCTL_H -# include -#endif - -/* File handling */ -#ifdef _WIN32 - #ifndef S_IRGRP - #define S_IRGRP 0 - #endif -#endif -#endif /* SIMGRID_PORTABLE_H */ diff --git a/src/simix/ThreadContext.cpp b/src/simix/ThreadContext.cpp index c84dc52918..91857d8196 100644 --- a/src/simix/ThreadContext.cpp +++ b/src/simix/ThreadContext.cpp @@ -9,7 +9,7 @@ #include "xbt/function_types.h" #include "smx_private.h" -#include "src/portable.h" /* loads context system definitions */ +#include "src/internal_config.h" /* loads context system definitions */ #include "xbt/swag.h" #include "xbt/xbt_os_thread.h" #include "src/xbt_modinter.h" /* prototype of os thread module's init/exit in XBT */ diff --git a/src/simix/smx_context.cpp b/src/simix/smx_context.cpp index b1bc093f71..87ea4dce38 100644 --- a/src/simix/smx_context.cpp +++ b/src/simix/smx_context.cpp @@ -6,7 +6,7 @@ /* 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. */ -#include "src/portable.h" +#include "src/internal_config.h" #include "xbt/log.h" #include "xbt/swag.h" #include "xbt/xbt_os_thread.h" diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index 2ef29f3fb1..b48faf5a04 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -5,7 +5,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include -#include "src/portable.h" +#include "src/internal_config.h" #include "src/surf/surf_interface.hpp" #include "src/surf/storage_interface.hpp" diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 8226352fbd..1dcc7540a1 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -4,7 +4,7 @@ /* 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. */ -#include "src/portable.h" +#include "src/internal_config.h" #include "surf_private.h" #include "surf_interface.hpp" #include "network_interface.hpp" diff --git a/src/xbt/cunit.c b/src/xbt/cunit.c index 550eb9ea8d..01c3f3ecad 100644 --- a/src/xbt/cunit.c +++ b/src/xbt/cunit.c @@ -9,7 +9,7 @@ /* This is partially inspirated from the OSSP ts (Test Suite Library) */ /* At some point we should use https://github.com/google/googletest instead */ -#include "src/portable.h" +#include "src/internal_config.h" #include #include "xbt/sysdep.h" /* bvprintf */ diff --git a/src/xbt/dict.c b/src/xbt/dict.c index c2268fa373..28c1165d1a 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -603,7 +603,7 @@ void xbt_dict_postexit(void) #ifdef SIMGRID_TEST #include "xbt.h" #include "xbt/ex.h" -#include "src/portable.h" +#include "src/internal_config.h" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_dict); diff --git a/src/xbt/ex.c b/src/xbt/ex.c index f5050cc9af..9d3dca6a4b 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -45,7 +45,7 @@ #include #include -#include "src/portable.h" /* execinfo when available */ +#include "src/internal_config.h" /* execinfo when available */ #include "xbt/ex.h" #include "xbt/str.h" #include "xbt/synchro_core.h" diff --git a/src/xbt/log.c b/src/xbt/log.c index 1a13c86dfd..8701f99a6e 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -11,7 +11,7 @@ #include /* snprintf */ #include /* snprintf */ -#include "src/portable.h" +#include "src/internal_config.h" #include "src/xbt_modinter.h" diff --git a/src/xbt/mmalloc/mmprivate.h b/src/xbt/mmalloc/mmprivate.h index 2528b8ff5c..ec155008af 100644 --- a/src/xbt/mmalloc/mmprivate.h +++ b/src/xbt/mmalloc/mmprivate.h @@ -17,7 +17,7 @@ #include #include -#include "src/portable.h" +#include "src/internal_config.h" #include "xbt/xbt_os_thread.h" #include "xbt/mmalloc.h" #include "xbt/ex.h" diff --git a/src/xbt/xbt_log_layout_format.c b/src/xbt/xbt_log_layout_format.c index b93ecadddc..a54136216d 100644 --- a/src/xbt/xbt_log_layout_format.c +++ b/src/xbt/xbt_log_layout_format.c @@ -6,7 +6,7 @@ /* 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. */ -#include "src/portable.h" /* execinfo when available */ +#include "src/internal_config.h" /* execinfo when available */ #include "xbt/synchro_core.h" /* xbt_thread_self_name */ #include "src/xbt/ex_interface.h" #include "xbt/sysdep.h" diff --git a/src/xbt/xbt_log_layout_simple.c b/src/xbt/xbt_log_layout_simple.c index 8f25418490..5ef77ba601 100644 --- a/src/xbt/xbt_log_layout_simple.c +++ b/src/xbt/xbt_log_layout_simple.c @@ -13,7 +13,7 @@ #include "simgrid/simix.h" /* SIMIX_host_self_get_name */ #include "surf/surf.h" #include -#include "src/portable.h" +#include "src/internal_config.h" extern const char *xbt_log_priority_names[8]; extern int xbt_log_no_loc; diff --git a/src/xbt/xbt_main.c b/src/xbt/xbt_main.c index ec1bddf4d0..61551dfb40 100644 --- a/src/xbt/xbt_main.c +++ b/src/xbt/xbt_main.c @@ -22,7 +22,7 @@ #include "simgrid/sg_config.h" -#include "src/portable.h" +#include "src/internal_config.h" #include #ifdef _WIN32 #include /* To silence MSVC on abort() */ diff --git a/src/xbt/xbt_os_file.c b/src/xbt/xbt_os_file.c index be781e16aa..4cc64d28df 100644 --- a/src/xbt/xbt_os_file.c +++ b/src/xbt/xbt_os_file.c @@ -9,7 +9,11 @@ #include "xbt/sysdep.h" #include "xbt/file.h" /* this module */ #include "xbt/log.h" -#include "src/portable.h" +#include "src/internal_config.h" + +#ifdef _WIN32 +#include +#endif #ifndef _MSC_VER #include "libgen.h" /* POSIX dirname */ diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index d5d97397b8..b80fb3199a 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -25,7 +25,8 @@ #include #include -#if defined(WIN32) +#if defined(_WIN32) +#include #elif defined(__MACH__) && defined(__APPLE__) #include #include @@ -37,7 +38,7 @@ #include "xbt/sysdep.h" #include "xbt/ex.h" #include "src/xbt/ex_interface.h" /* We play crude games with exceptions */ -#include "src/portable.h" +#include "src/internal_config.h" #include "xbt/xbt_os_time.h" /* Portable time facilities */ #include "xbt/xbt_os_thread.h" /* This module */ #include "src/xbt_modinter.h" /* Initialization/finalization of this module */ diff --git a/src/xbt/xbt_str.c b/src/xbt/xbt_str.c index 14f928fe27..5c1e85220d 100644 --- a/src/xbt/xbt_str.c +++ b/src/xbt/xbt_str.c @@ -6,7 +6,7 @@ /* 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. */ -#include "src/portable.h" +#include "src/internal_config.h" #include "xbt/misc.h" #include "xbt/sysdep.h" #include "xbt/str.h" /* headers of these functions */ diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 7aac810428..053598dd2f 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -14,7 +14,6 @@ set(EXTRA_DIST src/include/surf/maxmin.h src/include/surf/surf.h src/msg/msg_private.h - src/portable.h src/simdag/dax.dtd src/simdag/dax_dtd.c src/simdag/dax_dtd.h -- 2.20.1