From 8d66e1e020066d39c94f153ca284f9f263bcce73 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 2 Feb 2016 10:45:41 -0500 Subject: [PATCH] stapdyn: -fstd=c++11 compatibility typeof() and auto_ptr() needed some #ifdef love so that the code compiles with CXXFLAGS="-std=c++11 -O2 -g -Wextra -Wall -Werror" and CXXFLAGS="-O2 -g -Wextra -Wall -Werror" --- stapdyn/dynprobe.h | 3 +++ stapdyn/mutator.h | 3 +++ stapdyn/stapdyn.cxx | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/stapdyn/dynprobe.h b/stapdyn/dynprobe.h index 042098abd..3a7cf4958 100644 --- a/stapdyn/dynprobe.h +++ b/stapdyn/dynprobe.h @@ -16,6 +16,9 @@ extern "C" { #include } +#if __cplusplus >= 201103L /* -std=c++11 */ +#define typeof(x) decltype(x) +#endif // The individual probes' info read from the stap module. struct dynprobe_location { diff --git a/stapdyn/mutator.h b/stapdyn/mutator.h index 459cfc2c7..65c6160d7 100644 --- a/stapdyn/mutator.h +++ b/stapdyn/mutator.h @@ -26,6 +26,9 @@ extern "C" { #include "../runtime/dyninst/stapdyn.h" } +#if __cplusplus >= 201103L /* -std=c++11 */ +#define typeof(x) decltype(x) +#endif // The mutator drives all instrumentation. class mutator { diff --git a/stapdyn/stapdyn.cxx b/stapdyn/stapdyn.cxx index cb389f504..19ae8badf 100644 --- a/stapdyn/stapdyn.cxx +++ b/stapdyn/stapdyn.cxx @@ -145,7 +145,11 @@ main(int argc, char * const argv[]) if (!check_dyninst_sebools(pid != 0)) return 1; +#if __cplusplus >= 201103L /* -std=c++11 */ + unique_ptr session(new mutator(module, modoptions)); +#else auto_ptr session(new mutator(module, modoptions)); +#endif if (!session.get() || !session->load()) { staperror() << "Failed to create the mutator!" << endl; -- 2.43.5