Open skvadrik opened 4 years ago
What about a call to an undefined function? That will cause a link failure if not optimized away. GCC has an attribute that can be used to give a better message.
What about a call to an undefined function?
This is a nice hack, but re2c should not rely on the compiler optimizations: it can be TCC or GCC/Clang without optimizations.
What about a call to an undefined function?
This is a nice hack, but re2c should not rely on the compiler optimizations: it can be TCC or GCC/Clang without optimizations.
True, though with GCC there is a preprocessor macro that can be used to check if optimizations are on.
User-defined semantic actions should have a control flow transfer statement at the end (one of
goto
,return
,continue
,break
, etc). If the user forgets to add one, the program may fail in an unexpected way. This is especially confusing for new users.The suggestion is to add some sort of
assert(false)
or__builtin_trap()
statement after the user-defined semantic action. It should be unreachable (dead code) in correct programs, so some way of suppressing compiler warnings is needed.