Skip to content

Commit 7897233

Browse files
authored
lwp inline refactor (#138)
* `lwp_mutex.h`: remove unnecessary declaration and macro * include inline source files in the other source files that need to use them * remove ifdef inlines from headers remove `-DLIBOGC_INTERNAL` flag from `CFLAGS` in makefile as this is the only thing that it was used for `lwp_states.h`: remove entire `extern` block because this was the only thing in it * `lwp_mutex.inl`: turn `__lwp_mutex_seize` from macro into inline function also include `lwp_threads.h` since it uses `extern lwp_cntrl _thr_executing` * libogc: remove header includes that were just for the inline functions * `Makefile`: add libogc directory to include path allow other libraries to access the inline functions in the `*.inl` files stored there see [this comment](#138 (comment)) in the draft PR * other libraries: remove header includes that were just for the inline functions `lwip/netif/loopif.c`: remove duplicate `#include "lwp_watchdog.h"` apparently its been there the whole time? mostly whitespace around header includes sometimes move include directives around if it makes more sense outside of libogc: change from `"local"` to `<system>` where it made sense to do so --------- Co-authored-by: muff1nOS <[email protected]>
1 parent 5fbff84 commit 7897233

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+183
-117
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ wii
66
gc/ogc/libversion.h
77
*.bz2
88
docs
9-
warn.log
9+
warn.log

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ WIIKEYBLIB := $(LIBDIR)/libwiikeyboard
7676
STUBSLIB := $(LIBDIR)/libgclibstubs
7777

7878
#---------------------------------------------------------------------------------
79-
DEFINCS := -I$(BASEDIR) -I$(BASEDIR)/gc
79+
DEFINCS := -I$(BASEDIR) -I$(BASEDIR)/gc -I$(OGCDIR)
8080
INCLUDES := $(DEFINCS) -I$(BASEDIR)/gc/netif -I$(BASEDIR)/gc/ipv4 \
8181
-I$(BASEDIR)/gc/ogc -I$(BASEDIR)/gc/ogc/machine \
8282
-I$(BASEDIR)/gc/modplay \
@@ -99,7 +99,7 @@ MACHDEP += -DHW_DOL
9999
INCLUDES += -I$(BASEDIR)/cube
100100
endif
101101

102-
CFLAGS := $(FALSE_POSITIVES) -DLIBOGC_INTERNAL -g -O2 -fno-strict-aliasing -Wall $(MACHDEP) $(INCLUDES)
102+
CFLAGS := $(FALSE_POSITIVES) -g -O2 -fno-strict-aliasing -Wall $(MACHDEP) $(INCLUDES)
103103
ASFLAGS := $(MACHDEP) -mregnames -D_LANGUAGE_ASSEMBLY $(INCLUDES)
104104

105105
#---------------------------------------------------------------------------------

gc/ogc/lwp_heap.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ void* __lwp_heap_allocate(heap_cntrl *theheap,u32 size);
4949
BOOL __lwp_heap_free(heap_cntrl *theheap,void *ptr);
5050
u32 __lwp_heap_getinfo(heap_cntrl *theheap,heap_iblock *theinfo);
5151

52-
#ifdef LIBOGC_INTERNAL
53-
#include <libogc/lwp_heap.inl>
54-
#endif
55-
5652
#ifdef __cplusplus
5753
}
5854
#endif

gc/ogc/lwp_messages.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ u32 __lwpmq_flush(mq_cntrl *mqueue);
6868
u32 __lwpmq_flush_support(mq_cntrl *mqueue);
6969
void __lwpmq_flush_waitthreads(mq_cntrl *mqueue);
7070

71-
#ifdef LIBOGC_INTERNAL
72-
#include <libogc/lwp_messages.inl>
73-
#endif
74-
7571
#ifdef __cplusplus
7672
}
7773
#endif

