From: Gabriel Corona Date: Mon, 7 Sep 2015 12:52:47 +0000 (+0200) Subject: Merge remote-tracking branch 'origin2/master' X-Git-Tag: v3_12~279^2~5 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/57e75112e7ce09f9577c63184b2e7cebe2a312ba?hp=306ee8cf3546035594e183e063a12f11aff9e023 Merge remote-tracking branch 'origin2/master' --- diff --git a/contrib/deployment_generation/generate_random_deployment.pl b/contrib/deployment_generation/generate_random_deployment.pl index b160b3f4ec..bd353fae3c 100755 --- a/contrib/deployment_generation/generate_random_deployment.pl +++ b/contrib/deployment_generation/generate_random_deployment.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2009, 2011, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; sub melange { my $tableau=shift; diff --git a/contrib/network_model/regression2.py b/contrib/network_model/regression2.py index f314d9e50e..fc4e84ba7a 100755 --- a/contrib/network_model/regression2.py +++ b/contrib/network_model/regression2.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. diff --git a/examples/java/bittorrent/generate.py b/examples/java/bittorrent/generate.py index d4ea09ee9e..155957fc08 100755 --- a/examples/java/bittorrent/generate.py +++ b/examples/java/bittorrent/generate.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2013-2014. The SimGrid Team. # All rights reserved. diff --git a/examples/msg/bittorrent/generate.py b/examples/msg/bittorrent/generate.py index f3460bb3c9..7f0d6d455f 100755 --- a/examples/msg/bittorrent/generate.py +++ b/examples/msg/bittorrent/generate.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2012, 2014. The SimGrid Team. # All rights reserved. diff --git a/examples/msg/chord/generate.py b/examples/msg/chord/generate.py index afc0ea9123..3b707ac48a 100755 --- a/examples/msg/chord/generate.py +++ b/examples/msg/chord/generate.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011-2012, 2014. The SimGrid Team. # All rights reserved. diff --git a/examples/msg/kademlia/generate.py b/examples/msg/kademlia/generate.py index b47512022c..1b9526cefb 100755 --- a/examples/msg/kademlia/generate.py +++ b/examples/msg/kademlia/generate.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2012, 2014. The SimGrid Team. # All rights reserved. diff --git a/examples/platforms/conf/transform_optorsim_platform.pl b/examples/platforms/conf/transform_optorsim_platform.pl index 7e5369af29..d2db4d946e 100644 --- a/examples/platforms/conf/transform_optorsim_platform.pl +++ b/examples/platforms/conf/transform_optorsim_platform.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; if($#ARGV!=0) { die "Usage: perl transfrom_optorsim_platform.pl \n"; diff --git a/examples/platforms/generation_scripts/generate_g5k_platform.pl b/examples/platforms/generation_scripts/generate_g5k_platform.pl index 023ffacc4f..048143fb8a 100755 --- a/examples/platforms/generation_scripts/generate_g5k_platform.pl +++ b/examples/platforms/generation_scripts/generate_g5k_platform.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; use Switch; my $toversion=3; diff --git a/examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl b/examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl index 220565087b..9f3818e845 100755 --- a/examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl +++ b/examples/platforms/generation_scripts/generate_g5k_platform_cabinets.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; use Switch; my $site=""; diff --git a/examples/platforms/syscoord/generate_peer_platform.pl b/examples/platforms/syscoord/generate_peer_platform.pl index a01bcebd1e..7b530e3ab2 100755 --- a/examples/platforms/syscoord/generate_peer_platform.pl +++ b/examples/platforms/syscoord/generate_peer_platform.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; my $toversion=3; my $nb_peer = $ARGV[0]; diff --git a/src/mc/RegionSnapshot.cpp b/src/mc/RegionSnapshot.cpp index 4a6e63f573..0bcdd392d9 100644 --- a/src/mc/RegionSnapshot.cpp +++ b/src/mc/RegionSnapshot.cpp @@ -18,6 +18,21 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_RegionSnaphot, mc, namespace simgrid { namespace mc { +static inline +const char* to_cstr(RegionType region) +{ + switch (region) { + case RegionType::Unknown: + return "unknown"; + case RegionType::Heap: + return "Heap"; + case RegionType::Data: + return "Data"; + default: + return "?"; + } +} + RegionSnapshot dense_region( RegionType region_type, void *start_addr, void* permanent_addr, size_t size) @@ -31,8 +46,8 @@ RegionSnapshot dense_region( region_type, start_addr, permanent_addr, size); region.flat_data(std::move(data)); - XBT_DEBUG("New region : type : %d, data : %p (real addr %p), size : %zu", - region_type, region.flat_data().data(), permanent_addr, size); + XBT_DEBUG("New region : type : %s, data : %p (real addr %p), size : %zu", + to_cstr(region_type), region.flat_data().data(), permanent_addr, size); return std::move(region); } diff --git a/src/smpi/fixsrc.pl b/src/smpi/fixsrc.pl index 2bc55d93b1..8844d208c5 100755 --- a/src/smpi/fixsrc.pl +++ b/src/smpi/fixsrc.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright (c) 2011, 2014. The SimGrid Team. # All rights reserved. diff --git a/tools/MSG_visualization/colorize.pl b/tools/MSG_visualization/colorize.pl index b3c567189d..db2676b51e 100755 --- a/tools/MSG_visualization/colorize.pl +++ b/tools/MSG_visualization/colorize.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright (c) 2005, 2007, 2010, 2014. The SimGrid Team. # All rights reserved. diff --git a/tools/MSG_visualization/trace2fig.pl b/tools/MSG_visualization/trace2fig.pl index cd23d39cec..2ac7c85a82 100755 --- a/tools/MSG_visualization/trace2fig.pl +++ b/tools/MSG_visualization/trace2fig.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2006-2007, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,8 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; + #use Data::Dumper; use XFig; use POSIX; diff --git a/tools/cmake/Flags.cmake b/tools/cmake/Flags.cmake index 584434e5a1..872fe659fe 100644 --- a/tools/cmake/Flags.cmake +++ b/tools/cmake/Flags.cmake @@ -30,27 +30,51 @@ if(enable_compile_warnings) set(CMAKE_JAVA_COMPILE_FLAGS "-Xlint") endif() +# Se the optimisation flags +# NOTE, we should CMAKE_BUILD_TYPE for this if(enable_compile_optimizations) set(optCFLAGS "-O3 -funroll-loops -fno-strict-aliasing ") - if(CMAKE_COMPILER_IS_GNUCC AND (NOT enable_model-checking)) - set(optCFLAGS "${optCFLAGS} -finline-functions ") - if(WIN32) - if (COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.8") +else() + set(optCFLAGS "-O0 ") +endif() +if(enable_compile_optimizations AND CMAKE_COMPILER_IS_GNUCC + AND (NOT enable_model-checking)) + # This is redundant (already in -03): + set(optCFLAGS "${optCFLAGS} -finline-functions ") +endif() + +# Configure LTO +# TODO, provide an option to manually choose whether to use LTO +# NOTE, cmake 3.0 has a INTERPROCEDURAL_OPTIMIZATION target +# property for this (http://www.cmake.org/cmake/help/v3.0/prop_tgt/INTERPROCEDURAL_OPTIMIZATION.html) +set(enable_lto OFF) +if(enable_compile_optimizations + AND CMAKE_COMPILER_IS_GNUCC + AND (NOT enable_model-checking)) + if(WIN32) + if (COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.8") # On windows, we need 4.8 or higher to enable lto because of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50293 # # We are experiencing assertion failures even with 4.8 on MinGW. # Push the support forward: will see if 4.9 works when we test it. - set(optCFLAGS "${optCFLAGS} -flto ") - endif() - else() - # On non-windows, 4.6 is enough for that - if(LINKER_VERSION STRGREATER "2.22") - set(optCFLAGS "${optCFLAGS} -flto ") - endif() + set(enable_lto ON) endif() + elseif(LINKER_VERSION STRGREATER "2.22") + set(enable_lto ON) + endif() +endif() +if(enable_lto) + set(optCFLAGS "${optCFLAGS} -flto ") + # See https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ#ar.2C_nm_and_ranlib: + # "Since version 4.9 gcc produces slim object files that only contain + # the intermediate representation. In order to handle archives of + # these objects you have to use the gcc wrappers: + # gcc-ar, gcc-nm and gcc-ranlib." + if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" + AND COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.8") + set (CMAKE_AR gcc-ar) + set (CMAKE_RANLIB gcc-ranlib) endif() -else() - set(optCFLAGS "-O0 ") endif() if(enable_model-checking AND enable_compile_optimizations) diff --git a/tools/cmake/Scripts/generate_memcheck_tests.pl b/tools/cmake/Scripts/generate_memcheck_tests.pl index fc4fd61816..d37977aae5 100755 --- a/tools/cmake/Scripts/generate_memcheck_tests.pl +++ b/tools/cmake/Scripts/generate_memcheck_tests.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2012-2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; # input file = AddTest.txt diff --git a/tools/cmake/Scripts/my_valgrind.pl b/tools/cmake/Scripts/my_valgrind.pl index 073b4b8a07..3b273d5d61 100755 --- a/tools/cmake/Scripts/my_valgrind.pl +++ b/tools/cmake/Scripts/my_valgrind.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2012-2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,8 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; + my @argv = ("valgrind"); my $count = 0; diff --git a/tools/cmake/Scripts/update_tesh.pl b/tools/cmake/Scripts/update_tesh.pl index 7c340b4b5e..5e0a06d174 100755 --- a/tools/cmake/Scripts/update_tesh.pl +++ b/tools/cmake/Scripts/update_tesh.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2012, 2014. The SimGrid Team. # All rights reserved. @@ -7,6 +7,7 @@ # under the terms of the license (GNU LGPL) which comes with this package. use strict; +use warnings; if($#ARGV!=1) { die "Usage: perl make_tesh.pl \n"; diff --git a/tools/doxygen/index_create.pl b/tools/doxygen/index_create.pl index f9f58d2953..7d23af0a58 100755 --- a/tools/doxygen/index_create.pl +++ b/tools/doxygen/index_create.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2005, 2012-2014. The SimGrid Team. # All rights reserved. @@ -6,6 +6,8 @@ # 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. +use warnings; + ($#ARGV >= 1) or die "Usage: index_create.pl "; my($type) = ""; diff --git a/tools/doxygen/xbt_log_extract_hierarchy.pl b/tools/doxygen/xbt_log_extract_hierarchy.pl index 40f60ee650..ba13f8aac8 100755 --- a/tools/doxygen/xbt_log_extract_hierarchy.pl +++ b/tools/doxygen/xbt_log_extract_hierarchy.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright (c) 2008, 2010, 2012-2014. The SimGrid Team. # All rights reserved. diff --git a/tools/internal/generate-multi-jar.py b/tools/internal/generate-multi-jar.py index c200c49e58..41ec224c1b 100755 --- a/tools/internal/generate-multi-jar.py +++ b/tools/internal/generate-multi-jar.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2013-2014. The SimGrid Team. # All rights reserved. diff --git a/tools/internal/spell_comments.pl b/tools/internal/spell_comments.pl index 5ab59587f4..7ff91da032 100755 --- a/tools/internal/spell_comments.pl +++ b/tools/internal/spell_comments.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright (c) 2013-2015. The SimGrid Team. # All rights reserved. @@ -13,6 +13,7 @@ # Copyright 2003, Dan Kegel. Licensed under GPL. See the file ../COPYING for details. use strict; +use warnings; die "Please install iamerican to use that script." unless (-r "/usr/lib/ispell/american.hash"); diff --git a/tools/normalize-pointers.py b/tools/normalize-pointers.py index 04049fa48f..ba78a8078c 100755 --- a/tools/normalize-pointers.py +++ b/tools/normalize-pointers.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2013-2014. The SimGrid Team. # All rights reserved. diff --git a/tools/stack-cleaner/as b/tools/stack-cleaner/as index 1a66dd3798..46446cb3f0 100755 --- a/tools/stack-cleaner/as +++ b/tools/stack-cleaner/as @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby # Wrapper around the real `as` which adds filtering capabilities. require "tempfile" diff --git a/tools/stack-cleaner/clean-stack-filter b/tools/stack-cleaner/clean-stack-filter index a2f91aa0ad..64e79903c5 100755 --- a/tools/stack-cleaner/clean-stack-filter +++ b/tools/stack-cleaner/clean-stack-filter @@ -1,9 +1,10 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Transform assembly in order to clean each stack frame for X86_64. use strict; -$SIG{__WARN__} = sub { die @_ }; +use warnings; +$SIG{__WARN__} = sub { die @_ }; # Whether we are still scanning the content of a function: our $scanproc = 0; diff --git a/tools/stack-cleaner/compiler-wrapper b/tools/stack-cleaner/compiler-wrapper index 8b8a62f5fd..62504af416 100755 --- a/tools/stack-cleaner/compiler-wrapper +++ b/tools/stack-cleaner/compiler-wrapper @@ -1,7 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Compiler wrapper with stack-cleaner support (enabled by default). # Usage: ./compiler-wrapper target-compiler args [-f[no-]stack-cleaner] +use warnings; + use File::Basename; my $compiler = shift(@ARGV); diff --git a/tools/tesh/colorize.pl b/tools/tesh/colorize.pl index 9cc8d183c9..88b1f55e86 100755 --- a/tools/tesh/colorize.pl +++ b/tools/tesh/colorize.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (c) 2010, 2014. The SimGrid Team. # All rights reserved. @@ -6,6 +6,8 @@ # 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. +use warnings; + use Term::ANSIColor qw{:constants}; $Term::ANSIColor::AUTORESET = 1;