ardupilot/libraries/AP_Common/c++.cpp

54 lines
834 B
C++
Raw Normal View History

// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
//
// C++ runtime support not provided by Arduino
//
// Note: use new/delete with caution. The heap is small and
// easily fragmented.
//
#include <stdlib.h>
2012-10-27 08:41:03 -03:00
#ifndef PX4FMU_BUILD
void * operator new(size_t size)
{
2011-10-28 15:43:43 -03:00
return(calloc(size, 1));
}
void operator delete(void *p)
{
2011-10-28 15:43:43 -03:00
if (p) free(p);
}
extern "C" void __cxa_pure_virtual(){
while (1){}
}
void * operator new[](size_t size)
{
return(calloc(size, 1));
}
void operator delete[](void * ptr)
{
if (ptr) free(ptr);
}
__extension__ typedef int __guard __attribute__((mode (__DI__)));
int __cxa_guard_acquire(__guard *g)
{
2011-10-28 15:43:43 -03:00
return !*(char *)(g);
};
void __cxa_guard_release (__guard *g){
2011-10-28 15:43:43 -03:00
*(char *)g = 1;
};
2012-08-17 03:18:11 -03:00
void __cxa_guard_abort (__guard *) {
};
2012-10-27 08:41:03 -03:00
#endif // PX4FMU_BUILD