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

Ignore unknown annotations/pragmas #416

Closed
cc10512 opened this issue Mar 31, 2017 · 5 comments
Closed

Ignore unknown annotations/pragmas #416

cc10512 opened this issue Mar 31, 2017 · 5 comments
Assignees
Labels
enhancement This topic discusses an improvement to existing compiler code.

Comments

@cc10512
Copy link
Contributor

cc10512 commented Mar 31, 2017

Unknown @annotations should print a warning, but not give an error.

@cc10512 cc10512 self-assigned this Mar 31, 2017
@mihaibudiu
Copy link
Contributor

I think that today they are silently ignored.
Unfortunately I don't think that the front-end or mid-end can do anything about this: only the back-end knows what annotations it recognizes. We can however have a pass similar to ValidateTableProperties for annotations.

@mihaibudiu
Copy link
Contributor

It would be easy to check that there are no unknown annotations.
What is much harder to check is whether the annotations are used where they are supposed to be. E.g., @name annotations only make sense on declarations. The rules for each annotation type can be very complicated. So I think it is safer to go the Java/C# route: do not mandate anything in the spec about unknown annotations, and do the same thing in the compiler front-end.

@cc10512
Copy link
Contributor Author

cc10512 commented Apr 3, 2017

@mbudiu-vmw they were not silently ignored. Agreed that we should not mandate anything in the spec other that they should not do anything. However, an implementation (like p4c) should decide how to handle them. I thought warnings are a fair game, especially if we add support for ignoring classes of warnings. Silently ignored is not always the best, as people may think their annotation does something.

@mihaibudiu mihaibudiu added the enhancement This topic discusses an improvement to existing compiler code. label Apr 7, 2017
@mihaibudiu
Copy link
Contributor

@cc10512 : what are you proposing to do about this issue?

@cc10512
Copy link
Contributor Author

cc10512 commented Apr 12, 2017

Fixed by #419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This topic discusses an improvement to existing compiler code.
Projects
None yet
Development

No branches or pull requests

2 participants