Patch to enable atomic ops on FreeBSD

Hello.

I recently compiled SDL 1.3 (r5441) and the tests failed to build as atomic
operations weren’t enabled in the build. I patched configure.in:

Index: configure.in===================================================================
configure.in (revision 5441)
+++ configure.in (working copy)
@@ -2242,7 +2242,7 @@
# Set up files for the atomic operations library
if test x$enable_atomic = xyes; then
case $ARCH in

  •        linux)
    
  •        linux|freebsd)
               AC_DEFINE(SDL_ATOMIC_LINUX)
               SOURCES="$SOURCES $srcdir/src/atomic/linux/*.c"
               have_atomic=yes
    

The tests built and the output of testatomic is as follows:

$ ./testatomic

spin lock---------------------------------------

AtomicLock lock=1
AtomicUnlock lock=0

32 bit -----------------------------------------

TestThenSet32 tfret=true val=1
TestThenSet32 tfret=false val=1
Clear32 val=0
FetchThenIncrement32 ret=0 val=1
FetchThenDecrement32 ret=1 val=0
FetchThenAdd32 ret=0 val=10
FetchThenSubtract32 ret=10 val=0
IncrementThenFetch32 ret=1 val=1
DecrementThenFetch32 ret=0 val=0
AddThenFetch32 ret=10 val=10
SubtractThenFetch32 ret=0 val=0

64 bit -----------------------------------------

TestThenSet64 tfret=true val=1
TestThenSet64 tfret=false val=1
Clear64 val=0
FetchThenIncrement64 ret=0 val=1
FetchThenDecrement64 ret=1 val=0
FetchThenAdd64 ret=0 val=10
FetchThenSubtract64 ret=10 val=0
IncrementThenFetch64 ret=1 val=1
DecrementThenFetch64 ret=0 val=0
AddThenFetch64 ret=10 val=10
SubtractThenFetch64 ret=0 val=0

Unfortunately, the tests aren’t really “tests” (they don’t fail on
incorrect results) so I’m not sure if the above is the expected output.

uname: FreeBSD 8.0-RELEASE amd64 GENERIC

Regards,
M

Hello.

I recently compiled SDL 1.3 (r5441) and the tests failed to build as atomic
operations weren’t enabled in the build. I patched configure.in:

Yeah, that’s because I was never able to test them in freebsd. This
should now be added.

And, yes, mea culpa, I need to write better tests.

Bob PendletonOn Mon, Jan 4, 2010 at 8:30 PM, wrote:

Index: configure.in

— configure.in ?(revision 5441)
+++ configure.in ?(working copy)
@@ -2242,7 +2242,7 @@
? ? ? ? # Set up files for the atomic operations library
? ? ? ? if test x$enable_atomic = xyes; then
? ? ? ? ? case $ARCH in

  • ? ? ? ? ? ?linux)
  • ? ? ? ? ? ?linux|freebsd)
    ? ? ? ? ? ? ? ? AC_DEFINE(SDL_ATOMIC_LINUX)
    ? ? ? ? ? ? ? ? SOURCES=“$SOURCES $srcdir/src/atomic/linux/*.c”
    ? ? ? ? ? ? ? ? have_atomic=yes

The tests built and the output of testatomic is as follows:

$ ./testatomic

spin lock---------------------------------------

AtomicLock ? ? ? ? ? ? ? ? ? lock=1
AtomicUnlock ? ? ? ? ? ? ? ? lock=0

32 bit -----------------------------------------

TestThenSet32 ? ? ? ?tfret=true val=1
TestThenSet32 ? ? ? ?tfret=false val=1
Clear32 ? ? ? ? ? ? ?val=0
FetchThenIncrement32 ret=0 val=1
FetchThenDecrement32 ret=1 val=0
FetchThenAdd32 ? ? ? ret=0 val=10
FetchThenSubtract32 ?ret=10 val=0
IncrementThenFetch32 ret=1 val=1
DecrementThenFetch32 ret=0 val=0
AddThenFetch32 ? ? ? ret=10 val=10
SubtractThenFetch32 ?ret=0 val=0

64 bit -----------------------------------------

TestThenSet64 ? ? ? ?tfret=true val=1
TestThenSet64 ? ? ? ?tfret=false val=1
Clear64 ? ? ? ? ? ? ?val=0
FetchThenIncrement64 ret=0 val=1
FetchThenDecrement64 ret=1 val=0
FetchThenAdd64 ? ? ? ret=0 val=10
FetchThenSubtract64 ?ret=10 val=0
IncrementThenFetch64 ret=1 val=1
DecrementThenFetch64 ret=0 val=0
AddThenFetch64 ? ? ? ret=10 val=10
SubtractThenFetch64 ?ret=0 val=0

Unfortunately, the tests aren’t really “tests” (they don’t fail on
incorrect results) so I’m not sure if the above is the expected output.

uname: FreeBSD 8.0-RELEASE amd64 GENERIC

Regards,
M


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


±----------------------------------------------------------

Hello.

I recently compiled SDL 1.3 (r5441) and the tests failed to build as atomic
operations weren’t enabled in the build. I patched configure.in:

Yeah, that’s because I was never able to test them in freebsd. This
should now be added.

'Lo.

I can test (regularly) on FreeBSD 8.0 x86/x86_64 and FreeBSD 7.2 x86/x86_64
if that helps.

And, yes, mea culpa, I need to write better tests.

I can give that a go as well if you like.

A few other tests have straight segmentation faults on this system. I’ll
get around to looking at those in the near future.

MOn 2010-01-05 11:39:23, Bob Pendleton wrote:

On Mon, Jan 4, 2010 at 8:30 PM, wrote:

Hello.

I recently compiled SDL 1.3 (r5441) and the tests failed to build as atomic
operations weren’t enabled in the build. I patched configure.in:

Yeah, that’s because I was never able to test them in freebsd. This
should now be added.

'Lo.

I can test (regularly) on FreeBSD 8.0 x86/x86_64 and FreeBSD 7.2 x86/x86_64
if that helps.

And, yes, mea culpa, I need to write better tests.

I can give that a go as well if you like.

A few other tests have straight segmentation faults on this system. I’ll
get around to looking at those in the near future.

MOn 2010-01-05 11:39:23, Bob Pendleton wrote:

On Mon, Jan 4, 2010 at 8:30 PM, <@sdl_at_coreland.ath> wrote: