C++ runtime demo fails to build
- Dominant language
- Java
- Stars
- 19k
- Forks
- 3.5k
- PR merge metrics
- No merged PRs in 30d
Description
In the current state of the master branch (dd623ec), the C++ runtime demo fails to build:
```
$ cd /runtime/Cpp
$ mkdir build && mkdir run && cd build
$ cmake .. -DANTLR_JAR_LOCATION=/antlr-4.9.3-complete.jar -DWITH_DEMO=True
$ make
...
[ 97%] Building CXX object demo/CMakeFiles/antlr4-demo.dir/Linux/main.cpp.o
In file included from /home/felix/src/antlr4/runtime/Cpp/demo/Linux/main.cpp:16:
/home/felix/src/antlr4/runtime/Cpp/demo/generated/TLexer.h:57:43: error: ‘virtual const std::vector >& antlrcpptest::TLexer::getTokenNames() const’ marked ‘override’, but does not override
57 | virtual const std::vector& getTokenNames() const override; // deprecated, use vocabulary instead
| ^~~~~~~~~~~~~
In file included from /home/felix/src/antlr4/runtime/Cpp/demo/Linux/main.cpp:17:
/home/felix/src/antlr4/runtime/Cpp/demo/generated/TParser.h:44:43: error: ‘virtual const std::vector >& antlrcpptest::TParser::getTokenNames() const’ marked ‘override’, but does not override
44 | virtual const std::vector& getTokenNames() const override { return _tokenNames; }; // deprecated: use vocabulary instead.
| ^~~~~~~~~~~~~
make[2]: *** [demo/CMakeFiles/antlr4-demo.dir/build.make:97: demo/CMakeFiles/antlr4-demo.dir/Linux/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:414: demo/CMakeFiles/antlr4-demo.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
```
There's also a new warning:
```
[ 12%] Building CXX object runtime/CMakeFiles/antlr4_shared.dir/src/Vocabulary.cpp.o
/home/felix/src/antlr4/runtime/Cpp/runtime/src/Vocabulary.cpp: In static member function ‘static void antlr4::dfa::Vocabulary::__static_initialization_and_destruction_0(int, int)’:
/home/felix/src/antlr4/runtime/Cpp/runtime/src/Vocabulary.cpp:12:18: warning: ‘antlr4::dfa::Vocabulary::EMPTY_VOCABULARY’ is deprecated: Use the default constructor of Vocabulary instead. [-Wdeprecated-declarations]
12 | const Vocabulary Vocabulary::EMPTY_VOCABULARY;
| ^~~~~~~~~~
/home/felix/src/antlr4/runtime/Cpp/runtime/src/Vocabulary.cpp:12:18: note: declared here
```
@jcking / @mike-lischke - I'm naively assuming this is related to one of your recent PRs.
Could you please take a look?
I haven't spent the time to narrow down when exactly the error was introduced, but I can if you want me to.
Versions:
```
-- The C compiler identification is GNU 11.2.1
-- The CXX compiler identification is GNU 11.2.1
$ gcc --version
gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7)
$ java --version
openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment 18.9 (build 11.0.13+8)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8, mixed mode, sharing)
```
Contributor guide
Research direction
Start by reproducing the failure with the CMake and make commands in runtime/Cpp, then inspect demo/generated/TLexer.h, demo/generated/TParser.h, and the C++ runtime headers involved in their overrides. Also review runtime/src/Vocabulary.cpp for the reported deprecation warning. Done means the C++ runtime demo builds successfully without the reported errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100