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

Add error message for non-package main declaration #4141

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

jhavrane
Copy link
Contributor

@jhavrane jhavrane commented Sep 8, 2023

Fix #4140

@onf-cla-manager
Copy link

Hi @jhavrane, this is the ONF bot 🤖 I'm glad you want to contribute to our projects! However, before accepting your contribution, we need to ask you to sign a Contributor License Agreement (CLA). You can do it online, it will take only a few minutes:

✒️ 👉 https://cla.opennetworking.org

After signing, make sure to add your Github user ID jhavrane to the agreement.

For more information or help:"
https://wiki.opennetworking.org/x/BgCUI

@jhavrane
Copy link
Contributor Author

jhavrane commented Sep 8, 2023

Btw format specifier %1$ on line 281 is most likely not correct.

...
    if (!main->is<IR::Declaration_Instance>()) {
        ::error(ErrorType::ERR_INVALID, "%1$: must be a package declaration", main->getNode());
...

I tried to print with this specifier and got the following exception thrown. Got boost version 1.71

terminate called after throwing an instance of 'boost::wrapexcept<boost::io::bad_format_string>'
  what():  boost::bad_format_string: format-string is ill-formed

@fruffy
Copy link
Collaborator

fruffy commented Sep 9, 2023

Btw format specifier %1$ on line 281 is most likely not correct.

...
    if (!main->is<IR::Declaration_Instance>()) {
        ::error(ErrorType::ERR_INVALID, "%1$: must be a package declaration", main->getNode());
...

I tried to print with this specifier and got the following exception thrown. Got boost version 1.71

terminate called after throwing an instance of 'boost::wrapexcept<boost::io::bad_format_string>'
  what():  boost::bad_format_string: format-string is ill-formed

This looks like a typo to me. Could you also fix it with this PR?

@jhavrane
Copy link
Contributor Author

Fixed in #4145

@fruffy fruffy merged commit 5b301bb into p4lang:main Sep 12, 2023
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.

Compiler bug: toplevel block is not a package
2 participants