gc/ogc/lwp_mutex.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,6 @@ u32 __lwp_mutex_surrender(lwp_mutex *mutex);
4646
void __lwp_mutex_seize_irq_blocking(lwp_mutex *mutex,u64 timeout);
4747
void __lwp_mutex_flush(lwp_mutex *mutex,u32 status);
4848

49-
static __inline__ u32 __lwp_mutex_seize_irq_trylock(lwp_mutex *mutex,u32 *isr_level);
50-
51-
#define __lwp_mutex_seize(_mutex_t,_id,_wait,_timeout,_level) \
52-
do { \
53-
if(__lwp_mutex_seize_irq_trylock(_mutex_t,&_level)) { \
54-
if(!_wait) { \
55-
_CPU_ISR_Restore(_level); \
56-
_thr_executing->wait.ret_code = LWP_MUTEX_UNSATISFIED_NOWAIT; \
57-
} else { \
58-
__lwp_threadqueue_csenter(&(_mutex_t)->wait_queue); \
59-
_thr_executing->wait.queue = &(_mutex_t)->wait_queue; \
60-
_thr_executing->wait.id = _id; \
61-
__lwp_thread_dispatchdisable(); \
62-
_CPU_ISR_Restore(_level); \
63-
__lwp_mutex_seize_irq_blocking(_mutex_t,(u64)_timeout); \
64-
} \
65-
} \
66-
} while(0)
67-
68-
#ifdef LIBOGC_INTERNAL
69-
#include <libogc/lwp_mutex.inl>
70-
#endif
71-
7249
#ifdef __cplusplus
7350
}
7451
#endif

gc/ogc/lwp_objmgr.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ lwp_obj* __lwp_objmgr_get(lwp_objinfo *info,u32 id);
3838
lwp_obj* __lwp_objmgr_getisrdisable(lwp_objinfo *info,u32 id,u32 *p_level);
3939
lwp_obj* __lwp_objmgr_getnoprotection(lwp_objinfo *info,u32 id);
4040

41-
#ifdef LIBOGC_INTERNAL
42-
#include <libogc/lwp_objmgr.inl>
43-
#endif
44-
4541
#ifdef __cplusplus
4642
}
4743
#endif

gc/ogc/lwp_priority.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ extern u32 _prio_bitmap[];
2222

2323
void __lwp_priority_init(void);
2424

25-
#ifdef LIBOGC_INTERNAL
26-
#include <libogc/lwp_priority.inl>
27-
#endif
28-
2925
#ifdef __cplusplus
3026
}
3127
#endif

gc/ogc/lwp_queue.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ void __lwp_queue_append(lwp_queue *,lwp_node *);
3030
void __lwp_queue_extract(lwp_node *);
3131
void __lwp_queue_insert(lwp_node *,lwp_node *);
3232

33-
#ifdef LIBOGC_INTERNAL
34-
#include <libogc/lwp_queue.inl>
35-
#endif
36-
3733
#ifdef __cplusplus
3834
}
3935
#endif

gc/ogc/lwp_sema.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ u32 __lwp_sema_surrender(lwp_sema *sema,u32 id);
3333
u32 __lwp_sema_seize(lwp_sema *sema,u32 id,u32 wait,u64 timeout);
3434
void __lwp_sema_flush(lwp_sema *sema,u32 status);
3535

36-
#ifdef LIBOGC_INTERNAL
37-
#include <libogc/lwp_sema.inl>
38-
#endif
39-
4036
#ifdef __cplusplus
4137
}
4238
#endif

gc/ogc/lwp_stack.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ extern "C" {
1616
u32 __lwp_stack_allocate(lwp_cntrl *,u32);
1717
void __lwp_stack_free(lwp_cntrl *);
1818

19-
#ifdef LIBOGC_INTERNAL
20-
#include <libogc/lwp_stack.inl>
21-
#endif
22-
2319
#ifdef __cplusplus
2420
}
2521
#endif

0 commit comments

Comments
 (0)