www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3528] New: FreeBSD patches for druntime.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528

           Summary: FreeBSD patches for druntime.
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: FreeBSD
            Status: NEW
          Severity: minor
          Priority: P2
         Component: druntime
        AssignedTo: sean invisibleduck.org
        ReportedBy: boucher.travis gmail.com


--- Comment #0 from Travis Boucher <boucher.travis gmail.com> 2009-11-19
18:41:32 PST ---
Created an attachment (id=503)
FreeBSD quick fix (should compile, may not work properly)

This is a preliminary patch, mostly trivial, and not fully tested yet (but it
compiles, so that is 1 step in the right direction).

Some notes:

- posix.mak implies posix which also implies unix line termination.  This patch
doesn't have it corrected.  A simple  perl -pi -e 's/\r\n/\n/g' filename   will
convert from winderz to unix line termination.   Note a biggy, just something I
trip over sometimes when making patches.

- dmd2 changed freebsd to FreeBSD for version statements.  Maybe version
statements should case insensitive?

- For the most part I just copied the linux definitions of stuff that was
missing.  This may or may not work, I don't have everything ready to run a good
test yet.

- make is only gnu make on linux machines.  I'd like to make the whole build
structure a little more standard make-wise.  The dmd source is pretty good for
this.  I am not sure what druntime needs that is so gnu specific.

Future direction:

Cleanup the whole runtime and group Posix vs. Linux/FreeBSD definitions
properly.  Stuff that is defined in the Posix spec should be in a version(
Posix ) rather then a version( linux ) with duplicates for version( FreeBSD ),
version( Solaris ), version( each other os).

I'd prefer to see something like this:

version (Posix) {
  struct OSStructure {
     version(linux) int foo;
     version(FreeBSD) long foo;
     int bar;
  }
}

for trivial differences between implementations rather then a completely
different block.  This is even more important for things like standard posix
APIs.  Another example is when one implementation uses a macro and another uses
a function.

version (FreeBSD) {
   void MacroImplementation(...) { ... }
   alias MacroImplementaion DImplementaion
}

version (linux) {
  extern (C) void LibraryImplementation(...) { ... }
  alias LibraryImplementaion DImplementation
}

(I think some of the pthread stuff is like this, but I have to read through
both source trees to find out for sure).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 19 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2009-11-22
03:47:29 PST ---
I started with the fine grained versioning for OS differences, but abandoned it
after it got hopelessly tangled. The problem is updating support for one OS
that trashes another. All OS specific API's should be in separate modules. Then
maintenance is a lot easier.

Also, please compile & test patches before submitting them. If it's inserted
without testing, then it may silently fail, yet will be assumed to work some
arbitrary time later.

For sure, just copying linux stuff is fraught with peril. Linux and Freebsd are
substantially different, and every declaration needs to be manually and
carefully checked against the Freebsd C header files. Getting things like bit
masks, magic values, argument types, number of arguments, struct layouts, etc.,
wrong is a potential disastrous problem.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528


Sean Kelly <sean invisibleduck.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED


--- Comment #2 from Sean Kelly <sean invisibleduck.org> 2009-11-22 07:11:20 PST
---
The OS-specic blocks in the Posix headers are there to ease maintenance.  As
Walter has said, the alternative would be to have separate headers for each OS,
but I personally find it easier to work with them as-is.  I don't want to put
common stuff in a shared Posix version because it could cause problems later. 
Add support for another OS that doesn't define things that way and you either
have to separate it all again or add finer-grained versioning, which would be a
nightmare.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528



