Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive

Conversation

@Luhrel
Copy link
Contributor

@Luhrel Luhrel commented Mar 4, 2020

Blocking dlang/dmd#10872

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @Luhrel! 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

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

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

dub run digger -- build "master + druntime#2972"

@atilaneves
Copy link
Contributor

I don't see any changes in any tests, how can that be?

@thewilsonator
Copy link
Contributor

Because this is blocking a dmd PR and NFC. The tests are in that.

Note that the first diff is used in assert messages so any change will show up. If that isn't covered by tests I'd be surprised.

The second one is for debug only.

@Geod24
Copy link
Member

Geod24 commented Mar 4, 2020

Note that the first diff is used in assert messages so any change will show up. If that isn't covered by tests I'd be surprised.

There is one test, but it does not include real:

void testFloatingPoint()()
{
test(1.5, 2.5, "1.5 != 2.5");
test(float.max, -float.max, "3.40282e+38 != -3.40282e+38");
test(double.max, -double.max, "1.79769e+308 != -1.79769e+308");
}

@Luhrel Luhrel force-pushed the fix/chkscanf_printf_args branch from dd7a394 to dbbb785 Compare March 4, 2020 10:23
@Luhrel Luhrel force-pushed the fix/chkscanf_printf_args branch from dbbb785 to 4e45509 Compare March 4, 2020 10:24
@Luhrel Luhrel changed the title Fic printf arg. types 2 Fix printf arg. types 2 Mar 4, 2020
@Luhrel Luhrel force-pushed the fix/chkscanf_printf_args branch from 4e45509 to 2dc6860 Compare March 4, 2020 10:26
@Luhrel Luhrel requested a review from Geod24 March 4, 2020 10:30
@Luhrel Luhrel force-pushed the fix/chkscanf_printf_args branch 3 times, most recently from c2bad91 to feaa967 Compare March 4, 2020 11:08
@Luhrel Luhrel requested review from andralex and wilzbach as code owners March 4, 2020 11:08
@Luhrel Luhrel requested a review from thewilsonator March 4, 2020 13:16
test(1.5, 2.5, "1.5 != 2.5");
test(float.max, -float.max, "3.40282e+38 != -3.40282e+38");
test(double.max, -double.max, "1.79769e+308 != -1.79769e+308");
test(real.max, -real.max, "1.18973e+4932 != -1.18973e+4932");
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use another constant, real isn't 80-bit for most targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this way ?

import std.conv : to;
//test(real.max, -real.max, "1.18973e+4932 != -1.18973e+4932");
test(real.max, -real.max, real.max.to!string ~ " != -" ~ real.max.to!string);

How shall I test this with a number which change depending of the platform ?

Copy link
Contributor

@kinke kinke Mar 4, 2020

Choose a reason for hiding this comment

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

Well, real.max seems totally arbitrary, so any nicely representable value should do (5.25L or whatever). std.conv.to is in Phobos and so not suited for a druntime test.

Copy link
Contributor Author

@Luhrel Luhrel Mar 4, 2020

Choose a reason for hiding this comment

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

Changed to:

test(5.25L, -5.25L, "5.25 != -5.25");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to:

test(5.25L, -5.25L, "5.25 != -5.25");

Somehow it returns this:

'-nan != -nan' != '5.25 != -5.25'

Any idea @kinke @Geod24 ?

@Luhrel Luhrel force-pushed the fix/chkscanf_printf_args branch 4 times, most recently from ae499e2 to 91ddc63 Compare March 4, 2020 20:07
@Luhrel Luhrel force-pushed the fix/chkscanf_printf_args branch 2 times, most recently from 755eaf8 to fd5c6d1 Compare March 4, 2020 20:10
@Luhrel Luhrel force-pushed the fix/chkscanf_printf_args branch 4 times, most recently from 2c5d192 to a6a6cdb Compare March 6, 2020 20:12
@Luhrel Luhrel force-pushed the fix/chkscanf_printf_args branch 2 times, most recently from 76ff913 to 3119963 Compare March 6, 2020 22:31
@Luhrel Luhrel force-pushed the fix/chkscanf_printf_args branch from 3119963 to 2c261b3 Compare March 7, 2020 08:48
@dlang-bot dlang-bot merged commit ef788b3 into dlang:master Mar 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants