All of lore.kernel.org
 help / color / mirror / Atom feed
From: Magnus Fromreide <magfr at lysator.liu.se>
To: powertop@lists.01.org
Subject: Re: [Powertop] [PATCH] Use printf, not sprintf, to print messages to stdout.
Date: Fri, 22 Jun 2012 10:49:30 +0200	[thread overview]
Message-ID: <1340354970.2997.14.camel@sara> (raw)
In-Reply-To: CAOpc7mFZkCD1EngEtaMPv+T-Rg6m0ph-DP87GDajq8hhKe1=bg@mail.gmail.com

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

On Fri, 2012-06-22 at 08:45 +0200, Holger Schurig wrote:
> You guys should run powertop via clang's static analyzer :-)

Ok, I did.

It found a few bugs, but not these. On the other hand, the compiler
warned about these.

The warnings from g++ for this particular problem are:

main.cpp: In function ‘void out_of_memory()’:
main.cpp:234:72: warning: deprecated conversion from string constant to ‘char*’ 
[-Wwrite-strings]
main.cpp: In function ‘int main(int, char**)’:
main.cpp:465:39: warning: deprecated conversion from string constant to ‘char*’ 

>From clang++ I get:

main.cpp:234:10: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        sprintf("%s...\n",_("PowerTOP is out of memory. PowerTOP is Aborting"));
                ^
main.cpp:465:10: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
        sprintf("%s\n", _("Leaving PowerTOP"));
                ^

>From clang-analyze I get nothing.

The most interesting part is actually that the compilers reported this
as a warning and not an error.

/MF


             reply	other threads:[~2012-06-22  8:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-22  8:49 Magnus Fromreide [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-22 16:13 [Powertop] [PATCH] Use printf, not sprintf, to print messages to stdout Chris Ferron
2012-06-21 19:48 Magnus Fromreide
2012-06-21 19:42 Lekensteyn
2012-06-21 19:14 Sergey Senozhatsky
2012-06-21 19:07 Magnus Fromreide
2012-06-16 16:14 Magnus Fromreide

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=1340354970.2997.14.camel@sara \
    --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.