adamdruppe / arsd

This is a collection of modules that I've released over the years. Most of them stand alone, or have just one or two dependencies in here, so you don't have to download this whole repo.
http://arsd-official.dpldocs.info/arsd.html
531 stars 125 forks source link

cgi.d dual context issue with -unittest #388

Closed quickfur closed 1 year ago

quickfur commented 1 year ago

Due to current D compilers not allowing you to specify which modules -unittest should apply to, I'm forced to compile cgi.d with -unittest. But this leads to this error:

arsd/cgi.d(3886): Deprecation: function `arsd.cgi.__unittest_L499_C1.serve!(handler, Cgi, 5000000L).serve` function requires a dual-context, which is deprecated
arsd/cgi.d(4439):        instantiated from here: `serve!(handler, Cgi, 5000000L)`
arsd/cgi.d(3661):        instantiated from here: `cgiMainImpl!(handler, Cgi, 5000000L)`
arsd/cgi.d(3886): Deprecation: function `arsd.cgi.__unittest_L510_C1.serve!(requestHandler, Cgi, 5000000L).serve` function requires a dual-context, which is deprecated
arsd/cgi.d(543):        instantiated from here: `serve!(requestHandler, Cgi, 5000000L)`
arsd/cgi.d(3886): Error: function `arsd.cgi.__unittest_L510_C1.serve!(requestHandler, Cgi, 5000000L).serve` requires a dual-context, which is not yet supported by LDC

Even though this is currently only a deprecation in the front end, LDC doesn't actually support it: it aborts at codegen. This sux, since I'm forced to use DMD to do unittest builds, and given that dual context is deprecated, I'm not sure how much longer I can rely on this.

adamdruppe commented 1 year ago

the line numbers don't match up anymore, what test is this one?

quickfur commented 1 year ago

Around line 510, with the heading:

/++
        Same as the previous example, but written out long-form without the use of [DispatcherMain] nor [GenericMain].
+/
unittest {

The offending line is here:

                // and serve the request(s) according to the compile configuration
                server.serve!(requestHandler)();
adamdruppe commented 1 year ago

oooooh ok, just my newer demos that are never intended to even be run, just syntax checked!

quickfur commented 1 year ago

lol...

is there a way to make -unittest skip those? it's just annoying that I have to deal with 3rd party unittest issues when all I want is to unittest my own code. One of these days we should write up a DIP to make -unittest less bogonous...

adamdruppe commented 1 year ago

i use version(Demo) in a lot of places i might do that here

quickfur commented 1 year ago

Thanks, man, that would save me lots of headaches.

adamdruppe commented 1 year ago

there that version is up now

quickfur commented 1 year ago

Everything works beautifully now, thanks man!!