Made libcontext compile on FreeBSD. Code formatting too.

This commit is contained in:
Michael 2017-03-14 10:01:17 +01:00 committed by Tomasz Włostowski
parent 5b3f6d850d
commit 679074fdb2
1 changed files with 53 additions and 52 deletions

View File

@ -1,18 +1,18 @@
/*
libcontext - a slightly more portable version of boost::context
Copyright Martin Husemann 2013.
Copyright Oliver Kowalke 2009.
Copyright Sergue E. Leontiev 2013.
Copyright Thomas Sailer 2013.
Minor modifications by Tomasz Wlostowski 2016.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
*
* libcontext - a slightly more portable version of boost::context
*
* Copyright Martin Husemann 2013.
* Copyright Oliver Kowalke 2009.
* Copyright Sergue E. Leontiev 2013.
* Copyright Thomas Sailer 2013.
* Minor modifications by Tomasz Wlostowski 2016.
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
*/
#ifndef __LIBCONTEXT_H
#define __LIBCONTEXT_H
@ -27,41 +27,41 @@
#define LIBCONTEXT_COMPILER_gcc
#if defined(__linux__)
#ifdef __x86_64__
#define LIBCONTEXT_PLATFORM_linux_x86_64
#define LIBCONTEXT_CALL_CONVENTION
#ifdef __x86_64__
#define LIBCONTEXT_PLATFORM_linux_x86_64
#define LIBCONTEXT_CALL_CONVENTION
#elif __i386__
#define LIBCONTEXT_PLATFORM_linux_i386
#define LIBCONTEXT_CALL_CONVENTION
#elif __arm__
#define LIBCONTEXT_PLATFORM_linux_arm32
#define LIBCONTEXT_CALL_CONVENTION
#elif __aarch64__
#define LIBCONTEXT_PLATFORM_linux_arm64
#define LIBCONTEXT_CALL_CONVENTION
#endif
#elif __i386__
#define LIBCONTEXT_PLATFORM_linux_i386
#define LIBCONTEXT_CALL_CONVENTION
#elif __arm__
#define LIBCONTEXT_PLATFORM_linux_arm32
#define LIBCONTEXT_CALL_CONVENTION
#elif __aarch64__
#define LIBCONTEXT_PLATFORM_linux_arm64
#define LIBCONTEXT_CALL_CONVENTION
#endif
#elif defined(__MINGW32__) || defined (__MINGW64__)
#if defined(__x86_64__)
#define LIBCONTEXT_COMPILER_gcc
#define LIBCONTEXT_PLATFORM_windows_x86_64
#define LIBCONTEXT_CALL_CONVENTION
#endif
#elif defined(__MINGW32__) || defined(__MINGW64__)
#if defined(__x86_64__)
#define LIBCONTEXT_COMPILER_gcc
#define LIBCONTEXT_PLATFORM_windows_x86_64
#define LIBCONTEXT_CALL_CONVENTION
#endif
#if defined(__i386__)
#define LIBCONTEXT_COMPILER_gcc
#define LIBCONTEXT_PLATFORM_windows_i386
#define LIBCONTEXT_CALL_CONVENTION __cdecl
#endif
#if defined(__i386__)
#define LIBCONTEXT_COMPILER_gcc
#define LIBCONTEXT_PLATFORM_windows_i386
#define LIBCONTEXT_CALL_CONVENTION __cdecl
#endif
#elif defined(__APPLE__) && defined(__MACH__)
#if defined (__i386__)
#define LIBCONTEXT_PLATFORM_apple_i386
#define LIBCONTEXT_CALL_CONVENTION
#elif defined (__x86_64__)
#define LIBCONTEXT_PLATFORM_apple_x86_64
#define LIBCONTEXT_CALL_CONVENTION
#endif
#if defined(__i386__)
#define LIBCONTEXT_PLATFORM_apple_i386
#define LIBCONTEXT_CALL_CONVENTION
#elif defined(__x86_64__)
#define LIBCONTEXT_PLATFORM_apple_x86_64
#define LIBCONTEXT_CALL_CONVENTION
#endif
#endif
#endif
@ -73,23 +73,24 @@ namespace libcontext {
typedef int intptr_t;
#endif
typedef void* fcontext_t;
typedef void* fcontext_t;
#ifdef __cplusplus
extern "C"{
extern "C" {
#endif
intptr_t LIBCONTEXT_CALL_CONVENTION jump_fcontext( fcontext_t * ofc, fcontext_t nfc,
intptr_t vp, bool preserve_fpu = false);
fcontext_t LIBCONTEXT_CALL_CONVENTION make_fcontext( void * sp, size_t size, void (* fn)( intptr_t) );
intptr_t LIBCONTEXT_CALL_CONVENTION jump_fcontext( fcontext_t* ofc, fcontext_t nfc,
intptr_t vp, bool preserve_fpu = false );
fcontext_t LIBCONTEXT_CALL_CONVENTION make_fcontext( void* sp, size_t size,
void (* fn)( intptr_t ) );
#ifdef __cplusplus
}; // namespace
}; // namespace
#endif
#ifdef __cplusplus
}; // extern "C"
}; // extern "C"
#endif
#endif