[ccan] [PATCH 7/9] configurator: Fix compiler warning with compare

2016-09-18 Thread Kevin Locke
Visual Studio prints warning C4706 "assignment within conditional expression" when there is an assignment without a comparison in a conditional expression. Therefore, to silence the warning, add an explicit comparison. Signed-off-by: Kevin Locke --- tools/configurator/configurator.c

[ccan] [PATCH 1/9] configurator: Replace unlink with remove

2016-09-18 Thread Kevin Locke
Although Windows provides unlink, using it adds complication due to the lack of unistd.h which must be included to define the function on POSIX systems. Instead, use remove, which C89 requires to be in stdio.h. Signed-off-by: Kevin Locke --- tools/configurator/configurator.c | 4 ++-- 1 file

[ccan] [PATCH 5/9] configurator: Mark non-Windows tests MAY_NOT_COMPILE

2016-09-18 Thread Kevin Locke
Several of the EXECUTABLE tests depend on headers not available on Windows. Mark these tests MAY_NOT_COMPILE to handle this. Signed-off-by: Kevin Locke --- tools/configurator/configurator.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/configurator

[ccan] [PATCH 6/9] configurator: Print test source without cat

2016-09-18 Thread Kevin Locke
Windows does not provide cat. Instead, copy the test source to stdout using the file stream to which it was written. Signed-off-by: Kevin Locke --- tools/configurator/configurator.c | 28 +++- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/tools

[ccan] [PATCH 2/9] configurator: Reimplement run using popen

2016-09-18 Thread Kevin Locke
Rather than using fork+pipe+system+waitpid, most of which are only available on POSIX-like systems, use popen which is also available on Windows (under the name _popen). Signed-off-by: Kevin Locke --- tools/configurator/configurator.c | 77 +++ 1 file changed

[ccan] [PATCH 4/9] configurator: Use native directory separator

2016-09-18 Thread Kevin Locke
mand, operable program or batch file. Therefore, use "\\" when invoking tests on Windows. Signed-off-by: Kevin Locke --- tools/configurator/configurator.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/configurator/configurator.c b/tools/configu

[ccan] [PATCH 9/9] configurator: DEFAULT_{COMPILER, FLAGS} for MSVC

2016-09-18 Thread Kevin Locke
When compiling with Visual Studio, use default compiler name and flags which are likely to work with the known-available compiler. This is also a convenience for users who may not know what arguments cl.exe may need to compile the tests. Signed-off-by: Kevin Locke --- tools/configurator

[ccan] [PATCH 8/9] configurator: Pass output cflag to configurator

2016-09-18 Thread Kevin Locke
configurator. This is a breaking change. Existing scripts which pass flags to the compiler must be modified to add "-o" as the last flag. As noted in the cover letter for this patch series, I'm open to considering alternatives if this is unacceptable. Signed-off-by: Kevin Locke

[ccan] [PATCH 0/9] configurator: Support for Windows and MSVC

2016-09-18 Thread Kevin Locke
ll. Thanks for considering, Kevin Kevin Locke (9): configurator: Replace unlink with remove configurator: Reimplement run using popen configurator: Inline err.h functions from musl libc configurator: Use native directory separator configurator: Mark non-Windows tests MAY_NOT_COMPILE conf

[ccan] [PATCH 3/9] configurator: Inline err.h functions from musl libc

2016-09-18 Thread Kevin Locke
Since we can't use HAVE_ERR_H in configurator, provide a definition for the err.h functions used. The version provided is the one from musl libc, since it is concise and shares the MIT License with configurator. Signed-off-by: Kevin Locke --- tools/configurator/configurator.c

Re: [ccan] [PATCH 0/9] configurator: Support for Windows and MSVC

2016-09-19 Thread Kevin Locke
Hi David, Thank you for taking the time to review these patches, especially for a platform that you don't have a strong stake in. I really appreciate it. On 09/19/2016 10:48 PM, David Gibson wrote: On Sun, Sep 18, 2016 at 06:51:57PM -0600, Kevin Locke wrote: This patch series adds su

Re: [ccan] [PATCH 2/9] configurator: Reimplement run using popen

