Bug 5093 – improve error for importing std.c.windows.windows

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-10-21T09:08:13Z
Last change time
2018-05-18T10:18:49Z
Keywords
patch
Assigned to
No Owner
Creator
Jesse Phillips

Attachments

IDFilenameSummaryContent-TypeSize
812modBt.patchPATCH against rev 755: implement a module import backtrace for static asserttext/plain4344
816modBt.patchPATCH against rev 755: implement a module import backtrace for static assertapplication/octet-stream4403
818modBt.patchPATCH against rev 755: implement a module import backtrace for static asserttext/plain4557

Comments

Comment #0 by Jesse.K.Phillips+D — 2010-10-21T09:08:13Z
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?
Comment #1 by bearophile_hugs — 2010-10-21T09:40:34Z
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.
Comment #2 by schveiguy — 2010-10-21T10:43:50Z
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.
Comment #3 by s.d.hammett — 2010-11-15T11:03:49Z
Created attachment 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.
Comment #4 by s.d.hammett — 2010-11-16T15:37:40Z
Created attachment 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.
Comment #5 by s.d.hammett — 2010-11-17T13:03:19Z
Created attachment 818 PATCH against rev 755: implement a module import backtrace for static assert ...and printing the correct import location might help
Comment #6 by dmitry.olsh — 2018-05-18T10:18:49Z
This program compiles fine on Ubuntu right now: --- import std.c.windows.windows; --- Was fixed years ago when we introduced top-level version per platform in each file.