From: Kevin Locke Date: Fri, 23 Sep 2016 03:33:14 +0000 (-0600) Subject: configurator: Return pointer difference as ptrdiff_t X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=becfc7c324d821fe135a1ad843c596399ed5068a configurator: Return pointer difference as ptrdiff_t On LLP64 systems (like 64-bit Windows) long is 32 bits while pointers are 64 bits, which results in a warning similar to the following: warning C4244: 'return': conversion from '__int64' to 'long', possible loss of data for HAVE_STACK_GROWS_UPWARDS. Fix this by using the ptrdiff_t type introduced by C99 for this purpose. Signed-off-by: Kevin Locke Signed-off-by: David Gibson --- diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index 75c59f86..c7577c0c 100644 --- a/tools/configurator/configurator.c +++ b/tools/configurator/configurator.c @@ -278,7 +278,8 @@ static struct test tests[] = { " return __stop_mysec - __start_mysec;\n" "}\n" }, { "HAVE_STACK_GROWS_UPWARDS", DEFINES_EVERYTHING|EXECUTE, NULL, NULL, - "static long nest(const void *base, unsigned int i)\n" + "#include \n" + "static ptrdiff_t nest(const void *base, unsigned int i)\n" "{\n" " if (i == 0)\n" " return (const char *)&i - (const char *)base;\n"