2016-09-19 Thread Kevin Locke
On 09/19/2016 11:00 PM, David Gibson wrote: > On Sun, Sep 18, 2016 at 06:51:59PM -0600, Kevin Locke wrote: >> Rather than using fork+pipe+system+waitpid, most of which are only >> available on POSIX-like systems, use popen which is also available on >> Windows (under the name

Re: [ccan] [PATCH 8/9] configurator: Pass output cflag to configurator

2016-09-19 Thread Kevin Locke
On 09/19/2016 11:23 PM, David Gibson wrote: On Sun, Sep 18, 2016 at 06:52:05PM -0600, Kevin Locke wrote: Unfortunately, not all compilers support -o as a command-line option for specifying the output file. Visual Studio cl.exe issues warning D9035 when -o is given, which is detected as a

[ccan] [PATCH v2 04/13] configurator: Use native directory separator

2016-09-22 Thread Kevin Locke
mand, operable program or batch file. Therefore, use "\\" when invoking tests on Windows. Signed-off-by: Kevin Locke Reviewed-by: David Gibson --- tools/configurator/configurator.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/configurator/configu

[ccan] [PATCH v2 03/13] configurator: Inline err.h functions from musl libc

2016-09-22 Thread Kevin Locke
Since we can't use HAVE_ERR_H in configurator, provide a definition for the err.h functions used. The version provided is the one from musl libc, since it is concise and shares the MIT License with configurator. Signed-off-by: Kevin Locke --- tools/configurator/configurator.c

[ccan] [PATCH v2 02/13] configurator: Reimplement run using popen

2016-09-22 Thread Kevin Locke
. This can happen with non-conformant libc or if EINTR occurs after reading some data. - Define _POSIX_C_SOURCE for popen/pclose with strict implementations which require it (e.g. gcc with -std=c11). Signed-off-by: Kevin Locke --- tools/configurator/configurator.c | 90

[ccan] [PATCH v2 00/13] configurator: Support for Windows and MSVC

2016-09-22 Thread Kevin Locke
request hooks). Thanks for considering once again, Kevin Kevin Locke (13): configurator: Replace unlink with remove configurator: Reimplement run using popen configurator: Inline err.h functions from musl libc configurator: Use native directory separator configurator: Mark non-Windows

[ccan] [PATCH v2 01/13] configurator: Replace unlink with remove

2016-09-22 Thread Kevin Locke
Although Windows provides unlink, using it adds complication due to the lack of unistd.h which must be included to define the function on POSIX systems. Instead, use remove, which C89 requires to be in stdio.h. Signed-off-by: Kevin Locke Reviewed-by: David Gibson --- tools/configurator

[ccan] [PATCH v2 09/13] configurator: DEFAULT_{COMPILER, FLAGS} for MSVC

2016-09-22 Thread Kevin Locke
uot;/option" to avoid issues running under msys. - Disable C4200 warning for use of flexible array members, which MSVC considers an extension (since it does not fully support C99). Signed-off-by: Kevin Locke --- tools/configurator/configurator.c | 12 1 file changed, 12 inserti

[ccan] [PATCH v2 07/13] configurator: Fix compiler warning with compare

2016-09-22 Thread Kevin Locke
Visual Studio prints warning C4706 "assignment within conditional expression" when there is an assignment without a comparison in a conditional expression. Therefore, to silence the warning, add an explicit comparison. Signed-off-by: Kevin Locke Reviewed-by: David Gibson

[ccan] [PATCH v2 13/13] Add appveyor.yml

2016-09-22 Thread Kevin Locke
these, it seemed unwarranted if the compile errors may be fixed soon. Signed-off-by: Kevin Locke --- appveyor.yml | 25 + 1 file changed, 25 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000..822c4bd

[ccan] [PATCH v2 10/13] configurator: Fix warning in HAVE_FOR_LOOP_DECLARATION

2016-09-22 Thread Kevin Locke
Visual C++ prints "warning C4702: unreachable code" due to the return statement after the for loop which is never reached. Fix this by setting a variable returned by a single return statement at the end. Signed-off-by: Kevin Locke --- tools/configurator/configurator.c | 5 +++-- 1 fi

[ccan] [PATCH v2 05/13] configurator: Mark non-Windows tests MAY_NOT_COMPILE

2016-09-22 Thread Kevin Locke
Several of the EXECUTABLE tests depend on headers not available on Windows. Mark these tests MAY_NOT_COMPILE to handle this. Signed-off-by: Kevin Locke Reviewed-by: David Gibson --- tools/configurator/configurator.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff

[ccan] [PATCH v2 08/13] configurator: Add output cflag option and macro

2016-09-22 Thread Kevin Locke
in the future due to cl.exe requiring different flags for different types of output[1] (e.g. object files are /Fo:). 1. https://msdn.microsoft.com/en-us/library/f1cb223a.aspx Signed-off-by: Kevin Locke --- tools/compile.c | 15 tools/configurator/configurator.c

[ccan] [PATCH v2 12/13] Makefile: Define CFLAGS_FORCE_C_SOURCE macro

