Skip to content
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

scriptcomp: Support #line directive #53

Open
mtijanic opened this issue Jul 7, 2023 · 0 comments
Open

scriptcomp: Support #line directive #53

mtijanic opened this issue Jul 7, 2023 · 0 comments

Comments

@mtijanic
Copy link
Collaborator

mtijanic commented Jul 7, 2023

The #line <line_number> <filename> directive is emitted by many preprocessors as a way to tell the next stage compiler which un-preprocessed line a certain source line refers to.
Consider:

1  #if 0
2  // deadcode
3  #endif
4  compile_error_here

After preprocessing with cpp(1), line 4 becomes line 1, and then if that is fed into nwn_script_comp, it'll report an error at an incorrect line.
Most preprocessors have a way to emit code like this

#line 1
compile_error_here

which would make the compiler report correct lines. This makes it easier to hook any preprocessor as a build step prior to calling the compiler.

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

No branches or pull requests

1 participant