From 3a8a7a56ab604c3cca49792973c8b0c6d8a089b9 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Tue, 8 Oct 2013 01:40:11 +0200 Subject: Got rid of some warnings with gcc --- CMakeLists.txt | 4 +- apps/w3c-mmi/im/uscxml-interaction-manager.cpp | 1 + apps/w3c-mmi/mc/uscxml-modality-component.cpp | 2 +- src/bindings/swig/php/uscxmlNativePHP.php | 55 +++++++++++++++++++++- src/uscxml/Common.h | 3 ++ .../plugins/datamodel/prolog/swi/SWIDataModel.cpp | 3 +- src/uscxml/plugins/element/file/FileElement.cpp | 2 +- test/src/test-cmdline-parsing.cpp | 4 -- test/src/test-stress.cpp | 2 +- test/src/test-w3c.cpp | 2 +- 10 files changed, 65 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfd0a38..077368a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -739,7 +739,7 @@ endforeach() # add compile time reducer # see https://github.com/sakra/cotire -if ((WIN32 OR UNIX) AND NOT APPLE) +if (NOT CMAKE_CROSSCOMPILING) include(cotire) endif() @@ -751,7 +751,7 @@ else() add_library(uscxml ${USCXML_FILES}) target_link_libraries(uscxml ${USCXML_OPT_LIBS} ${USCXML_CORE_LIBS}) endif() -if ((WIN32 OR UNIX) AND NOT APPLE) +if (NOT CMAKE_CROSSCOMPILING) set_target_properties(uscxml PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "src/uscxml/pch.h") cotire(uscxml) endif() diff --git a/apps/w3c-mmi/im/uscxml-interaction-manager.cpp b/apps/w3c-mmi/im/uscxml-interaction-manager.cpp index 13189fc..19e9d9b 100644 --- a/apps/w3c-mmi/im/uscxml-interaction-manager.cpp +++ b/apps/w3c-mmi/im/uscxml-interaction-manager.cpp @@ -167,6 +167,7 @@ int main(int argc, char** argv) { } } + (void)verbose; // intialize http server on given port HTTPServer::getInstance(port); diff --git a/apps/w3c-mmi/mc/uscxml-modality-component.cpp b/apps/w3c-mmi/mc/uscxml-modality-component.cpp index 39f81d7..5b06279 100644 --- a/apps/w3c-mmi/mc/uscxml-modality-component.cpp +++ b/apps/w3c-mmi/mc/uscxml-modality-component.cpp @@ -174,7 +174,7 @@ int main(int argc, char** argv) { LOG(INFO) << "Processing " << argv[optind]; Interpreter interpreter = Interpreter::fromURI(argv[optind]); if (interpreter) { - interpreter.setCmdLineOptions(argc, argv); +// interpreter.setCmdLineOptions(argc, argv); // interpreter->setCapabilities(Interpreter::CAN_NOTHING); // interpreter->setCapabilities(Interpreter::CAN_BASIC_HTTP | Interpreter::CAN_GENERIC_HTTP); diff --git a/src/bindings/swig/php/uscxmlNativePHP.php b/src/bindings/swig/php/uscxmlNativePHP.php index dccfbaf..4a9c37b 100644 --- a/src/bindings/swig/php/uscxmlNativePHP.php +++ b/src/bindings/swig/php/uscxmlNativePHP.php @@ -702,6 +702,57 @@ class SendRequest extends Event { } } +class InterpreterOptions { + public $_cPtr=null; + protected $_pData=array(); + + function __set($var,$value) { + $func = 'InterpreterOptions_'.$var.'_set'; + if (function_exists($func)) return call_user_func($func,$this->_cPtr,$value); + if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value); + $this->_pData[$var] = $value; + } + + function __isset($var) { + if (function_exists('InterpreterOptions_'.$var.'_set')) return true; + if ($var === 'thisown') return true; + return array_key_exists($var, $this->_pData); + } + + function __get($var) { + if ($var === 'additionalParameters') return new StringMap(InterpreterOptions_additionalParameters_get($this->_cPtr)); + $func = 'InterpreterOptions_'.$var.'_get'; + if (function_exists($func)) return call_user_func($func,$this->_cPtr); + if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr); + return $this->_pData[$var]; + } + function __construct($h) { + $this->_cPtr=$h; + } + + function isValid() { + return InterpreterOptions_isValid($this->_cPtr); + } + + static function printUsageAndExit($progName) { + InterpreterOptions_printUsageAndExit($progName); + } + + static function fromCmdLine($argc,$argv) { + $r=InterpreterOptions_fromCmdLine($argc,$argv); + if (is_resource($r)) { + $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3)); + if (class_exists($c)) return new $c($r); + return new InterpreterOptions($r); + } + return $r; + } + + function getCapabilities() { + return InterpreterOptions_getCapabilities($this->_cPtr); + } +} + class Interpreter { public $_cPtr=null; protected $_pData=array(); @@ -826,8 +877,8 @@ class Interpreter { return $r; } - function setCmdLineOptions($argc,$argv) { - Interpreter_setCmdLineOptions($this->_cPtr,$argc,$argv); + function setCmdLineOptions($params) { + Interpreter_setCmdLineOptions($this->_cPtr,$params); } function getCmdLineOptions() { diff --git a/src/uscxml/Common.h b/src/uscxml/Common.h index 279306a..f73e8bd 100644 --- a/src/uscxml/Common.h +++ b/src/uscxml/Common.h @@ -10,6 +10,9 @@ #include #endif +#define _USE_MATH_DEFINES +#include + #if defined(_MSC_VER) // disable signed / unsigned comparison warnings #pragma warning (disable : 4018) diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp index aec044e..092426e 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp @@ -106,7 +106,8 @@ boost::shared_ptr SWIDataModel::create(InterpreterImpl* interpret int rc = PL_set_engine(engine, NULL); assert(rc == PL_ENGINE_SET); - + (void)rc; + _plModule = boost::replace_all_copy(interpreter->getSessionId(), "-", ""); boost::replace_all(_plModule, "0", "g"); boost::replace_all(_plModule, "1", "h"); diff --git a/src/uscxml/plugins/element/file/FileElement.cpp b/src/uscxml/plugins/element/file/FileElement.cpp index e551ad7..2287eed 100644 --- a/src/uscxml/plugins/element/file/FileElement.cpp +++ b/src/uscxml/plugins/element/file/FileElement.cpp @@ -67,7 +67,7 @@ void FileElement::enterElement(const Arabica::DOM::Node& node) { std::string contentStr; char* content = NULL; - size_t contentSize; + size_t contentSize = 0; if (_operation == WRITE || _operation == APPEND) { if (!HAS_ATTR(node, "content") && !HAS_ATTR(node, "contentexpr")) { LOG(ERROR) << "File element requires content or contentexpr"; diff --git a/test/src/test-cmdline-parsing.cpp b/test/src/test-cmdline-parsing.cpp index b0b909e..9ff094a 100644 --- a/test/src/test-cmdline-parsing.cpp +++ b/test/src/test-cmdline-parsing.cpp @@ -35,7 +35,6 @@ int main(int argc, char** argv) { assert(!options); // invalid as no SCXML document is given optind = 0; - optreset = 1; } if (true) { @@ -53,7 +52,6 @@ int main(int argc, char** argv) { assert(options.interpreters.find("/foo/bar.scxml") != options.interpreters.end()); optind = 0; - optreset = 1; } if (true) { @@ -80,7 +78,6 @@ int main(int argc, char** argv) { assert(!options.interpreters["/foo/bar3.scxml"]->withHTTP); optind = 0; - optreset = 1; } if (true) { @@ -102,7 +99,6 @@ int main(int argc, char** argv) { assert(options.interpreters["/foo/bar1.scxml"]->additionalParameters.find("tmp-path") != options.interpreters["/foo/bar1.scxml"]->additionalParameters.end()); optind = 0; - optreset = 1; } return EXIT_SUCCESS; diff --git a/test/src/test-stress.cpp b/test/src/test-stress.cpp index 07cc733..4f15bc3 100644 --- a/test/src/test-stress.cpp +++ b/test/src/test-stress.cpp @@ -162,7 +162,7 @@ int main(int argc, char** argv) { LOG(INFO) << "Processing " << entryIter->first; Interpreter interpreter = Interpreter::fromURI(std::string(argv[optind]) + PATH_SEPERATOR + entryIter->first); if (interpreter) { - interpreter.setCmdLineOptions(argc, argv); +// interpreter.setCmdLineOptions(argc, argv); interpreter.addMonitor(&vm); diff --git a/test/src/test-w3c.cpp b/test/src/test-w3c.cpp index 1600c27..e89ab2c 100644 --- a/test/src/test-w3c.cpp +++ b/test/src/test-w3c.cpp @@ -150,7 +150,7 @@ int main(int argc, char** argv) { LOG(INFO) << "Processing " << argv[optind]; Interpreter interpreter = Interpreter::fromURI(argv[optind]); if (interpreter) { - interpreter.setCmdLineOptions(argc, argv); +// interpreter.setCmdLineOptions(argc, argv); // interpreter->setCapabilities(Interpreter::CAN_NOTHING); // interpreter->setCapabilities(Interpreter::CAN_BASIC_HTTP | Interpreter::CAN_GENERIC_HTTP); -- cgit v0.12