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