August 29, 2012
Is the following expected?
When I put the exception:
class LogicError : Exception
{
    this( string file = __FILE__, size_t line = __LINE__, Throwable next = null )
    {
        super( "Internal logic error", file, line, next );
    }
}

In the same file as the rest of the program,
rdmd --main -unittest avl.d
had no trouble with it, but when I put it in a separate file,
while:
dmd -c -unittest avl.d utils.d
accepted it without complaint, rdmd responded with:
rdmd --main -unittest avl.d utils.d
/tmp/.rdmd-1000/rdmd-avl.d-EFC2A8F3F9817BAA59A3A00532D5696F/objs/avl.o: In function `_D3avl3AVL6insertMFKC3avl3AVL4NodeKC3avl3AVL4NodeKbZC3avl3AVL4Node':
/tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL6insertMFKC3avl3AVL4NodeKC3avl3AVL4NodeKbZC3avl3AVL4Node+0x10d): undefined reference to `_D5utils10LogicError7__ClassZ'
/tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL6insertMFKC3avl3AVL4NodeKC3avl3AVL4NodeKbZC3avl3AVL4Node+0x144): undefined reference to `_D5utils10LogicError6__ctorMFAyamC6object9ThrowableZC5utils10LogicError'
/tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL6insertMFKC3avl3AVL4NodeKC3avl3AVL4NodeKbZC3avl3AVL4Node+0x273): undefined reference to `_D5utils10LogicError7__ClassZ'
/tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL6insertMFKC3avl3AVL4NodeKC3avl3AVL4NodeKbZC3avl3AVL4Node+0x2aa): undefined reference to `_D5utils10LogicError6__ctorMFAyamC6object9ThrowableZC5utils10LogicError'
/tmp/.rdmd-1000/rdmd-avl.d-EFC2A8F3F9817BAA59A3A00532D5696F/objs/avl.o: In function `_D3avl3AVL9delLftBalMFKC3avl3AVL4NodeKbZC3avl3AVL4Node':
/tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL9delLftBalMFKC3avl3AVL4NodeKbZC3avl3AVL4Node+0x3f): undefined reference to `_D5utils10LogicError7__ClassZ'
/tmp/.rdmd-1000/stubmain.d:(.text._D3avl3AVL9delLftBalMFKC3avl3AVL4NodeKbZC3avl3AVL4Node+0x76): undefined reference to `_D5utils10LogicError6__ctorMFAyamC6object9ThrowableZC5utils10LogicError'
collect2: ld returned 1 exit status
--- errorlevel 1

Is this expected?

August 29, 2012
On 30-Aug-12 00:14, Charles Hixson wrote:
> Is the following expected?
> When I put the exception:
> class LogicError : Exception
> {
>      this( string file = __FILE__, size_t line = __LINE__, Throwable
> next = null )
>      {
>          super( "Internal logic error", file, line, next );
>      }
> }
>
> In the same file as the rest of the program,
> rdmd --main -unittest avl.d
> had no trouble with it, but when I put it in a separate file,
> while:
> dmd -c -unittest avl.d utils.d
> accepted it without complaint, rdmd responded with:
> rdmd --main -unittest avl.d utils.d

It should work with plain rdmd --main -unittest avl.d that's the whole point of rdmd actually.

-- 
Olshansky Dmitry
August 29, 2012
On 08/29/2012 01:36 PM, Dmitry Olshansky wrote:
> On 30-Aug-12 00:14, Charles Hixson wrote:
>> Is the following expected?
>> When I put the exception:
>> class LogicError : Exception
>> {
>> this( string file = __FILE__, size_t line = __LINE__, Throwable
>> next = null )
>> {
>> super( "Internal logic error", file, line, next );
>> }
>> }
>>
>> In the same file as the rest of the program,
>> rdmd --main -unittest avl.d
>> had no trouble with it, but when I put it in a separate file,
>> while:
>> dmd -c -unittest avl.d utils.d
>> accepted it without complaint, rdmd responded with:
>> rdmd --main -unittest avl.d utils.d
>
> It should work with plain rdmd --main -unittest avl.d that's the whole
> point of rdmd actually.
>
You were right.  That worked.  Where should I look to better understand rdmd?  I expected to need to list all the local files that were needed, but clearly that's the wrong approach.
August 29, 2012
On 8/29/12 3:47 PM, Charles Hixson wrote:
> Where should I look to better understand
> rdmd? I expected to need to list all the local files that were needed,
> but clearly that's the wrong approach.

http://dlang.org/rdmd.html

To my surprise, it's not in the top Google search results. However, Dmitry's shadow page is: http://blackwhale.github.com/rdmd.html

Andrei
August 29, 2012
On 08/29/2012 03:47 PM, Charles Hixson wrote:
> On 08/29/2012 01:36 PM, Dmitry Olshansky wrote:
>> On 30-Aug-12 00:14, Charles Hixson wrote:
>>> Is the following expected?
>>> When I put the exception:
>>> class LogicError : Exception
>>> {
>>> this( string file = __FILE__, size_t line = __LINE__, Throwable
>>> next = null )
>>> {
>>> super( "Internal logic error", file, line, next );
>>> }
>>> }
>>>
>>> In the same file as the rest of the program,
>>> rdmd --main -unittest avl.d
>>> had no trouble with it, but when I put it in a separate file,
>>> while:
>>> dmd -c -unittest avl.d utils.d
>>> accepted it without complaint, rdmd responded with:
>>> rdmd --main -unittest avl.d utils.d
>>
>> It should work with plain rdmd --main -unittest avl.d that's the whole
>> point of rdmd actually.
>>
> You were right. That worked. Where should I look to better understand
> rdmd? I expected to need to list all the local files that were needed,
> but clearly that's the wrong approach.

Well, it worked until I started "depending on it".  Then it stopped.
So I guess that, at least for exceptions, they need to be defined within the same file that they are used for rdmd to be happy with them, though clearly that's not true for the standard libraries.  And I don't know where the boundaries are.

This is particularly weird, because when I try to create a simple example case it doesn't display the problem.  Not too surprisingly it depends on the presence of the unittest parameter, though even that's a little surprising as I haven't yet added any unit tests.  Still, without the unittest it isn't even thinking of executing anything.

Still, for some reason if the exception is defined in a separate file (utils.d) it can't find the symbol.  I even tried including utils.o instead of utils.d.  No change.

FWIW, I invoke the exception with:
default:
	assert	(false, "internal logic error");
	throw	new	LogicError ();
in a few places.  As I said, I haven't written the unittests yet, so even the assert has never been called.  Still, that's a consideration that happens much after linking.
August 30, 2012
On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote:
> On 8/29/12 3:47 PM, Charles Hixson wrote:
>> Where should I look to better understand
>> rdmd? I expected to need to list all the local files that were needed,
>> but clearly that's the wrong approach.
>
> http://dlang.org/rdmd.html
>
> To my surprise, it's not in the top Google search results. However,
> Dmitry's shadow page is: http://blackwhale.github.com/rdmd.html
>
> Andrei
Thank you.  Unfortunately, that page doesn't address the symptoms that I've been experiencing, which while they don't halt development certainly confuse it.

It's starting to look as if while I use rdmd I'll need to keep everything in one file, as otherwise I can't share exceptions between classes.  (And I'm only guessing that the problem is limited to exceptions, as I haven't tested with other functions.)

Since the small test programs DO call successfully between different files (including for exceptions) I don't really have a clue as to what's going on, except that it appears to happen during linking.  And combining the routines into one file appears to "fix" the problem.  And that dmd doesn't seem to have the same problem.  (I.e., if I add a dummy main routine to the avl.d file, then
dmd -unittest avl.d utils.d
compiles and executes without problems, even though it doesn't do anything.

FWIW:
charles@mandala1:~$ dmd
DMD64 D Compiler v2.060
Copyright (c) 1999-2012 by Digital Mars written by Walter Bright
Documentation: http://www.dlang.org/index.html
Usage:
August 30, 2012
On 8/29/12 4:52 PM, Charles Hixson wrote:
> On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote:
>> On 8/29/12 3:47 PM, Charles Hixson wrote:
>>> Where should I look to better understand
>>> rdmd? I expected to need to list all the local files that were needed,
>>> but clearly that's the wrong approach.
>>
>> http://dlang.org/rdmd.html
>>
>> To my surprise, it's not in the top Google search results. However,
>> Dmitry's shadow page is: http://blackwhale.github.com/rdmd.html
>>
>> Andrei
> Thank you. Unfortunately, that page doesn't address the symptoms that
> I've been experiencing, which while they don't halt development
> certainly confuse it.
>
> It's starting to look as if while I use rdmd I'll need to keep
> everything in one file, as otherwise I can't share exceptions between
> classes. (And I'm only guessing that the problem is limited to
> exceptions, as I haven't tested with other functions.)
>
> Since the small test programs DO call successfully between different
> files (including for exceptions) I don't really have a clue as to what's
> going on, except that it appears to happen during linking. And combining
> the routines into one file appears to "fix" the problem. And that dmd
> doesn't seem to have the same problem. (I.e., if I add a dummy main
> routine to the avl.d file, then
> dmd -unittest avl.d utils.d
> compiles and executes without problems, even though it doesn't do anything.

You should be able to use rdmd for that dependency pattern, and if not there's a bug in it. However, nobody can work on that without a test case.

Andrei

August 30, 2012
On Thu, Aug 30, 2012 at 1:09 AM, Charles Hixson <charleshixsn@earthlink.net> wrote:
> Well, it worked until I started "depending on it".  Then it stopped.
> So I guess that, at least for exceptions, they need to be defined within the
> same file that they are used for rdmd to be happy with them, though clearly
> that's not true for the standard libraries.  And I don't know where the
> boundaries are.

FWIW, in my own projects, I started having *lots* of linker errors with rdmd recently, when I changed to 2.060. I don't know if that comes from dmd proper or rdmd, but now half my compilation cycles fail and I had to downgrade to using DMD directly.

And I'm not using exception, nor classes but lot of templates.

I think it'll be Dustmite time.
August 30, 2012
On 08/29/2012 06:46 PM, Andrei Alexandrescu wrote:
> On 8/29/12 4:52 PM, Charles Hixson wrote:
>> On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote:
>>> On 8/29/12 3:47 PM, Charles Hixson wrote:
>>>> Where should I look to better understand
>>>> rdmd? I expected to need to list all the local files that were needed,
>>>> but clearly that's the wrong approach.
>>>
>>> http://dlang.org/rdmd.html
>>>
>>> To my surprise, it's not in the top Google search results. However,
>>> Dmitry's shadow page is: http://blackwhale.github.com/rdmd.html
>>>
>>> Andrei
>> Thank you. Unfortunately, that page doesn't address the symptoms that
>> I've been experiencing, which while they don't halt development
>> certainly confuse it.
>>
>> It's starting to look as if while I use rdmd I'll need to keep
>> everything in one file, as otherwise I can't share exceptions between
>> classes. (And I'm only guessing that the problem is limited to
>> exceptions, as I haven't tested with other functions.)
>>
>> Since the small test programs DO call successfully between different
>> files (including for exceptions) I don't really have a clue as to what's
>> going on, except that it appears to happen during linking. And combining
>> the routines into one file appears to "fix" the problem. And that dmd
>> doesn't seem to have the same problem. (I.e., if I add a dummy main
>> routine to the avl.d file, then
>> dmd -unittest avl.d utils.d
>> compiles and executes without problems, even though it doesn't do
>> anything.
>
> You should be able to use rdmd for that dependency pattern, and if not
> there's a bug in it. However, nobody can work on that without a test case.
>
> Andrei
>

The only one I have is about 450 lines long.  If you want I could send it to you.  (I probably shouldn't just post it.)
August 30, 2012
On 30-Aug-12 09:40, Charles Hixson wrote:
> On 08/29/2012 06:46 PM, Andrei Alexandrescu wrote:
>> On 8/29/12 4:52 PM, Charles Hixson wrote:
>>> On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote:
>>>> On 8/29/12 3:47 PM, Charles Hixson wrote:
>>>>> Where should I look to better understand
>>>>> rdmd? I expected to need to list all the local files that were needed,
>>>>> but clearly that's the wrong approach.
>>>>
>>>> http://dlang.org/rdmd.html
>>>>
>>>> To my surprise, it's not in the top Google search results. However,
>>>> Dmitry's shadow page is: http://blackwhale.github.com/rdmd.html
>>>>
>>>> Andrei
>>> Thank you. Unfortunately, that page doesn't address the symptoms that
>>> I've been experiencing, which while they don't halt development
>>> certainly confuse it.
>>>
>>> It's starting to look as if while I use rdmd I'll need to keep
>>> everything in one file, as otherwise I can't share exceptions between
>>> classes. (And I'm only guessing that the problem is limited to
>>> exceptions, as I haven't tested with other functions.)
>>>
>>> Since the small test programs DO call successfully between different
>>> files (including for exceptions) I don't really have a clue as to what's
>>> going on, except that it appears to happen during linking. And combining
>>> the routines into one file appears to "fix" the problem. And that dmd
>>> doesn't seem to have the same problem. (I.e., if I add a dummy main
>>> routine to the avl.d file, then
>>> dmd -unittest avl.d utils.d
>>> compiles and executes without problems, even though it doesn't do
>>> anything.
>>
>> You should be able to use rdmd for that dependency pattern, and if not
>> there's a bug in it. However, nobody can work on that without a test
>> case.
>>
>> Andrei
>>
>
> The only one I have is about 450 lines long.  If you want I could send
> it to you.  (I probably shouldn't just post it.)

This is the place to report bugs (including big and obscure ones):
http://d.puremagic.com/issues/

The only requirement is to clear reproducible problem statement like this command fails with this on dmd version xx.

As for size, well there is dustmite test case reduction tool that sometimes does miracles.

-- 
Olshansky Dmitry
« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home