[ccan] [PATCH v2 09/13] configurator: DEFAULT_{COMPILER, FLAGS} for MSVC
David Gibson
david at gibson.dropbear.id.au
Tue Sep 27 15:17:47 AEST 2016
On Thu, Sep 22, 2016 at 09:33:12PM -0600, Kevin Locke wrote:
> 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.
>
> Changes since v1:
> - Use "-option" instead of "/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 <kevin at kevinlocke.name>
Reviewed-by: David Gibson <david at gibson.dropbear.id.au>
But I won't apply it for now, since it makes no sense without the
previous one.
> ---
> tools/configurator/configurator.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c
> index d81f878..d3e01cd 100644
> --- a/tools/configurator/configurator.c
> +++ b/tools/configurator/configurator.c
> @@ -38,9 +38,21 @@
> #define pclose _pclose
> #endif
>
> +#ifdef _MSC_VER
> +#define DEFAULT_COMPILER "cl"
> +/* Note: Dash options avoid POSIX path conversion when used under msys bash
> + * and are therefore preferred to slash (e.g. -nologo over /nologo)
> + * Note: Disable Warning 4200 "nonstandard extension used : zero-sized array
> + * in struct/union" for flexible array members.
> + */
> +#define DEFAULT_FLAGS "-nologo -Zi -W4 -wd4200 " \
> + "-D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS"
> +#define DEFAULT_OUTPUT_EXE_FLAG "-Fe:"
> +#else
> #define DEFAULT_COMPILER "cc"
> #define DEFAULT_FLAGS "-g3 -ggdb -Wall -Wundef -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wold-style-definition"
> #define DEFAULT_OUTPUT_EXE_FLAG "-o"
> +#endif
>
> #define OUTPUT_FILE "configurator.out"
> #define INPUT_FILE "configuratortest.c"
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20160927/4577c4f4/attachment.sig>
More information about the ccan
mailing list