[Issue 5560] New: unittests add code size when compiling with -lib and without -unittest

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 10 14:18:01 PST 2011


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: nobody at puremagic.com
        ReportedBy: schveiguy at yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy at 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 at steve-laptop:~/testd/unittestbug$ ~/dmd-2.051/linux/bin/dmd -lib
-oflib1.a lib1.d
steves at steve-laptop:~/testd/unittestbug$ ~/dmd-2.051/linux/bin/dmd -lib
-oflib2.a lib2.d
steves at steve-laptop:~/testd/unittestbug$ ~/dmd-2.051/linux/bin/dmd -lib
-oflib3.a lib3.d
steves at 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 at steve-laptop:~/testd/unittestbug$ ~/dmd-2.051/linux/bin/dmd -c *.d
steves at 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: -------


More information about the Digitalmars-d-bugs mailing list