Skip to content

Conversation

@sim642
Copy link
Member

@sim642 sim642 commented Mar 1, 2022

Here's a fun feature that nobody asked for! Quoting of relevant source code a la any normal compiler:

[Success][Assert] Assertion "success" will succeed (tests/regression/00-sanity/01-assert.c:9:3-9:18)
    assert(success);
  
[Error][Assert] Assertion "fail" will fail. (tests/regression/00-sanity/01-assert.c:10:3-10:15)
    assert(fail); // FAIL!
  
[Warning][Assert] Assertion "unknown == 4" is unknown. (tests/regression/00-sanity/01-assert.c:11:3-11:23)
    assert(unknown == 4); // UNKNOWN!
  
[Warning][Deadcode] Function 'main' has dead code:
  on line 13 (tests/regression/00-sanity/01-assert.c:13-13)
      assert(silence); // NOWARN!

Also works for multiline location ranges and in a terminal the range is highlighted with a turquoise color (the only color that our rainbow 🌈 output doesn't yet use).

It is disabled via warn.quote-code by default since getting the quotes for all messages involves opening the files to read out the corresponding lines, which might otherwise negatively impact benchmarking.

@sim642 sim642 changed the title Message quote Quote source code in messages output Mar 1, 2022
@sim642 sim642 merged commit 2b0d88d into master Mar 11, 2022
@sim642 sim642 deleted the message-quote branch March 11, 2022 11:36
@sim642 sim642 added this to the v2.0.0 milestone Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants