Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANTLR3 C++ Target HPUX error #182

Open
Gariben opened this issue Jan 6, 2016 · 2 comments
Open

ANTLR3 C++ Target HPUX error #182

Gariben opened this issue Jan 6, 2016 · 2 comments

Comments

@Gariben
Copy link

Gariben commented Jan 6, 2016

If you try to build the C++ Target in HPUX, somehow the pair <ANTLR_MARKER, TokenType> in the TokensType::iterator has a different value than the reference... the ANTLR_MARKER becomes const-qualified, and therefore you can't dereference the pair, breaking any instances with TokensType::iterators being dereferenced.

I don't know why this is happening, but I was able to get it to build by const qualifying the UnOrderedMapType and OrderedMapType in antlr3memory.h:

template<class KeyType, class ValueType>
class UnOrderedMapType : public std::map< KeyType, ValueType, std::less<KeyType>, 
                                    AllocatorType<std::pair<const KeyType, ValueType> > >
{
};

template<class KeyType, class ValueType>
class OrderedMapType : public std::map< KeyType, ValueType, std::less<KeyType>, 
                                    AllocatorType<std::pair<const KeyType, ValueType> > >
{
};

Here's a bit more thorough discussion:
https://groups.google.com/forum/#!topic/antlr-discussion/3OU9s4mfXgk

@elfprince13
Copy link

I'm seeing a related issue in even the very simple demo grammar distributed with the Cpp runtime, when building on OSX with a modern clang.

TParser.cpp:294:17: error: assigning to 'ImplTraits::CommonTokenType *' (aka 'antlr3::CommonToken<antlr3::Traits<User::TLexer, User::TParser, UserTraits, antlr3::Empty> > *') from incompatible type 'const CommonTokenType *' (aka 'const antlr3::CommonToken<antlr3::Traits<User::TLexer, User::TParser, UserTraits, antlr3::Empty> > *')
            ID1 =  this->matchToken(ID, &FOLLOW_ID_in_method96);

This was using ANTLR 3.5.2, which while purportedly non supported by the Cpp target is distributed with it, and I can't seem to track down an earlier release to test with. I may have to abandon ANTLR entirely given the very sorry state of C/C++ support (I just backported my grammar from v4 since the claim was that v3 had just fine support).

@ibre5041
Copy link
Contributor

Try it with this branch: https://github.com/ibre5041/antlr3 (the tool and runtime). I think I fixed it several months ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants