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

Implement issue 20515: add command line flag to allow selecting GNU message style for errors and warnings. #10732

Merged
merged 1 commit into from
Feb 3, 2020

Conversation

FeepingCreature
Copy link
Contributor

This should ease interoperability with existing IDEs.

The GNU style is documented at https://www.gnu.org/prep/standards/html_node/Errors.html

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @FeepingCreature! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
20515 enhancement Errors should be reported in GNU style on Linux

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#10732"

src/dmd/globals.d Outdated Show resolved Hide resolved
src/dmd/mars.d Outdated Show resolved Hide resolved
src/dmd/mars.d Outdated Show resolved Hide resolved
src/dmd/mars.d Outdated Show resolved Hide resolved
src/dmd/mars.d Outdated Show resolved Hide resolved
src/dmd/mars.d Outdated Show resolved Hide resolved
@FeepingCreature FeepingCreature force-pushed the feature/gnu-message-style branch 5 times, most recently from 5873c6c to 544741c Compare January 17, 2020 11:29
@FeepingCreature FeepingCreature force-pushed the feature/gnu-message-style branch 4 times, most recently from 096e704 to 7aa7cbd Compare January 17, 2020 11:41
@FeepingCreature
Copy link
Contributor Author

sorry for the spam, c++ interop wouldn't go

@FeepingCreature FeepingCreature force-pushed the feature/gnu-message-style branch 2 times, most recently from 0fa96d3 to 2af15c8 Compare January 17, 2020 11:43
Copy link
Member

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might even want to add -verrors=context to this new flag as it's similarly just about the formatting style.

src/dmd/cli.d Outdated
@@ -641,6 +641,12 @@ dmd -cov -unittest myprog.d
Option("vcolumns",
"print character (column) numbers in diagnostics"
),
Option("verror-style=digitalmars",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Option("verror-style=digitalmars",
Option("verror-style=[digitalmars|gnu|?]",

See the other options.

Copy link
Contributor Author

@FeepingCreature FeepingCreature Jan 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better? Not sure '?' is worth it here, the options are fairly self-explanatory.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most DMD options have a help page that lists all available options.

the options are fairly self-explanatory.

Fair enough.

src/dmd/globals.d Outdated Show resolved Hide resolved
@FeepingCreature FeepingCreature force-pushed the feature/gnu-message-style branch 2 times, most recently from 515361d to 013007a Compare January 17, 2020 12:22
@FeepingCreature
Copy link
Contributor Author

@wilzbach not sure what you mean with "add -verrors=context"

@wilzbach
Copy link
Member

wilzbach commented Jan 17, 2020

@wilzbach not sure what you mean with "add -verrors=context"

It's an existing output error style:

> dmd -verrors=context foo.d
foo.d(1): Error: declaration expected, not =
a = b
  ^

It would fit more with the new flag.

@FeepingCreature
Copy link
Contributor Author

FeepingCreature commented Jan 17, 2020

I get what it is, I don't know what you mean by "fit more with the new flag".

edit: Do you mean -verrors=gnu?

@FeepingCreature
Copy link
Contributor Author

ping @wilzbach

Copy link
Member

@Geod24 Geod24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a changelog entry ? Many people probably want to add that to their dmd.conf. I know I do.

src/dmd/mars.d Outdated
else if (strcmp(style, "gnu") == 0)
params.messageStyle = MessageStyle.gnu;
else
error("unknown error style '%s'", style);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List possible style

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Listed.

src/dmd/globals.d Show resolved Hide resolved
@FeepingCreature FeepingCreature force-pushed the feature/gnu-message-style branch from 013007a to 09a1a38 Compare January 31, 2020 10:29
@FeepingCreature
Copy link
Contributor Author

Added a changelog entry.

@FeepingCreature
Copy link
Contributor Author

@Geod24 thanks for automerge but could you set it to 72h instead? I would still like to understand what @wilzbach meant.

@thewilsonator thewilsonator added Merge:72h no objection -> merge The PR will be merged if there are no objections raised. and removed Merge:auto-merge labels Jan 31, 2020
@thewilsonator
Copy link
Contributor

Done. (N.B 72h merge stoped sef-merging a while ago)

@wilzbach
Copy link
Member

I get what it is, I don't know what you mean by "fit more with the new flag".

The one that you introduce.
So -verrors=context -> -verror-style=context as it's an error style as well. WDYT?

@FeepingCreature
Copy link
Contributor Author

FeepingCreature commented Jan 31, 2020

Ah, I finally understand. I'm not sure that's a good idea, as it seems to do a very different thing? So we'd need to do it "feature flag" style, ie something like -verror-style=context,gnu which seems a bit awkward, or -verror-style=context -verror-style=gnu which looks like we're overriding context.

@wilzbach
Copy link
Member

Ah, I finally understand.

Sorry about that.

N.B 72h merge stoped sef-merging a while ago)

It never did that. A merge should always be a conscious decision. You can get a list of all of them easily over all repos e.g. via https://github.com/pulls?utf8=%E2%9C%93&q=is%3Aopen+is%3Apr+org%3Adlang+label%3A%2272h+no+objection+-%3E+merge%22

I'm not sure that's a good idea, as it seems to do a very different thing?

IMHO it's more an -verror-style than an -verrors option.

So we'd need to do it "feature flag" style

Yeah we would, what do other people think about this?

@MoonlightSentinel
Copy link
Contributor

MoonlightSentinel commented Jan 31, 2020

Yeah we would, what do other people think about this?

I don't think this is a good idea because feature flags should IMHO accept any subset of all possible values. That would imply -verror-style=digitalmars,gnu as a valid configuration allhough they are mutually exclusive.

@RazvanN7 RazvanN7 added Merge:auto-merge and removed Merge:72h no objection -> merge The PR will be merged if there are no objections raised. labels Feb 3, 2020
@dlang-bot dlang-bot merged commit 79ad934 into dlang:master Feb 3, 2020
@FeepingCreature FeepingCreature deleted the feature/gnu-message-style branch February 3, 2020 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants