Author Daniel Lord
Recipients Daniel Lord
Date 2016-07-16.17:05:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468688744.22.0.0620333802067.issue27530@psf.upfronthosting.co.za>
In-reply-to
Content
ERROR SUMMARY:
abstract.h:1332:60: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
 #define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL)

ISSUE CRITICALITY:
Non-fatal Warning (will become an error eventually when deprecations expire and errors are introduced in c++XX or later)

COMPILER:
g++ -std=c++11
g++ 4.2.1

$g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

FILE:
abstract.h

WORKAROUND:
add compiler option: -Wc++11-compat-deprecated-writable-strings and -Wwritable-strings. In theory anyway: doesn't seem to work (still get the warning) and when I tried g++ 5.3.0, the compiler marks that option as an error and unsupported.

g++-5.3.0: error: unrecognized command line option ‘-Wwritable-strings’
g++-5.3.0: error: unrecognized command line option ‘-Wc++11-compat-deprecated-writable-strings’

ERROR MESSAGE:
warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
        pList = PyMapping_Keys(pDict);
                ^
/Users/xxxxxx/anaconda/include/python2.7/abstract.h:1332:49: note: expanded from macro 'PyMapping_Keys'
#define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL)
                                                ^
1 warning generated.

OFFENDING STATEMNT:
#define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL)

PROBLEM:
"keys" is a string literal but not declared as a constant.

COMMENTS:
This is not a big deal...yet.
I can compile with g++ C++11 using the above flag to allow deprecated writeable string literals for my application embedding Python 2.7.
However, I assume the embedding code is replete with non-constant string literals which eventually need to be fixed though this is the first one I have run into.
History
Date User Action Args
2016-07-16 17:05:44Daniel Lordsetrecipients: + Daniel Lord
2016-07-16 17:05:44Daniel Lordsetmessageid: <1468688744.22.0.0620333802067.issue27530@psf.upfronthosting.co.za>
2016-07-16 17:05:44Daniel Lordlinkissue27530 messages
2016-07-16 17:05:43Daniel Lordcreate