File tree Expand file tree Collapse file tree 15 files changed +47
-33
lines changed
Expand file tree Collapse file tree 15 files changed +47
-33
lines changed Original file line number Diff line number Diff line change 1+ CompileFlags :
2+ Add : [-D__CLANGD__]
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ typedef struct ps_f32 {
2525 SECTION_GARBAGE static void __garbage_ordering_hints(void)
2626#define order_hint_access (var ) (void)(var)
2727
28- #elif defined (__INTELLISENSE__ )
28+ #elif defined (__EDITOR_CHECKING__ )
29+ // dummy implementations for editor tooling
2930
3031#define sdata_ps_f32 ps_f32
3132#define sdata2_ps_f32 ps_f32
@@ -35,9 +36,5 @@ typedef struct ps_f32 {
3536#define SECTION_GARBAGE
3637#define static_order_hints
3738#define order_hint_access (var ) (void)(var)
38-
39- #endif
40-
41- #ifdef __clang__
42- #define __cntlzw (x ) __builtin_clz(x)
39+ #define __cntlzw (x ) (x)
4340#endif
Original file line number Diff line number Diff line change 2424
2525#define DECLTYPE (x ) __decltype__(x)
2626
27- // https://github.com/DarkRTA/rb3/blob/235050f88a263fec0387b7c618dda76a8bb24d2c/src/sdk/RVL_SDK/revolution/os/OSUtils.h#L13-L17
28- #if defined(__MWERKS__ ) && !defined(__INTELLISENSE__ )
29- #define AT_ADDRESS (addr ) : (addr)
30- #else
31- #define AT_ADDRESS (addr )
27+ #if defined(__INTELLISENSE__ ) || defined(__CLANGD__ )
28+ #define __EDITOR_CHECKING__
3229#endif
3330
34- // For VSCode
35- #ifdef __INTELLISENSE__
31+ #ifdef __CWCC__
32+ // codewarrior-specific syntax
33+ #define AT_ADDRESS (addr ) : (addr)
34+ #elif defined(__EDITOR_CHECKING__ )
35+ // dummy implementations for editor tooling
36+ #define AT_ADDRESS (addr )
3637#define asm
3738#define __attribute__ (x )
3839#define __declspec (x )
40+ #else
41+ // building with a non-codewarrior compiler is not supported yet
42+ #error "workarounds for codewarrior's language extensions unimplemented"
3943#endif
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ class NonCopyable {
111111
112112
113113// Main static assert macro
114- #if defined(__INTELLISENSE__)
114+ #ifdef __EDITOR_CHECKING__
115115 #if !__has_extension(c_static_assert)
116116 #error "language server lacks `_Static_assert` support"
117117 #endif
Original file line number Diff line number Diff line change @@ -25,9 +25,14 @@ inline f32 sqrtf(f32 x) { return (f32)sqrt(x); }
2525f64 acos (f64 );
2626inline f32 acosf (f32 x ) { return (f32 )acos (x ); }
2727
28- #ifdef __INTELLISENSE__
29- #define __fabsf (x ) x
30- #define __fabs (x ) x
28+ #ifdef __CWCC__
29+ // when using the codewarrior compiler, __fabs and __fabsf are builtin intrinsics.
30+ #elif defined(__EDITOR_CHECKING__ )
31+ // dummy implementation for editor tooling
32+ #define __fabsf (x ) (x)
33+ #define __fabs (x ) (x)
34+ #else
35+ #error "attempted to compile MSL (Metrowerks Standard Library) header with non-codewarrior compiler"
3136#endif
3237
3338f32 fabsf (f32 );
Original file line number Diff line number Diff line change 11#pragma once
22
3- #ifdef __INTELLISENSE__
3+ #include "macros.h"
4+
5+ #ifdef __EDITOR_CHECKING__
46#define offsetof (type , m ) __builtin_offsetof(type,m)
57#else
68#define offsetof (type , m ) ((size_t) & (((type*)0)->m))
Original file line number Diff line number Diff line change 11#pragma once
22
3+ #include "macros.h"
4+
35#ifndef SIZE_T_DEFINE
46#define SIZE_T_DEFINE
57typedef unsigned long size_t ;
@@ -9,11 +11,12 @@ typedef unsigned long size_t;
911#ifdef __CWCC__
1012#define abs (x ) __abs(x)
1113#define labs (x ) __labs(x)
12- #elif defined(__clang__ )
13- #define abs (x ) __builtin_abs(x)
14- #define labs (x ) __builtin_labs(x)
14+ #elif defined(__EDITOR_CHECKING__ )
15+ // dummy implementation for editor tooling
16+ #define abs (x ) (x)
17+ #define labs (x ) (x)
1518#else
16- #error compiler has no instrinsic abs support, please do some sit ups.
19+ #error "attempted to compile MSL (Metrowerks Standard Library) header with non-codewarrior compiler"
1720#endif
1821
1922long strtol (const char * restrict nptr , char * * restrict endptr , int base );
Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ unsigned int** gt2StringToIPs(const char* string) {
230230** INTERNAL FUNCTIONS **
231231***********************/
232232
233- #ifdef __MWERKS__ // CodeWarrior will warn if not prototyped
233+ #ifdef __CWCC__ // CodeWarrior will warn if not prototyped
234234void gti2MessageCheck (const GT2Byte * * message , int * len );
235235#endif
236236
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ INCLUDES
1111extern "C" {
1212#endif
1313
14- #ifdef __MWERKS__ // Codewarrior requires function prototypes
14+ #ifdef __CWCC__ // Codewarrior requires function prototypes
1515qr2_error_t qr2_initW (/*[out]*/ qr2_t * qrec , const unsigned short * ip ,
1616 int baseport , const unsigned short * gamename ,
1717 const unsigned short * secret_key , int ispublic ,
Original file line number Diff line number Diff line change 44#include "../common/gsDebug.h"
55#include "../common/gsStringUtil.h"
66
7- #ifdef __MWERKS__ // CodeWarrior requires prototypes
7+ #ifdef __CWCC__ // CodeWarrior requires prototypes
88void qr2_register_keyW (int keyid , const unsigned short * key );
99void qr2_register_keyA (int keyid , const char * key );
1010#endif
You can’t perform that action at this time.
0 commit comments