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

Validation mode #99

Open
evmar opened this issue Jan 8, 2024 · 3 comments
Open

Validation mode #99

evmar opened this issue Jan 8, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@evmar
Copy link
Owner

evmar commented Jan 8, 2024

In various places like #80 we relax the rules to accommodate some questionable Ninja behaviors.

We currently key some of these off a "ninja compat" flag, but I wonder if it would be better to make some sort of explicit mode flag that is extra strict.

I think there are basically two categories of users of n2:

  • people who are just trying to build something and at the mercy of whatever their build system emits; n2 emitting warnings doesn't help them much
  • people who are working explicitly on generating ninja files, e.g. CMake authors; n2 helping them find bugs is helpful

This is very similar to the question of whether you want to enable -Werror on a project, where you have the same two categories of people.

@evmar
Copy link
Owner Author

evmar commented Jan 8, 2024

(I wrote a much longer post with some thoughts about -Werror here https://neugierig.org/software/blog/2022/01/rethinking-errors.html )

@evmar evmar added the enhancement New feature or request label Jan 8, 2024
@Colecf
Copy link
Contributor

Colecf commented Jan 8, 2024

I think it would be good if n2 had a kind of "capabilities" config file, where each little thing that could be stricter was a separate flag. "ninja compat" mode would be one built-in configuration, and "strict" mode would be another. But projects could start out in ninja compat mode and turn on flags one by one until they eventually reach strict mode.

I think there would probably multiple "editions" (like rust's editions) of strict mode as well, where we have a certain strict mode edition to start, but then when we add more checks we don't want to add them to that strict mode because it will break existing users, but instead we add a new edition of strict mode that has the checks enabled.

@evmar
Copy link
Owner Author

evmar commented Jan 11, 2024

It just occurred to me that a reasonable place to put configuration like this is in the ninja file itself, given that the generator is the tool where you know what settings you care about. You could imagine some sort of like

config
  missing_depfiles = error

kind of block, though it would mean breaking syntax compatibility with Ninja. (Ninja already has some configurationy stuff in magic globals that ought to have been done this way)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants