some portability cleanups

This commit is contained in:
notaz 2017-10-13 23:30:44 +03:00
parent 7612bf90be
commit bce144211c
4 changed files with 21 additions and 25 deletions

View file

@ -10,7 +10,7 @@
#include <pico/pico_int.h> #include <pico/pico_int.h>
#include "cmn.h" #include "cmn.h"
u8 __attribute__((aligned(4096))) tcache[DRC_TCACHE_SIZE]; u8 ALIGNED(4096) tcache[DRC_TCACHE_SIZE];
void drc_cmn_init(void) void drc_cmn_init(void)

View file

@ -1,11 +1,7 @@
#ifndef __SH2_H__ #ifndef __SH2_H__
#define __SH2_H__ #define __SH2_H__
#if !defined(REGPARM) && defined(__i386__) #include "../../pico/pico_port.h"
#define REGPARM(x) __attribute__((regparm(x)))
#else
#define REGPARM(x)
#endif
// registers - matches structure order // registers - matches structure order
typedef enum { typedef enum {

View file

@ -13,6 +13,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "pico_port.h"
#include "pico.h" #include "pico.h"
#include "carthw/carthw.h" #include "carthw/carthw.h"
@ -1072,25 +1073,6 @@ void pevt_dump(void);
#define pevt_dump() #define pevt_dump()
#endif #endif
// misc
#ifdef _MSC_VER
#define cdprintf
#else
#define cdprintf(x...)
#endif
#if defined(__GNUC__) && defined(__i386__)
#define REGPARM(x) __attribute__((regparm(x)))
#else
#define REGPARM(x)
#endif
#ifdef __GNUC__
#define NOINLINE __attribute__((noinline))
#else
#define NOINLINE
#endif
#ifdef __cplusplus #ifdef __cplusplus
} // End of extern "C" } // End of extern "C"
#endif #endif

18
pico/pico_port.h Normal file
View file

@ -0,0 +1,18 @@
#ifndef PICO_PORT_INCLUDED
#define PICO_PORT_INCLUDED
#if defined(__GNUC__) && defined(__i386__)
#define REGPARM(x) __attribute__((regparm(x)))
#else
#define REGPARM(x)
#endif
#ifdef __GNUC__
#define NOINLINE __attribute__((noinline))
#define ALIGNED(n) __attribute__((aligned(n)))
#else
#define NOINLINE
#define ALIGNED(n)
#endif
#endif // PICO_PORT_INCLUDED