Coder Social home page Coder Social logo

beltoforion / muparser Goto Github PK

View Code? Open in Web Editor NEW
402.0 33.0 119.0 17.25 MB

muparser is a fast math parser library for C/C++ with (optional) OpenMP support.

Home Page: http://beltoforion.de/en/muparser

License: BSD 2-Clause "Simplified" License

C++ 92.64% C 6.08% CMake 1.27%
library math-parser math-parser-library mathematics openmp parser fast

muparser's Introduction

GitHub issues Version Packaging status Appveyor

muparser - fast math parser library

title

Change Notes for Revision 2.3.5

Fixed Compiler Warnings:

  • Fix problem with IntelLLVM fast math

Build System:

  • fix for #127 (minimum required cmake version set to 3.15)
  • fix for #123 (Strange behavior of the postfix operator on macOS)
  • fix for #132 example1 fails to builds on Windows with mingw gcc

Change Notes for Revision 2.3.4

Maintainance Release with updates of the cmake build system.

Build System:

  • cmake is using OpenMP target and setting _UNICODE preprocessor definition

Fixed Compiler Warnings:

  • fix for #117 (sprintf deprecated)

Change Notes for Revision 2.3.3

To read the full documentation please go to: http://beltoforion.de/en/muparser.

See Install.txt for installation

Security Fixes:

The following new issues, discovered by oss-fuzz are fixed:

Bugfixes:

  • Fixed a couple of issues for building the C-Interface (muParserDLL.cpp/.h) with wide character support.
  • fix for #93
  • fix for #94
  • fix for #110; new expression size limit is 20000

Fixed Compiler Warnings:

  • Visual Studio: Disabled compiler warning 26812 (Prefer 'enum class' over 'enum') Use of plain old enums has not been deprecated and only MSVC is complaining.
  • Visual Studio: Disabled compiler warning 4251 (... needs to have dll-interface to be used by clients of class ...) For technical reason the DLL contains the class API and the DLL API. Just do not use the class API if you intent to share the dll accross windows versions. (The same is true for Linux but distributions do compile each application against their own library version anyway)

Changes:

  • Adding manual definitions to avoid potential issues with MSVC
  • Adding missing overrides
  • Added a new option "-DENABLE_WIDE_CHAR" to CMake for building muparser with wide character support
  • export muparser targets, such that client projects can import it using find_package() (#81 (comment))

muparser's People

Contributors

al42and avatar beltoforion avatar eirrgang avatar giraldeau avatar gknispel avatar haraldkl avatar jgeudens avatar jschueller avatar junghans avatar k61n avatar loumalouomega avatar luzpaz avatar marcfehling avatar masterleinad avatar mikebm94 avatar mliszcz avatar reputeless avatar xantares avatar zchcai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

muparser's Issues

add all callbacks a pointer to a user data or allow member function registration as a callback for easier C++ integration

What steps will reproduce the problem?
1. read the documentation of DefineFun, DefineOprt, DefineInfixOprt and 
DefinePostfixOprt function 
2.
3.

What is the expected output? What do you see instead?
I expect this function to receive either a member function as a callback or a 
function with one more parameter/pointer to the user data

What version of the product are you using? On what operating system?
Ubuntu

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 6 Aug 2015 at 6:36

switch to cmake build system

Hello,

Here's a CMake file that allows to build muparser with cmake in a 
cross-platform manner.

Basically removes the need for specific build systems on each platforms (almost 
everything in /build): configure, bakefiles (build/bakefiles), mingw specific 
makefile (makefile.mingw), and msvc projects 
(./build/msvc2013/muparser*.vcxproj)

Usage:
cd [path to muParser]
cmake [-DBUILD_SHARED_LIBS=ON/OFF] [-DBUILD_SAMPLES=ON/PFF]
             [-DCMAKE_BUILD_TYPE=Release/Debug]
make
[sudo*] make install

Also builds tarballs muparser-2.2.4.zip|tar.gz:
make package_source

Has in it almost all that is needed to solve #3. We should then create a 
muParserDef.h.in file to be configured with the conditional definition of 
MUP_USE_OPENMP. Then cmake can take advantage of arguments 
[-DUSE_OPENMP=ON/OFF]. See comments inside.

Tested on linux, mingw-w64, should build on msvc too.

Would you consider this as a build-system replacement ?

Original issue reported on code.google.com by [email protected] on 25 Feb 2015 at 4:50

Attachments:

`-std=C++11` is must to compile the library?

I noticed that weak_ptr/unique_ptr are used ParserTokenReader::Clone(ParserBase *a_pParent) const. Does it mean the compiler has to support c++11 or c++0x etc to compile the library.

Is yes, which version can be used with a compiler which only has c++98 support? We wish to support CentOS-5 in our application, which has only gcc4.1 by default (I know its pretty old).

Probably a good idea to mention it in the documentation.

Why aren't muparser exceptions inherited from std::exception?

Inheriting from std::exception is very helpful, as it helps in getting the operating system to read the error message if the exception is not caught. I see that you have a message part of the exception, and an error code, etc. How about you inherit from std::exception, and then override that what() to return something like: "Error [code]: [error message]"?

Is there a particular reason why muparser exceptions are not inherited from std::exception in muparser?

-no-cpp-precomp flag is not recognized on non-Apple gcc versions

Originally the configure script assumed that if the compiler was gcc and the system was darwin, then it would be Apple's gcc and the -no-cpp-precomp flag was used. This assumption is no longer true - other versions of gcc are used on darwin now, to get more modern compilers - but these FSF gcc versions error on the -no-cpp-precomp flag.

See https://gcc.gnu.org/ml/gcc/2005-12/msg00367.html.

I think the darwin test in the gcc block could be deleted, as the -no-cpp-precomp flag does not appear to do anything since gcc3.x according to the link. I changed the block in the configure script to:

        DEPS_TRACKING=1

        if test "x$GCC" = "xyes"; then
            DEPSMODE=gcc
            DEPSFLAG="-MMD"
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: gcc" >&5
$as_echo "gcc" >&6; }

and it no longer causes errors when compiled with newer non-Apple gcc versions.

some warnings during compilation with gcc6.2.1

Hi, there are some warnings during compilation with gcc6.2.1, please review when possible.

[filiperosset@rosset-laptop muParser]$ fedpkg local
Executando (%prep): /bin/sh -e /var/tmp/rpm-tmp.JZ1nfm

  • umask 022
  • cd /home/filiperosset/rpmbuild/extras/muParser
  • cd /home/filiperosset/rpmbuild/extras/muParser
  • rm -rf muparser-2.2.5
  • /usr/bin/gzip -dc /home/filiperosset/rpmbuild/extras/muParser/muparser-2.2.5.tar.gz
  • /usr/bin/tar -xof -
  • STATUS=0
  • '[' 0 -ne 0 ']'
  • cd muparser-2.2.5
  • /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
  • exit 0
    Executando (%build): /bin/sh -e /var/tmp/rpm-tmp.ic385f
  • umask 022
  • cd /home/filiperosset/rpmbuild/extras/muParser
  • cd muparser-2.2.5
  • CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic'
  • export CFLAGS
  • CXXFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic'
  • export CXXFLAGS
  • FFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -I/usr/lib64/gfortran/modules'
  • export FFLAGS
  • FCFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -I/usr/lib64/gfortran/modules'
  • export FCFLAGS
  • LDFLAGS='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
  • export LDFLAGS
  • '[' 1 = 1 ']'
    +++ dirname ./configure
    ++ find . -name config.guess -o -name config.sub
  • for i in '$(find $(dirname ./configure) -name config.guess -o -name config.sub)'
    ++ basename ./build/autoconf/config.guess
  • '[' -f /usr/lib/rpm/redhat/config.guess ']'
  • /usr/bin/rm -f ./build/autoconf/config.guess
    ++ basename ./build/autoconf/config.guess
  • /usr/bin/cp -fv /usr/lib/rpm/redhat/config.guess ./build/autoconf/config.guess
    '/usr/lib/rpm/redhat/config.guess' -> './build/autoconf/config.guess'
  • for i in '$(find $(dirname ./configure) -name config.guess -o -name config.sub)'
    ++ basename ./build/autoconf/config.sub
  • '[' -f /usr/lib/rpm/redhat/config.sub ']'
  • /usr/bin/rm -f ./build/autoconf/config.sub
    ++ basename ./build/autoconf/config.sub
  • /usr/bin/cp -fv /usr/lib/rpm/redhat/config.sub ./build/autoconf/config.sub
    '/usr/lib/rpm/redhat/config.sub' -> './build/autoconf/config.sub'
  • '[' 1 = 1 ']'
  • '[' x '!=' x-specs=/usr/lib/rpm/redhat/redhat-hardened-ld ']'
    ++ find . -name ltmain.sh
  • ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared=yes --enable-debug=no --enable-samples=no
    checking build system type... x86_64-redhat-linux-gnu
    checking host system type... x86_64-redhat-linux-gnu
    checking target system type... x86_64-redhat-linux-gnu
    checking for gawk... gawk
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether ln -s works... yes
    checking for x86_64-redhat-linux-gnu-ranlib... no
    checking for ranlib... ranlib
    checking for x86_64-redhat-linux-gnu-gcc... no
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking for x86_64-redhat-linux-gnu-g++... no
    checking for x86_64-redhat-linux-gnu-c++... no
    checking for x86_64-redhat-linux-gnu-gpp... no
    checking for x86_64-redhat-linux-gnu-aCC... no
    checking for x86_64-redhat-linux-gnu-CC... no
    checking for x86_64-redhat-linux-gnu-cxx... no
    checking for x86_64-redhat-linux-gnu-cc++... no
    checking for x86_64-redhat-linux-gnu-cl.exe... no
    checking for x86_64-redhat-linux-gnu-FCC... no
    checking for x86_64-redhat-linux-gnu-KCC... no
    checking for x86_64-redhat-linux-gnu-RCC... no
    checking for x86_64-redhat-linux-gnu-xlC_r... no
    checking for x86_64-redhat-linux-gnu-xlC... no
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking how to run the C++ preprocessor... g++ -E
    checking for the --enable-debug option... no
    checking for the --enable-shared option... yes
    checking for the --enable-samples option... no
    checking whether we are using the Intel C compiler... no
    checking whether we are using the Intel C++ compiler... no
    checking whether we are using the Sun C++ compiler... no
    checking for x86_64-redhat-linux-gnu-ranlib... ranlib
    checking whether ln -s works... yes
    checking whether make sets $(MAKE)... yes
    checking for x86_64-redhat-linux-gnu-ar... no
    checking for ar... ar
    checking for x86_64-redhat-linux-gnu-strip... no
    checking for strip... strip
    checking for x86_64-redhat-linux-gnu-nm... no
    checking for nm... nm
    checking for command to install directories... /usr/bin/install -c -d
    checking if make is GNU make... yes
    checking for dependency tracking method... disabled
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating build/autoconf/muparser.pc

Configuration for muparser 2.2.4 successfully completed.
Summary of main configuration settings for muparser:

  • SHARED mode
  • RELEASE build
  • SAMPLES disabled
    Now, just run make.

  • make 'CXXFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' -j8
    g++ -c -o muParser_dll_muParser.o -DNDEBUG -DMUPARSER_DLL -DMUPARSERLIB_EXPORTS -I./include -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic ./src/muParser.cpp
    g++ -c -o muParser_dll_muParserBase.o -DNDEBUG -DMUPARSER_DLL -DMUPARSERLIB_EXPORTS -I./include -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic ./src/muParserBase.cpp
    g++ -c -o muParser_dll_muParserBytecode.o -DNDEBUG -DMUPARSER_DLL -DMUPARSERLIB_EXPORTS -I./include -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic ./src/muParserBytecode.cpp
    g++ -c -o muParser_dll_muParserCallback.o -DNDEBUG -DMUPARSER_DLL -DMUPARSERLIB_EXPORTS -I./include -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic ./src/muParserCallback.cpp
    g++ -c -o muParser_dll_muParserDLL.o -DNDEBUG -DMUPARSER_DLL -DMUPARSERLIB_EXPORTS -I./include -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic ./src/muParserDLL.cpp
    g++ -c -o muParser_dll_muParserError.o -DNDEBUG -DMUPARSER_DLL -DMUPARSERLIB_EXPORTS -I./include -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic ./src/muParserError.cpp
    g++ -c -o muParser_dll_muParserInt.o -DNDEBUG -DMUPARSER_DLL -DMUPARSERLIB_EXPORTS -I./include -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic ./src/muParserInt.cpp
    g++ -c -o muParser_dll_muParserTest.o -DNDEBUG -DMUPARSER_DLL -DMUPARSERLIB_EXPORTS -I./include -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic ./src/muParserTest.cpp
    g++ -c -o muParser_dll_muParserTokenReader.o -DNDEBUG -DMUPARSER_DLL -DMUPARSERLIB_EXPORTS -I./include -fPIC -DPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic ./src/muParserTokenReader.cpp
    In file included from ./include/muParserStack.h:35:0,
    from ./include/muParserBase.h:39,
    from ./include/muParser.h:32,
    from ./src/muParser.cpp:26:
    ./include/muParserToken.h:72:12: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
    std::auto_ptr m_pCallback;
    ^~~~~~~~
    In file included from /usr/include/c++/6.2.1/memory:81:0,
    from ./include/muParserBase.h:33,
    from ./include/muParser.h:32,
    from ./src/muParser.cpp:26:
    /usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
    template class auto_ptr;
    ^~~~~~~~
    In file included from ./include/muParser.h:32:0,
    from ./src/muParser.cpp:26:
    ./include/muParserBase.h:291:10: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
    std::auto_ptr<token_reader_type> m_pTokenReader; ///< Managed pointer to the token reader object.
    ^~~~~~~~
    In file included from /usr/include/c++/6.2.1/memory:81:0,
    from ./include/muParserBase.h:33,
    from ./include/muParser.h:32,
    from ./src/muParser.cpp:26:
    /usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
    template class auto_ptr;
    ^~~~~~~~
    In file included from ./include/muParserBytecode.h:35:0,
    from ./src/muParserBytecode.cpp:26:
    ./include/muParserToken.h:72:12: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
    std::auto_ptr m_pCallback;
    ^~~~~~~~
    In file included from /usr/include/c++/6.2.1/memory:81:0,
    from ./include/muParserError.h:34,
    from ./include/muParserBytecode.h:34,
    from ./src/muParserBytecode.cpp:26:
    /usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
    template class auto_ptr;
    ^~~~~~~~
    ./src/muParserBytecode.cpp: In member function 'void mu::ParserByteCode::AddOp(mu::ECmdCode)':
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmLE' not handled in switch [-Wswitch]
    switch(a_Oprt)
    ^
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmGE' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmNEQ' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmEQ' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmLT' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmGT' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmLAND' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmLOR' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmASSIGN' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmBO' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmBC' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmIF' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmELSE' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmENDIF' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmARG_SEP' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmVAR' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmVAL' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmVARPOW2' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmVARPOW3' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmVARPOW4' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmVARMUL' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmPOW2' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmFUNC' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmFUNC_STR' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmFUNC_BULK' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmSTRING' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmOPRT_BIN' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmOPRT_POSTFIX' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmOPRT_INFIX' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmEND' not handled in switch [-Wswitch]
    ./src/muParserBytecode.cpp:213:15: warning: enumeration value 'cmUNKNOWN' not handled in switch [-Wswitch]
    In file included from ./include/muParserStack.h:35:0,
    from ./include/muParserBase.h:39,
    from ./include/muParser.h:32,
    from ./src/muParserDLL.cpp:33:
    ./include/muParserToken.h:72:12: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
    std::auto_ptr m_pCallback;
    ^~~~~~~~
    In file included from /usr/include/c++/6.2.1/memory:81:0,
    from ./include/muParserBase.h:33,
    from ./include/muParser.h:32,
    from ./src/muParserDLL.cpp:33:
    /usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
    template class auto_ptr;
    ^~~~~~~~
    In file included from ./include/muParser.h:32:0,
    from ./src/muParserDLL.cpp:33:
    ./include/muParserBase.h:291:10: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
    std::auto_ptr<token_reader_type> m_pTokenReader; ///< Managed pointer to the token reader object.
    ^~~~~~~~
    In file included from /usr/include/c++/6.2.1/memory:81:0,
    from ./include/muParserBase.h:33,
    from ./include/muParser.h:32,
    from ./src/muParserDLL.cpp:33:
    /usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
    template class auto_ptr;
    ^~~~~~~~
    In file included from ./include/muParserStack.h:35:0,
    from ./include/muParserBase.h:39,
    from ./src/muParserBase.cpp:26:
    ./include/muParserToken.h:72:12: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
    std::auto_ptr m_pCallback;
    ^~~~~~~~
    In file included from /usr/include/c++/6.2.1/memory:81:0,
    from ./include/muParserBase.h:33,
    from ./src/muParserBase.cpp:26:
    /usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
    template class auto_ptr;
    ^~~~~~~~
    In file included from ./src/muParserBase.cpp:26:0:
    ./include/muParserBase.h:291:10: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
    std::auto_ptr<token_reader_type> m_pTokenReader; ///< Managed pointer to the token reader object.
    ^~~~~~~~
    In file included from /usr/include/c++/6.2.1/memory:81:0,
    from ./include/muParserBase.h:33,
    from ./src/muParserBase.cpp:26:
    /usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
    template class auto_ptr;
    ^~~~~~~~
    ./src/muParserBase.cpp: In member function 'void mu::ParserBase::ApplyFunc(mu::ParserStack<mu::ParserToken<double, std::__cxx11::basic_string > >&, mu::ParserStack<mu::ParserToken<double, std::__cxx11::basic_string > >&, int) const':
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmLE' not handled in switch [-Wswitch]
    switch(funTok.GetCode())
    ^
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmGE' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmNEQ' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmEQ' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmLT' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmGT' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmADD' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmSUB' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmMUL' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmDIV' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmPOW' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmLAND' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmLOR' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmASSIGN' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmBO' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmBC' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmIF' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmELSE' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmENDIF' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmARG_SEP' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmVAR' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmVAL' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmVARPOW2' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmVARPOW3' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmVARPOW4' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmVARMUL' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmPOW2' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmSTRING' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmEND' not handled in switch [-Wswitch]
    ./src/muParserBase.cpp:838:11: warning: enumeration value 'cmUNKNOWN' not handled in switch [-Wswitch]
    ./src/muParserTest.cpp:1387:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
    #pragma warning(push)

./src/muParserTest.cpp:1388:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(disable:4127)

./src/muParserTest.cpp:1390:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(pop)

In file included from ./include/muParserStack.h:35:0,
from ./include/muParserBase.h:39,
from ./include/muParser.h:32,
from ./include/muParserTest.h:32,
from ./src/muParserTest.cpp:26:
./include/muParserToken.h:72:12: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
std::auto_ptr m_pCallback;
^~~~~~~~
In file included from /usr/include/c++/6.2.1/memory:81:0,
from ./include/muParserBase.h:33,
from ./include/muParser.h:32,
from ./include/muParserTest.h:32,
from ./src/muParserTest.cpp:26:
/usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^~~~~~~~
In file included from ./include/muParser.h:32:0,
from ./include/muParserTest.h:32,
from ./src/muParserTest.cpp:26:
./include/muParserBase.h:291:10: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
std::auto_ptr<token_reader_type> m_pTokenReader; ///< Managed pointer to the token reader object.
^~~~~~~~
In file included from /usr/include/c++/6.2.1/memory:81:0,
from ./include/muParserBase.h:33,
from ./include/muParser.h:32,
from ./include/muParserTest.h:32,
from ./src/muParserTest.cpp:26:
/usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^~~~~~~~
./src/muParserTest.cpp: In member function 'int mu::Test::ParserTester::EqnTest(const string_type&, double, bool)':
./src/muParserTest.cpp:1261:14: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
std::auto_ptr p1;
^~~~~~~~
In file included from /usr/include/c++/6.2.1/memory:81:0,
from ./include/muParserBase.h:33,
from ./include/muParser.h:32,
from ./include/muParserTest.h:32,
from ./src/muParserTest.cpp:26:
/usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^~~~~~~~
In file included from ./include/muParserStack.h:35:0,
from ./include/muParserBase.h:39,
from ./include/muParserInt.h:29,
from ./src/muParserInt.cpp:26:
./include/muParserToken.h:72:12: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
std::auto_ptr m_pCallback;
^~~~~~~~
In file included from /usr/include/c++/6.2.1/memory:81:0,
from ./include/muParserBase.h:33,
from ./include/muParserInt.h:29,
from ./src/muParserInt.cpp:26:
/usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^~~~~~~~
In file included from ./include/muParserInt.h:29:0,
from ./src/muParserInt.cpp:26:
./include/muParserBase.h:291:10: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
std::auto_ptr<token_reader_type> m_pTokenReader; ///< Managed pointer to the token reader object.
^~~~~~~~
In file included from /usr/include/c++/6.2.1/memory:81:0,
from ./include/muParserBase.h:33,
from ./include/muParserInt.h:29,
from ./src/muParserInt.cpp:26:
/usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^~~~~~~~
In file included from ./include/muParserTokenReader.h:39:0,
from ./src/muParserTokenReader.cpp:32:
./include/muParserToken.h:72:12: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
std::auto_ptr m_pCallback;
^~~~~~~~
In file included from /usr/include/c++/6.2.1/memory:81:0,
from ./include/muParserTokenReader.h:34,
from ./src/muParserTokenReader.cpp:32:
/usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^~~~~~~~
In file included from ./src/muParserTokenReader.cpp:33:0:
./include/muParserBase.h:291:10: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
std::auto_ptr<token_reader_type> m_pTokenReader; ///< Managed pointer to the token reader object.
^~~~~~~~
In file included from /usr/include/c++/6.2.1/memory:81:0,
from ./include/muParserTokenReader.h:34,
from ./src/muParserTokenReader.cpp:32:
/usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^~~~~~~~
./src/muParserTokenReader.cpp: In member function 'mu::ParserTokenReader* mu::ParserTokenReader::Clone(mu::ParserBase*) const':
./src/muParserTokenReader.cpp:150:10: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
std::auto_ptr ptr(new ParserTokenReader(*this));
^~~~~~~~
In file included from /usr/include/c++/6.2.1/memory:81:0,
from ./include/muParserTokenReader.h:34,
from ./src/muParserTokenReader.cpp:32:
/usr/include/c++/6.2.1/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^~~~~~~~
g++ -shared -fPIC -o lib/libmuparser.so.2.2.4 muParser_dll_muParser.o muParser_dll_muParserBase.o muParser_dll_muParserBytecode.o muParser_dll_muParserCallback.o muParser_dll_muParserDLL.o muParser_dll_muParserError.o muParser_dll_muParserInt.o muParser_dll_muParserTest.o muParser_dll_muParserTokenReader.o -Wl,-soname,libmuparser.so.2 -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
(cd ./lib/; rm -f libmuparser.so libmuparser.so.2; ln -s libmuparser.so.2.2.4 libmuparser.so.2; ln -s libmuparser.so.2 libmuparser.so)

  • exit 0
    Executando (%install): /bin/sh -e /var/tmp/rpm-tmp.UqiGKb
  • umask 022
  • cd /home/filiperosset/rpmbuild/extras/muParser
  • '[' /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64 '!=' / ']'
  • rm -rf /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64
    ++ dirname /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64
  • mkdir -p /home/filiperosset/rpmbuild/BUILDROOT
  • mkdir /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64
  • cd muparser-2.2.5
  • make libdir=/home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/lib64 prefix=/home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr install
    /usr/bin/install -c -d /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/lib64
    /usr/bin/install -c -m 644 ./lib/libmuparser.so /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/lib64
    /usr/bin/install -c ./lib/libmuparser.so.2.2.4 /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/lib64
    (cd /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/lib64 ; rm -f libmuparser.so libmuparser.so.2; ln -s libmuparser.so.2.2.4 libmuparser.so.2; ln -s libmuparser.so.2 libmuparser.so)
    /usr/bin/install -c -d /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr
    for f in include/muParser.h include/muParserBase.h include/muParserBytecode.h include/muParserCallback.h include/muParserDLL.h include/muParserDef.h include/muParserError.h include/muParserFixes.h include/muParserInt.h include/muParserStack.h include/muParserTemplateMagic.h include/muParserTest.h include/muParserToken.h include/muParserTokenReader.h; do
    if test ! -d /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/dirname $f ; then
    /usr/bin/install -c -d /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/dirname $f;
    fi;
    /usr/bin/install -c -m 644 ./$f /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/$f;
    done
    /usr/bin/install -c -d /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/lib64/pkgconfig
    /usr/bin/install -c -m 644 build/autoconf/muparser.pc /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/lib64/pkgconfig
  • /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /home/filiperosset/rpmbuild/extras/muParser/muparser-2.2.5
    extracting debug info from /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/lib64/libmuparser.so.2.2.4
    dwz: Too few files for multifile optimization
    /usr/lib/rpm/sepdebugcrcfix: Updated 1 CRC32s, 0 CRC32s did match.
    symlinked /usr/lib/debug/usr/lib64/libmuparser.so.2.2.4.debug to /usr/lib/debug/usr/lib64/libmuparser.so.2.debug
    symlinked /usr/lib/debug/usr/lib64/libmuparser.so.2.2.4.debug to /usr/lib/debug/usr/lib64/libmuparser.so.debug
    738 blocks
  • '[' '%{buildarch}' = noarch ']'
  • QA_CHECK_RPATHS=1
  • case "${QA_CHECK_RPATHS:-}" in
  • /usr/lib/rpm/check-rpaths
  • /usr/lib/rpm/check-buildroot
  • /usr/lib/rpm/brp-compress
  • /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
  • /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
  • /usr/lib/rpm/brp-python-hardlink
  • /usr/lib/rpm/redhat/brp-java-repack-jars
    Processando arquivos: muParser-2.2.5-1.fc26.x86_64
    Executando (%doc): /bin/sh -e /var/tmp/rpm-tmp.rQG9P8
  • umask 022
  • cd /home/filiperosset/rpmbuild/extras/muParser
  • cd muparser-2.2.5
  • DOCDIR=/home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/share/doc/muParser
  • export DOCDIR
  • /usr/bin/mkdir -p /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/share/doc/muParser
  • cp -pr Changes.txt /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/share/doc/muParser
  • cp -pr License.txt /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64/usr/share/doc/muParser
  • exit 0
    Provides: libmuparser.so.2()(64bit) muParser = 2.2.5-1.fc26 muParser(x86-64) = 2.2.5-1.fc26
    Requires(interp): /sbin/ldconfig /sbin/ldconfig
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
    Requires(post): /sbin/ldconfig
    Requires(postun): /sbin/ldconfig
    Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libgcc_s.so.1()(64bit) libgcc_s.so.1(GCC_3.0)(64bit) libm.so.6()(64bit) libm.so.6(GLIBC_2.2.5)(64bit) libstdc++.so.6()(64bit) libstdc++.so.6(CXXABI_1.3)(64bit) libstdc++.so.6(CXXABI_1.3.9)(64bit) libstdc++.so.6(GLIBCXX_3.4)(64bit) libstdc++.so.6(GLIBCXX_3.4.11)(64bit) libstdc++.so.6(GLIBCXX_3.4.15)(64bit) libstdc++.so.6(GLIBCXX_3.4.20)(64bit) libstdc++.so.6(GLIBCXX_3.4.21)(64bit) libstdc++.so.6(GLIBCXX_3.4.9)(64bit) rtld(GNU_HASH)
    Processando arquivos: muParser-devel-2.2.5-1.fc26.x86_64
    Provides: muParser-devel = 2.2.5-1.fc26 muParser-devel(x86-64) = 2.2.5-1.fc26 pkgconfig(muparser) = 2.2.4
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
    Requires: /usr/bin/pkg-config libmuparser.so.2()(64bit)
    Processando arquivos: muParser-debuginfo-2.2.5-1.fc26.x86_64
    Provides: muParser-debuginfo = 2.2.5-1.fc26 muParser-debuginfo(x86-64) = 2.2.5-1.fc26
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
    Procurando por arquivos desempacotados: /usr/lib/rpm/check-files /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64
    Gravou: /home/filiperosset/rpmbuild/extras/muParser/muParser-2.2.5-1.fc26.src.rpm
    Gravou: /home/filiperosset/rpmbuild/extras/muParser/x86_64/muParser-2.2.5-1.fc26.x86_64.rpm
    Gravou: /home/filiperosset/rpmbuild/extras/muParser/x86_64/muParser-devel-2.2.5-1.fc26.x86_64.rpm
    Gravou: /home/filiperosset/rpmbuild/extras/muParser/x86_64/muParser-debuginfo-2.2.5-1.fc26.x86_64.rpm
    Executando (%clean): /bin/sh -e /var/tmp/rpm-tmp.u5K336
  • umask 022
  • cd /home/filiperosset/rpmbuild/extras/muParser
  • cd muparser-2.2.5
  • /usr/bin/rm -rf /home/filiperosset/rpmbuild/BUILDROOT/muParser-2.2.5-1.fc26.x86_64
  • exit 0

