ObjFW  Check-in [bb73116ce2]

Overview
Comment:Disable a Clang warning preventing limit checks
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bb73116ce2f503c8419aaf8d5b8bf903d6d6dbcb276b779490db696858bd1a3c
User & Date: js on 2020-07-19 14:16:04
Other Links: manifest | tags
Context
2020-07-19
16:12
OFNumber: Add singletons for 0, 1, 2, true & false check-in: d8123a1f26 user: js tags: trunk
14:16
Disable a Clang warning preventing limit checks check-in: bb73116ce2 user: js tags: trunk
12:00
README.md: Update the broken Xcode versions list check-in: 6a89f40114 user: js tags: trunk
Changes

Modified src/OFNumber.m from [f930cc4476] to [537e45b1d4].

256
257
258
259
260
261
262









263
264
265
266
267
268
269
{
	if (uIntMax <= ULLONG_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedLongLong: (unsigned long long)uIntMax];

	return (id)[[OFNumber of_alloc] initWithUIntMax: uIntMax];
}










- (instancetype)initWithPtrDiff: (ptrdiff_t)ptrDiff
{
	if (ptrDiff >= LLONG_MIN && ptrDiff <= LLONG_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithLongLong: (long long)ptrDiff];








>
>
>
>
>
>
>
>
>







256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
{
	if (uIntMax <= ULLONG_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedLongLong: (unsigned long long)uIntMax];

	return (id)[[OFNumber of_alloc] initWithUIntMax: uIntMax];
}

#ifdef __clang__
/*
 * This warning should probably not exist at all, as it prevents checking
 * whether one type fits into another in a portable way.
 */
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare"
#endif

- (instancetype)initWithPtrDiff: (ptrdiff_t)ptrDiff
{
	if (ptrDiff >= LLONG_MIN && ptrDiff <= LLONG_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithLongLong: (long long)ptrDiff];

285
286
287
288
289
290
291




292
293
294
295
296
297
298
{
	if (uIntPtr <= ULLONG_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedLongLong: (unsigned long long)uIntPtr];

	return (id)[[OFNumber of_alloc] initWithUIntPtr: uIntPtr];
}





- (instancetype)initWithFloat: (float)float_
{
	if (float_ == (uintmax_t)float_)
		return (id)[[OFNumber of_alloc]
		    initWithUIntMax: (uintmax_t)float_];
	if (float_ == (intmax_t)float_)







>
>
>
>







294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
{
	if (uIntPtr <= ULLONG_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedLongLong: (unsigned long long)uIntPtr];

	return (id)[[OFNumber of_alloc] initWithUIntPtr: uIntPtr];
}

#ifdef __clang__
# pragma clang diagnostic pop
#endif

- (instancetype)initWithFloat: (float)float_
{
	if (float_ == (uintmax_t)float_)
		return (id)[[OFNumber of_alloc]
		    initWithUIntMax: (uintmax_t)float_];
	if (float_ == (intmax_t)float_)