ObjFW  Check-in [8c90e88939]

Overview
Comment:runtime: Remove errno from Amiga library

There is nothing left that needs errno.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8c90e88939674d4cd78de3854f4a8335bb36bf17272bcdc8cb46657c8b1e1cf3
User & Date: js on 2020-12-20 21:29:54
Other Links: manifest | tags
Context
2020-12-21
00:25
runtime: Don't pass std{out,err} to Amiga .library check-in: 08d155e3f0 user: js tags: trunk
2020-12-20
21:36
Merge trunk into branch "amiga-library" check-in: 90637a4ecc user: js tags: amiga-library
21:29
runtime: Remove errno from Amiga library check-in: 8c90e88939 user: js tags: trunk
21:26
Return error instead of using errno for threading check-in: 5b37fbeb82 user: js tags: trunk
Changes

Modified src/runtime/amiga-library.m from [aa5ebeffcc] to [6e1b91ee55].

572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
572
573
574
575
576
577
578






579
580
581
582
583
584
585







-
-
-
-
-
-







void
_Unwind_Resume(void *ex)
{
	libc._Unwind_Resume(ex);
}
#endif

int *
objc_get_errno(void)
{
	return libc.get_errno();
}

#ifdef OF_AMIGAOS_M68K
int
snprintf(char *restrict str, size_t size, const char *restrict fmt, ...)
{
	va_list args;
	int ret;

Modified src/runtime/linklib/linklib.m from [aa40a4a4c1] to [5e0b11dcbb].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
24
25
26
27
28
29
30

31
32
33
34
35
36
37







-







#include <proto/exec.h>
#include <proto/intuition.h>

struct ObjFWRTBase;

#import "inline.h"

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

#if defined(OF_AMIGAOS_M68K)
# include <stabs.h>
# define SYM(name) __asm__("_" name)
#elif defined(OF_MORPHOS)
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
66
67
68
69
70
71
72






73
74
75
76
77
78
79







-
-
-
-
-
-







extern void __register_frame(void *);
extern void __deregister_frame(void *);
#endif

struct Library *ObjFWRTBase;
void *__objc_class_name_Protocol;

static int *
get_errno(void)
{
	return &errno;
}

static void
error(const char *string, ULONG arg)
{
	struct Library *IntuitionBase = OpenLibrary("intuition.library", 0);

	if (IntuitionBase != NULL) {
		struct EasyStruct easy = {
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
125
126
127
128
129
130
131

132
133
134
135
136
137
138







-







		.__register_frame_info = __register_frame_info,
		.__deregister_frame_info = __deregister_frame_info,
#endif
#ifdef OF_MORPHOS
		.__register_frame = __register_frame,
		.__deregister_frame = __deregister_frame,
#endif
		.get_errno = get_errno,
#ifdef OF_AMIGAOS_M68K
		.vsnprintf = vsnprintf,
#endif
		.atexit = atexit,
		.exit = exit,
	};

Modified src/runtime/private.h from [dfdcb65a2c] to [67e48517bd].

250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
250
251
252
253
254
255
256

257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276

277


278
279
280
281
282
283
284







-




















-

-
-







	    void *_Nonnull);
	void *(*_Nonnull __deregister_frame_info)(const void *_Nonnull);
# endif
# ifdef OF_MORPHOS
	void (*_Nonnull __register_frame)(void *_Nonnull);
	void (*_Nonnull __deregister_frame)(void *_Nonnull);
# endif
	int *_Nonnull (*_Nonnull get_errno)(void);
# ifdef OF_AMIGAOS_M68K
	int (*_Nonnull vsnprintf)(char *restrict _Nonnull str, size_t size,
	    const char *_Nonnull restrict fmt, va_list args);
# endif
	int (*_Nonnull atexit)(void (*_Nonnull)(void));
	void (*_Nonnull exit)(int);
};
#endif

#ifdef OBJC_COMPILING_AMIGA_LIBRARY
# if defined(__MORPHOS__)
#  include <ppcinline/macros.h>
#  define OBJC_M68K_ARG(type, name, reg) type name = (type)REG_##reg;
# else
#  define OBJC_M68K_ARG(type, name, reg)	\
	register type reg_##name __asm__(#reg);	\
	type name = reg_##name;
# endif
# undef stdout
# undef stderr
# undef errno
extern FILE *_Nonnull stdout, *_Nonnull stderr;
extern int *_Nonnull objc_get_errno(void);
# define errno (*objc_get_errno())
#endif

extern void objc_register_all_categories(struct objc_symtab *_Nonnull);
extern struct objc_category *_Nullable *_Nullable
    objc_categories_for_class(Class _Nonnull);
extern void objc_unregister_all_categories(void);
extern void objc_initialize_class(Class _Nonnull);