From: Frederic Suter Date: Sun, 26 Mar 2017 12:47:35 +0000 (+0200) Subject: sunday smell chase X-Git-Tag: v3.16~448 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f3f75bc2f18724100ab01ced9891742ea48b7a08 sunday smell chase --- diff --git a/examples/s4u/actor-create/s4u_actor-create.cpp b/examples/s4u/actor-create/s4u_actor-create.cpp index f4146a59d0..a20f02edea 100644 --- a/examples/s4u/actor-create/s4u_actor-create.cpp +++ b/examples/s4u/actor-create/s4u_actor-create.cpp @@ -30,9 +30,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor_create, "The logging channel used in this class Sender { public: std::string msg = "GaBuZoMeu"; - explicit Sender(){ - /* Constructor used when no parameter is passed to the actor */ - }; + explicit Sender() = default; explicit Sender(std::vector args) { /* This constructor is used when we pass parameters to the actor */ diff --git a/include/xbt/base.h b/include/xbt/base.h index 4ecf84e014..de8f8ce509 100644 --- a/include/xbt/base.h +++ b/include/xbt/base.h @@ -10,75 +10,75 @@ /* Define _GNU_SOURCE for getline, isfinite, etc. */ #ifndef _GNU_SOURCE - #define _GNU_SOURCE +# define _GNU_SOURCE #endif // Teach the compiler that some code path is unreacheable: #if defined(__has_builtin) - #if __has_builtin(__builtin_unreachable) - #define XBT_UNREACHABLE() __builtin_unreachable() - #else - #include - #define XBT_UNREACHABLE() abort() - #endif +# if __has_builtin(__builtin_unreachable) +# define XBT_UNREACHABLE() __builtin_unreachable() +# else +# include +# define XBT_UNREACHABLE() abort() +# endif #elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) - #define XBT_UNREACHABLE() __builtin_unreachable() +# define XBT_UNREACHABLE() __builtin_unreachable() #else - #include - #define XBT_UNREACHABLE() abort() +# include +# define XBT_UNREACHABLE() abort() #endif /* On MinGW, stdio.h defines __MINGW_PRINTF_FORMAT and __MINGW_SCANF_FORMAT which are the suitable format style (either gnu_printf or ms_printf) depending on which version is available (__USE_MINGW_ANSI_STDIO): */ #ifdef __MINGW32__ - #include +# include - # define XBT_ATTRIB_PRINTF( format_idx, arg_idx ) \ +# define XBT_ATTRIB_PRINTF( format_idx, arg_idx ) \ __attribute__((__format__ (__MINGW_PRINTF_FORMAT, format_idx, arg_idx))) - # define XBT_ATTRIB_SCANF( format_idx, arg_idx ) \ - __attribute__((__MINGW_SCANF_FORMAT (__scanf__, format_idx, arg_idx))) +# define XBT_ATTRIB_SCANF( format_idx, arg_idx ) \ + __attribute__((__MINGW_SCANF_FORMAT (__scanf__, format_idx, arg_idx))) #else - # define XBT_ATTRIB_PRINTF( format_idx, arg_idx ) \ +# define XBT_ATTRIB_PRINTF( format_idx, arg_idx ) \ __attribute__((__format__ (__printf__, format_idx, arg_idx))) - # define XBT_ATTRIB_SCANF( format_idx, arg_idx ) \ - __attribute__((__format__ (__scanf__, format_idx, arg_idx))) +# define XBT_ATTRIB_SCANF( format_idx, arg_idx ) \ + __attribute__((__format__ (__scanf__, format_idx, arg_idx))) #endif -# define XBT_ATTRIB_NORETURN __attribute__((__noreturn__)) -# define XBT_ATTRIB_UNUSED __attribute__((__unused__)) -# define XBT_ATTRIB_DEPRECATED(m) __attribute__((__deprecated__(m))) +#define XBT_ATTRIB_NORETURN __attribute__((__noreturn__)) +#define XBT_ATTRIB_UNUSED __attribute__((__unused__)) +#define XBT_ATTRIB_DEPRECATED(m) __attribute__((__deprecated__(m))) /* Constructor priorities exist since gcc 4.3. Apparently, they are however not * supported on Macs. */ -# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && !defined(__APPLE__) +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && !defined(__APPLE__) # define _XBT_GNUC_CONSTRUCTOR(prio) __attribute__((__constructor__ (prio))) # define _XBT_GNUC_DESTRUCTOR(prio) __attribute__((__destructor__ (prio))) -# else +#else # define _XBT_GNUC_CONSTRUCTOR(prio) __attribute__((__constructor__)) # define _XBT_GNUC_DESTRUCTOR(prio) __attribute__((__destructor__)) -# endif +#endif #if defined(__GNUC__) -# define XBT_ALWAYS_INLINE inline __attribute__ ((always_inline)) +# define XBT_ALWAYS_INLINE inline __attribute__ ((always_inline)) #else -# define XBT_ALWAYS_INLINE inline +# define XBT_ALWAYS_INLINE inline #endif #if defined(__GNUC__) -# define XBT_THREAD_LOCAL __thread +# define XBT_THREAD_LOCAL __thread #else -# define XBT_THREAD_LOCAL No thread local on this architecture +# define XBT_THREAD_LOCAL No thread local on this architecture #endif /* improvable on gcc (by evaluating arguments only once), but wouldn't be portable */ #ifdef MIN -# undef MIN +# undef MIN #endif #define MIN(a,b) ((a)<(b)?(a):(b)) #ifdef MAX -# undef MAX +# undef MAX #endif #define MAX(a,b) ((a)>(b)?(a):(b)) diff --git a/include/xbt/matrix.h b/include/xbt/matrix.h index 55363e2950..f6ae73fa0b 100644 --- a/include/xbt/matrix.h +++ b/include/xbt/matrix.h @@ -20,8 +20,8 @@ typedef struct { char *data; void_f_pvoid_t free_f; -} s_xbt_matrix_t, *xbt_matrix_t; - +} s_xbt_matrix_t; +typedef s_xbt_matrix_t* xbt_matrix_t; /** @brief Retrieve the address of a cell (not its content) * @hideinitializer */ diff --git a/include/xbt/strbuff.h b/include/xbt/strbuff.h index 585d719d09..cc7aaa52af 100644 --- a/include/xbt/strbuff.h +++ b/include/xbt/strbuff.h @@ -29,15 +29,15 @@ SG_BEGIN_DECL() */ /** @brief Buffer data container **/ -struct xbt_strbuff { +typedef struct xbt_strbuff { char *data; - int used, size; -}; -typedef struct xbt_strbuff s_xbt_strbuff_t; -typedef struct xbt_strbuff* xbt_strbuff_t; + int used; + int size; +} s_xbt_strbuff_t; +typedef s_xbt_strbuff_t* xbt_strbuff_t; XBT_PUBLIC(void) xbt_strbuff_clear(xbt_strbuff_t b); -XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new(void); +XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new(); XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new_from(const char *s); XBT_PUBLIC(void) xbt_strbuff_free(xbt_strbuff_t b); XBT_PUBLIC(void) xbt_strbuff_free_container(xbt_strbuff_t b); diff --git a/src/msg/msg_private.h b/src/msg/msg_private.h index add80f2361..008bf9826d 100644 --- a/src/msg/msg_private.h +++ b/src/msg/msg_private.h @@ -90,7 +90,8 @@ typedef struct process_arg { int argc; char **argv; double kill_time; -} s_process_arg_t, *process_arg_t; +} s_process_arg_t; +typedef s_process_arg_t* process_arg_t; typedef struct msg_comm { smx_activity_t s_comm; /* SIMIX communication object encapsulated (the same for both processes) */ @@ -105,7 +106,8 @@ typedef struct MSG_Global { unsigned long int sent_msg; /* Total amount of messages sent during the simulation */ void (*task_copy_callback) (msg_task_t task, msg_process_t src, msg_process_t dst); void_f_pvoid_t process_data_cleanup; -} s_MSG_Global_t, *MSG_Global_t; +} s_MSG_Global_t; +typedef s_MSG_Global_t* MSG_Global_t; SG_BEGIN_DECL() diff --git a/src/xbt/config.cpp b/src/xbt/config.cpp index 539ba59f39..bbbbf29399 100644 --- a/src/xbt/config.cpp +++ b/src/xbt/config.cpp @@ -39,7 +39,7 @@ extern "C" { namespace simgrid { namespace config { -missing_key_error::~missing_key_error() {} +missing_key_error::~missing_key_error() = default; class Config; diff --git a/src/xbt/dict_private.h b/src/xbt/dict_private.h index 9b5087ff75..98f4adbfa2 100644 --- a/src/xbt/dict_private.h +++ b/src/xbt/dict_private.h @@ -24,7 +24,8 @@ SG_BEGIN_DECL() typedef struct s_xbt_het_dictelm { s_xbt_dictelm_t element; void_f_pvoid_t free_f; -} s_xbt_het_dictelm_t, *xbt_het_dictelm_t; +} s_xbt_het_dictelm_t; +typedef s_xbt_het_dictelm_t* xbt_het_dictelm_t; typedef struct s_xbt_dict { void_f_pvoid_t free_f; diff --git a/src/xbt/heap_private.h b/src/xbt/heap_private.h index 5c0d12a7b4..aeed373793 100644 --- a/src/xbt/heap_private.h +++ b/src/xbt/heap_private.h @@ -13,7 +13,8 @@ typedef struct xbt_heap_item { void *content; double key; -} s_xbt_heap_item_t, *xbt_heap_item_t; +} s_xbt_heap_item_t; +typedef s_xbt_heap_item_t* xbt_heap_item_t; typedef struct xbt_heap { int size; diff --git a/src/xbt/log.c b/src/xbt/log.c index c8659e0123..e9ed472a00 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -41,7 +41,9 @@ typedef struct { e_xbt_log_priority_t thresh; int additivity; xbt_log_appender_t appender; -} s_xbt_log_setting_t, *xbt_log_setting_t; +} s_xbt_log_setting_t; + +typedef s_xbt_log_setting_t* xbt_log_setting_t; static xbt_dynar_t xbt_log_settings = NULL; diff --git a/src/xbt/xbt_os_time.c b/src/xbt/xbt_os_time.c index fa6fc2b437..0e8951f837 100644 --- a/src/xbt/xbt_os_time.c +++ b/src/xbt/xbt_os_time.c @@ -92,15 +92,22 @@ void xbt_os_sleep(double sec) */ struct s_xbt_os_timer { #if HAVE_POSIX_GETTIME - struct timespec start, stop, elapse; + struct timespec start; + struct timespec stop; + struct timespec elapse; #elif HAVE_GETTIMEOFDAY || defined(_WIN32) - struct timeval start, stop, elapse; + struct timeval start; + struct timeval stop; + struct timeval elapse; #else - unsigned long int start, stop, elapse; + unsigned long int start; + unsigned long int stop; + unsigned long int elapse; #endif }; -size_t xbt_os_timer_size(void){ +size_t xbt_os_timer_size(void) +{ return sizeof(struct s_xbt_os_timer); }