2016-09-22 Thread Kevin Locke
This macro holds the C compiler flag(s) to force input files to be recognized as C sources regardless of extension. It is defined to allow overriding on the make command line. Signed-off-by: Kevin Locke --- Makefile | 2 +- Makefile-ccan | 1 + 2 files changed, 2 insertions(+), 1 deletion

[ccan] [PATCH v2 11/13] configurator: Return pointer difference as ptrdiff_t

2016-09-22 Thread Kevin Locke
is by using the ptrdiff_t type introduced by C99 for this purpose. Signed-off-by: Kevin Locke --- tools/configurator/configurator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index a43061b..2acb0b2 1

[ccan] [PATCH v2 06/13] configurator: Print test source without cat

2016-09-22 Thread Kevin Locke
EINTR occurs after reading some data. - Handle short writes from fwrite. This can happen with non-conformant libc or if EINTR occurs after writing some data. Signed-off-by: Kevin Locke --- tools/configurator/configurator.c | 48 +++ 1 file changed, 43

[ccan] dgraph, tlist, tcon: MSVC error due to array of flexible structs

2016-09-22 Thread Kevin Locke
Hi all, Building dgraph using Microsoft Visual C++ produces the following error: dgraph.h(25): error C2233: 'edge': arrays of objects containing zero-size arrays are illegal The issue is that MSVC supports flexible array members, but does not support arrays of structs with flexible array members

[ccan] [PATCH v3 2/13] configurator: Reimplement run using popen

2016-09-27 Thread Kevin Locke
On Tue, 2016-09-27 at 14:52 +1000, David Gibson wrote: > On Thu, Sep 22, 2016 at 09:33:05PM -0600, Kevin Locke wrote: >> - Create fread_noeintr to avoid EINTR in fread without reading any data. >> - Handle short reads from fread. This can happen with non-conformant >> li

[ccan] [PATCH v3 3/13] configurator: Inline err.h functions

2016-09-27 Thread Kevin Locke
le sources instead of musl libc sources to avoid introducing another implementation of these functions. - Prefix err.h functions with "c12r_" to avoid name conflicts and "static declaration follows non-static" errors. Signed-off-by: Kevin Locke --- tools/configurator/configu

Re: [ccan] [PATCH v2 06/13] configurator: Print test source without cat

2016-09-27 Thread Kevin Locke
On Tue, 2016-09-27 at 15:06 +1000, David Gibson wrote: > On Thu, Sep 22, 2016 at 09:33:09PM -0600, Kevin Locke wrote: >> Windows does not provide cat. Instead, copy the test source to stdout >> using the file stream to which it was written. >> >> Changes since v1: &g

[ccan] [PATCH v3 13/13] Add appveyor.yml

2016-09-27 Thread Kevin Locke
On Tue, 2016-09-27 at 15:20 +1000, David Gibson wrote: > On Thu, Sep 22, 2016 at 09:33:16PM -0600, Kevin Locke wrote: >> This file defines the AppVeyor CI (appveyor.com) settings. > > Nice, though I can't really test it until we've got the rest of the > Windows /

Re: [ccan] [PATCH v2 00/13] configurator: Support for Windows and MSVC

2016-09-27 Thread Kevin Locke
On Tue, 2016-09-27 at 15:23 +1000, David Gibson wrote: > On Thu, Sep 22, 2016 at 09:33:03PM -0600, Kevin Locke wrote: >> This is the second revision of my patch series which adds support for >> building configurator with Microsoft Visual C++ and running it on >> Windows. The

Re: [ccan] [PATCH v2 00/13] configurator: Support for Windows and MSVC

2016-09-27 Thread Kevin Locke
On Tue, 2016-09-27 at 15:50 +0930, Rusty Russell wrote: > David Gibson writes: >> On Thu, Sep 22, 2016 at 09:33:03PM -0600, Kevin Locke wrote: >>> Hi all, >>> >>> This is the second revision of my patch series which adds support for >>> building confi

[ccan] [PATCH v3 2/7] configurator: Inline err.h functions

2016-09-28 Thread Kevin Locke
CCAN err module sources instead of musl libc sources to avoid introducing another implementation of these functions. - Prefix err.h functions with "c12r_" to avoid name conflicts and "static declaration follows non-static" errors. Signed-off-by: Kevin Locke --- tools/configu

[ccan] [PATCH v3 3/7] configurator: Print test source without cat

2016-09-28 Thread Kevin Locke
EINTR occurs after reading some data. - Handle short writes from fwrite. This can happen with non-conformant libc or if EINTR occurs after writing some data. Changes since v2: - Revert fwrite_noeintr and short read/write changes. Signed-off-by: Kevin Locke --- tools/configurator/configurator.c

