Subject: [PATCH] remove configure-time type size checks

[PATCH] remove configure-time type size checks

From: Brad House via c-ares <c-ares_at_cool.haxx.se>
Date: Thu, 1 Sep 2016 13:32:02 -0400

Configure-time type size checks are a really bad idea, especially for things like
Apple (MacOS, iOS) where you could be building multi-arch, where you run configure
once, but the compiler, internally, is building the source more than once (per
architecture). That means if you hard-code SIZEOF_LONG 4 based on what configure
detected, but building arm32 and arm64 simultaneously, you get a misbuild on at
least one of the platforms! For information from Apple here on this subject:
https://developer.apple.com/library/mac/documentation/Porting/Conceptual/PortingUnix/compiling/compiling.html

Its a fairly trivial patch to remove these dependencies on detected preprocessor
macros, for the most part they aren't used, except for a couple of cases. Most of the
diff is just removing the defines themselves so people don't think it is ok
to use them. Any preprocessor macros provided by the OS for similar purposes are
considered to be safe.

The exceptions that needed fixing are NS_IN6ADDRSZ, NS_INADDRSZ, and
CARES_MASK_{SHORT,USHORT,SINT,UINT,SLONG,ULONG} (which basically all systems
should have limits.h ... if not, there's still a fallback).

Comments?
-Brad

Received on 2016-09-01