NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/42842: atomic_ops(3) cannot be used from C++



>Number:         42842
>Category:       lib
>Synopsis:       atomic_ops(3) cannot be used from C++
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 18 19:00:00 +0000 2010
>Originator:     Martin Lucina
>Release:        5.0.1
>Organization:
>Environment:
NetBSD j728.lan 5.0.1 NetBSD 5.0.1 (JORNADA728) #0: Fri Feb 12 21:54:30 CET 
2010  mato%j728.lan@localhost:/usr/src/sys/arch/hpcarm/compile/JORNADA728 hpcarm

>Description:
The atomic_ops(3) family of functions, declared in sys/atomic.h, cannot be used 
from C++ programs due to missing __BEGIN_DECLS and __END_DECLS in sys/atomic.h.
>How-To-Repeat:
Compiling the following test program with g++:

#include <sys/atomic.h>

int main (int argc, char *argv[])
{
        uint32_t value;

        atomic_cas_32 (&value, 0, 0);
        return 0;
}

produces:

/var/tmp//ccViRyM9.o: In function `main':
atomic-test.c:(.text+0x28): undefined reference to `atomic_cas_32(unsigned int 
volatile*, unsigned int, unsigned int)'

>Fix:
Adding the appropriate __BEGIN_DECLS and __END_DECLS wrapper macros to 
sys/atomic.h fixes this for me.



Home | Main Index | Thread Index | Old Index