Skip to content

Conversation

@ssvb
Copy link
Contributor

@ssvb ssvb commented Dec 14, 2023

Using the "#line" directives, it's possible to allow compilers to report line numbers from the original source file. At least GCC and Clang support this. It's useful for tracing the compilation error locations back to the original file. Example:

  #include <iostream>
  #include <atcoder/lazysegtree>
  int main() {
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(arr);
  }

== The current default behaviour: ==

$ ./expander.py example.cpp
$ g++ combined.cpp
combined.cpp: In function ‘int main()’:
combined.cpp:263:3: error: ‘lazy_segtree’ was not declared in this
                    scope; did you mean ‘atcoder::lazy_segtree’?

== With the new '--origname' option: ==

$ ./expander.py --origname=example.cpp example.cpp
$ g++ combined.cpp
example.cpp: In function ‘int main()’:
example.cpp:4:3: error: ‘lazy_segtree’ was not declared in this
                 scope; did you mean ‘atcoder::lazy_segtree’?

Using the "#line" directives, it's possible to allow compilers to
report line numbers from the original source file. At least GCC
and Clang support this. It's useful for tracing the compilation
error locations back to the original file. Example:

  #include <iostream>
  #include <atcoder/lazysegtree>
  int main() {
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(arr);
  }

== The current default behaviour: ==

$ ./expander.py example.cpp
$ g++ combined.cpp
combined.cpp: In function ‘int main()’:
combined.cpp:263:3: error: ‘lazy_segtree’ was not declared in this
                    scope; did you mean ‘atcoder::lazy_segtree’?

== With the new '--origname' option: ==

$ ./expander.py --origname=example.cpp example.cpp
$ g++ combined.cpp
example.cpp: In function ‘int main()’:
example.cpp:4:3: error: ‘lazy_segtree’ was not declared in this
                 scope; did you mean ‘atcoder::lazy_segtree’?
@yosupo06 yosupo06 merged commit bc63fe9 into atcoder:master Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants