ObjFW  Check-in [1e30dbc891]

Overview
Comment:Fix compilation for PSP
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 0.8
Files: files | file ages | folders
SHA3-256: 1e30dbc8910aee38a83ed3661c212b939979cdd958236bc51242a166052f387e
User & Date: js on 2015-10-01 20:38:31
Other Links: branch diff | manifest | tags
Context
2015-10-01
20:39
Use _Nullable instead of __nullable check-in: edd5f57b86 user: js tags: 0.8
20:38
Fix compilation for PSP check-in: 1e30dbc891 user: js tags: 0.8
2015-09-14
13:50
OFUDPSocket: More constness check-in: 4ee556ab98 user: js tags: 0.8
Changes

Modified configure.ac from [42239fc479] to [3a659041ab].

1077
1078
1079
1080
1081
1082
1083





1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108


1109
1110
1111
1112
1113
1114
1115
	], [
		AC_MSG_RESULT(yes)
	], [
		AC_MSG_RESULT(no)
		OBJCFLAGS="$old_OBJCFLAGS"
	])






	old_OBJCFLAGS="$OBJCFLAGS"
	OBJCFLAGS="$OBJCFLAGS -pedantic"
	AC_MSG_CHECKING(whether -pedantic is buggy)
	AC_TRY_COMPILE([
		#import <stdlib.h>

		#ifdef __has_attribute
		# if __has_attribute(objc_root_class)
		__attribute__((__objc_root_class__))
		# endif
		#endif
		@interface Foo
		{
			void *foo;
		}
		@end

		@interface Bar: Foo
		@end
	], [], [
		AC_MSG_RESULT(no)
	], [
		AC_MSG_RESULT(yes)
		OBJCFLAGS="$old_OBJCFLAGS"
	])


])

AS_IF([test x"$cross_compiling" = x"yes"], [
	AC_SUBST(BIN_PREFIX, "${host_alias}-")

	case "$host" in
		*-*-mingw*)







>
>
>
>
>
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
>
>







1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
	], [
		AC_MSG_RESULT(yes)
	], [
		AC_MSG_RESULT(no)
		OBJCFLAGS="$old_OBJCFLAGS"
	])

	case "$host" in
		*-psp*)
			# PSP headers don't work with -pedantic
			;;
		*)
			old_OBJCFLAGS="$OBJCFLAGS"
			OBJCFLAGS="$OBJCFLAGS -pedantic"
			AC_MSG_CHECKING(whether -pedantic is buggy)
			AC_TRY_COMPILE([
				#import <stdlib.h>

				#ifdef __has_attribute
				# if __has_attribute(objc_root_class)
				__attribute__((__objc_root_class__))
				# endif
				#endif
				@interface Foo
				{
					void *foo;
				}
				@end

				@interface Bar: Foo
				@end
			], [], [
				AC_MSG_RESULT(no)
			], [
				AC_MSG_RESULT(yes)
				OBJCFLAGS="$old_OBJCFLAGS"
			])
			;;
	esac
])

AS_IF([test x"$cross_compiling" = x"yes"], [
	AC_SUBST(BIN_PREFIX, "${host_alias}-")

	case "$host" in
		*-*-mingw*)

Modified src/OFApplication.m from [65102b7290] to [0ce2c00df2].

158
159
160
161
162
163
164

165
166
167
168
169
170
171
	exit(0);
}

+ (void)terminateWithStatus: (int)status
{
#ifdef _PSP
	sceKernelExitGame();

#else
	exit(status);
#endif
}

- init
{







>







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
	exit(0);
}

+ (void)terminateWithStatus: (int)status
{
#ifdef _PSP
	sceKernelExitGame();
	abort();	/* sceKernelExitGame() is not marked noreturn */
#else
	exit(status);
#endif
}

- init
{

Modified src/OFThread.m from [5fea1c6704] to [8a7b628ccd].

11
12
13
14
15
16
17

18
19
20
21
22
23
24
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#define OF_THREAD_M

#define __NO_EXT_QNX

#include "config.h"

#include <stdlib.h>
#include <math.h>
#include <time.h>







>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#define OF_THREAD_M
#define _POSIX_TIMERS
#define __NO_EXT_QNX

#include "config.h"

#include <stdlib.h>
#include <math.h>
#include <time.h>
34
35
36
37
38
39
40

41
42

43
44
45
46
47
48
49

#ifdef OF_HAVE_SCHED_YIELD
# include <sched.h>
#endif

#ifdef __wii__
# define BOOL OGC_BOOL

# include <ogcsys.h>
# undef BOOL

#endif

#import "OFThread.h"
#import "OFThread+Private.h"
#import "OFRunLoop.h"
#import "OFList.h"
#import "OFDate.h"







>


>







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

#ifdef OF_HAVE_SCHED_YIELD
# include <sched.h>
#endif

#ifdef __wii__
# define BOOL OGC_BOOL
# define nanosleep ogc_nanosleep
# include <ogcsys.h>
# undef BOOL
# undef nanosleep
#endif

#import "OFThread.h"
#import "OFThread+Private.h"
#import "OFRunLoop.h"
#import "OFList.h"
#import "OFDate.h"
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201

	rqtp.tv_sec = (time_t)timeInterval;
	rqtp.tv_nsec = lrint((timeInterval - rqtp.tv_sec) * 1000000000);

	if (rqtp.tv_sec != floor(timeInterval))
		@throw [OFOutOfRangeException exception];

# ifndef __wii__
	nanosleep(&rqtp, NULL);
# else
	nanosleep(&rqtp);
# endif
#elif defined(OF_NINTENDO_DS)
	uint64_t counter;

	if (timeInterval > UINT64_MAX / 60)
		@throw [OFOutOfRangeException exception];

	counter = timeInterval * 60;







<

<
<
<







186
187
188
189
190
191
192

193



194
195
196
197
198
199
200

	rqtp.tv_sec = (time_t)timeInterval;
	rqtp.tv_nsec = lrint((timeInterval - rqtp.tv_sec) * 1000000000);

	if (rqtp.tv_sec != floor(timeInterval))
		@throw [OFOutOfRangeException exception];


	nanosleep(&rqtp, NULL);



#elif defined(OF_NINTENDO_DS)
	uint64_t counter;

	if (timeInterval > UINT64_MAX / 60)
		@throw [OFOutOfRangeException exception];

	counter = timeInterval * 60;

Modified src/of_asprintf.m from [e5f48e3c7d] to [7771a499a7].

24
25
26
27
28
29
30










31
32
33
34
35
36
37
#include <wchar.h>

#include <sys/types.h>

#import "OFString.h"

#define MAX_SUBFORMAT_LEN 64











struct context {
	const char *format;
	size_t formatLen;
	char subformat[MAX_SUBFORMAT_LEN + 1];
	size_t subformatLen;
	va_list arguments;







>
>
>
>
>
>
>
>
>
>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <wchar.h>

#include <sys/types.h>

#import "OFString.h"

#define MAX_SUBFORMAT_LEN 64

#ifndef HAVE_ASPRINTF
/*
 * (v)asprintf might be declared, but HAVE_ASPRINTF not defined because
 * configure determined it is broken. In this case, we must make sure there is
 * no name clash.
 */
# define asprintf asprintf_
# define vasprintf vasprintf_
#endif

struct context {
	const char *format;
	size_t formatLen;
	char subformat[MAX_SUBFORMAT_LEN + 1];
	size_t subformatLen;
	va_list arguments;