]> git.ozlabs.org Git - ccan/commitdiff
configurator: DEFAULT_{COMPILER, FLAGS} for MSVC
authorKevin Locke <kevin@kevinlocke.name>
Thu, 29 Sep 2016 00:44:46 +0000 (18:44 -0600)
committerDavid Gibson <david@gibson.dropbear.id.au>
Fri, 30 Sep 2016 03:51:27 +0000 (13:51 +1000)
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@kevinlocke.name>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
tools/configurator/configurator.c

index 4cb84d0b5301b7f9a5743ecdeb44f10442561e96..6ec30bd6deb77596fde041983175f4eaa117741d 100644 (file)
 #define pclose _pclose
 #endif
 
 #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"
 #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"
 
 #define OUTPUT_FILE "configurator.out"
 #define INPUT_FILE "configuratortest.c"