http://d.puremagic.com/issues/show_bug.cgi?id=5560

           Summary: unittests add code size when compiling with -lib and
                    without -unittest
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: schvei...@yahoo.com


--- Comment #0 from Steven Schveighoffer <schvei...@yahoo.com> 2011-02-10 
14:15:33 PST ---
When compiling a lib with that has unit tests, but without -unittest, each unit
test for some reason adds a small amount of space.

For example:

lib1.d:

void foo() {}

lib2.d:

void foo() {}

unittest {}

lib3.d

void foo() {}

unittest {}

unittest {}

results:

steves@steve-laptop:~/testd/unittestbug$ ~/dmd-2.051/linux/bin/dmd -lib
-oflib1.a lib1.d
steves@steve-laptop:~/testd/unittestbug$ ~/dmd-2.051/linux/bin/dmd -lib
-oflib2.a lib2.d
steves@steve-laptop:~/testd/unittestbug$ ~/dmd-2.051/linux/bin/dmd -lib
-oflib3.a lib3.d
steves@steve-laptop:~/testd/unittestbug$ ls -l *.a
-rw-r--r-- 1 steves steves 3070 2011-02-10 17:07 lib1.a
-rw-r--r-- 1 steves steves 3914 2011-02-10 17:07 lib2.a
-rw-r--r-- 1 steves steves 4758 2011-02-10 17:07 lib3.a

If I compile these files with the -c option:

steves@steve-laptop:~/testd/unittestbug$ ~/dmd-2.051/linux/bin/dmd -c *.d
steves@steve-laptop:~/testd/unittestbug$ ls -l *.o
-rw-r--r-- 1 steves steves 1184 2011-02-10 17:08 lib1.o
-rw-r--r-- 1 steves steves 1184 2011-02-10 17:08 lib2.o
-rw-r--r-- 1 steves steves 1184 2011-02-10 17:08 lib3.o

So clearly it has something to do with the -lib option, but I'm not sure what.

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

Reply via email to