Skip to content

expander.py: trace line numbers back to the original source file #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2024

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