I have the following code:
const GL_DEBUG_CHECK=true
template checkError() =
if GL_DEBUG_CHECK==true:
let (e, m) = checkErrorCode()
doAssert(e == GL_NO_ERROR, $m) and in the application I have:
...
glBindVertexArray( vao_polygon )
glDrawArrays( GL_POLYGON, 0, polygon.len.cint )
checkError()
... When an error does occur, doAssert reports the line at the checkError template and not at the call of this template in the main code.
My question is: is it possible to have doAssert indicate the line at the call site?
TIA
This annoys me this as well. Rarely do I care about the template triggering the issue. It changed sometime a while back in the 2.0 series I think. Essentially the templates set the lineDir directives now.
@araq is there an option to change this behavior?
There is a pragma for that:
template assertImpl(cond: bool, msg: string, expr: string, enabled: static[bool]) =
const
loc = instantiationInfo(fullPaths = compileOption("excessiveStackTrace"))
{.line: loc.}:
if not cond:
failedAssertImpl(msg)What must I actually do?