[ccan] [PATCH v3 0/7] configurator: Support for Windows and MSVC

2016-09-28 Thread Kevin Locke
module one in hopes of reducing maintenance burden and code proliferation. * Additional documentation comments for AppVeyor. Thanks again! Kevin Kevin Locke (7): configurator: Reimplement run using popen configurator: Inline err.h functions configurator: Print test source without cat con

[ccan] [PATCH v3 1/7] configurator: Reimplement run using popen

2016-09-28 Thread Kevin Locke
-by: Kevin Locke --- tools/configurator/configurator.c | 79 +++ 1 file changed, 31 insertions(+), 48 deletions(-) diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index c7577c0..2ad3fff 100644 --- a/tools/configurator

[ccan] [PATCH v3 5/7] configurator: DEFAULT_{COMPILER, FLAGS} for MSVC

2016-09-28 Thread Kevin Locke
uot;/option" to avoid issues running under msys. - Disable C4200 warning for use of flexible array members, which MSVC considers an extension (since it does not fully support C99). Signed-off-by: Kevin Locke --- tools/configurator/configurator.c | 12 1 file changed, 12 inserti

[ccan] [PATCH v3 4/7] configurator: Add output cflag option and macro

2016-09-28 Thread Kevin Locke
in the future due to cl.exe requiring different flags for different types of output[1] (e.g. object files are /Fo:). 1. https://msdn.microsoft.com/en-us/library/f1cb223a.aspx Signed-off-by: Kevin Locke --- tools/compile.c | 15 tools/configurator/configurator.c

[ccan] [PATCH v3 7/7] Add appveyor.yml

2016-09-28 Thread Kevin Locke
these, it seemed unwarranted if the compile errors may be fixed soon. Changes since v2: - Add reference to AppVeyor results for canonical repo and basic instructions to setup AppVeyor for forks. Signed-off-by: Kevin Locke --- appveyor.yml | 37 + 1 file changed

[ccan] [PATCH v3 6/7] Makefile: Define CFLAGS_FORCE_C_SOURCE macro

2016-09-28 Thread Kevin Locke
This macro holds the C compiler flag(s) to force input files to be recognized as C sources regardless of extension. It is defined to allow overriding on the make command line. Signed-off-by: Kevin Locke --- Makefile | 2 +- Makefile-ccan | 1 + 2 files changed, 2 insertions(+), 1 deletion

Re: [ccan] [PATCH v3 0/7] configurator: Support for Windows and MSVC

2016-10-02 Thread Kevin Locke
On Sat, 2016-10-01 at 01:08 +1000, David Gibson wrote: > On Wed, Sep 28, 2016 at 06:44:41PM -0600, Kevin Locke wrote: >> Here is the third revision of the patch series which adds support for >> building configurator with Microsoft Visual C++ and running it on >> Windows. >&

[ccan] [PATCH] edit_distance: calculate edit distance between strings

2016-11-18 Thread Kevin Locke
defining cost functions as preprocessor macros when compiling this module. Distances over other array types (e.g. wide strings, integers, structs) can be accomplished by defining the element type and equality test macros. Signed-off-by: Kevin Locke --- I have tried to make the inline

Re: [ccan] [PATCH] edit_distance: calculate edit distance between strings

2016-11-23 Thread Kevin Locke
On Wed, 2016-11-23 at 23:58 +1100, David Gibson wrote: > On Fri, Nov 18, 2016 at 09:19:25PM -0700, Kevin Locke wrote: >> This commit creates the edit_distance module for calculating various >> edit distance measures. >> [...] > > I've merged this module in, alo

[ccan] AppVeyor custom Git URL support (was Re: [PATCH v3 0/7] configurator: Support for Windows and MSVC)

2016-12-02 Thread Kevin Locke
On Sun, 2016-10-02 at 21:14 -0600, Kevin Locke wrote: > On Sat, 2016-10-01 at 01:08 +1000, David Gibson wrote: >> I set myself up an appveyor account and tweaked your comment to point >> at that instead of the hypothetical one Rusty may or may not set up at >> some point. >

Re: [ccan] dgraph, tlist, tcon: MSVC error due to array of flexible structs

2017-08-01 Thread Kevin Locke
On Tue, 2017-08-01 at 15:22 +1000, David Gibson wrote: > On Thu, Sep 22, 2016 at 10:31:16PM -0600, Kevin Locke wrote: >> [...] >> >> The issue is that MSVC supports flexible array members, but does not >> support arrays of structs with flexible array members. My &g