All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Ferron <chris.e.ferron at linux.intel.com>
To: powertop@lists.01.org
Subject: Re: [Powertop] [PATCH 1/2] Fix build with C++11 support enabled
Date: Mon, 14 May 2012 10:29:08 -0700	[thread overview]
Message-ID: <4FB140E4.2040600@linux.intel.com> (raw)
In-Reply-To: 3068026.LgSXzsabzU@intelfx-laptop

[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]

Thank you for the patch.
-Chris

On 05/13/2012 02:49 AM, Ivan Shapovalov wrote:
> In particular, usage of __DATE__ in main.cpp is now recognized as a
> user-defined literal, so an additional whitespace is required separating
> the string and __DATE__.
>
> Also, typeof (which was a GNU extension) is now replaced by decltype,
> so perf/perf_bundle.cpp has been modified.
> The preprocessor is used to tell whether we are compiling in C++11 mode
> or not and select the keyword accordingly.
> ---
>   src/main.cpp             |    2 +-
>   src/perf/perf_bundle.cpp |    8 ++++++++
>   2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/main.cpp b/src/main.cpp
> index e168fa4..433fea6 100644
> --- a/src/main.cpp
> +++ b/src/main.cpp
> @@ -80,7 +80,7 @@ static const struct option long_options[] =
>
>   static void print_version()
>   {
> -	printf(_("Powertop version" POWERTOP_VERSION ", compiled on "__DATE__ "\n"));
> +	printf(_("Powertop version" POWERTOP_VERSION ", compiled on " __DATE__ "\n"));
>   }
>
>   static bool set_refresh_timeout()
> diff --git a/src/perf/perf_bundle.cpp b/src/perf/perf_bundle.cpp
> index fc677f5..38e1e91 100644
> --- a/src/perf/perf_bundle.cpp
> +++ b/src/perf/perf_bundle.cpp
> @@ -38,6 +38,10 @@
>
>   #include "../cpu/cpu.h"
>
> +#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus>= 201103L)
> +# define USE_DECLTYPE
> +#endif
> +
>   class perf_bundle_event: public perf_event
>   {
>   public:
> @@ -58,7 +62,11 @@ void perf_bundle_event::handle_event(struct perf_event_header *header, void *coo
>   	buffer = (unsigned char *)malloc(header->size);
>   	memcpy(buffer, header, header->size);
>
> +#ifdef USE_DECLTYPE
> +	vector = (decltype(vector))cookie;
> +#else
>   	vector = (typeof(vector))cookie;
> +#endif
>   	vector->push_back(buffer);
>   }
>


             reply	other threads:[~2012-05-14 17:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14 17:29 Chris Ferron [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-13  9:49 [Powertop] [PATCH 1/2] Fix build with C++11 support enabled Ivan Shapovalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FB140E4.2040600@linux.intel.com \
    --to=powertop@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.