When compiling under gcc, ANTLR4CPP_PUBLIC macro expands to the following
gcc visibility attribute:
__attribute__((visibility ("default")))
(when compiling under Windows it expands to the corresponding __declspec
attribute)
This change was introduced in commit 8ff852640a
Although the attribute makes perfect sense when applied to a "class"
declaration, it makes no sense (has no effect) when applied to an
"enum class" declaration. I assume that doing so was unintentional; that
when the change was introduced it was it was added mechanically to all
"class XXX" instances in the source code, a process which accidentally
picked up one "enum class XXX" instance.
Although it has no effect on the object code, it leads to the following
warning when compiling under gcc:
/usr/local/include/antlr4-runtime/atn/PredictionMode.h:18:31: error: type attributes ignored after type is already defined [-Werror=attributes]
enum class ANTLR4CPP_PUBLIC PredictionMode {
This is a problem for people who would like their builds to be warning-free.
Happily, this declaration can be safely removed. The "enum class" construct
(just like with regular enum) does not cause any linker symbols to be
emitted. So having a linker attribute on the type does not actually have any
effect. It can therefore be safely removed.
Some systems have low-granularity timestamps, so that file modification
dates are rounded to seconds. This causes false negatives when detecting
if a grammar needs to be recompiled if it changes a second after producing
its tokens.
This likely only causes an issue for tests that frequently mutate files;
real humans are unlikely to compile within 1s of changing a grammar.
Still, this seems a cleaner solution that hacking the failing test to use
force a different modification time, as there will almost never be false
positives.
This fixes the failing test after making the test correct.
TokenStreamRewriter implementation was missing
Ported code from Java version; however, there are couple of deviations due to difference between composition (Go) and inheritance (Java) concepts
Ported tests from Swift for LexerA
Iterators on an unordered_map were being dereferenced after dropping a
read lock, leading to races where iterators could be invalidated before
they were used.
[dotnet] for linux target, bring up to jdk8 since jdk7 no longer available for Trusty; for linux and osx targets, bring up dotnet from 1.0.3 to 1.0.4; Trusty image now has mvn 3.3.9 builtin, removed install code
- Remove the readonly status from IntervalSet.
- Remove virtual functions from IntervalSet and Interval. These are
passed by value throughout the C++ runtime; meaningful inheritance is
not possible anyway.
- Moving the atomic flag into ATNState as a "now cached" flag.
- Return a const reference from ATN::nextStates(ATNState*) so the readonly
status is enforced by the compiler not at runtime in the code.
- Use value semantics using std::move to reduce the number of copies performed,
constent with how these classes are used in the C++ runtime source.
- Remove type-unsafe varargs constructor in IntervalSet, replace with
type-safe varadic templates implementation.