Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1001 (reopened enhancement)

Opened 6 months ago

Last modified 6 months ago

Remove std.stdarg and std.c.stdarg

Reported by: fawzi Assigned to: sean
Priority: normal Milestone: External Bugs
Component: Core Functionality Version: trunk
Keywords: stdio tangobos Cc: fawzi@gmx.ch

Description

When using gdc there is a dependence of tango.stdc.stdargs (and thus tango.stdc.stdio) on std.c.stdio. This dependence is easy to remove, and, if removed, makes it possible to use tango.stdc.stdio in tangobos std.c.stdio as done in a recent change in tangobos.

Here is a patch wrt. to svn, to fix it.

Fawzi

svn diff tango/stdc/stdarg.d

Index: tango/stdc/stdarg.d
===================================================================
--- tango/stdc/stdarg.d (revision 3396)
+++ tango/stdc/stdarg.d (working copy)
@@ -11,7 +11,26 @@
 
 version( GNU )
 {
-    public import std.c.stdarg;
+    private import gcc.builtins;
+    alias __builtin_va_list va_list;
+    alias __builtin_va_end  va_end;
+    alias __builtin_va_copy va_copy;
+
+    template va_start(T)
+    {
+        void va_start( out va_list ap, inout T parmn )
+        {
+
+        }
+    }
+
+    template va_arg(T)
+    {
+        T va_arg( inout va_list ap )
+        {
+            return T.init;
+        }
+    }
 }
 else
 {

Change History

03/25/08 14:19:52 changed by larsivi

There used to be a problem (at least perceived problem) doing this in the past, due to how std.stdarg is hardcoded into GDC. When I did the Tangobos change, I tested the same as you did above, and I think we now safely can remove std.stdarg and std.c.stdarg. I'd like to have it properly confirmed first though.

03/25/08 16:30:04 changed by larsivi

  • status changed from new to closed.
  • resolution set to fixed.

(In [3397]) Remove std.stdarg hacks for GDC. closes #1001, refs #924

03/25/08 23:19:01 changed by darrylb

  • status changed from closed to reopened.
  • resolution deleted.

This seems to have broken something, at least on my system and also reported by 'jhouse' on irc.

A simple test program that does 'Stdout("foo" ~ "bar").newline;' should show the problem (nothing is output at all for me, nor the original reporter).

If I backrev to 3396 all works again.

03/26/08 04:10:27 changed by larsivi

Not able to reproduce - any more details on your setup? Did you properly clean your previous installation?

03/26/08 12:17:28 changed by darrylb

Indeed I did :)

I was testing on my laptop, which is a 32bit Intel, ubuntu. (gcc version 4.1.3 20070831 (prerelease gdc 0.25, using dmd 1.021) (Ubuntu 0.25-4.1.2-16ubuntu1))

I went back to 3100 first, worked fine. 3396 also worked fine. When I went to 3397, I would no longer get concat output. Going back to 3396 solved it.

I was using a test program something like:

char[] foo = "foo"; char[] bar = "bar"; Stdout(foo, bar, foo ~ bar).newline;

3396 would output: foo, bar, foobar

3397 would output: foo, bar,

03/26/08 12:24:54 changed by Nietsnie

Just to add some more, I'm testing with a Core2Duo, ubuntu, gdc .25 using dmd 1.021, this test program:

import tango.io.Stdout;

void main()
{
        char[] foo = "foo";
        char[] bar = "bar";
        Stdout(foo, bar, foo ~ bar).newline;
}

I get:

jeff@jeff-desktop:~/code/tetra/src$ ./test8
foo, bar, foobar

So, yea.. :p

03/26/08 12:49:01 changed by darrylb

tried it on my pc here at work, (I had to change line 1076 in tango/io/Path.d to this to get it to compile):

FS.Listing list;
list.folder = folder ~ '\0';

System here is:

Linux darryl 2.6.22.5-31-default #1 SMP 2007/09/21 22:29:00 UTC i686 athlon i386 GNU/Linux
gcc version 4.1.2 20070214 (  (gdc 0.24, using dmd 1.020))

(running 32bit Suse)

same test program as Nietsnie posted above outputs:

foo, bar,

03/26/08 12:58:21 changed by Nietsnie

Just to update my comment.

I just rebuild the library with dsss, and didn't run the build-gdc.sh script.

After running ./build-gdc.sh and ./install-gdc.sh I get the results reported by darrylb.

03/26/08 17:49:45 changed by larsivi

03/26/08 17:51:20 changed by larsivi

  • summary changed from remove std.c.stdio dependence from tango.stdc.stdargs with gdc to Remove std.stdarg and std.c.stdarg.
  • milestone changed from 0.99.6 to External Bugs.