Memory Leaks

I have compiled the latest build to a lib.

I am checking mem leaks in my code via:

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

_CrtDumpMemoryLeaks();

And comes up lots of unallocated blocks:

Data: Too many paramet 54 6F 6F 20 6D 61 6E 79 20 70 61 72 61 6D 65 74
{200} normal block at 0x0000017BA829D210, 32 bytes long.
Data: Missing parenthe 4D 69 73 73 69 6E 67 20 70 61 72 65 6E 74 68 65
{199} normal block at 0x0000017BA829D160, 64 bytes long.
Data: Function argumen 46 75 6E 63 74 69 6F 6E 20 61 72 67 75 6D 65 6E
{198} normal block at 0x0000017BA829D0B0, 64 bytes long.
Data: Unexpected varia 55 6E 65 78 70 65 63 74 65 64 20 76 61 72 69 61

These are all strings allocated by MuParser (error strings).

My code is:

#include "muParser.h"

int Eval() {

using namespace mu;

std::string sstr = "1 == 1";
int e = 0;
Parser p;
p.SetExpr((char *)sstr.c_str());

try {

	e = p.Eval();

}
catch (mu::Parser::exception_type &e)
{

	OutputDebugString(e.GetMsg().c_str());

}

return e;

}

and in the main routine, I am calling Eval()

Any clues?

Thanks

Build problems with MSVC 2017

I pulled v 2.2.6.1 and tried to build the 'debug static' and 'release static' versions.

Two problems with the MSVC 'muparser.sln' configurations:

  1. The 'Code Generation | Smaller Type Check' property is Yes, which causes the '/RTCc' option to be used on the compiler. This inhibits the muparser build. Lots of '/RTCc rejects conformant code' errors.

  2. The 'MUPARSER_STATIC' preprocessor directive is missing which causes lots of 'dll-specification' errors - again, when compiling the 'static' configurations. Needed to add this preprocessor directive to those build configurations.

Is there a bug in locale validation in "ParserBase::SetExpr"?

In ParserBase::SetExpr, we see the code:

 // Check locale compatibility
    std::locale loc;
    if (m_pTokenReader->GetArgSep()==std::use_facet<numpunct<char_type> >(loc).decimal_point())
      Error(ecLOCALE);

However, ParserBase also has static member s_locale defined as follows:

static std::locale s_locale;  ///< The locale used by the parser

We can manipulate s_locale with SetThousandsSep and SetDecSep. However, when we go to validate our settings, we validate a new std::locale instead of s_locale. Shouldn't the validation code look more like this? (I've substituted "s_locale" for "loc")

 // Check locale compatibility
    if (m_pTokenReader->GetArgSep()==std::use_facet<numpunct<char_type> >(s_locale).decimal_point())
      Error(ecLOCALE);

Check parsing error without evaluation

Would it be possible to add a check function that would raise up basic syntax errors without trying to evaluate the whole expression ? This would be helpful to detect basic problems without having to set up the whole context (variable could have any value, or even not being declared, as long as the tokens are at least well formed)

ParserTokenReader::ExtractOperatorToken incorrectly uses ValidInfixOprtChars()

Because of a somewhat confusing usage of "infix" to mean "prefix" in muParser, 
the author of ParserTokenReader::ExtractOperatorToken validates the input 
characters for binary operators against ValidInfixOprtChars(), whereas it 
should be validated against ValidOprtChars().

Attached is a patch for the problem.

What steps will reproduce the problem?
1. Add an extra operator char, eg ";"

    m_parser.DefineOprtChars(
            // standard operator chars as defined in mu::Parser::InitCharSets()
            "abcdefghijklmnopqrstuvwxyz"
            "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
            "+-*^/?<>=#!$%&|~'_"
            // our additions
            ";");

2.

Add the extra binary operator
    m_parser.DefineOprt(";", statementSeparator, -2);

3.

Add some suitable expression

m_parser.SetExpr("12.0 ; 13.0");


4. Call m_parser.Eval();

This will throw with an unexpected token exception.

What version of the product are you using? On what operating system?

2.2.3 compiled on OpenSUSE 12.2

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 28 Sep 2014 at 6:37

Attachments:

-std=c++11 was not added for Ubunto subsystem in Windows 10

Hi,

I am using the library on Ubuntu-subsystem on Windows 10.
I have g++ 5.4.0.
After "./configure", and when doing a "make" i get the error:

/include/muParserToken.h:72:12: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type

After checking, the compile command, it seems missing "-std=c++11".
After adding it manually to the Makefile, the library compiles smoothly !

Regards,

Add eval function returning a string

Are you calulating with floats internally? It would be cool to have a eval function that evaluates "0.8*0.8" to "0.64" instead of the float 0,6400000000000001.

Compiling on Android

What steps will reproduce the problem?
1.`export PATH=$PATH:$MY_ANDROID_STANDALONE_TOOLCHAIN/bin`
2.`./configure --disable-samples 
--prefix=$MY_ANDROID_STANDALONE_TOOLCHAIN/sysroot --host=arm-linux-androideabi`

What is the expected output? What do you see instead?
compile everything without any error but it outputs 
checking build system type... x86_64-unknown-linux-gnu
checking host system type... Invalid configuration `arm-linux-androideabi': 
system `androideabi' not recognized
configure: error: /bin/sh build/autoconf/config.sub arm-linux-androideabi 

What version of the product are you using? On what operating system?
Linux localhost.localdomain 3.13.11-100.fc19.x86_64 #1 SMP Wed Apr 23 20:10:57 
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Please provide any additional information below.
SEE: 
http://stackoverflow.com/questions/4594736/configure-does-not-recognize-androide
abi
GET: https://www.gnu.org/software/gettext/manual/html_node/config_002eguess.html

NOTE: Android dont support versioned libraries. this did the trick:
Makefile.in 263: 
`@COND_SHARED_1@    $(SHARED_LD_CXX) $@ $(MUPARSER_DLL_OBJECTS)   
$(__muParser_dll___macinstnamecmd) $(__muParser_dll___importlib) 
$(__muParser_dll___macver) $(LDFLAGS)  $(LIBS)`

removed the `$(__muParser_dll___soname_flags)`
perform a conditional check to remove this if compiling for Android.

Alternate solution:
use Android NDK. afaik better and easier (for everyone).

Original issue reported on code.google.com by [email protected] on 13 Aug 2014 at 11:27

muparser.beltoforion.de website is offline

This repo links to http://muparser.beltoforion.de, but that website is offline.

beltoforion.de specifies the following nameservers:

docks19.rzone.de
shades17.rzone.de

…but those nameservers return neither an A nor CNAME record for the muparser.beltoforion.de domain.

Is the domain permanently offline (and should the links thus be changed), or is this a temporary issue?

Enable OpenMP support on Linux.

Hello,

OpenTURNS, an open-source lib dedicated to the treatment of uncertainties, use 
MuParser for some study. By the way, thanks for your work! 
So, for some large study we would like to speed up a little bit the 
computation. So we would like to enable OpenMP inside muParser. 
We know that using a just in time parser would be much faster, but it would 
involve much more work. OpenMP in muParser is the first easy step to speed up 
our code.

I tried to enable OpenMP support on Linux (using autoconf). 
But using the revision 10 of http://muparser.googlecode.com/svn/trunk source, 
if I uncomment the line "#define MUP_USE_OPENMP" it does not enable OpenMP 
compilation  switch and the compilation fails.

I made a patch and the compilation using autoconf runs fine now.
The patch add an --enable-openmp feature (openmp is disabled by default).

  ./configure --enable-openmp
  make
  ...

My system is running on ubuntu 12.04 64bits.

Do you think the patch is good enough? I do not know if it will break 
compilation on other systems (windows ...) as I know only autoconf and cmake.
Could you consider merging this patch to muParser source code?

Beset regards,
Mathieu Souchaud

Original issue reported on code.google.com by [email protected] on 21 Dec 2013 at 5:41

Attachments:

2.2.5 libs issue

v2.2.5 provides these libs:
/usr/lib64/libmuparser.so
/usr/lib64/libmuparser.so.2
/usr/lib64/libmuparser.so.2.2.4 (shold be 2.2.5 instead?!?)
/usr/lib64/pkgconfig/muparser.pc

v2.2.3 provides these libs:
/usr/lib64/libmuparser.so
/usr/lib64/libmuparser.so.2
/usr/lib64/libmuparser.so.2.2.3
/usr/lib64/pkgconfig/muparser.pc

muParser identifies integers with at least 4 digits as variables


What steps will reproduce the problem?
1. Set a mu::Parser's expression to one of the following:
1000*Part_0
1000.2*Part_0
0000.2*Part_0

2. Call mu::Parser::GetUsedVar()

3. 1000, 1000, and 0000 will be returned as variables for the cases listed 
above.

What is the expected output? What do you see instead?
I only expect to see Part_0 as a used variable.

-For the first case, muParser does not throw an exception, but it does say that 
1000 is a variable. I should say that it is a value.

-For the second case (1000.2*Part_0): I get the exception message: "Unexpected 
token ".2*Part_0*Part_1 " found at position 4."

-For the last case (000.2*Part_0): I get the exception message "Unexpected 
token ".2*Part_0*Part_1 " found at position 4."

muParser parses the expressions correctlywhen I use 999 and 999.2 in the 
expressions (instead of 1000 and 1000.2).

What version of the product are you using? On what operating system?
muParser 2.2.3.  I tried this with 2.2.4 taken from the svn repo and it also 
occurred. I'm on OSX version 10.7.5, and I am building muParser with the 
provided configure and make scripts. For my code, I'm compiling it with Apple 
LLVM 4.2 with C++11 support and linking to the libc++ std lib. I compiled 
muParser so that it also uses the same compiler settings as my code.

Please provide any additional information below.
I set some breakpoints in the muParser code to try and track it down. I tried 
to figure it out myself, but it's taking me a long time. Here's what I've got 
so far, and hopefully someone who knows the code better can take it from here:

In ParserBase::CreateRPN(), the line of code on line 1199:
opt = m_pTokenReader->ReadNextToken();

It returns an opt with the following state:
(mu::ParserBase::token_type) opt = {
  m_iCode = cmVAR
  m_iType = tpDBL
  m_pTok = 0x0000000100c038b8
  m_iIdx = -1
  m_strTok = "1000"
  m_strVal = ""
  m_fVal = 6.95322297490987e-310
  m_pCallback = {
    __ptr_ = 0x0000000000000000
  }
}

I believe that m_iCode should NOT be set to cmVAR, and should instead be set to 
cmVAL. I tried to dig deeper, but I didn't get very far.

Thanks for looking at this.


Original issue reported on code.google.com by [email protected] on 22 Aug 2013 at 11:40

Test is blocking

The unit tests in example1 should have a non-interactive mode, otherwise the CI is blocking.

position of valmap_type

In one of the examples, mu::Parser::valmap_type is used, however, in the current version this type if found via mu::valmap_type.

Only evaluate one branch of the if(a,b,c) statement

As discussed in geodynamics/aspect#2540, it turns out that muparser evaluates both branches of an if statement, even if only one is needed. This may not be optimal performancewise, but more importantly it leads to trouble if one has floating point exceptions switched on: in that case, the evaluation of the inactive branch can lead to a floating point exception even though the result of that evaluation is not actually used.

Build muparser example2 with Visual Studio 2015 does not work

Running nmake with VS140 toolset produces the file example2.exe, which works.
Running msbuild with VS140 toolset to build vcxproj (which is produced by VS120 toolset produces the file example2.exe, which crashes when user inputs something like "list var".

Example regarding querying variables

While for constants, the following works:

	mu::valmap_type cmap_c = parser.GetConst();
	if (cmap_c.size())
	{
		mu::valmap_type::const_iterator item = cmap_c.begin();
		for (; item != cmap_c.end(); ++item)
		{

for variables, the iterator cannot be a const_iterator as given in the example, but works with

	mu::varmap_type variables = parser.GetVar();
	
	if (variables.size())
	{
		mu::varmap_type::iterator item = variables.begin();
		for (; item != variables.end(); ++item)
		{

some error when I make ?

jony@jony-unbroken:~/3rd_party_lib/muparser$ make
/home/jony/3rd_party_lib/muparser/bk-deps g++ -c -o muParser_dll_muParser.o -DNDEBUG -DMUPARSER_DLL -DMUPARSERLIB_EXPORTS -I./include -fPIC -DPIC -O2 ./src/muParser.cpp
In file included from ./include/muParserStack.h:34:0,
from ./include/muParserBase.h:39,
from ./include/muParser.h:32,
from ./src/muParser.cpp:26:
./include/muParserError.h:110:57: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
ParserErrorMsg& operator=(const ParserErrorMsg &) = delete;
^
./include/muParserError.h:111:45: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
ParserErrorMsg(const ParserErrorMsg&) = delete;
^
./include/muParserError.h:114:24: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
~ParserErrorMsg() = default;
^
In file included from ./include/muParserStack.h:35:0,
from ./include/muParserBase.h:39,
from ./include/muParser.h:32,
from ./src/muParser.cpp:26:
./include/muParserToken.h:72:12: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type
std::unique_ptr m_pCallback;
^
./include/muParserToken.h: In constructor ‘mu::ParserToken<TBase, TString>::ParserToken()’:
./include/muParserToken.h:91:10: error: class ‘mu::ParserToken<TBase, TString>’ does not have any field named ‘m_pCallback’
,m_pCallback()
^
./include/muParserToken.h: In member function ‘void mu::ParserToken<TBase, TString>::Assign(const mu::ParserToken<TBase, TString>&)’:
./include/muParserToken.h:135:9: error: ‘m_pCallback’ was not declared in this scope
m_pCallback.reset(a_Tok.m_pCallback.get() ? a_Tok.m_pCallback->Clone()
^
./include/muParserToken.h: In member function ‘mu::ParserToken<TBase, TString>& mu::ParserToken<TBase, TString>::Set(const mu::ParserCallback&, const TString&)’:
./include/muParserToken.h:174:9: error: ‘m_pCallback’ was not declared in this scope
m_pCallback.reset(new ParserCallback(a_pCallback));
^
./include/muParserToken.h: In member function ‘mu::ParserToken<TBase, TString>& mu::ParserToken<TBase, TString>::SetVal(TBase, const TString&)’:
./include/muParserToken.h:197:9: error: ‘m_pCallback’ was not declared in this scope
m_pCallback.reset(0);
^
./include/muParserToken.h: In member function ‘mu::ParserToken<TBase, TString>& mu::ParserToken<TBase, TString>::SetVar(TBase*, const TString&)’:
./include/muParserToken.h:215:9: error: ‘m_pCallback’ was not declared in this scope
m_pCallback.reset(0);
^
./include/muParserToken.h: In member function ‘mu::ParserToken<TBase, TString>& mu::ParserToken<TBase, TString>::SetString(const TString&, std::size_t)’:
./include/muParserToken.h:233:9: error: ‘m_pCallback’ was not declared in this scope
m_pCallback.reset(0);
^
./include/muParserToken.h: In member function ‘mu::ECmdCode mu::ParserToken<TBase, TString>::GetCode() const’:
./include/muParserToken.h:276:13: error: ‘m_pCallback’ was not declared in this scope
if (m_pCallback.get())
^
./include/muParserToken.h: In member function ‘mu::ETypeCode mu::ParserToken<TBase, TString>::GetType() const’:
./include/muParserToken.h:289:13: error: ‘m_pCallback’ was not declared in this scope
if (m_pCallback.get())
^
./include/muParserToken.h: In member function ‘int mu::ParserToken<TBase, TString>::GetPri() const’:
./include/muParserToken.h:302:15: error: ‘m_pCallback’ was not declared in this scope
if ( !m_pCallback.get())
^
./include/muParserToken.h:305:14: error: ‘m_pCallback’ was not declared in this scope
if ( m_pCallback->GetCode()!=cmOPRT_BIN && m_pCallback->GetCode()!=cmO
^
./include/muParserToken.h:308:16: error: ‘m_pCallback’ was not declared in this scope
return m_pCallback->GetPri();
^
./include/muParserToken.h: In member function ‘mu::EOprtAssociativity mu::ParserToken<TBase, TString>::GetAssociativity() const’:
./include/muParserToken.h:314:13: error: ‘m_pCallback’ was not declared in this scope
if (m_pCallback.get()==NULL || m_pCallback->GetCode()!=cmOPRT_BIN)
^
./include/muParserToken.h:317:16: error: ‘m_pCallback’ was not declared in this scope
return m_pCallback->GetAssociativity();
^
./include/muParserToken.h: In member function ‘mu::value_type (* mu::ParserToken<TBase, TString>::GetFuncAddr() const)()’:
./include/muParserToken.h:337:17: error: ‘m_pCallback’ was not declared in this scope
return (m_pCallback.get()) ? (generic_fun_type)m_pCallback->GetAddr()
^
./include/muParserToken.h: In member function ‘int mu::ParserToken<TBase, TString>::GetArgCount() const’:
./include/muParserToken.h:379:14: error: ‘m_pCallback’ was not declared in this scope
if (!m_pCallback->GetAddr())
^
./include/muParserToken.h:382:16: error: ‘m_pCallback’ was not declared in this scope
return m_pCallback->GetArgc();
^
In file included from ./include/muParser.h:32:0,
from ./src/muParser.cpp:26:
./include/muParserBase.h: At global scope:
./include/muParserBase.h:291:10: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type
std::unique_ptr<token_reader_type> m_pTokenReader; ///< Managed pointer to
^
Makefile:332: recipe for target 'muParser_dll_muParser.o' failed
make: *** [muParser_dll_muParser.o] Error 1

Dont want to throw exception incase of an error in an expression

Suppose i have a composed expression a=10 , b=20 + c , d = 30, e= 40 where the 2nd expression(b=20 +c) is erroneous. In this case, muParser will correctly throw exception and not evaluate 3rd and 4th expression. But i dont want to throw exception in the middle and want that the 3rd and 4th expression gets calculated.
How can i achieve this ?

Compile error with #define MUP_BASETYPE float

I tried compiling the library using floats instead of doubles. I changed the corresponding line inside muParserDef.h to #define MUP_BASETYPE float but there were some compilation errors related to muParserDLL.h
To fix those, I also had to to change line 50 of muParserDLL.h to be
typedef float muFloat_t

I might have missed something while reading library documentation, but if the user is expected to make this little extra change maybe we could write something inside the Compiler switches web page, in the MUP_BASETYPE section.

log() function returns natural logarithm

Hello,
As described in http://beltoforion.de/article.php?a=muparser&hl=en&p=features&s=idDef2#idDef2, built-in function log() returns logarithm to the base 10.
When running example1, log() returns natural logarithm:

Version 2.2.5 (20150427; GC; 64BIT; RELEASE; ASCII)

(C) 2015 Ingo Berg

Running test suite:

testing name restriction enforcement...passed
testing syntax engine...passed
testing postfix operators...passed
testing infix operators...passed
testing variable/constant detection...passed
testing multiarg functions...passed
testing expression samples...passed
testing if-then-else operator...passed
testing member functions...passed
testing binary operators...passed
testing error codes...passed
testing string arguments...passed
testing bulkmode...passed

Test passed (542 expressions)

Commands:

list var - list parser variables
list exprvar - list expression variables
list const - list all numeric parser constants
opt on - enable optimizer (default)
opt off - disable optimizer
locale de - switch to german locale
locale en - switch to english locale
locale reset - reset locale
test bulk - test bulk mode
quit - exits the parser

Constants:

"_e" 2.718281828459045235360287

"_pi" 3.141592653589793238462643

Enter an expression or a command:
log(10)
ans=2.30258509299
ln(10)
ans=2.30258509299
log10(10)
ans=1
^C

G++ version:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu114.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1
14.04.3)

Best regards,

Wanup0

Integrating with Oss-Fuzz

Greetings muparser developers and contributors,

We’re reaching out because your project is an important part of the open source ecosystem, and we’d like to invite you to integrate with our fuzzing service, OSS-Fuzz. OSS-Fuzz is a free fuzzing infrastructure you can use to identify security vulnerabilities and stability bugs in your project. OSS-Fuzz will:

  • Continuously run at scale all the fuzzers you write.
  • Alert you when it finds issues.
  • Automatically close issues after they’ve been fixed by a commit.

Many widely used open source projects like OpenSSL, FFmpeg, LibreOffice, and ImageMagick are fuzzing via OSS-Fuzz, which helps them find and remediate critical issues.

Even though typical integrations can be done in < 100 LoC, we have a reward program in place which aims to recognize folks who are not just contributing to open source, but are also working hard to make it more secure.

We want to stress that anyone who meets the eligibility criteria and integrates a project with OSS-Fuzz is eligible for a reward.

To help you getting started, we can attach our internal fuzzer for your project that you are welcome to use directly, or to use it as a starting point.

If you're not interested in integrating with OSS-Fuzz, it would be helpful for us to understand why—lack of interest, lack of time, or something else—so we can better support projects like yours in the future.

If we’ve missed your question in our FAQ, feel free to reply or reach out to us at [email protected].

Thanks!

Tommy
OSS-Fuzz Team

stringstream not working on Android

the code in muParser.cpp
int Parser::IsVal(const char_type* a_szExpr, int *a_iPos, value_type *a_fVal)
{
....
....
below one will crash on android(NDK)
stream >> fVal;//stringstream not working right on android plaform
....
}

so I have change as
//return how many string is legal for value,if return 0 this is not a value
inline int Mywtof( const wchar_t* e_str,double_e_pdValue )
int Parser::IsVal(const char_type_ a_szExpr, int *a_iPos, value_type *a_fVal)
{
value_type fVal(0);
int l_iValueLength = Mywtof(a_szExpr,&fVal);
if( l_iValueLength == 0 )
return 0;
*a_iPos += l_iValueLength;
*a_fVal = fVal;
return 1;
}

inline int Mywtof( const wchar_t* e_str,double*e_pdValue )
{
    int l_iLegalValueLength = 0;
    bool l_bIsValue = true;
    bool bMinus = false;
    if (*e_str == '+')
    {
        e_str++;
    }
    else
    if (*e_str == '-')
    {
        bMinus = true;
        e_str++;
    }
    double  l_dbValue = 0.f;
    int     l_dotStart = -1;
    int l_iLength = wcslen(e_str);
    for( int i=0;i<l_iLength;++i )
    {
        if( e_str[i] == L'.' )
        {
            l_dotStart = i;
        }
        else
        if( e_str[i] >= L'0' && e_str[i] <= L'9' )
        {
            l_dbValue = (l_dbValue*10) +(e_str[i]-L'0');
        }
        else
        if( e_str[i] == L'e'||e_str[i] == L'E' )
        {
            int l_ie = e_str[i+2]-L'0';
            for( int j=1;j<l_ie;++j )
                l_dbValue /= 10;
        }
        else
        {
            break;
        }
        ++l_iLegalValueLength;
    }

    if( l_dotStart != -1 )
    {
        float   l_fDotOffset = 1.f;
        for( int j=1;j<l_iLength-l_dotStart;++j )
            l_fDotOffset*=10;
        l_dbValue/=l_fDotOffset;
    }
    *e_pdValue = bMinus?-l_dbValue:l_dbValue;
    return l_iLegalValueLength;
}

Dual result of 'the same' expression

Let's have an expression 'max(0/0,1)' and mathematically equal
expression 'max(1,0/0)'. I expect (why shouldn't I ?) to get the same results.
However, muParser calculates
max(0/0,1) = -nan(ind)
max(1,0/0) = 1
max(1,0/0,1) = 1

Verified using the latest commit from Jan 23 2018 (6cf2746)
and an older version 2.2.4 (more than 2yrs old).
Is there a bug or my expectations are incorrect?

Thanks in advance,
Marcel

Feature request for strfun_type4 and strfun_type5

Hello,

we are using muparser happily for many years in our academic software.

I was not the one who integrated muparser (that guy is no longer available), but I used it. Now I updated to the newest version to make benefit from the cmake features. With 2.2.6.1 I get the regression that two of our callbacks are not compiling any more:
'double ()(const char, double, double, double)'
and
'double ()(const char, double, double, double, double)'

A 'double ()(const char, double, double)' compiles via
muParser.h: typedef value_type (strfun_type3)(const char_type, value_type, value_type);

So I think, there is just an implementation for strfun_type4 and strfun_type5 missing.

Might it be, that this once existed or is there another way to implement it?

If muparser needs to be extended, I assume this is a quick thing for an expert but would be rather involved for me to extend muparser.

Is there another option (e.g. a hero) who can help me? Otherwise I would try it by myself and either attempt to officially patch muparser or patch it always on our side.

I don't know about the development community so I better ask.

Thanks!

Export C++ symbols

Export C++ symbols for Windows using macro. This is done adding MUPARSERLIB_EXPORTS to every classes that belongs to the API.

muParser build fails on new compilers

auto_ptr should be replaced with unique_ptr;

Can we make these changes

--- include/muParserBase.h.orig	2018-09-05 20:00:43 UTC
+++ include/muParserBase.h
@@ -288,7 +288,7 @@ friend class ParserTokenReader; (private)
     mutable stringbuf_type  m_vStringBuf; ///< String buffer, used for storing string function arguments
     stringbuf_type  m_vStringVarBuf;
 
-    std::auto_ptr<token_reader_type> m_pTokenReader; ///< Managed pointer to the token reader object.
+    std::unique_ptr<token_reader_type> m_pTokenReader; ///< Managed pointer to the token reader object.
 
     funmap_type  m_FunDef;         ///< Map of function names and pointers.
     funmap_type  m_PostOprtDef;    ///< Postfix operator callbacks
--- include/muParserToken.h.orig	2018-09-05 20:01:07 UTC
+++ include/muParserToken.h
@@ -69,7 +69,7 @@ namespace mu
       TString m_strTok;   ///< Token string
       TString m_strVal;   ///< Value for string variables
       value_type m_fVal;  ///< the value 
-      std::auto_ptr<ParserCallback> m_pCallback;
+      std::unique_ptr<ParserCallback> m_pCallback;
 
   public:
--- src/muParserTest.cpp.orig	2018-09-05 20:00:19 UTC
+++ src/muParserTest.cpp
@@ -1258,7 +1258,7 @@ namespace mu
 
       try
       {
-        std::auto_ptr<Parser> p1;
+        std::unique_ptr<Parser> p1;
         Parser  p2, p3;   // three parser objects
                           // they will be used for testing copy and assignment operators
         // p1 is a pointer since i'm going to delete it in order to test if
--- src/muParserTokenReader.cpp.orig	2018-09-05 19:59:55 UTC
+++ src/muParserTokenReader.cpp
@@ -147,7 +147,7 @@ namespace mu
   */
   ParserTokenReader* ParserTokenReader::Clone(ParserBase *a_pParent) const
   {
-    std::auto_ptr<ParserTokenReader> ptr(new ParserTokenReader(*this));
+    std::unique_ptr<ParserTokenReader> ptr(new ParserTokenReader(*this));
     ptr->SetParent(a_pParent);
     return ptr.release();
   }

Will crash rather than catching exception on Android

sample code:

    p.DefineVar("b", &fVal); 
    p.DefineFun("MySqr", MySqr); 
    p.SetExpr("MySqr(a)*_pi+min(10,a)");

logcat:

06-19 15:09:44.960 2640-2640/com.autonavi.minimap.ajx3 A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 2640 (vi.minimap.ajx3)
06-19 15:09:45.063 289-289/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-19 15:09:45.063 289-289/? A/DEBUG: Build fingerprint: 'Xiaomi/cancro_wc_lte/cancro:6.0.1/MMB29M/7.5.25:user/release-keys'
06-19 15:09:45.063 289-289/? A/DEBUG: Revision: '0'
06-19 15:09:45.063 289-289/? A/DEBUG: ABI: 'arm'
06-19 15:09:45.064 289-289/? A/DEBUG: pid: 2640, tid: 2640, name: vi.minimap.ajx3  >>> com.autonavi.minimap.ajx3 <<<
06-19 15:09:45.064 289-289/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
06-19 15:09:45.087 289-289/? A/DEBUG:     r0 00000000  r1 00000a50  r2 00000006  r3 b6f0cb7c
06-19 15:09:45.088 289-289/? A/DEBUG:     r4 b6f0cb84  r5 b6f0cb34  r6 00000002  r7 0000010c
06-19 15:09:45.088 289-289/? A/DEBUG:     r8 be93d1f4  r9 be93d1cc  sl 00000001  fp be93d1f8
06-19 15:09:45.088 289-289/? A/DEBUG:     ip 00000006  sp be93d170  lr b6c68c69  pc b6c6b058  cpsr 400b0010
06-19 15:09:45.102 289-289/? A/DEBUG: backtrace:
06-19 15:09:45.103 289-289/? A/DEBUG:     #00 pc 00042058  /system/lib/libc.so (tgkill+12)
06-19 15:09:45.104 289-289/? A/DEBUG:     #01 pc 0003fc65  /system/lib/libc.so (pthread_kill+32)
06-19 15:09:45.104 289-289/? A/DEBUG:     #02 pc 0001c403  /system/lib/libc.so (raise+10)
06-19 15:09:45.104 289-289/? A/DEBUG:     #03 pc 000195b5  /system/lib/libc.so (__libc_android_abort+34)
06-19 15:09:45.105 289-289/? A/DEBUG:     #04 pc 00017508  /system/lib/libc.so (abort+4)
06-19 15:09:45.105 289-289/? A/DEBUG:     #05 pc 005bd8d7  /data/app/com.autonavi.minimap.ajx3-2/lib/arm/libajx_v3.so
06-19 15:09:45.105 289-289/? A/DEBUG:     #06 pc 005bd949  /data/app/com.autonavi.minimap.ajx3-2/lib/arm/libajx_v3.so (_Unwind_Resume+24)
06-19 15:09:45.105 289-289/? A/DEBUG:     #07 pc 0059e611  /data/app/com.autonavi.minimap.ajx3-2/lib/arm/libajx_v3.so
unwind_phase2(unw_context_t*, _Unwind_Control_Block*, bool)
/Volumes/Android/buildbot/src/android/ndk-r13-release/external/libcxx/../../external/libunwind_llvm/src/Unwind-EHABI.cpp:685
_Unwind_Resume
/Volumes/Android/buildbot/src/android/ndk-r13-release/external/libcxx/../../external/libunwind_llvm/src/Unwind-EHABI.cpp:750
__cxa_end_cleanup

64-bit compatibility issue in muParserBase.h

 void  Error(EErrorCodes a_iErrc, 
                int a_iPos = (int)mu::string_type::npos, // <--- This line doesn't look safe
                const string_type &a_strTok = string_type() ) const;

std::string::npos is size_type, it's a 64-bit value in 64-bit mode. The highlighted line truncates it to 32-bit signed int. It's probably not causing any actual runtime errors, but looks bad and causes a host of compiler warnings (remember, it's in .h file so a warning is emitted for every .cpp that includes it).

Weird time results when compiling with clang v6 and gcc 7+

Weird time results when compiling with clang v6 and gcc 7+:

Expression 41 of 440: "((cos(cos(tan(pi)))+a)/a)"; Progress: #####
[01] ExprTk               (    8.000 ns,       1.491183914425581625,      13.683879358191861186)
[02] ExprTkFloat          (    9.000 ns,       1.491183876991271973,      13.683879375457763672)
[03] FParser 4.5          (   15.900 ns,       1.491183914425581625,      13.683879358191861186)
[04] muparser 2.2.4       (36478.800 ns,       1.491183914425581625,      13.683879358191861186)
[05] muparser 2.2.4 (omp) (38305.600 ns,       1.491183914425581625,      13.683879358191861186)

CPU details:

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              20
On-line CPU(s) list: 0-19
Thread(s) per core:  2
Core(s) per socket:  10
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               85
Model name:          Intel(R) Xeon(R) W-2155 CPU @ 3.30GHz
Stepping:            4
CPU MHz:             1869.970
CPU max MHz:         4500.0000
CPU min MHz:         1200.0000
BogoMIPS:            6600.00
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            14080K
NUMA node0 CPU(s):   0-19

Incorrect string assignment, causing 1+2+3 to be parsed as "1", "+", and "2+3"

Incorrect string assignment, causing 1+2+3 to be parsed as "1", "+", and "2+3". 
Though the RPN part fix this and calculates the correct output.

In
  bool ParserTokenReader::IsValTok(token_type &a_Tok)
the line
        strTok.assign(m_strFormula.c_str(), iStart, m_iPos);
should be
        strTok.assign(m_strFormula.c_str(), iStart, m_iPos-iStart);
.

The string assign function uses count, not a second position:
    _Myt& assign(const _Myt& _Right,
        size_type _Roff, size_type _Count)


Original issue reported on code.google.com by [email protected] on 25 Nov 2013 at 9:37

Bug for variable and postfix

Dear developer,

If I define "k" as postfix (*1e3), and parsing this kind of equation.

"a+k+3k" --> it will be error ParserTokenReader::IsVarTok
I found this is cause by 'noVal' flag and can be fixed by change the order of IsPostFix to the presence of isVarTok.

How do you think??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.