Comments (8)
@mikepurvis these are good suggestions. I admit I have never used CMake on my own projects and I always felt that projects that use it are a little bit more complicated to use than with make
, but this is from someone that never really learned to use CMake, I will search a little bit and see if I change my mind.
I will make this change on Travis, thanks for the suggestion.
If you have any other problems just tell me =].
from cparse.
Got it, I will take a look and try to fix it.
from cparse.
I'm assuming that gcc is making these test assertions work by promoting the long up to an int64_t
, and then coercing that to a packToken
using this constructor:
Line 26 in e762179
To be honest, that does seem like a bit of a stretch, so I'm not shocked that clang doesn't care for it. The problem goes away if you explicitly grab the int value out of the variant, eg:
REQUIRE_NOTHROW(c1.compile("~10"));
REQUIRE(c1.eval().asInt() == ~10l);
REQUIRE_NOTHROW(c1.compile("2 * ~10"));
REQUIRE(c1.eval().asInt() == 2 * ~10l);
REQUIRE_NOTHROW(c1.compile("2 * ~10 * 3"));
REQUIRE(c1.eval().asInt() == 2 * ~(10l*3));
Alternatively, the packToken class could get an operator int()
method, which should allow it to be cast down to an integer (including implicitly). See: https://stackoverflow.com/a/4469907/109517
Blah, having problems making operator int
work either— because of the overloaded operator==
, there's an ambiguity. Hrmph.
from cparse.
Well that's sure a problem between different compilers. I think GCC does not differentiate between long
and int64_t
but clang does.
If GCC did differentiate between them I could just add a constructor for the type long
.
I also noticed that all errors are reported on the test file, so I will make 2 changes:
- I will accept your suggestion and use the
.asInt()
to fix these warnings - I will update the default action on the
Makefile
fromall
torelease
; this way it won't compile the test file and it should avoid future problems of this kind.
If you have another suggestion on the right way to solve this I would be happy to implement, this auto conversion was a feature I liked on the library, but it seems it can't be made to work on all compilers =/.
from cparse.
@mikepurvis can you test to see if the problems are fixed?
I have made the changes I mentioned so to reproduce the compilation of the tests you should use
make all
Also, if no more errors appear you may be able to run only make
to compile the release version without compiling the code.
Thanks for reporting the problem, I hope this fixes it.
from cparse.
I seem to get a link warning now with make
(still on OS X):
6 warnings generated.
ld -r -O1 shunting-yard.o packToken.o functions.o containers.o -o core-shunting-yard.o
ld: unknown option: -O1
However, curiously enough the make test
target now runs to completion:
6 warnings generated.
c++ -std=c++11 -Wall -pedantic -Wmissing-field-initializers -Wuninitialized -g -c catch.cpp -o catch.o -g
c++ -std=c++11 -Wall -pedantic -Wmissing-field-initializers -Wuninitialized -g test-shunting-yard.o shunting-yard.o packToken.o functions.o containers.o builtin-features.o catch.o -o test-shunting-yard
./test-shunting-yard
===============================================================================
All tests passed (419 assertions in 36 test cases)
from cparse.
That's good I think.
This -O1 option on the linkage step is for asking the linker to optimize the final binary.
Since it has only generated warnings it should be safe to use the library now, but I will search to understand why this option is not available on OSX (probably the ld binary is not exactly the same).
Were there any other warnings? I would be happy to fix them if possible.
Again thanks for reporting these problems.
from cparse.
If you're not opposed to it, just switching the buildsystem to CMake would take care of these kinds of cross-platform issues, since it has knowledge of what flags are appropriate for a debug vs release build across a wide range of compilers and platforms.
I think the main other warnings are as in the original post: complaints about const qualifier having no effect, and struct/class confusion between declaration and implementation.
Since you're already using Travis anyway, you could consider dropping the hard-coded CXX=g++
and then letting Travis set that envvar and use its build matrix feature to test both clang and gcc; with -Wall;-Werror
, this would turn warnings from either compiler into errors.
Anyway, thanks for cleaning up and making available this library— it will definitely help on a project I'm working on!
from cparse.
Related Issues (20)
- exception on simple calculatorexample
- Segmentation fault on bad inputs
- group/vector operation possible? Naive iteration can be expensive when number of elements is huge HOT 5
- terminating with uncaught exception of type syntax_error: Invalid operator: - HOT 4
- Token names cannot have UTF8 characters HOT 4
- Project doesn't install anything HOT 10
- Syntax errors cause crashes HOT 21
- Hexadecimal number computation HOT 4
- calculator ignores variable HOT 3
- Consider adding a namespace to cparse code HOT 6
- Program treats "." in numeric "0.x" as an operator and throw an exception! HOT 5
- Thread Safety HOT 4
- Is not operator supported? HOT 1
- Warning c4099 is everywhere. HOT 3
- Invalid operators, but with ALL operators HOT 1
- It doesn't compile in Windows and Linux, am I doing something wrong? HOT 3
- Buffer-overflow (out-of-bounds read) occured in two positions HOT 1
- cparse/builtin-features/operators.inc HOT 9
- Solved. Errors with Linux emulator using GCC. HOT 22
- TokenMap value change to None,when using getChild() HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cparse.