--- Comment #3 from Travis Boucher <boucher.travis gmail.com> 2009-11-22
08:44:41 PST ---
(In reply to comment #2)
 The OS-specic blocks in the Posix headers are there to ease maintenance.  As
 Walter has said, the alternative would be to have separate headers for each OS,
 but I personally find it easier to work with them as-is.  I don't want to put
 common stuff in a shared Posix version because it could cause problems later. 
 Add support for another OS that doesn't define things that way and you either
 have to separate it all again or add finer-grained versioning, which would be a
 nightmare.

The problem I am having now is that the FreeBSD stuff isn't being maintained. I am also trying to figure out the specific interactions between dmd, druntime and phobos. This will become even more of a nightmare if more platforms becomes supported. Maybe dropping freebsd support all together in dmd is an answer, and then my focus could be on gdc and making sure phobos/tango has the support I require. (of course druntime is still required at some level). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528



--- Comment #4 from Sean Kelly <sean invisibleduck.org> 2009-11-22 11:22:00 PST
---
OS support beyond Linux and OSX is by submission, since I don't have an install
of other OSes to check.  Tango is the same way though, unless something has
changed recently.  What issue do you have with Druntime/Phobos interaction? 
I'm not sure I understand.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528



--- Comment #5 from Sean Kelly <sean invisibleduck.org> 2009-11-22 11:26:29 PST
---
Regarding your commends, eol-style should be set for all files in SVN, so if
you're working from SVN all that should be handled for you.  And please please
don't copy definitions from one OS without checking them.  If something doesn't
compile now it indicates where work needs to be done to fill out the headers
properly.  Throwing in potentially invalid definitions just papers over the
problem and is likely to produce subtly broken code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528



--- Comment #6 from Travis Boucher <boucher.travis gmail.com> 2009-11-22
13:05:49 PST ---
(In reply to comment #4)
 OS support beyond Linux and OSX is by submission, since I don't have an install
 of other OSes to check.  Tango is the same way though, unless something has
 changed recently.  What issue do you have with Druntime/Phobos interaction? 
 I'm not sure I understand.

No issues with druntime/phobos interaction, just trying to learn/figure out what is defined where. Most of what I am doing is to learn the internals a little more so I can use it for targets other then x86/winderz/linux. I am especially interested in embedded targets (which is why understanding what all druntime provides is important to me). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528



--- Comment #7 from Travis Boucher <boucher.travis gmail.com> 2009-11-22
13:09:03 PST ---
(In reply to comment #5)
 Regarding your commends, eol-style should be set for all files in SVN, so if
 you're working from SVN all that should be handled for you.  And please please
 don't copy definitions from one OS without checking them.  If something doesn't
 compile now it indicates where work needs to be done to fill out the headers
 properly.  Throwing in potentially invalid definitions just papers over the
 problem and is likely to produce subtly broken code.

Understood, I'll be sure to test things properly before submitting anything else. I think one of the biggest frustrations in making D more cross platform is the inability to look at system C headers to create the proper definitions automatically. (not a fault in D's design, just an annoyance for integration) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528


Anders F Bj <afb algonet.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |afb algonet.se


--- Comment #8 from Anders F Bj <afb algonet.se> 2009-11-22 13:23:49 PST ---
(In reply to comment #7)
 I think one of the biggest frustrations in making D more cross platform
 is the inability to look at system C headers to create the proper definitions
 automatically.  (not a fault in D's design, just an annoyance for integration)

GDC looks at the system C headers. http://dgcc.svn.sourceforge.net/viewvc/dgcc/trunk/d/phobos/config/ -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528


Shin Fujishiro <rsinfu gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #503 is|0                           |1
           obsolete|                            |


--- Comment #9 from Shin Fujishiro <rsinfu gmail.com> 2010-05-17 00:26:58 PDT
---
Created an attachment (id=634)
New patch for svn r296

This is a new patch for druntime trunk r296.

I tested the patch with the Phobos (r1513) unit tests -- it successfully passed
on FreeBSD 8-STABLE (compiler patches bug 4191 and bug 4198 were required).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 17 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528


Shin Fujishiro <rsinfu gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #634 is|0                           |1
           obsolete|                            |


--- Comment #10 from Shin Fujishiro <rsinfu gmail.com> 2010-08-03 22:15:29 PDT
---
Created an attachment (id=702)
Patch against svn r352

Updated the patch for svn trunk r352.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 03 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528


Shin Fujishiro <rsinfu gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #702 is|0                           |1
           obsolete|                            |


--- Comment #11 from Shin Fujishiro <rsinfu gmail.com> 2010-08-03 22:44:52 PDT
---
Created an attachment (id=703)
Patch against svn r352

Oops, forgot to eliminate backtrace stuffs that FreeBSD libc does'nt have.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 03 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3528


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #12 from Walter Bright <bugzilla digitalmars.com> 2010-08-05
03:01:26 PDT ---
http://www.dsource.org/projects/druntime/changeset/356

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