Thread overview
[Issue 5093] New: improve error for importing std.c.windows.windows
Oct 21, 2010
Jesse Phillips
Nov 15, 2010
simon
Nov 15, 2010
Don
Nov 15, 2010
Jonathan M Davis
Nov 15, 2010
Don
Nov 15, 2010
Jonathan M Davis
Nov 16, 2010
simon
Nov 17, 2010
simon
October 21, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5093

           Summary: improve error for importing std.c.windows.windows
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: Jesse.K.Phillips+D@gmail.com
                CC: Jesse.K.Phillips+D@gmail.com


--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D@gmail.com> 2010-10-21 09:08:13 PDT ---
Currently when you import std.c.windows.windows on a non-Windows machine, the file and line number of std/c/windows/windows.d is returned due to a static assert(0).

This is great and all, but it would be really nice to have the file and line number of the importer. I don't know of how to improve this. Maybe an improvement to DMD so that a module that is imported and has a static assert(0) results in the importer file and line being used?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5093


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2010-10-21 09:40:34 PDT ---
More generally, it may useful to have an error message for failed imports that shows the file name and line number of the module that contains the import statement.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5093


Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@yahoo.com


--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-10-21 10:43:50 PDT ---
you might want to try dmd -v.  It shows imports in the order they were imported.  It doesn't show the file which imports it, but you can get a good idea probably from the prior file list.

I'd say adding the file imported from would be a good thing to add to -v.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 15, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5093



--- Comment #3 from simon <s.d.hammett@googlemail.com> 2010-11-15 11:03:49 PST ---
Created an attachment (id=812)
PATCH against rev 755: implement a module import backtrace for static assert

Implements a module import back-trace for static asserts.

This ought to be implemented for non-static asserts as well, but that probably involves mucking about in the back end and I can't be bothered diving into that at the mo.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 15, 2010
d-bugmail@puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=5093
> 
> 
> 
> --- Comment #3 from simon <s.d.hammett@googlemail.com> 2010-11-15 11:03:49 PST ---
> Created an attachment (id=812)
> PATCH against rev 755: implement a module import backtrace for static assert
> 
> Implements a module import back-trace for static asserts.
> 
> This ought to be implemented for non-static asserts as well,
> but that probably involves mucking about in the back end
> and I can't be bothered diving into that at the mo.
> 
Cool! In cases where it's imported from inside a static if, this is fantastic.
Ideally, it would only do the module trace starting from the last instantiated template. (Which would mean that in many cases, it wouldn't appear at all). I think this should be applied to all template instantiation back traces.
November 15, 2010
On Monday 15 November 2010 12:49:05 Don wrote:
> d-bugmail@puremagic.com wrote:
> > http://d.puremagic.com/issues/show_bug.cgi?id=5093
> > 
> > 
> > 
> > --- Comment #3 from simon <s.d.hammett@googlemail.com> 2010-11-15
> > 11:03:49 PST --- Created an attachment (id=812)
> > PATCH against rev 755: implement a module import backtrace for static
> > assert
> > 
> > Implements a module import back-trace for static asserts.
> > 
> > This ought to be implemented for non-static asserts as well, but that probably involves mucking about in the back end and I can't be bothered diving into that at the mo.
> 
> Cool! In cases where it's imported from inside a static if, this is
> fantastic.
> Ideally, it would only do the module trace starting from the last
> instantiated template. (Which would mean that in many cases, it wouldn't
> appear at all). I think this should be applied to all template
> instantiation back traces.

I expect that you meant to post a comment to the bug rather than post on the bug list...

- Jonathan M Davis
November 15, 2010
Jonathan M Davis wrote:
> On Monday 15 November 2010 12:49:05 Don wrote:
>> d-bugmail@puremagic.com wrote:
>>> http://d.puremagic.com/issues/show_bug.cgi?id=5093
>>>
>>>
>>>
>>> --- Comment #3 from simon <s.d.hammett@googlemail.com> 2010-11-15
>>> 11:03:49 PST --- Created an attachment (id=812)
>>> PATCH against rev 755: implement a module import backtrace for static
>>> assert
>>>
>>> Implements a module import back-trace for static asserts.
>>>
>>> This ought to be implemented for non-static asserts as well,
>>> but that probably involves mucking about in the back end
>>> and I can't be bothered diving into that at the mo.
>> Cool! In cases where it's imported from inside a static if, this is
>> fantastic.
>> Ideally, it would only do the module trace starting from the last
>> instantiated template. (Which would mean that in many cases, it wouldn't
>> appear at all). I think this should be applied to all template
>> instantiation back traces.
> 
> I expect that you meant to post a comment to the bug rather than post on the bug list...
> 
> - Jonathan M Davis
You expect wrong.
November 15, 2010
On Monday, November 15, 2010 13:59:10 Don wrote:
> Jonathan M Davis wrote:
> > On Monday 15 November 2010 12:49:05 Don wrote:
> >> d-bugmail@puremagic.com wrote:
> >>> http://d.puremagic.com/issues/show_bug.cgi?id=5093
> >>> 
> >>> 
> >>> 
> >>> --- Comment #3 from simon <s.d.hammett@googlemail.com> 2010-11-15
> >>> 11:03:49 PST --- Created an attachment (id=812)
> >>> PATCH against rev 755: implement a module import backtrace for static
> >>> assert
> >>> 
> >>> Implements a module import back-trace for static asserts.
> >>> 
> >>> This ought to be implemented for non-static asserts as well, but that probably involves mucking about in the back end and I can't be bothered diving into that at the mo.
> >> 
> >> Cool! In cases where it's imported from inside a static if, this is
> >> fantastic.
> >> Ideally, it would only do the module trace starting from the last
> >> instantiated template. (Which would mean that in many cases, it wouldn't
> >> appear at all). I think this should be applied to all template
> >> instantiation back traces.
> > 
> > I expect that you meant to post a comment to the bug rather than post on the bug list...
> > 
> > - Jonathan M Davis
> 
> You expect wrong.

Okay. Sorry. It's just that normally no one posts directly to the list and any comments posted directly to the list probably won't get seen in the long run, since people will generally look at the bug reports directly.

- Jonathan M Davis
November 16, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5093


simon <s.d.hammett@googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #812 is|0                           |1
           obsolete|                            |


--- Comment #4 from simon <s.d.hammett@googlemail.com> 2010-11-16 15:37:40 PST ---
Created an attachment (id=816)
PATCH against rev 755: implement a module import backtrace for static assert

modified patch so it doesn't print module back trace when inside a template, the template instantiation trace already gets printed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 17, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5093


simon <s.d.hammett@googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #816 is|0                           |1
           obsolete|                            |


--- Comment #5 from simon <s.d.hammett@googlemail.com> 2010-11-17 13:03:19 PST ---
Created an attachment (id=818)
PATCH against rev 755: implement a module import backtrace for static assert

...and printing the correct import location might help

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------